Commit 61de4c34 authored by Yan Zhao's avatar Yan Zhao Committed by Paolo Bonzini

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: default avatarYan Zhao <yan.y.zhao@intel.com>
Message-ID: <20240703021219.13939-1-yan.y.zhao@intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 218f6415
...@@ -113,6 +113,7 @@ static_assert(ATOMIC_BOOL_LOCK_FREE == 2, "atomic bool is not lockless"); ...@@ -113,6 +113,7 @@ static_assert(ATOMIC_BOOL_LOCK_FREE == 2, "atomic bool is not lockless");
static sem_t vcpu_ready; static sem_t vcpu_ready;
static bool map_unmap_verify; static bool map_unmap_verify;
static bool disable_slot_zap_quirk;
static bool verbose; static bool verbose;
#define pr_info_v(...) \ #define pr_info_v(...) \
...@@ -578,6 +579,9 @@ static bool test_memslot_move_prepare(struct vm_data *data, ...@@ -578,6 +579,9 @@ static bool test_memslot_move_prepare(struct vm_data *data,
uint32_t guest_page_size = data->vm->page_size; uint32_t guest_page_size = data->vm->page_size;
uint64_t movesrcgpa, movetestgpa; uint64_t movesrcgpa, movetestgpa;
if (disable_slot_zap_quirk)
vm_enable_cap(data->vm, KVM_CAP_DISABLE_QUIRKS2, KVM_X86_QUIRK_SLOT_ZAP_ALL);
movesrcgpa = vm_slot2gpa(data, data->nslots - 1); movesrcgpa = vm_slot2gpa(data, data->nslots - 1);
if (isactive) { if (isactive) {
...@@ -896,6 +900,7 @@ static void help(char *name, struct test_args *targs) ...@@ -896,6 +900,7 @@ static void help(char *name, struct test_args *targs)
pr_info(" -h: print this help screen.\n"); pr_info(" -h: print this help screen.\n");
pr_info(" -v: enable verbose mode (not for benchmarking).\n"); pr_info(" -v: enable verbose mode (not for benchmarking).\n");
pr_info(" -d: enable extra debug checks.\n"); pr_info(" -d: enable extra debug checks.\n");
pr_info(" -q: Disable memslot zap quirk during memslot move.\n");
pr_info(" -s: specify memslot count cap (-1 means no cap; currently: %i)\n", pr_info(" -s: specify memslot count cap (-1 means no cap; currently: %i)\n",
targs->nslots); targs->nslots);
pr_info(" -f: specify the first test to run (currently: %i; max %zu)\n", 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[], ...@@ -954,7 +959,7 @@ static bool parse_args(int argc, char *argv[],
uint32_t max_mem_slots; uint32_t max_mem_slots;
int opt; int opt;
while ((opt = getopt(argc, argv, "hvds:f:e:l:r:")) != -1) { while ((opt = getopt(argc, argv, "hvdqs:f:e:l:r:")) != -1) {
switch (opt) { switch (opt) {
case 'h': case 'h':
default: default:
...@@ -966,6 +971,11 @@ static bool parse_args(int argc, char *argv[], ...@@ -966,6 +971,11 @@ static bool parse_args(int argc, char *argv[],
case 'd': case 'd':
map_unmap_verify = true; map_unmap_verify = true;
break; break;
case 'q':
disable_slot_zap_quirk = true;
TEST_REQUIRE(kvm_check_cap(KVM_CAP_DISABLE_QUIRKS2) &
KVM_X86_QUIRK_SLOT_ZAP_ALL);
break;
case 's': case 's':
targs->nslots = atoi_paranoid(optarg); targs->nslots = atoi_paranoid(optarg);
if (targs->nslots <= 1 && targs->nslots != -1) { if (targs->nslots <= 1 && targs->nslots != -1) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment