diff mbox series

[2/2] KVM: selftests: Assign guest page size in sync area early in memslot_perf_test

Message ID 20230118092133.320003-3-gshan@redhat.com (mailing list archive)
State New, archived
Headers show
Series KVM: selftests: Remove duplicate VM in memslot_perf_test | expand

Commit Message

Gavin Shan Jan. 18, 2023, 9:21 a.m. UTC
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>
---
 tools/testing/selftests/kvm/memslot_perf_test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Maciej S. Szmigiero Jan. 23, 2023, 11:57 p.m. UTC | #1
On 18.01.2023 10:21, Gavin Shan wrote:
> 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>

Thanks,
Maciej
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/memslot_perf_test.c b/tools/testing/selftests/kvm/memslot_perf_test.c
index adbbcca3e354..4210cd21d159 100644
--- a/tools/testing/selftests/kvm/memslot_perf_test.c
+++ b/tools/testing/selftests/kvm/memslot_perf_test.c
@@ -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);
@@ -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;