Skip to content

Commit

Permalink
KVM: selftests: Assign guest page size in sync area early in memslot_…
Browse files Browse the repository at this point in the history
…perf_test

The guest page size in the synchronization area is needed by all test
cases. So it's reasonable to set it in the unified preparation function
(prepare_vm()).

Signed-off-by: Gavin Shan <gshan@redhat.com>
Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Link: https://lore.kernel.org/r/20230118092133.320003-3-gshan@redhat.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
  • Loading branch information
Gavin Shan authored and sean-jc committed Feb 7, 2023
1 parent e5b4268 commit 45f6795
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tools/testing/selftests/kvm/memslot_perf_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ static bool prepare_vm(struct vm_data *data, int nslots, uint64_t *maxslots,
virt_map(data->vm, MEM_GPA, MEM_GPA, data->npages);

sync = (typeof(sync))vm_gpa2hva(data, MEM_SYNC_GPA, NULL);
sync->guest_page_size = data->vm->page_size;
atomic_init(&sync->start_flag, false);
atomic_init(&sync->exit_flag, false);
atomic_init(&sync->sync_flag, false);
Expand Down Expand Up @@ -808,8 +809,6 @@ static bool test_execute(int nslots, uint64_t *maxslots,
}

sync = (typeof(sync))vm_gpa2hva(data, MEM_SYNC_GPA, NULL);

sync->guest_page_size = data->vm->page_size;
if (tdata->prepare &&
!tdata->prepare(data, sync, maxslots)) {
ret = false;
Expand Down

0 comments on commit 45f6795

Please sign in to comment.