* [PATCH 0/2] KVM: selftests: enable the memslot tests in ARM64 @ 2021-09-03 23:11 Ricardo Koller 2021-09-03 23:11 ` [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent Ricardo Koller 2021-09-03 23:11 ` [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 Ricardo Koller 0 siblings, 2 replies; 11+ messages in thread From: Ricardo Koller @ 2021-09-03 23:11 UTC (permalink / raw) To: kvm, kvmarm Cc: drjones, Paolo Bonzini, maciej.szmigiero, maz, oupton, jingzhangos, pshier, rananta, reijiw, Ricardo Koller 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). 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(-) -- 2.33.0.153.gba50c8fa24-goog ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent 2021-09-03 23:11 [PATCH 0/2] KVM: selftests: enable the memslot tests in ARM64 Ricardo Koller @ 2021-09-03 23:11 ` Ricardo Koller 2021-09-06 6:50 ` Andrew Jones ` (2 more replies) 2021-09-03 23:11 ` [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 Ricardo Koller 1 sibling, 3 replies; 11+ messages in thread From: Ricardo Koller @ 2021-09-03 23:11 UTC (permalink / raw) To: kvm, kvmarm Cc: drjones, Paolo Bonzini, maciej.szmigiero, maz, oupton, jingzhangos, pshier, rananta, reijiw, Ricardo Koller memslot_perf_test uses ucalls for synchronization between guest and host. Ucalls API is architecture independent: tests do not need know 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. Signed-off-by: Ricardo Koller <ricarkol@google.com> --- .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/kvm/memslot_perf_test.c b/tools/testing/selftests/kvm/memslot_perf_test.c index d6e381e01db7..1727f75e0c2c 100644 --- a/tools/testing/selftests/kvm/memslot_perf_test.c +++ b/tools/testing/selftests/kvm/memslot_perf_test.c @@ -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); -- 2.33.0.153.gba50c8fa24-goog ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent 2021-09-03 23:11 ` [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent Ricardo Koller @ 2021-09-06 6:50 ` Andrew Jones 2021-09-06 18:03 ` Maciej S. Szmigiero 2021-09-07 14:34 ` Oliver Upton 2 siblings, 0 replies; 11+ messages in thread From: Andrew Jones @ 2021-09-06 6:50 UTC (permalink / raw) To: Ricardo Koller Cc: kvm, kvmarm, Paolo Bonzini, maciej.szmigiero, maz, oupton, jingzhangos, pshier, rananta, reijiw On Fri, Sep 03, 2021 at 04:11:53PM -0700, Ricardo Koller wrote: > memslot_perf_test uses ucalls for synchronization between guest and > host. Ucalls API is architecture independent: tests do not need know > 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. > > Signed-off-by: Ricardo Koller <ricarkol@google.com> > --- > .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- > 1 file changed, 34 insertions(+), 22 deletions(-) > Reviewed-by: Andrew Jones <drjones@redhat.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent 2021-09-03 23:11 ` [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent Ricardo Koller 2021-09-06 6:50 ` Andrew Jones @ 2021-09-06 18:03 ` Maciej S. Szmigiero 2021-09-07 14:34 ` Oliver Upton 2 siblings, 0 replies; 11+ messages in thread From: Maciej S. Szmigiero @ 2021-09-06 18:03 UTC (permalink / raw) To: Ricardo Koller Cc: drjones, Paolo Bonzini, maz, oupton, jingzhangos, pshier, rananta, reijiw, kvm, kvmarm On 04.09.2021 01:11, Ricardo Koller wrote: > memslot_perf_test uses ucalls for synchronization between guest and > host. Ucalls API is architecture independent: tests do not need know > 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. > > Signed-off-by: Ricardo Koller <ricarkol@google.com> > --- Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Thanks, Maciej ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent 2021-09-03 23:11 ` [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent Ricardo Koller 2021-09-06 6:50 ` Andrew Jones 2021-09-06 18:03 ` Maciej S. Szmigiero @ 2021-09-07 14:34 ` Oliver Upton 2 siblings, 0 replies; 11+ messages in thread From: Oliver Upton @ 2021-09-07 14:34 UTC (permalink / raw) To: Ricardo Koller Cc: kvm, kvmarm, drjones, Paolo Bonzini, maciej.szmigiero, maz, jingzhangos, pshier, rananta, reijiw On Fri, Sep 3, 2021 at 6:12 PM Ricardo Koller <ricarkol@google.com> wrote: > > memslot_perf_test uses ucalls for synchronization between guest and > host. Ucalls API is architecture independent: tests do not need know > 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. > > Signed-off-by: Ricardo Koller <ricarkol@google.com> > --- > .../testing/selftests/kvm/memslot_perf_test.c | 56 +++++++++++-------- > 1 file changed, 34 insertions(+), 22 deletions(-) Reviewed-by: Oliver Upton <oupton@google.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 2021-09-03 23:11 [PATCH 0/2] KVM: selftests: enable the memslot tests in ARM64 Ricardo Koller 2021-09-03 23:11 ` [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent Ricardo Koller @ 2021-09-03 23:11 ` Ricardo Koller 2021-09-06 6:52 ` Andrew Jones ` (2 more replies) 1 sibling, 3 replies; 11+ messages in thread From: Ricardo Koller @ 2021-09-03 23:11 UTC (permalink / raw) To: kvm, kvmarm Cc: drjones, Paolo Bonzini, maciej.szmigiero, maz, oupton, jingzhangos, pshier, rananta, reijiw, Ricardo Koller Add memslot_perf_test and memslot_modification_stress_test to the list of aarch64 selftests. Signed-off-by: Ricardo Koller <ricarkol@google.com> --- tools/testing/selftests/kvm/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile index 5832f510a16c..e6e88575c40b 100644 --- a/tools/testing/selftests/kvm/Makefile +++ b/tools/testing/selftests/kvm/Makefile @@ -84,6 +84,8 @@ TEST_GEN_PROGS_x86_64 += set_memory_region_test TEST_GEN_PROGS_x86_64 += steal_time TEST_GEN_PROGS_x86_64 += kvm_binary_stats_test +TEST_GEN_PROGS_aarch64 += memslot_modification_stress_test +TEST_GEN_PROGS_aarch64 += memslot_perf_test TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list TEST_GEN_PROGS_aarch64 += aarch64/vgic_init -- 2.33.0.153.gba50c8fa24-goog ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 2021-09-03 23:11 ` [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 Ricardo Koller @ 2021-09-06 6:52 ` Andrew Jones 2021-09-07 17:39 ` Ricardo Koller 2021-09-06 18:03 ` Maciej S. Szmigiero 2021-09-07 14:39 ` Oliver Upton 2 siblings, 1 reply; 11+ messages in thread From: Andrew Jones @ 2021-09-06 6:52 UTC (permalink / raw) To: Ricardo Koller Cc: kvm, kvmarm, Paolo Bonzini, maciej.szmigiero, maz, oupton, jingzhangos, pshier, rananta, reijiw On Fri, Sep 03, 2021 at 04:11:54PM -0700, Ricardo Koller wrote: > Add memslot_perf_test and memslot_modification_stress_test to the list > of aarch64 selftests. > > Signed-off-by: Ricardo Koller <ricarkol@google.com> > --- > tools/testing/selftests/kvm/Makefile | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile > index 5832f510a16c..e6e88575c40b 100644 > --- a/tools/testing/selftests/kvm/Makefile > +++ b/tools/testing/selftests/kvm/Makefile > @@ -84,6 +84,8 @@ TEST_GEN_PROGS_x86_64 += set_memory_region_test > TEST_GEN_PROGS_x86_64 += steal_time > TEST_GEN_PROGS_x86_64 += kvm_binary_stats_test > > +TEST_GEN_PROGS_aarch64 += memslot_modification_stress_test > +TEST_GEN_PROGS_aarch64 += memslot_perf_test > TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions > TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list > TEST_GEN_PROGS_aarch64 += aarch64/vgic_init These tests need to be added below the aarch64/* tests and in alphabetical order. Thanks, drew > -- > 2.33.0.153.gba50c8fa24-goog > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 2021-09-06 6:52 ` Andrew Jones @ 2021-09-07 17:39 ` Ricardo Koller 0 siblings, 0 replies; 11+ messages in thread From: Ricardo Koller @ 2021-09-07 17:39 UTC (permalink / raw) To: Andrew Jones Cc: kvm, kvmarm, Paolo Bonzini, maciej.szmigiero, maz, oupton, jingzhangos, pshier, rananta, reijiw On Mon, Sep 06, 2021 at 08:52:48AM +0200, Andrew Jones wrote: > On Fri, Sep 03, 2021 at 04:11:54PM -0700, Ricardo Koller wrote: > > Add memslot_perf_test and memslot_modification_stress_test to the list > > of aarch64 selftests. > > > > Signed-off-by: Ricardo Koller <ricarkol@google.com> > > --- > > tools/testing/selftests/kvm/Makefile | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile > > index 5832f510a16c..e6e88575c40b 100644 > > --- a/tools/testing/selftests/kvm/Makefile > > +++ b/tools/testing/selftests/kvm/Makefile > > @@ -84,6 +84,8 @@ TEST_GEN_PROGS_x86_64 += set_memory_region_test > > TEST_GEN_PROGS_x86_64 += steal_time > > TEST_GEN_PROGS_x86_64 += kvm_binary_stats_test > > > > +TEST_GEN_PROGS_aarch64 += memslot_modification_stress_test > > +TEST_GEN_PROGS_aarch64 += memslot_perf_test > > TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions > > TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list > > TEST_GEN_PROGS_aarch64 += aarch64/vgic_init > > These tests need to be added below the aarch64/* tests and in alphabetical > order. > Sure, will fix this in v2. Thanks, Ricardo > Thanks, > drew > > > -- > > 2.33.0.153.gba50c8fa24-goog > > > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 2021-09-03 23:11 ` [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 Ricardo Koller 2021-09-06 6:52 ` Andrew Jones @ 2021-09-06 18:03 ` Maciej S. Szmigiero 2021-09-07 14:39 ` Oliver Upton 2 siblings, 0 replies; 11+ messages in thread From: Maciej S. Szmigiero @ 2021-09-06 18:03 UTC (permalink / raw) To: Ricardo Koller Cc: drjones, Paolo Bonzini, maz, oupton, jingzhangos, pshier, rananta, reijiw, kvm, kvmarm On 04.09.2021 01:11, Ricardo Koller wrote: > Add memslot_perf_test and memslot_modification_stress_test to the list > of aarch64 selftests. > > Signed-off-by: Ricardo Koller <ricarkol@google.com> > --- Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Thanks, Maciej ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 2021-09-03 23:11 ` [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 Ricardo Koller 2021-09-06 6:52 ` Andrew Jones 2021-09-06 18:03 ` Maciej S. Szmigiero @ 2021-09-07 14:39 ` Oliver Upton 2021-09-07 17:42 ` Ricardo Koller 2 siblings, 1 reply; 11+ messages in thread From: Oliver Upton @ 2021-09-07 14:39 UTC (permalink / raw) To: Ricardo Koller Cc: kvm, kvmarm, drjones, Paolo Bonzini, maciej.szmigiero, maz, jingzhangos, pshier, rananta, reijiw Ricardo, On Fri, Sep 3, 2021 at 6:12 PM Ricardo Koller <ricarkol@google.com> wrote: > > Add memslot_perf_test and memslot_modification_stress_test to the list > of aarch64 selftests. > > Signed-off-by: Ricardo Koller <ricarkol@google.com> There isn't anything that prevents these tests from being used for s390x too right? Of course, we haven't anything to test on but just a thought. Besides Drew's comments: Reviewed-by: Oliver Upton <oupton@google.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 2021-09-07 14:39 ` Oliver Upton @ 2021-09-07 17:42 ` Ricardo Koller 0 siblings, 0 replies; 11+ messages in thread From: Ricardo Koller @ 2021-09-07 17:42 UTC (permalink / raw) To: Oliver Upton Cc: kvm, kvmarm, drjones, Paolo Bonzini, maciej.szmigiero, maz, jingzhangos, pshier, rananta, reijiw On Tue, Sep 07, 2021 at 09:39:12AM -0500, Oliver Upton wrote: > Ricardo, > > On Fri, Sep 3, 2021 at 6:12 PM Ricardo Koller <ricarkol@google.com> wrote: > > > > Add memslot_perf_test and memslot_modification_stress_test to the list > > of aarch64 selftests. > > > > Signed-off-by: Ricardo Koller <ricarkol@google.com> > > There isn't anything that prevents these tests from being used for > s390x too right? Of course, we haven't anything to test on but just a > thought. Tbh I'm not sure. Will ask if somebody can try it in the cover letter for v2. Thanks, Ricardo > > Besides Drew's comments: > > Reviewed-by: Oliver Upton <oupton@google.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-09-07 17:42 UTC | newest] Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-09-03 23:11 [PATCH 0/2] KVM: selftests: enable the memslot tests in ARM64 Ricardo Koller 2021-09-03 23:11 ` [PATCH 1/2] KVM: selftests: make memslot_perf_test arch independent Ricardo Koller 2021-09-06 6:50 ` Andrew Jones 2021-09-06 18:03 ` Maciej S. Szmigiero 2021-09-07 14:34 ` Oliver Upton 2021-09-03 23:11 ` [PATCH 2/2] KVM: selftests: build the memslot tests for arm64 Ricardo Koller 2021-09-06 6:52 ` Andrew Jones 2021-09-07 17:39 ` Ricardo Koller 2021-09-06 18:03 ` Maciej S. Szmigiero 2021-09-07 14:39 ` Oliver Upton 2021-09-07 17:42 ` Ricardo Koller
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).