Re: [RFC PATCH 00/10] KVM: selftests: Add support for test-selectable ucall implementations

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

 



On Wed, Jan 05, 2022 at 10:02:53PM +0000, Sean Christopherson wrote:
> On Wed, Jan 05, 2022, Michael Roth wrote:
> > On Wed, Jan 05, 2022 at 07:40:57PM +0000, Sean Christopherson wrote:
> > > As for ucall_init(), I think the best approach would be to make kvm_vm_elf_load()
> > > a static and replace all calls with:
> > > 
> > > 	kvm_vm_load_guest(vm);
> > > 
> > > where its implementation is:
> > > 
> > >   void kvm_vm_load_guest(struct kvm_vm *vm)
> > >   {
> > >   	kvm_vm_elf_load(vm, program_invocation_name);
> > > 
> > > 	ucall_init(vm);
> > >   }
> > > 
> > > The logic being that if a test creates a VM but never loads any code into the guest,
> > > e.g. kvm_create_max_vcpus, then it _can't_ make ucalls.
> > 
> > Makes sense. And if different ops are needed for vmgexit()/tdcall() it
> > could be something like (if based on patches 1-5 of this series, and
> > extending vm_guest_mode as you suggested earlier):
> > 
> >    void kvm_vm_load_guest(struct kvm_vm *vm)
> >    {
> > 
> >      kvm_vm_elf_load(vm, program_invocation_name);
> >   
> >      if (vm->mode == VM_MODE_SEV)
> >   	    ucall_init_ops(vm, ucall_ops_pio_vmgexit);
> >      else (vm->vm_type == VM_MODE_TDX)
> 
> I don't think we want to do this here, but instead down in the arch-specific
> ucall_init().  Also, not sure if I was clear before (can't tell what you interpreted
> based on the above snippet), but I think we'll want VM_MODE_SEV etc... to be
> modifiers on top of the VA/PA stuff.

Ok, something like this (with additional ones added as-needed)?

  #define VM_MODE_DEFAULT VM_MODE_PXXV48_4K
  +#define SEV_VM_MODE_DEFAULT SEV_VM_MODE_PXXV48_4K

  enum vm_guest_mode {
    ...
    VM_MODE_PXXV48_4K,
    ...
    NUM_VM_MODES,
  + SEV_VM_MODE_PXXV48_4K,
  + NUM_VM_MODES_EXTENDED,
  }

> 
> >   	    ucall_init_ops(vm, ucall_ops_pio_tdcall);
> >      else
> >   	    ucall_init_ops(vm, ucall_ops_pio);
> > 
> > Shame we have to update all the kvm_vm_elf_load() call-sites, but
> > they'd end up potentially breaking things if left as-is anyway.
> > 
> > Were you planning on sending patches for these changes, or should I incorporate
> > your prototype and take a stab at the other changes as part of v2 of this
> > series?
> 
> Nope, all yours.  Thanks!

Thanks for the suggestions!



[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