Skip to content

KVM: x86: Add "governed" X86_FEATURE framework

Sean Christopherson kvm lkml 3 versions – Applied

Status from this message: Applied to kvm-x86 misc, with a blurb added to the nVMX changelog to explain

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest15 patches 22 repliesApplied
  2. v221 patches 5 repliesSuperseded
  3. v112 patches 18 repliesSuperseded

Changes in v3 from the cover letter

- "Drop" TSC scaling patches (already applied).
- Remove dead xsave_enabled code (snuck into v2 by a bad conflict resolution). [Zeng]
- Make kvm_is_governed_feature() return a bool. [Zeng]
- Collect a review. [Yuan]

Patches in v3 Applied

#Subject and filesSizeRepliesApplied
1/15KVM: x86: Add a framework for enabling KVM-governed x86 featuresarch/x86/include/asm/kvm_host.h arch/x86/kvm/cpuid.c arch/x86/kvm/cpuid.h +1 more+78 -05 replies
2/15KVM: x86/mmu: Use KVM-governed feature framework to track "GBPAGES enabled"arch/x86/kvm/cpuid.c arch/x86/kvm/governed_features.h arch/x86/kvm/mmu/mmu.c+22 -171 reply
3/15KVM: VMX: Recompute "XSAVES enabled" only after CPUID updatearch/x86/kvm/vmx/vmx.c+11 -131 reply
4/15KVM: VMX: Check KVM CPU caps, not just VMX MSR support, for XSAVE enablingarch/x86/kvm/vmx/vmx.c+1 -11 reply
5/15KVM: VMX: Rename XSAVES control to follow KVM's preferred "ENABLE_XYZ"arch/x86/include/asm/vmx.h arch/x86/kvm/vmx/capabilities.h arch/x86/kvm/vmx/hyperv.c +4 more+9 -92 replies
6/15KVM: x86: Use KVM-governed feature framework to track "XSAVES enabled"arch/x86/include/asm/kvm_host.h arch/x86/kvm/governed_features.h arch/x86/kvm/svm/svm.c +2 more+35 -242 replies
7/15KVM: nVMX: Use KVM-governed feature framework to track "nested VMX enabled"arch/x86/kvm/governed_features.h arch/x86/kvm/vmx/nested.c arch/x86/kvm/vmx/vmx.c +1 more+11 -193 replies
8/15KVM: nSVM: Use KVM-governed feature framework to track "NRIPS enabled"arch/x86/kvm/governed_features.h arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +1 more+5 -71 reply
9/15KVM: nSVM: Use KVM-governed feature framework to track "TSC scaling enabled"arch/x86/kvm/governed_features.h arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +1 more+8 -63 replies
10/15KVM: nSVM: Use KVM-governed feature framework to track "vVM{SAVE,LOAD} enabled"arch/x86/kvm/governed_features.h arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +1 more+9 -50 replies
11/15KVM: nSVM: Use KVM-governed feature framework to track "LBRv enabled"arch/x86/kvm/governed_features.h arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +1 more+16 -140 replies
12/15KVM: nSVM: Use KVM-governed feature framework to track "Pause Filter enabled"arch/x86/kvm/governed_features.h arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +1 more+12 -91 reply
13/15KVM: nSVM: Use KVM-governed feature framework to track "vGIF enabled"arch/x86/kvm/governed_features.h arch/x86/kvm/svm/nested.c arch/x86/kvm/svm/svm.c +1 more+7 -51 reply
14/15KVM: nSVM: Use KVM-governed feature framework to track "vNMI enabled"arch/x86/kvm/governed_features.h arch/x86/kvm/svm/svm.c arch/x86/kvm/svm/svm.h+3 -60 replies
15/15KVM: x86: Disallow guest CPUID lookups when IRQs are disabledarch/x86/kvm/cpuid.c+13 -00 replies

Reviews trailers per patch

10 of 15 patches have a Reviewed-by or Acked-by.

