All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/11] KVM: nVMX: shadow VMCS support, v1
@ 2013-03-10 16:03 Abel Gordon
  2013-03-10 16:03 ` [PATCH 01/11] KVM: nVMX: Stats counters for nVMX Abel Gordon
                   ` (11 more replies)
  0 siblings, 12 replies; 46+ messages in thread
From: Abel Gordon @ 2013-03-10 16:03 UTC (permalink / raw)
  To: kvm; +Cc: owasserm, nadav, jun.nakajima, dongxiao.xu, abelg

This series of patches implements shadow-vmcs capability for nested VMX.

Shadow-vmcs - background and overview:

 In Intel VMX, vmread and vmwrite privileged instructions are used by the
 hypervisor to read and modify the guest and host specifications (VMCS). In a
 nested virtualization environment, L1 executes multiple vmread and vmwrite
 instruction to handle a single L2 exit. Each vmread and vmwrite executed by L1
 traps (cause an exit) to the L0 hypervisor (KVM). L0 emulates the instruction
 behaviour and resumes L1 execution.

 Removing the need to trap and emulate these special instructions reduces the
 number of exits and improves nested virtualization performance. As it was first
 evaluated in [1], exit-less vmread and vmwrite can reduce nested virtualization
 overhead up-to 40%.
 
 Intel introduced a new feature to their processors called shadow-vmcs.  Using
 shadow-vmcs, L0 can configure the processor to let L1 running in guest-mode
 access VMCS12 fields using vmread and vmwrite instructions but without causing
 an exit to L0. The VMCS12 fields' data is stored in a shadow-vmcs controlled
 by L0.

Shadow-vmcs - design considerations: 

 A shadow-vmcs is processor-dependent and must be accessed by L0 or L1 using
 vmread and vmwrite instructions. With nested virtualization we aim to abstract
 the hardware from the L1 hypervisor. Thus, to avoid hardware dependencies we
 prefered to keep the software defined VMCS12 format as part of L1 address space
 and hold the processor-specific shadow-vmcs format only in L0 address space.
 In other words, the shadow-vmcs is used by L0 as an accelerator but the format
 and content is never exposed to L1 directly. L0 syncs the content of the
 processor-specific shadow vmcs with the content of the software-controlled
 VMCS12 format.

 We could have been kept the processor-specific shadow-vmcs format in L1 address
 space to avoid using the software defined VMCS12 format, however, this type of
 design/implementation would have been created hardware dependencies and
 would complicate other capabilities (e.g. Live Migration of L1).
 
Acknowledgments:

 Many thanks to
 "Xu, Dongxiao" <dongxiao.xu@intel.com>
 "Nakajima, Jun" <jun.nakajima@intel.com>
 "Har'El, Nadav" <nadav@harel.org.il> 
  
 for the insightful discussions, comments and reviews.


 These patches were easily created and maintained using
     Patchouli -- patch creator
     http://patchouli.sourceforge.net/


[1] "The Turtles Project: Design and Implementation of Nested Virtualization",
    http://www.usenix.org/events/osdi10/tech/full_papers/Ben-Yehuda.pdf


^ permalink raw reply	[flat|nested] 46+ messages in thread
* [PATCH 0/11] KVM: nVMX: shadow VMCS support, v4
@ 2013-04-18  8:34 Abel Gordon
  2013-04-18  8:39 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs Abel Gordon
  0 siblings, 1 reply; 46+ messages in thread
From: Abel Gordon @ 2013-04-18  8:34 UTC (permalink / raw)
  To: kvm; +Cc: owasserm, nadav, jun.nakajima, dongxiao.xu, abelg

This series of patches implements shadow-vmcs capability for nested VMX.

Shadow-vmcs - background and overview:

 In Intel VMX, vmread and vmwrite privileged instructions are used by the
 hypervisor to read and modify the guest and host specifications (VMCS). In a
 nested virtualization environment, L1 executes multiple vmread and vmwrite
 instruction to handle a single L2 exit. Each vmread and vmwrite executed by L1
 traps (cause an exit) to the L0 hypervisor (KVM). L0 emulates the instruction
 behaviour and resumes L1 execution.

 Removing the need to trap and emulate these special instructions reduces the
 number of exits and improves nested virtualization performance. As it was first
 evaluated in [1], exit-less vmread and vmwrite can reduce nested virtualization
 overhead up-to 40%.
 
 Intel introduced a new feature to their processors called shadow-vmcs.  Using
 shadow-vmcs, L0 can configure the processor to let L1 running in guest-mode
 access VMCS12 fields using vmread and vmwrite instructions but without causing
 an exit to L0. The VMCS12 fields' data is stored in a shadow-vmcs controlled
 by L0.

