[PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM

Vitaly Kuznetsov posted 4 patches 4 years, 4 months ago
arch/x86/kvm/hyperv.c           | 12 +--------
arch/x86/kvm/hyperv.h           |  6 ++++-
arch/x86/kvm/svm/hyperv.h       | 35 ++++++++++++++++++++++++
arch/x86/kvm/svm/nested.c       | 47 ++++++++++++++++++++++++++++-----
arch/x86/kvm/svm/svm.c          |  3 ++-
arch/x86/kvm/svm/svm.h          | 11 ++++++++
arch/x86/kvm/svm/svm_onhyperv.h | 25 +-----------------
7 files changed, 95 insertions(+), 44 deletions(-)
create mode 100644 arch/x86/kvm/svm/hyperv.h
[PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM
Posted by Vitaly Kuznetsov 4 years, 4 months ago
Changes since v1:
- Patches 1/2 from "[PATCH 0/5] KVM: SVM: nSVM: Implement Enlightened
  MSR-Bitmap for Hyper-V-on-KVM and fix it for KVM-on-Hyper-V" are already
  merged, dropped.
- Fix build when !CONFIG_HYPERV (PATCH3 "KVM: nSVM: Split off common
  definitions for Hyper-V on KVM and KVM on Hyper-V" added).

Description:

Enlightened MSR-Bitmap feature implements a PV protocol for L0 and L1
hypervisors to collaborate and skip unneeded updates to MSR-Bitmap.
KVM already implements the feature for KVM-on-Hyper-V.

Vitaly Kuznetsov (4):
  KVM: nSVM: Track whether changes in L0 require MSR bitmap for L2 to be
    rebuilt
  KVM: x86: Make kvm_hv_hypercall_enabled() static inline
  KVM: nSVM: Split off common definitions for Hyper-V on KVM and KVM on
    Hyper-V
  KVM: nSVM: Implement Enlightened MSR-Bitmap feature

 arch/x86/kvm/hyperv.c           | 12 +--------
 arch/x86/kvm/hyperv.h           |  6 ++++-
 arch/x86/kvm/svm/hyperv.h       | 35 ++++++++++++++++++++++++
 arch/x86/kvm/svm/nested.c       | 47 ++++++++++++++++++++++++++++-----
 arch/x86/kvm/svm/svm.c          |  3 ++-
 arch/x86/kvm/svm/svm.h          | 11 ++++++++
 arch/x86/kvm/svm/svm_onhyperv.h | 25 +-----------------
 7 files changed, 95 insertions(+), 44 deletions(-)
 create mode 100644 arch/x86/kvm/svm/hyperv.h

-- 
2.34.1

Re: [PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM
Posted by Paolo Bonzini 4 years, 4 months ago
On 2/2/22 10:50, Vitaly Kuznetsov wrote:
> Changes since v1:
> - Patches 1/2 from "[PATCH 0/5] KVM: SVM: nSVM: Implement Enlightened
>    MSR-Bitmap for Hyper-V-on-KVM and fix it for KVM-on-Hyper-V" are already
>    merged, dropped.
> - Fix build when !CONFIG_HYPERV (PATCH3 "KVM: nSVM: Split off common
>    definitions for Hyper-V on KVM and KVM on Hyper-V" added).
> 
> Description:
> 
> Enlightened MSR-Bitmap feature implements a PV protocol for L0 and L1
> hypervisors to collaborate and skip unneeded updates to MSR-Bitmap.
> KVM already implements the feature for KVM-on-Hyper-V.
> 
> Vitaly Kuznetsov (4):
>    KVM: nSVM: Track whether changes in L0 require MSR bitmap for L2 to be
>      rebuilt
>    KVM: x86: Make kvm_hv_hypercall_enabled() static inline
>    KVM: nSVM: Split off common definitions for Hyper-V on KVM and KVM on
>      Hyper-V
>    KVM: nSVM: Implement Enlightened MSR-Bitmap feature
> 
>   arch/x86/kvm/hyperv.c           | 12 +--------
>   arch/x86/kvm/hyperv.h           |  6 ++++-
>   arch/x86/kvm/svm/hyperv.h       | 35 ++++++++++++++++++++++++
>   arch/x86/kvm/svm/nested.c       | 47 ++++++++++++++++++++++++++++-----
>   arch/x86/kvm/svm/svm.c          |  3 ++-
>   arch/x86/kvm/svm/svm.h          | 11 ++++++++
>   arch/x86/kvm/svm/svm_onhyperv.h | 25 +-----------------
>   7 files changed, 95 insertions(+), 44 deletions(-)
>   create mode 100644 arch/x86/kvm/svm/hyperv.h
> 

Queued, thanks.

Paolo

Re: [PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM
Posted by Vitaly Kuznetsov 4 years, 4 months ago
Paolo Bonzini <pbonzini@redhat.com> writes:

> On 2/2/22 10:50, Vitaly Kuznetsov wrote:
...
>>    KVM: nSVM: Implement Enlightened MSR-Bitmap feature
...
>
> Queued, thanks.

While writing a selftest for the feature, I've discovered an embarassing
bug: in nested_svm_vmrun_msrpm() I check bit number instead of bit
mask. It worked in testing by pure luck, it seems genuine Hyper-V sets
some other clean fields simultaneously.

Would it be possible to squash the attached patch in? Thanks!

I'll be sending out selftests shortly.

-- 
Vitaly

Re: [PATCH v2 0/4] KVM: SVM: nSVM: Implement Enlightened MSR-Bitmap for Hyper-V-on-KVM
Posted by Paolo Bonzini 4 years, 4 months ago
On 2/3/22 10:51, Vitaly Kuznetsov wrote:
> Would it be possible to squash the attached patch in? Thanks!

Yes, of course.  Tests FTW. :)

Paolo