Skip to content

Commit 61de4c3

Browse files
yanzhao56bonzini
authored andcommitted
KVM: selftests: Test memslot move in memslot_perf_test with quirk disabled
Add a new user option to memslot_perf_test to allow testing memslot move with quirk KVM_X86_QUIRK_SLOT_ZAP_ALL disabled. Signed-off-by: Yan Zhao <[email protected]> Message-ID: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 218f641 commit 61de4c3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tools/testing/selftests/kvm/memslot_perf_test.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static_assert(ATOMIC_BOOL_LOCK_FREE == 2, "atomic bool is not lockless");
113113
static sem_t vcpu_ready;
114114

115115
static bool map_unmap_verify;
116+
static bool disable_slot_zap_quirk;
116117

117118
static bool verbose;
118119
#define pr_info_v(...) \
@@ -578,6 +579,9 @@ static bool test_memslot_move_prepare(struct vm_data *data,
578579
uint32_t guest_page_size = data->vm->page_size;
579580
uint64_t movesrcgpa, movetestgpa;
580581

582+
if (disable_slot_zap_quirk)
583+
vm_enable_cap(data->vm, KVM_CAP_DISABLE_QUIRKS2, KVM_X86_QUIRK_SLOT_ZAP_ALL);
584+
581585
movesrcgpa = vm_slot2gpa(data, data->nslots - 1);
582586

583587
if (isactive) {
@@ -896,6 +900,7 @@ static void help(char *name, struct test_args *targs)
896900
pr_info(" -h: print this help screen.\n");
897901
pr_info(" -v: enable verbose mode (not for benchmarking).\n");
898902
pr_info(" -d: enable extra debug checks.\n");
903+
pr_info(" -q: Disable memslot zap quirk during memslot move.\n");
899904
pr_info(" -s: specify memslot count cap (-1 means no cap; currently: %i)\n",
900905
targs->nslots);
901906
pr_info(" -f: specify the first test to run (currently: %i; max %zu)\n",
@@ -954,7 +959,7 @@ static bool parse_args(int argc, char *argv[],
954959
uint32_t max_mem_slots;
955960
int opt;
956961

957-
while ((opt = getopt(argc, argv, "hvds:f:e:l:r:")) != -1) {
962+
while ((opt = getopt(argc, argv, "hvdqs:f:e:l:r:")) != -1) {
958963
switch (opt) {
959964
case 'h':
960965
default:
@@ -966,6 +971,11 @@ static bool parse_args(int argc, char *argv[],
966971
case 'd':
967972
map_unmap_verify = true;
968973
break;
974+
case 'q':
975+
disable_slot_zap_quirk = true;
976+
TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
977+
KVM_X86_QUIRK_SLOT_ZAP_ALL);
978+
break;
969979
case 's':
970980
targs->nslots = atoi_paranoid(optarg);
971981
if (targs->nslots <= 1 && targs->nslots != -1) {

0 commit comments

Comments
 (0)