Re: [PATCH] KVM/nVMX: Use __vmx_vcpu_run in nested_vmx_check_vmentry_hw

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

 



On Wed, Dec 16, 2020, Krish Sadhukhan wrote:
> > > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> > > index d14c94d0aff1..0f390c748b18 100644
> > > --- a/arch/x86/kvm/vmx/vmx.c
> > > +++ b/arch/x86/kvm/vmx/vmx.c
> > > @@ -6591,8 +6591,6 @@ static fastpath_t vmx_exit_handlers_fastpath(struct kvm_vcpu *vcpu)
> > >          }
> > >   }
> > > 
> > > -bool __vmx_vcpu_run(struct vcpu_vmx *vmx, unsigned long *regs, bool launched);
> > > -
> > >   static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu,
> > >                                          struct vcpu_vmx *vmx)
> > >   {
> > > diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> > > index f6f66e5c6510..32db3b033e9b 100644
> > > --- a/arch/x86/kvm/vmx/vmx.h
> > > +++ b/arch/x86/kvm/vmx/vmx.h
> > > @@ -339,6 +339,7 @@ void vmx_set_virtual_apic_mode(struct kvm_vcpu *vcpu);
> > >   struct vmx_uret_msr *vmx_find_uret_msr(struct vcpu_vmx *vmx, u32 msr);
> > >   void pt_update_intercept_for_msr(struct kvm_vcpu *vcpu);
> > >   void vmx_update_host_rsp(struct vcpu_vmx *vmx, unsigned long host_rsp);
> > > +bool __vmx_vcpu_run(struct vcpu_vmx *vmx, unsigned long *regs, bool launched);
> > >   int vmx_find_loadstore_msr_slot(struct vmx_msrs *m, u32 msr);
> > >   void vmx_ept_load_pdptrs(struct kvm_vcpu *vcpu);
> > > 
> > > --
> > > 2.26.2
> > > 
> Semantically __vmx_vcpu_run() is called to enter guest mode. In
> nested_vmx_check_vmentry_hw(), we are not entering guest mode. Guest mode is
> entered when nested_vmx_enter_non_root_mode() calls enter_guest_mode().

Naming aside, this patch intentionally redefines the semantics to mean "execute
VM-Enter that may or may not succeed".  And as called out in the changelog, the
overhead of the GPR save/load/restore is tolerable; reusing code and avoiding
ugly inline asm is more important.

> Secondly, why not just replace the first half of the assembly block with a
> call to vmx_update_host_rsp() and leave the rest as is ?

As above, though not called out in the changelog, the goal is to move away from
the inline asm without introducing another asm subroutine.

Uros, I'll try to double check and review this later today.



[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