Shadow-vmcs - design considerations: 

 A shadow-vmcs is processor-dependent and must be accessed by L0 or L1 using
 vmread and vmwrite instructions. With nested virtualization we aim to abstract
 the hardware from the L1 hypervisor. Thus, to avoid hardware dependencies we
 prefered to keep the software defined VMCS12 format as part of L1 address space
 and hold the processor-specific shadow-vmcs format only in L0 address space.
 In other words, the shadow-vmcs is used by L0 as an accelerator but the format
 and content is never exposed to L1 directly. L0 syncs the content of the
 processor-specific shadow vmcs with the content of the software-controlled
 VMCS12 format.

 We could have been kept the processor-specific shadow-vmcs format in L1 address
 space to avoid using the software defined VMCS12 format, however, this type of
 design/implementation would have been created hardware dependencies and
 would complicate other capabilities (e.g. Live Migration of L1).

Changes since v1:
 1) Added sync_shadow_vmcs flag used to indicate when the content of VMCS12
    must be copied to the shadow vmcs. The flag value is checked during 
    vmx_vcpu_run.
 2) Code quality improvements

Changes since v2:
 1) Allocate shadow vmcs only once per VCPU on handle_vmxon and re-use the 
    same instance for multiple VMCS12s
 2) More code quality improvements

Changes since v3:
 1) Fixed VMXON emulation (new patch). 
    Previous nVMX code didn't verify if L1 is already in root mode (VMXON
    was previously called). Now we call nested_vmx_failValid if VMX is 
    already ON. This is requird to avoid host leaks (due to shadow vmcs 
    allocation) if L1 repetedly executes VMXON.
 2) Improved comment: clarified we do not shadow fields that are modified
    when L1 executes vmx instructions like the VM_INSTRUCTION_ERROR field.
 
Acknowledgments:

 Many thanks to
 "Natapov, Gleb" <gleb@redhat.com> 
 "Xu, Dongxiao" <dongxiao.xu@intel.com>
 "Nakajima, Jun" <jun.nakajima@intel.com>
 "Har'El, Nadav" <nadav@harel.org.il> 
  
 for the insightful discussions, comments and reviews.


 These patches were easily created and maintained using
     Patchouli -- patch creator
     http://patchouli.sourceforge.net/


[1] "The Turtles Project: Design and Implementation of Nested Virtualization",
    http://www.usenix.org/events/osdi10/tech/full_papers/Ben-Yehuda.pdf


^ permalink raw reply	[flat|nested] 46+ messages in thread
* [PATCH 0/11] KVM: nVMX: shadow VMCS support, v5
@ 2013-04-18 11:34 Abel Gordon
  2013-04-18 11:39 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs Abel Gordon
  0 siblings, 1 reply; 46+ messages in thread
From: Abel Gordon @ 2013-04-18 11:34 UTC (permalink / raw)
  To: kvm; +Cc: owasserm, nadav, jun.nakajima, dongxiao.xu, abelg

This series of patches implements shadow-vmcs capability for nested VMX.

Shadow-vmcs - background and overview:

 In Intel VMX, vmread and vmwrite privileged instructions are used by the
 hypervisor to read and modify the guest and host specifications (VMCS). In a
 nested virtualization environment, L1 executes multiple vmread and vmwrite
 instruction to handle a single L2 exit. Each vmread and vmwrite executed by L1
 traps (cause an exit) to the L0 hypervisor (KVM). L0 emulates the instruction
 behaviour and resumes L1 execution.

 Removing the need to trap and emulate these special instructions reduces the
 number of exits and improves nested virtualization performance. As it was first
 evaluated in [1], exit-less vmread and vmwrite can reduce nested virtualization
 overhead up-to 40%.
 
 Intel introduced a new feature to their processors called shadow-vmcs.  Using
 shadow-vmcs, L0 can configure the processor to let L1 running in guest-mode
 access VMCS12 fields using vmread and vmwrite instructions but without causing
 an exit to L0. The VMCS12 fields' data is stored in a shadow-vmcs controlled
 by L0.

Shadow-vmcs - design considerations: 

 A shadow-vmcs is processor-dependent and must be accessed by L0 or L1 using
 vmread and vmwrite instructions. With nested virtualization we aim to abstract
 the hardware from the L1 hypervisor. Thus, to avoid hardware dependencies we
 prefered to keep the software defined VMCS12 format as part of L1 address space
 and hold the processor-specific shadow-vmcs format only in L0 address space.
 In other words, the shadow-vmcs is used by L0 as an accelerator but the format
 and content is never exposed to L1 directly. L0 syncs the content of the
 processor-specific shadow vmcs with the content of the software-controlled
 VMCS12 format.

 We could have been kept the processor-specific shadow-vmcs format in L1 address
 space to avoid using the software defined VMCS12 format, however, this type of
 design/implementation would have been created hardware dependencies and
 would complicate other capabilities (e.g. Live Migration of L1).

Changes since v1:
 1) Added sync_shadow_vmcs flag used to indicate when the content of VMCS12
    must be copied to the shadow vmcs. The flag value is checked during 
    vmx_vcpu_run.
 2) Code quality improvements

Changes since v2:
 1) Allocate shadow vmcs only once per VCPU on handle_vmxon and re-use the 
    same instance for multiple VMCS12s
 2) More code quality improvements

