Re: [PATCH v2 000/144] KVM: selftests: Overhaul APIs, purge VCPU_ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 09, 2022 at 05:26:19PM +0000, Sean Christopherson wrote:
> 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);
>

LGTM, Thanks 




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux