[PATCH v2 00/11] SVM: vNMI (with my fixes)

Maxim Levitsky posted 11 patches 2 years, 9 months ago
arch/x86/include/asm/cpufeatures.h |   1 +
arch/x86/include/asm/kvm-x86-ops.h |   2 +
arch/x86/include/asm/kvm_host.h    |  24 +++--
arch/x86/include/asm/svm.h         |   7 ++
arch/x86/kvm/emulate.c             |  11 +--
arch/x86/kvm/kvm_emulate.h         |   7 +-
arch/x86/kvm/smm.c                 |   2 -
arch/x86/kvm/svm/nested.c          | 102 ++++++++++++++++---
arch/x86/kvm/svm/svm.c             | 154 ++++++++++++++++++++++-------
arch/x86/kvm/svm/svm.h             |  41 +++++++-
arch/x86/kvm/x86.c                 |  50 ++++++++--
11 files changed, 318 insertions(+), 83 deletions(-)
[PATCH v2 00/11] SVM: vNMI (with my fixes)
Posted by Maxim Levitsky 2 years, 9 months ago
Hi!

This is the vNMI patch series based on Santosh Shukla's vNMI patch series.

In this version of this patch series I addressed most of the review feedback
added some more refactoring and also I think fixed the issue with migration.

I only tested this on a machine which doesn't have vNMI, so this does need
some testing to ensure that nothing is broken.

Best regards,
       Maxim Levitsky

Maxim Levitsky (9):
  KVM: nSVM: don't sync back tlb_ctl on nested VM exit
  KVM: nSVM: clean up the copying of V_INTR bits from vmcb02 to vmcb12
  KVM: nSVM: explicitly raise KVM_REQ_EVENT on nested VM exit if L1
    doesn't intercept interrupts
  KVM: SVM: drop the SVM specific H_FLAGS
  KVM: x86: emulator: stop using raw host flags
  KVM: SVM: add wrappers to enable/disable IRET interception
  KVM: x86: add a delayed hardware NMI injection interface
  KVM: SVM: implement support for vNMI
  KVM: nSVM: implement support for nested VNMI

Santosh Shukla (2):
  x86/cpu: Add CPUID feature bit for VNMI
  KVM: SVM: Add VNMI bit definition

 arch/x86/include/asm/cpufeatures.h |   1 +
 arch/x86/include/asm/kvm-x86-ops.h |   2 +
 arch/x86/include/asm/kvm_host.h    |  24 +++--
 arch/x86/include/asm/svm.h         |   7 ++
 arch/x86/kvm/emulate.c             |  11 +--
 arch/x86/kvm/kvm_emulate.h         |   7 +-
 arch/x86/kvm/smm.c                 |   2 -
 arch/x86/kvm/svm/nested.c          | 102 ++++++++++++++++---
 arch/x86/kvm/svm/svm.c             | 154 ++++++++++++++++++++++-------
 arch/x86/kvm/svm/svm.h             |  41 +++++++-
 arch/x86/kvm/x86.c                 |  50 ++++++++--
 11 files changed, 318 insertions(+), 83 deletions(-)

-- 
2.26.3

Re: [PATCH v2 00/11] SVM: vNMI (with my fixes)
Posted by Maxim Levitsky 2 years, 9 months ago
On Tue, 2022-11-29 at 21:37 +0200, Maxim Levitsky wrote:
> Hi!
> 
> This is the vNMI patch series based on Santosh Shukla's vNMI patch series.
> 
> In this version of this patch series I addressed most of the review feedback
> added some more refactoring and also I think fixed the issue with migration.
> 
> I only tested this on a machine which doesn't have vNMI, so this does need
> some testing to ensure that nothing is broken.
> 
> Best regards,
>        Maxim Levitsky
> 
> Maxim Levitsky (9):
>   KVM: nSVM: don't sync back tlb_ctl on nested VM exit
>   KVM: nSVM: clean up the copying of V_INTR bits from vmcb02 to vmcb12
>   KVM: nSVM: explicitly raise KVM_REQ_EVENT on nested VM exit if L1
>     doesn't intercept interrupts
>   KVM: SVM: drop the SVM specific H_FLAGS
>   KVM: x86: emulator: stop using raw host flags
>   KVM: SVM: add wrappers to enable/disable IRET interception
>   KVM: x86: add a delayed hardware NMI injection interface
>   KVM: SVM: implement support for vNMI
>   KVM: nSVM: implement support for nested VNMI
> 
> Santosh Shukla (2):
>   x86/cpu: Add CPUID feature bit for VNMI
>   KVM: SVM: Add VNMI bit definition
> 
>  arch/x86/include/asm/cpufeatures.h |   1 +
>  arch/x86/include/asm/kvm-x86-ops.h |   2 +
>  arch/x86/include/asm/kvm_host.h    |  24 +++--
>  arch/x86/include/asm/svm.h         |   7 ++
>  arch/x86/kvm/emulate.c             |  11 +--
>  arch/x86/kvm/kvm_emulate.h         |   7 +-
>  arch/x86/kvm/smm.c                 |   2 -
>  arch/x86/kvm/svm/nested.c          | 102 ++++++++++++++++---
>  arch/x86/kvm/svm/svm.c             | 154 ++++++++++++++++++++++-------
>  arch/x86/kvm/svm/svm.h             |  41 +++++++-
>  arch/x86/kvm/x86.c                 |  50 ++++++++--
>  11 files changed, 318 insertions(+), 83 deletions(-)
> 
> -- 
> 2.26.3
> 
> 
A very kind ping on these patches.


Best regards,
	Maxim Levitsky
Re: [PATCH v2 00/11] SVM: vNMI (with my fixes)
Posted by Sean Christopherson 2 years, 9 months ago
On Tue, Dec 20, 2022, Maxim Levitsky wrote:
> On Tue, 2022-11-29 at 21:37 +0200, Maxim Levitsky wrote:
> > Hi!
> > 
> > This is the vNMI patch series based on Santosh Shukla's vNMI patch series.
> > 
> > In this version of this patch series I addressed most of the review feedback
> > added some more refactoring and also I think fixed the issue with migration.
> > 
> > I only tested this on a machine which doesn't have vNMI, so this does need
> > some testing to ensure that nothing is broken.
> > 
> > Best regards,
> >        Maxim Levitsky
> > 
> > Maxim Levitsky (9):
> >   KVM: nSVM: don't sync back tlb_ctl on nested VM exit
> >   KVM: nSVM: clean up the copying of V_INTR bits from vmcb02 to vmcb12
> >   KVM: nSVM: explicitly raise KVM_REQ_EVENT on nested VM exit if L1
> >     doesn't intercept interrupts
> >   KVM: SVM: drop the SVM specific H_FLAGS
> >   KVM: x86: emulator: stop using raw host flags
> >   KVM: SVM: add wrappers to enable/disable IRET interception
> >   KVM: x86: add a delayed hardware NMI injection interface
> >   KVM: SVM: implement support for vNMI
> >   KVM: nSVM: implement support for nested VNMI
> > 
> > Santosh Shukla (2):
> >   x86/cpu: Add CPUID feature bit for VNMI
> >   KVM: SVM: Add VNMI bit definition
> > 
> >  arch/x86/include/asm/cpufeatures.h |   1 +
> >  arch/x86/include/asm/kvm-x86-ops.h |   2 +
> >  arch/x86/include/asm/kvm_host.h    |  24 +++--
> >  arch/x86/include/asm/svm.h         |   7 ++
> >  arch/x86/kvm/emulate.c             |  11 +--
> >  arch/x86/kvm/kvm_emulate.h         |   7 +-
> >  arch/x86/kvm/smm.c                 |   2 -
> >  arch/x86/kvm/svm/nested.c          | 102 ++++++++++++++++---
> >  arch/x86/kvm/svm/svm.c             | 154 ++++++++++++++++++++++-------
> >  arch/x86/kvm/svm/svm.h             |  41 +++++++-
> >  arch/x86/kvm/x86.c                 |  50 ++++++++--
> >  11 files changed, 318 insertions(+), 83 deletions(-)
> > 
> > -- 
> > 2.26.3
> > 
> > 
> A very kind ping on these patches.

Sorry, I won't get to this (or anything else) until the new year.
Re: [PATCH v2 00/11] SVM: vNMI (with my fixes)
Posted by Sean Christopherson 2 years, 7 months ago
On Tue, Nov 29, 2022, Maxim Levitsky wrote:
> Hi!
> 
> This is the vNMI patch series based on Santosh Shukla's vNMI patch series.
> 
> In this version of this patch series I addressed most of the review feedback
> added some more refactoring and also I think fixed the issue with migration.
> 
> I only tested this on a machine which doesn't have vNMI, so this does need
> some testing to ensure that nothing is broken.

Apologies for the slow review.

Did a fast run through, mostly have questions to address my lack of knowledge.
I'll give this a much more thorough review first thing next week (my brain is
fried), and am planning on queueing it unless I see someone truly busted (I'll
fixup my nits when applying).
Re: [PATCH v2 00/11] SVM: vNMI (with my fixes)
Posted by Maxim Levitsky 2 years, 8 months ago
On Tue, 2022-11-29 at 21:37 +0200, Maxim Levitsky wrote:
> Hi!
> 
> This is the vNMI patch series based on Santosh Shukla's vNMI patch series.
> 
> In this version of this patch series I addressed most of the review feedback
> added some more refactoring and also I think fixed the issue with migration.
> 
> I only tested this on a machine which doesn't have vNMI, so this does need
> some testing to ensure that nothing is broken.
> 
> Best regards,
>        Maxim Levitsky
> 
> Maxim Levitsky (9):
>   KVM: nSVM: don't sync back tlb_ctl on nested VM exit
>   KVM: nSVM: clean up the copying of V_INTR bits from vmcb02 to vmcb12
>   KVM: nSVM: explicitly raise KVM_REQ_EVENT on nested VM exit if L1
>     doesn't intercept interrupts
>   KVM: SVM: drop the SVM specific H_FLAGS
>   KVM: x86: emulator: stop using raw host flags
>   KVM: SVM: add wrappers to enable/disable IRET interception
>   KVM: x86: add a delayed hardware NMI injection interface
>   KVM: SVM: implement support for vNMI
>   KVM: nSVM: implement support for nested VNMI
> 
> Santosh Shukla (2):
>   x86/cpu: Add CPUID feature bit for VNMI
>   KVM: SVM: Add VNMI bit definition
> 
>  arch/x86/include/asm/cpufeatures.h |   1 +
>  arch/x86/include/asm/kvm-x86-ops.h |   2 +
>  arch/x86/include/asm/kvm_host.h    |  24 +++--
>  arch/x86/include/asm/svm.h         |   7 ++
>  arch/x86/kvm/emulate.c             |  11 +--
>  arch/x86/kvm/kvm_emulate.h         |   7 +-
>  arch/x86/kvm/smm.c                 |   2 -
>  arch/x86/kvm/svm/nested.c          | 102 ++++++++++++++++---
>  arch/x86/kvm/svm/svm.c             | 154 ++++++++++++++++++++++-------
>  arch/x86/kvm/svm/svm.h             |  41 +++++++-
>  arch/x86/kvm/x86.c                 |  50 ++++++++--
>  11 files changed, 318 insertions(+), 83 deletions(-)
> 
> -- 
> 2.26.3
> 
> 
Another kind ping on this patch series.

Best regards,
	Maxim Levitsky
Re: [PATCH v2 00/11] SVM: vNMI (with my fixes)
Posted by Santosh Shukla 2 years, 9 months ago
On 11/30/2022 1:07 AM, Maxim Levitsky wrote:
> Hi!
> 
> 
> 
> This is the vNMI patch series based on Santosh Shukla's vNMI patch series.
> 
> 
> 
> In this version of this patch series I addressed most of the review feedback
> 
> added some more refactoring and also I think fixed the issue with migration.
> 
> 
> 
> I only tested this on a machine which doesn't have vNMI, so this does need
> 
> some testing to ensure that nothing is broken.
> 
> 
> 
> Best regards,
> 
>        Maxim Levitsky
> 
> 
Series tested on EPYC-v4.
Tested-By: Santosh Shukla <Santosh.Shukla@amd.com>

