All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13]  KVM: VMX: Reduce VMWRITEs to VMCS controls
@ 2019-05-07 19:17 Sean Christopherson
  2019-05-07 19:17 ` [PATCH 01/13] KVM: nVMX: Use adjusted pin controls for vmcs02 Sean Christopherson
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Sean Christopherson @ 2019-05-07 19:17 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář; +Cc: kvm

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(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-06-06 19:05 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-07 19:17 [PATCH 00/13] KVM: VMX: Reduce VMWRITEs to VMCS controls Sean Christopherson
2019-05-07 19:17 ` [PATCH 01/13] KVM: nVMX: Use adjusted pin controls for vmcs02 Sean Christopherson
2019-06-06 16:55   ` Paolo Bonzini
2019-05-07 19:17 ` [PATCH 02/13] KVM: VMX: Add builder macros for shadowing controls Sean Christopherson
2019-05-07 19:17 ` [PATCH 03/13] KVM: VMX: Shadow VMCS pin controls Sean Christopherson
2019-05-07 19:17 ` [PATCH 04/13] KVM: VMX: Shadow VMCS primary execution controls Sean Christopherson
2019-05-07 19:17 ` [PATCH 05/13] KVM: VMX: Shadow VMCS secondary " Sean Christopherson
2019-06-06 16:59   ` Paolo Bonzini
2019-05-07 19:17 ` [PATCH 06/13] KVM: nVMX: Shadow VMCS controls on a per-VMCS basis Sean Christopherson
2019-05-07 19:17 ` [PATCH 07/13] KVM: nVMX: Don't reset VMCS controls shadow on VMCS switch Sean Christopherson
2019-05-07 19:18 ` [PATCH 08/13] KVM: VMX: Explicitly initialize controls shadow at VMCS allocation Sean Christopherson
2019-05-07 19:18 ` [PATCH 09/13] KVM: nVMX: Preserve last USE_MSR_BITMAPS when preparing vmcs02 Sean Christopherson
2019-06-06 17:12   ` Paolo Bonzini
2019-05-07 19:18 ` [PATCH 10/13] KVM: nVMX: Preset *DT exiting in vmcs02 when emulating UMIP Sean Christopherson
2019-06-06 17:15   ` Paolo Bonzini
2019-05-07 19:18 ` [PATCH 11/13] KVM: VMX: Drop hv_timer_armed from 'struct loaded_vmcs' Sean Christopherson
2019-05-07 19:18 ` [PATCH 12/13] KVM: nVMX: Don't mark vmcs12 as dirty when L1 writes pin controls Sean Christopherson
2019-06-06 17:16   ` Paolo Bonzini
2019-06-06 17:24   ` Paolo Bonzini
2019-06-06 19:05     ` Sean Christopherson
2019-05-07 19:18 ` [PATCH 13/13] KVM: VMX: Leave preemption timer running when it's disabled Sean Christopherson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.