Changes since v3:
 1) Fixed VMXON emulation (new patch). 
    Previous nVMX code didn't verify if L1 is already in root mode (VMXON
    was previously called). Now we call nested_vmx_failValid if VMX is 
    already ON. This is requird to avoid host leaks (due to shadow vmcs 
    allocation) if L1 repetedly executes VMXON.
 2) Improved comment: clarified we do not shadow fields that are modified
    when L1 executes vmx instructions like the VM_INSTRUCTION_ERROR field.

Changes since v4:
 1) Fixed free_nested: we now free the shadow vmcs also 
    when there is no current vmcs.
 
Acknowledgments:

 Many thanks to
 "Natapov, Gleb" <gleb@redhat.com> 
 "Xu, Dongxiao" <dongxiao.xu@intel.com>
 "Nakajima, Jun" <jun.nakajima@intel.com>
 "Har'El, Nadav" <nadav@harel.org.il> 
  
 for the insightful discussions, comments and reviews.


 These patches were easily created and maintained using
     Patchouli -- patch creator
     http://patchouli.sourceforge.net/


[1] "The Turtles Project: Design and Implementation of Nested Virtualization",
    http://www.usenix.org/events/osdi10/tech/full_papers/Ben-Yehuda.pdf


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

end of thread, other threads:[~2013-04-18 11:39 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-10 16:03 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v1 Abel Gordon
2013-03-10 16:03 ` [PATCH 01/11] KVM: nVMX: Stats counters for nVMX Abel Gordon
2013-04-08 10:27   ` Gleb Natapov
2013-04-10 19:08     ` Abel Gordon
2013-04-11  6:10       ` Gleb Natapov
2013-03-10 16:04 ` [PATCH 02/11] KVM: nVMX: Shadow-vmcs control fields/bits Abel Gordon
2013-03-10 16:04 ` [PATCH 03/11] KVM: nVMX: Detect shadow-vmcs capability Abel Gordon
2013-04-08 11:12   ` Gleb Natapov
2013-04-10 19:14     ` Abel Gordon
2013-03-10 16:05 ` [PATCH 04/11] KVM: nVMX: Introduce vmread and vmwrite bitmaps Abel Gordon
2013-04-08 11:50   ` Gleb Natapov
2013-04-10 19:14     ` Abel Gordon
2013-03-10 16:05 ` [PATCH 05/11] KVM: nVMX: Refactor handle_vmwrite Abel Gordon
2013-04-09 11:05   ` Gleb Natapov
2013-04-10 20:35     ` Abel Gordon
2013-03-10 16:06 ` [PATCH 06/11] KVM: nVMX: Allocate shadow vmcs Abel Gordon
2013-03-10 16:06 ` [PATCH 07/11] KVM: nVMX: Release " Abel Gordon
2013-03-10 16:07 ` [PATCH 08/11] KVM: nVMX: Copy processor-specific shadow-vmcs to VMCS12 Abel Gordon
2013-03-10 16:07 ` [PATCH 09/11] KVM: nVMX: Copy VMCS12 to processor-specific shadow vmcs Abel Gordon
2013-04-09 12:47   ` Gleb Natapov
2013-04-10 19:15     ` Abel Gordon
2013-03-10 16:08 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the " Abel Gordon
2013-03-10 22:43   ` Nadav Har'El
2013-03-11  7:54     ` Abel Gordon
2013-04-09 13:14       ` Gleb Natapov
2013-04-10 19:15         ` Abel Gordon
2013-04-11  6:54           ` Gleb Natapov
2013-04-12 10:26             ` Abel Gordon
2013-04-12 10:31               ` Gleb Natapov
2013-04-12 10:44                 ` Abel Gordon
2013-04-12 10:48                   ` Gleb Natapov
2013-04-14  9:51                     ` Abel Gordon
2013-04-14 10:00                       ` Gleb Natapov
2013-04-14 10:07                         ` Gleb Natapov
2013-04-14 10:27                           ` Jan Kiszka
2013-04-14 10:34                             ` Abel Gordon
2013-04-14 10:34                             ` Gleb Natapov
2013-04-14 10:49                               ` Abel Gordon
2013-04-14 11:16                                 ` Gleb Natapov
2013-04-14 13:47                                   ` Abel Gordon
2013-04-14 14:41                                     ` Gleb Natapov
2013-03-10 16:08 ` [PATCH 11/11] KVM: nVMX: Enable and disable shadow vmcs functionality Abel Gordon
2013-03-21 12:22 ` [PATCH 0/11] KVM: nVMX: shadow VMCS support, v1 Orit Wasserman
2013-03-21 13:56   ` Abel Gordon
2013-04-18  8:34 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v4 Abel Gordon
2013-04-18  8:39 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs Abel Gordon
2013-04-18 11:34 [PATCH 0/11] KVM: nVMX: shadow VMCS support, v5 Abel Gordon
2013-04-18 11:39 ` [PATCH 10/11] KVM: nVMX: Synchronize VMCS12 content with the shadow vmcs Abel Gordon

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.