Skip to content

Switch MSR_MISC_FEATURES_ENABLES and one optimization

Xiaoyao Li kvm lkml 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest2 patches 0 repliesNew
  2. v32 patches 3 repliesSuperseded
  3. v11 patch 8 repliesSuperseded

Changes in v4 from the cover letter

remove the helper function, and some code refine. per Sean Christopherson's comments.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kvm/vmx: Switch MSR_MISC_FEATURES_ENABLES between host and guestarch/x86/kernel/process.c arch/x86/kvm/vmx/vmx.c+9 -00 replies
2/2x86/vmx: optimize MSR_MISC_FEATURES_ENABLES switcharch/x86/include/asm/kvm_host.h arch/x86/kvm/vmx/vmx.c arch/x86/kvm/x86.c+22 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/2] Switch MSR_MISC_FEATURES_ENABLES and one optimization

Patch 1 switches MSR_MISC_FEATURES_ENABLE between host and guest during vcpu_{load,put} to avoid cpuid faulting and ring3mwait of host leaking to guest. Because cpuid faulting eanbled in host may potentially cause guest boot failure, and kvm doesn't expose ring3mwait to guest yet. Both two features shouldn't be leaked to guest.

Patch 2 optimizes the switch of MSR_MISC_FEATURES_ENABLES by avoiding WRMSR whenever possible to save cycles.

==changelog==
v3->v4:
remove the helper function, and some code refine. per Sean Christopherson's comments.

v2->v3:
- use msr_misc_features_shadow instead of reading hardware msr, from Sean Christopherson
- avoid WRMSR whenever possible, from Sean Christopherson.

v1->v2:
- move the save/restore of cpuid faulting bit to vmx_prepare_swich_to_guest/vmx_prepare_swich_to_host to avoid every vmentry RDMSR, based on Paolo's comment.

Xiaoyao Li (2):
kvm/vmx: Switch MSR_MISC_FEATURES_ENABLES between host and guest x86/vmx: optimize MSR_MISC_FEATURES_ENABLES switch

 arch/x86/include/asm/kvm_host.h |  2 ++
 arch/x86/kernel/process.c       |  1 +
 arch/x86/kvm/vmx/vmx.c          | 17 +++++++++++++++++
 arch/x86/kvm/x86.c              | 11 ++++++++---
 4 files changed, 28 insertions(+), 3 deletions(-)
Signature · 1 line
2.19.1