KVM: selftests: enable the memslot tests in ARM64
v2 cover KVM: selftests: enable the memslot tests in ARM64
Enable memslot_modification_stress_test and memslot_perf_test in ARM64 (second patch). memslot_modification_stress_test builds and runs in aarch64 without any modification. memslot_perf_test needs some nits regarding ucalls (first patch).
Can anybody try these two tests in s390, please?
Changes:
v2: Makefile tests in the right order (from Andrew).
Ricardo Koller (2):
KVM: selftests: make memslot_perf_test arch independent
KVM: selftests: build the memslot tests for arm64
tools/testing/selftests/kvm/Makefile | 2 + .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- 2 files changed, 36 insertions(+), 22 deletions(-)
Signature · 1 line
2.33.0.153.gba50c8fa24-goog
PATCH v2 1/2 KVM: selftests: make memslot_perf_test arch independent
memslot_perf_test uses ucalls for synchronization between guest and host. Ucalls API is architecture independent: tests do not need to know details like what kind of exit they generate on a specific arch. More specifically, there is no need to check whether an exit is KVM_EXIT_IO in x86 for the host to know that the exit is ucall related, as get_ucall() already makes that check.
Change memslot_perf_test to not require specifying what exit does a ucall generate. Also add a missing ucall_init.
--- .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-)
tools/testing/selftests/kvm/memslot_perf_test.c +34 -22
@@ -127,43 +127,54 @@ static bool verbose;pr_info (__VA_ARGS__); \ }while (0 ) +static void check_mmio_access(struct vm_data *vm, struct kvm_run *run) +{ +TEST_ASSERT (vm->mmio_ok,"Unexpected mmio exit" ); +TEST_ASSERT (run->mmio.is_write,"Unexpected mmio read" ); +TEST_ASSERT (run->mmio.len ==8 , +"Unexpected exit mmio size = %u" , run->mmio.len); +TEST_ASSERT (run->mmio.phys_addr >= vm->mmio_gpa_min && + run->mmio.phys_addr <= vm->mmio_gpa_max, +"Unexpected exit mmio address = 0x%llx" , + run->mmio.phys_addr); +} +static void *vcpu_worker (void *data) {struct vm_data *vm = data;struct kvm_run *run;struct ucall uc; -uint64_t cmd; run =vcpu_state (vm->vm,VCPU_ID );while (1 ) {vcpu_run (vm->vm,VCPU_ID ); -if (run->exit_reason ==KVM_EXIT_IO ) { - cmd =get_ucall (vm->vm,VCPU_ID , &uc); -if (cmd !=UCALL_SYNC ) -break ; - +switch (get_ucall (vm->vm,VCPU_ID , &uc)) { +case UCALL_SYNC : +TEST_ASSERT (uc.args[1 ] ==0 , +"Unexpected sync ucall, got %lx" , + (ulong )uc.args[1 ]);sem_post (&vcpu_ready);continue ; - } - -if (run->exit_reason !=KVM_EXIT_MMIO ) +case UCALL_NONE : +if (run->exit_reason ==KVM_EXIT_MMIO ) +check_mmio_access (vm, run); +else + goto done;break ; - -TEST_ASSERT (vm->mmio_ok,"Unexpected mmio exit" ); -TEST_ASSERT (run->mmio.is_write,"Unexpected mmio read" ); -TEST_ASSERT (run->mmio.len ==8 , -"Unexpected exit mmio size = %u" , run->mmio.len); -TEST_ASSERT (run->mmio.phys_addr >= vm->mmio_gpa_min && - run->mmio.phys_addr <= vm->mmio_gpa_max, -"Unexpected exit mmio address = 0x%llx" , - run->mmio.phys_addr); +case UCALL_ABORT : +TEST_FAIL ("%s at %s:%ld, val = %lu" , + (const char *)uc.args[0 ], + __FILE__, uc.args[1 ], uc.args[2 ]); +break ; +case UCALL_DONE : + goto done; +default : +TEST_FAIL ("Unknown ucall %lu" , uc.cmd); + } } -if (run->exit_reason ==KVM_EXIT_IO && cmd ==UCALL_ABORT ) -TEST_FAIL ("%s at %s:%ld, val = %lu" , (const char *)uc.args[0 ], - __FILE__, uc.args[1 ], uc.args[2 ]); - +done:return NULL ; }
@@ -268,6 +279,7 @@ static bool prepare_vm(struct vm_data *data, int nslots, uint64_t *maxslots,TEST_ASSERT (data->hva_slots,"malloc() fail" ); data->vm =vm_create_default (VCPU_ID , mempages, guest_code); +ucall_init (data->vm,NULL );pr_info_v ("Adding slots 1..%i, each slot with %" PRIu64" pages + %" PRIu64" extra pages last\n" , max_mem_slots -1 , data->pages_per_slot, rempages);
Signature · 1 line
2.33.0.153.gba50c8fa24-goog
Re: [PATCH v2 1/2] KVM: selftests: make memslot_perf_test arch independent
Quoted 7 lines · Ricardo Koller
memslot_perf_testuses ucalls for synchronization between guest and host. Ucalls API is architecture independent: tests do not need to know details like what kind of exit they generate on a specific arch. More specifically, there is no need to check whether an exit isKVM_EXIT_IOin x86 for the host to know that the exit is ucall related, asget_ucall()already makes that check.
Quoted 8 lines
Change
memslot_perf_testto not require specifying what exit does a ucall generate. Also add a missingucall_init.Signed-off-by Ricardo Koller <[email protected]>--- .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-)
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v2 1/2] KVM: selftests: make memslot_perf_test arch independent
In reply to Ricardo KollerQuoted 8 lines · Ricardo Koller
memslot_perf_testuses ucalls for synchronization between guest and host. Ucalls API is architecture independent: tests do not need to know details like what kind of exit they generate on a specific arch. More specifically, there is no need to check whether an exit isKVM_EXIT_IOin x86 for the host to know that the exit is ucall related, asget_ucall()already makes that check.
Quoted 8 lines
Change
memslot_perf_testto not require specifying what exit does a ucall generate. Also add a missingucall_init.Signed-off-by Ricardo Koller <[email protected]>--- .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-)
PATCH v2 2/2 KVM: selftests: build the memslot tests for arm64
In reply to Ricardo KollerAdd memslot_perf_test and memslot_modification_stress_test to the list of aarch64 selftests.
--- tools/testing/selftests/kvm/Makefile | 2 ++ 1 file changed, 2 insertions(+)
tools/testing/selftests/kvm/Makefile +2 -0
@@ -92,6 +92,8 @@ TEST_GEN_PROGS_aarch64 += dirty_log_test TEST_GEN_PROGS_aarch64 += dirty_log_perf_test TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus TEST_GEN_PROGS_aarch64 += kvm_page_table_test +TEST_GEN_PROGS_aarch64 += memslot_modification_stress_test +TEST_GEN_PROGS_aarch64 += memslot_perf_test TEST_GEN_PROGS_aarch64 += set_memory_region_test TEST_GEN_PROGS_aarch64 += steal_time TEST_GEN_PROGS_aarch64 += kvm_binary_stats_test
Signature · 1 line
2.33.0.153.gba50c8fa24-goog
Re: [PATCH v2 2/2] KVM: selftests: build the memslot tests for arm64
Quoted 24 lines · Ricardo Koller
Add
memslot_perf_testandmemslot_modification_stress_testto the list of aarch64 selftests.Signed-off-by Ricardo Koller <[email protected]>--- tools/testing/selftests/kvm/Makefile | 2 ++ 1 file changed, 2 insertions(+)tools/testing/selftests/kvm/Makefile +2
-0@@ -92,6 +92,8 @@ TEST_GEN_PROGS_aarch64 += dirty_log_test TEST_GEN_PROGS_aarch64 += dirty_log_perf_test TEST_GEN_PROGS_aarch64 += kvm_create_max_vcpus TEST_GEN_PROGS_aarch64 += kvm_page_table_test +TEST_GEN_PROGS_aarch64 += memslot_modification_stress_test +TEST_GEN_PROGS_aarch64 += memslot_perf_test TEST_GEN_PROGS_aarch64 += set_memory_region_test TEST_GEN_PROGS_aarch64 += steal_time TEST_GEN_PROGS_aarch64 += kvm_binary_stats_testSignature · 1 line
2.33.0.153.gba50c8fa24-goog
Re: [PATCH v2 2/2] KVM: selftests: build the memslot tests for arm64
In reply to Ricardo KollerQuoted 8 lines · Ricardo Koller
Add
memslot_perf_testandmemslot_modification_stress_testto the list of aarch64 selftests.Signed-off-by Ricardo Koller <[email protected]>--- tools/testing/selftests/kvm/Makefile | 2 ++ 1 file changed, 2 insertions(+)
Quoted 9 lines · Ricardo Koller
Enable
memslot_modification_stress_testandmemslot_perf_testin ARM64 (second patch).memslot_modification_stress_testbuilds and runs in aarch64 without any modification.memslot_perf_testneeds some nits regarding ucalls (first patch).Can anybody try these two tests in s390, please?
Changes:
v2:Makefiletests in the right order (from Andrew).
Hi Ricardo,
You could have collected all the r-b's too.
Thanks,
drew
Quoted 12 lines
Ricardo Koller (2):
KVM: selftests: makememslot_perf_testarch independent
KVM: selftests: build the memslot tests for arm64tools/testing/selftests/kvm/Makefile | 2 + .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- 2 files changed, 36 insertions(+), 22 deletions(-)Signature · 1 line
2.33.0.153.gba50c8fa24-goog
Quoted 6 lines · Andrew Jones
Quoted 5 lines · Ricardo Koller
Enable
memslot_modification_stress_testandmemslot_perf_testin ARM64 (second patch).memslot_modification_stress_testbuilds and runs in aarch64 without any modification.memslot_perf_testneeds some nits regarding ucalls (first patch).
Quoted 8 lines
Quoted 4 lines
Can anybody try these two tests in s390, please?
Changes:
v2:Makefiletests in the right order (from Andrew).Hi Ricardo,
You could have collected all the r-b's too.
Thanks Andrew. Will try to do it next time (if changes are small like in this patch set.
Thanks,
Ricardo
Quoted 17 lines
Thanks,
drewQuoted 12 lines
Ricardo Koller (2):
KVM: selftests: makememslot_perf_testarch independent
KVM: selftests: build the memslot tests for arm64tools/testing/selftests/kvm/Makefile | 2 + .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- 2 files changed, 36 insertions(+), 22 deletions(-)Signature · 1 line
2.33.0.153.gba50c8fa24-goog
Quoted 11 lines · Andrew Jones
Quoted 9 lines · Ricardo Koller
Enable
memslot_modification_stress_testandmemslot_perf_testin ARM64 (second patch).memslot_modification_stress_testbuilds and runs in aarch64 without any modification.memslot_perf_testneeds some nits regarding ucalls (first patch).Can anybody try these two tests in s390, please?
Changes:
v2:Makefiletests in the right order (from Andrew).
Quoted 7 lines
Hi Ricardo,
You could have collected all the r-b's too.
Thanks,
drew
Friendly ping on this one, please.
Quoted 13 lines
Quoted 12 lines
Ricardo Koller (2):
KVM: selftests: makememslot_perf_testarch independent
KVM: selftests: build the memslot tests for arm64tools/testing/selftests/kvm/Makefile | 2 + .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- 2 files changed, 36 insertions(+), 22 deletions(-)Signature · 1 line
2.33.0.153.gba50c8fa24-goog
Quoted 8 lines · Ricardo Koller
Enable
memslot_modification_stress_testandmemslot_perf_testin ARM64 (second patch).memslot_modification_stress_testbuilds and runs in aarch64 without any modification.memslot_perf_testneeds some nits regarding ucalls (first patch).Can anybody try these two tests in s390, please?
[...]
Applied to next, thanks!
[1/2] KVM: selftests: make memslot_perf_test arch independent
commit: ffb4ce3c49366f02f1c064fbe2e66a96ab5f98b8
[2/2] KVM: selftests: build the memslot tests for arm64
commit: 358928fd5264f069b9758f8b29297c7bff2a06deCheers,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.