PatchYuan YaoKai HuangVitaly KuznetsovBinbin Wu
1/15R-b R-b R-b
2/15R-b
3/15R-b
4/15R-b
5/15R-b
6/15R-b
7/15R-b Reviwed-by
8/15R-b
9/15R-b
10/15
11/15
12/15R-b
13/15
14/15
15/15

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/15] KVM: x86: Add "governed" X86_FEATURE framework

Third and hopefully final version of the framework to manage and cache KVM-governed features, i.e. CPUID based features that require explicit KVM enabling and/or need to be queried semi-frequently by KVM.

This version is just the governed features patches, as I kept the TSC scaling patches in kvm-x86/misc but blasted away the goverend features with a forced push.

My plan is again to apply this quite quickly so that it can be used as a base for other series.

v3:
- "Drop" TSC scaling patches (already applied).
- Remove dead xsave_enabled code (snuck into v2 by a bad conflict resolution). [Zeng]
- Make kvm_is_governed_feature() return a bool. [Zeng]
- Collect a review. [Yuan]

v2:
- https://lore.kernel.org/all/[email protected]
- Add patches to clean up TSC scaling.
- Add a comment explaining the virtual VMLOAD/VMLAVE vs. SYSENTER on Intel madness.
- Use a governed feature for X86_FEATURE_VMX.
- Incorporate KVM capabilities into the main check-and-set helper. [Chao]

v1: https://lore.kernel.org/all/[email protected]

Sean Christopherson (15):
KVM: x86: Add a framework for enabling KVM-governed x86 features
KVM: x86/mmu: Use KVM-governed feature framework to track "GBPAGES
enabled"
KVM: VMX: Recompute "XSAVES enabled" only after CPUID update
KVM: VMX: Check KVM CPU caps, not just VMX MSR support, for XSAVE
enabling
KVM: VMX: Rename XSAVES control to follow KVM's preferred "ENABLE_XYZ"
KVM: x86: Use KVM-governed feature framework to track "XSAVES enabled"
KVM: nVMX: Use KVM-governed feature framework to track "nested VMX
enabled"
KVM: nSVM: Use KVM-governed feature framework to track "NRIPS enabled"
KVM: nSVM: Use KVM-governed feature framework to track "TSC scaling
enabled"
KVM: nSVM: Use KVM-governed feature framework to track "vVM{SAVE,LOAD}
enabled"
KVM: nSVM: Use KVM-governed feature framework to track "LBRv enabled"
KVM: nSVM: Use KVM-governed feature framework to track "Pause Filter
enabled"
KVM: nSVM: Use KVM-governed feature framework to track "vGIF enabled"
KVM: nSVM: Use KVM-governed feature framework to track "vNMI enabled"
KVM: x86: Disallow guest CPUID lookups when IRQs are disabled

 arch/x86/include/asm/kvm_host.h  | 20 ++++++++-
 arch/x86/include/asm/vmx.h       |  2 +-
 arch/x86/kvm/cpuid.c             | 34 ++++++++++++++++
 arch/x86/kvm/cpuid.h             | 46 +++++++++++++++++++++
 arch/x86/kvm/governed_features.h | 21 ++++++++++
 arch/x86/kvm/mmu/mmu.c           | 20 ++-------
 arch/x86/kvm/svm/nested.c        | 46 ++++++++++++---------
 arch/x86/kvm/svm/svm.c           | 59 +++++++++++++++------------
 arch/x86/kvm/svm/svm.h           | 16 ++------
 arch/x86/kvm/vmx/capabilities.h  |  2 +-
 arch/x86/kvm/vmx/hyperv.c        |  2 +-
 arch/x86/kvm/vmx/nested.c        | 13 +++---
 arch/x86/kvm/vmx/nested.h        |  2 +-
 arch/x86/kvm/vmx/vmx.c           | 69 ++++++++++++++------------------
 arch/x86/kvm/vmx/vmx.h           |  3 +-
 arch/x86/kvm/x86.c               |  4 +-
 16 files changed, 232 insertions(+), 127 deletions(-)
 create mode 100644 arch/x86/kvm/governed_features.h

base-commit: aaf44a3a699309c77537d0abf49411f9dc7dc523

Signature · 1 line
2.41.0.694.ge786442a9b-goog