> 
> Maxim Levitsky (9):
> 
>   KVM: nSVM: don't sync back tlb_ctl on nested VM exit
> 
>   KVM: nSVM: clean up the copying of V_INTR bits from vmcb02 to vmcb12
> 
>   KVM: nSVM: explicitly raise KVM_REQ_EVENT on nested VM exit if L1
> 
>     doesn't intercept interrupts
> 
>   KVM: SVM: drop the SVM specific H_FLAGS
> 
>   KVM: x86: emulator: stop using raw host flags
> 
>   KVM: SVM: add wrappers to enable/disable IRET interception
> 
>   KVM: x86: add a delayed hardware NMI injection interface
> 
>   KVM: SVM: implement support for vNMI
> 
>   KVM: nSVM: implement support for nested VNMI
> 
> 
> 
> Santosh Shukla (2):
> 
>   x86/cpu: Add CPUID feature bit for VNMI
> 
>   KVM: SVM: Add VNMI bit definition
> 
> 
> 
>  arch/x86/include/asm/cpufeatures.h |   1 +
> 
>  arch/x86/include/asm/kvm-x86-ops.h |   2 +
> 
>  arch/x86/include/asm/kvm_host.h    |  24 +++--
> 
>  arch/x86/include/asm/svm.h         |   7 ++
> 
>  arch/x86/kvm/emulate.c             |  11 +--
> 
>  arch/x86/kvm/kvm_emulate.h         |   7 +-
> 
>  arch/x86/kvm/smm.c                 |   2 -
> 
>  arch/x86/kvm/svm/nested.c          | 102 ++++++++++++++++---
> 
>  arch/x86/kvm/svm/svm.c             | 154 ++++++++++++++++++++++-------
> 
>  arch/x86/kvm/svm/svm.h             |  41 +++++++-
> 
>  arch/x86/kvm/x86.c                 |  50 ++++++++--
> 
>  11 files changed, 318 insertions(+), 83 deletions(-)
> 
> 
>
Re: [PATCH v2 00/11] SVM: vNMI (with my fixes)
Posted by Sean Christopherson 2 years, 7 months ago
On Tue, Dec 06, 2022, Santosh Shukla wrote:
> Series tested on EPYC-v4.
> Tested-By: Santosh Shukla <Santosh.Shukla@amd.com>

In the future, please use Tested-by, not Tested-By.  For whatever reason, the
preferred kernel style for tags is to capitalize only the first word, e.g.
Co-developed-by, Tested-by, Reviewed-by, etc...
Re: [PATCH v2 00/11] SVM: vNMI (with my fixes)
Posted by Sean Christopherson 2 years, 7 months ago
On Tue, 29 Nov 2022 21:37:06 +0200, Maxim Levitsky wrote:
> This is the vNMI patch series based on Santosh Shukla's vNMI patch series.
> 
> In this version of this patch series I addressed most of the review feedback
> added some more refactoring and also I think fixed the issue with migration.
> 
> I only tested this on a machine which doesn't have vNMI, so this does need
> some testing to ensure that nothing is broken.
> 
> [...]

Applied 1, 4, and 5 to kvm-x86 svm.  I split patch 4 as doing so made the
HF_GIF_MASK change super trivial.

vNMI support will get pushed beyond v6.3, but I will do my best to promptly
review future versions, while I still have all of this paged in...

[01/11] KVM: nSVM: Don't sync tlb_ctl back to vmcb12 on nested VM-Exit
        https://github.com/kvm-x86/linux/commit/8957cbcfed0a
[04/11] KVM: x86: Move HF_GIF_MASK into "struct vcpu_svm" as "guest_gif"
        https://github.com/kvm-x86/linux/commit/c760e86f27fe
[04/11] KVM: x86: Move HF_NMI_MASK and HF_IRET_MASK into "struct vcpu_svm"
        https://github.com/kvm-x86/linux/commit/916b54a7688b
[05/11] KVM: x86: Use emulator callbacks instead of duplicating "host flags"
        https://github.com/kvm-x86/linux/commit/32e69f232db4

--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes