[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YqItO2cbsGDSyxD8@google.com>
Date: Thu, 9 Jun 2022 17:26:19 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Andrew Jones <drjones@...hat.com>
Cc: Marc Zyngier <maz@...nel.org>, Paolo Bonzini <pbonzini@...hat.com>,
kvm@...r.kernel.org, Vitaly Kuznetsov <vkuznets@...hat.com>,
David Matlack <dmatlack@...gle.com>,
Ben Gardon <bgardon@...gle.com>,
Oliver Upton <oupton@...gle.com>, linux-kernel@...r.kernel.org,
anup@...infault.org, Raghavendra Rao Ananta <rananta@...gle.com>,
eric.auger@...hat.com
Subject: Re: [PATCH v2 000/144] KVM: selftests: Overhaul APIs, purge VCPU_ID
On Thu, Jun 09, 2022, Sean Christopherson wrote:
> On Thu, Jun 09, 2022, Andrew Jones wrote:
> > On Wed, Jun 08, 2022 at 11:20:06PM +0000, Sean Christopherson wrote:
> > > diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> > > index b3116c151d1c..17f7ef975d5c 100644
> > > --- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> > > +++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
> > > @@ -419,7 +419,7 @@ static void run_test(struct vcpu_config *c)
> > >
> > > check_supported(c);
> > >
> > > - vm = vm_create_barebones();
> > > + vm = vm_create(1);
> >
> > Hmm, looks like something, somewhere for AArch64 needs improving to avoid
> > strangeness like this. I'll look into it after we get this series merged.
>
> Huh, you're right, that is odd. Ah, duh, aarch64_vcpu_add() allocates a stack
> for the vCPU, and that will fail if there's no memslot from which to allocate
> guest memory.
>
> So, this is my goof in
>
> KVM: selftests: Rename vm_create() => vm_create_barebones(), drop param
>
> get-reg-list should first be converted to vm_create_without_vcpus(). I'll also
> add a comment explaining that vm_create_barebones() can be used with __vm_vcpu_add(),
> but not the "full" vm_vcpu_add() or vm_arch_vcpu_add() variants.
Actually, I agree with your assessment. A better solution is to open code the
calls to add and setup the vCPU. It's a small amount of code duplication, but I
actually like the end result because it better documents the test's dependencies.
Assuming it actually works, i.e. the stack setup is truly unnecessary, I'll add a
patch like so before the barebones change.
diff --git a/tools/testing/selftests/kvm/aarch64/get-reg-list.c b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
index ecfb773ec41e..7bba365b1522 100644
--- a/tools/testing/selftests/kvm/aarch64/get-reg-list.c
+++ b/tools/testing/selftests/kvm/aarch64/get-reg-list.c
@@ -418,7 +418,8 @@ static void run_test(struct vcpu_config *c)
vm = vm_create(DEFAULT_GUEST_PHY_PAGES);
prepare_vcpu_init(c, &init);
- aarch64_vcpu_add_default(vm, 0, &init, NULL);
+ vm_vcpu_add(vm, vcpuid);
+ aarch64_vcpu_setup(vm, 0, &init);
finalize_vcpu(vm, 0, c);
reg_list = vcpu_get_reg_list(vm, 0);
Powered by blists - more mailing lists