KVM: VMX: Reduce VMWRITEs to VMCS controls
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest13 patches 7 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/13 | KVM: nVMX: Use adjusted pin controls for vmcs02arch/ arch/ arch/ | +4 | 1 reply | |
| 2/13 | KVM: VMX: Add builder macros for shadowing controlsarch/ | +37 | 0 replies | |
| 3/13 | KVM: VMX: Shadow VMCS pin controlsarch/ arch/ arch/ | +8 | 0 replies | |
| 4/13 | KVM: VMX: Shadow VMCS primary execution controlsarch/ arch/ arch/ | +23 | 0 replies | |
| 5/13 | KVM: VMX: Shadow VMCS secondary execution controlsarch/ arch/ arch/ | +28 | 1 reply | |
| 6/13 | KVM: nVMX: Shadow VMCS controls on a per-VMCS basisarch/ arch/ | +16 | 0 replies | |
| 7/13 | KVM: nVMX: Don't reset VMCS controls shadow on VMCS switcharch/ arch/ | +0 | 0 replies | |
| 8/13 | KVM: VMX: Explicitly initialize controls shadow at VMCS allocationarch/ arch/ arch/ | +12 | 0 replies | |
| 9/13 | KVM: nVMX: Preserve last USE_MSR_BITMAPS when preparing vmcs02arch/ | +2 | 1 reply | |
| 10/13 | KVM: nVMX: Preset *DT exiting in vmcs02 when emulating UMIParch/ | +5 | 1 reply | |
| 11/13 | KVM: VMX: Drop hv_timer_armed from 'struct loaded_vmcs'arch/ arch/ arch/ | +2 | 0 replies | |
| 12/13 | KVM: nVMX: Don't mark vmcs12 as dirty when L1 writes pin controlsarch/ | +5 | 3 replies | |
| 13/13 | KVM: VMX: Leave preemption timer running when it's disabledarch/ arch/ arch/ | +41 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 00/13] KVM: VMX: Reduce VMWRITEs to VMCS controls
The overarching theme of this series is to reduce the number of VMWRITEs to VMCS controls. VMWRITEs to the major VMCS controls, i.e. vm_entry, vm_exit, pin, exec and sec_exec, are deceptively expensive. CPUs with VMCS caching (Westmere and later) also optimize away consistency checks on VM-Entry, i.e. skip consistency checks if the relevant fields haven't changed since the last successful VM-Entry (of the cached VMCS). Because uops are a precious commodity, uCode's dirty VMCS field tracking isn't as precise as software would prefer. Notably, writing any of the major VMCS fields effectively marks the entire VMCS dirty, i.e. causes the next VM-Entry to perform all consistency checks, which consumes several hundred cycles.
The majority of this series is technically vanilla VMX, but the end goal of nearly every patch is to eliminate VMWRITEs to controls when running nested guests, e.g. much of the series resolves around shadowing the various controls so that they don't need to be rewritten to vmcs02 on every nested VM-Entry.
The sole patch that is purely vanilla VMX is to avoid writing pin controls when disabling/enabling the preemption timer. This is the last known known case where semi-frequent writes to control fields can be avoided (in non-nested operation). E.g. detecting IRQ windows frequently toggles VIRTUAL_INTR_PENDING, but at this juncture that behavior is effectively unavoidable. Resolving the preemption timer case takes a somewhat adventurous approach of leaving the timer running even when it's not in use.
Sean Christopherson (13):
KVM: nVMX: Use adjusted pin controls for vmcs02
KVM: VMX: Add builder macros for shadowing controls
KVM: VMX: Shadow VMCS pin controls
KVM: VMX: Shadow VMCS primary execution controls
KVM: VMX: Shadow VMCS secondary execution controls
KVM: nVMX: Shadow VMCS controls on a per-VMCS basis
KVM: nVMX: Don't reset VMCS controls shadow on VMCS switch
KVM: VMX: Explicitly initialize controls shadow at VMCS allocation
KVM: nVMX: Preserve last USE_MSR_BITMAPS when preparing vmcs02
KVM: nVMX: Preset *DT exiting in vmcs02 when emulating UMIP
KVM: VMX: Drop hv_timer_armed from 'struct loaded_vmcs'
KVM: nVMX: Don't mark vmcs12 as dirty when L1 writes pin controls
KVM: VMX: Leave preemption timer running when it's disabled
arch/x86/kvm/vmx/nested.c | 54 ++++++------- arch/x86/kvm/vmx/vmcs.h | 11 ++- arch/x86/kvm/vmx/vmx.c | 156 +++++++++++++++++++------------------- arch/x86/kvm/vmx/vmx.h | 92 +++++++--------------- 4 files changed, 145 insertions(+), 168 deletions(-)
Signature · 1 line
2.21.0