Skip to content

nVMX: Nested VMX, v7

Nadav Har'El kvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest28 patches 11 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/28nVMX: Add "nested" module option to vmx.carch/x86/kvm/vmx.c+8 -00 replies
2/28nVMX: Add VMX and SVM to list of supported cpuid featuresarch/x86/kvm/vmx.c+2 -02 replies
3/28nVMX: Implement VMXON and VMXOFFarch/x86/kvm/vmx.c+100 -20 replies
4/28nVMX: Allow setting the VMXE bit in CR4arch/x86/include/asm/kvm_host.h arch/x86/kvm/svm.c arch/x86/kvm/vmx.c +1 more+18 -70 replies
5/28nVMX: Introduce vmcs12: a VMCS structure for L1arch/x86/kvm/vmx.c+64 -00 replies
6/28nVMX: Implement reading and writing of VMX MSRsarch/x86/kvm/vmx.c arch/x86/kvm/x86.c+122 -11 reply
7/28nVMX: Decoding memory operands of VMX instructionsarch/x86/kvm/vmx.c arch/x86/kvm/x86.c arch/x86/kvm/x86.h+64 -11 reply
8/28nVMX: Hold a vmcs02 for each vmcs12arch/x86/kvm/vmx.c+96 -01 reply
9/28nVMX: Add VMCS fields to the vmcs12arch/x86/kvm/vmx.c+295 -02 replies
10/28nVMX: Success/failure of VMX instructions.arch/x86/include/asm/vmx.h arch/x86/kvm/vmx.c+61 -00 replies
11/28nVMX: Implement VMCLEARarch/x86/kvm/vmx.c+59 -10 replies
12/28nVMX: Implement VMPTRLDarch/x86/kvm/vmx.c+60 -10 replies
13/28nVMX: Implement VMPTRSTarch/x86/kvm/vmx.c arch/x86/kvm/x86.c arch/x86/kvm/x86.h+31 -20 replies
14/28nVMX: Implement VMREAD and VMWRITEarch/x86/kvm/vmx.c+169 -20 replies
15/28nVMX: Prepare vmcs02 from vmcs01 and vmcs12arch/x86/kvm/vmx.c+409 -00 replies
16/28nVMX: Move register-syncing to a functionarch/x86/kvm/vmx.c+10 -50 replies
17/28nVMX: Implement VMLAUNCH and VMRESUMEarch/x86/kvm/vmx.c+232 -30 replies
18/28nVMX: No need for handle_vmx_insn function any morearch/x86/kvm/vmx.c+0 -60 replies
19/28nVMX: Exiting from L2 to L1arch/x86/kvm/vmx.c+233 -01 reply
20/28nVMX: Deciding if L0 or L1 should handle an L2 exitarch/x86/kvm/vmx.c+217 -00 replies
21/28nVMX: Correct handling of interrupt injectionarch/x86/kvm/vmx.c+33 -00 replies
22/28nVMX: Correct handling of exception injectionarch/x86/kvm/vmx.c+26 -00 replies
23/28nVMX: Correct handling of idt vectoring infoarch/x86/kvm/vmx.c+32 -00 replies
24/28nVMX: Handling of CR0 and CR4 modifying instructionsarch/x86/kvm/vmx.c+51 -31 reply
25/28nVMX: Further fixes for lazy FPU loadingarch/x86/kvm/vmx.c+35 -31 reply
26/28nVMX: Additional TSC-offset handlingarch/x86/kvm/vmx.c+11 -00 replies
27/28nVMX: Miscellenous small correctionsarch/x86/kvm/vmx.c+1 -10 replies
28/28nVMX: DocumentationDocumentation/kvm/nested-vmx.txt+237 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [PATCH 0/28] nVMX: Nested VMX, v7

Hi,

This is the seventh iteration of the nested VMX patch set. It fixes a bunch of bugs in the previous iteration, and in particular it now works correctly with EPT in the L0 hypervisor, so "ept=0" no longer needs to be specified.

This new set of patches should apply to the current KVM trunk (I checked with 66fc6be8d2b04153b753182610f919faf9c705bc). In particular it uses the recently added is_guest_mode() function (common to both nested svm and vmx) instead of inventing our own flag.

About nested VMX:
-----------------

The following 28 patches implement nested VMX support. This feature enables a guest to use the VMX APIs in order to run its own nested guests. In other words, it allows running hypervisors (that use VMX) under KVM. Multiple guest hypervisors can be run concurrently, and each of those can in turn host multiple guests.

The theory behind this work, our implementation, and its performance characteristics were presented in OSDI 2010 (the USENIX Symposium on Operating Systems Design and Implementation). Our paper was titled "The Turtles Project: Design and Implementation of Nested Virtualization", and was awarded "Jay Lepreau Best Paper". The paper is available online, at:

http://www.usenix.org/events/osdi10/tech/full_papers/Ben-Yehuda.pdf

This patch set does not include all the features described in the paper. In particular, this patch set is missing nested EPT (shadow page tables are used in L1, while L0 can use shadow page tables or EPT). It is also missing some features required to run VMWare Server as a guest. These missing features will be sent as follow-on patchs.

Running nested VMX:
------------------

The current patches have a number of requirements, which will be relaxed in follow-on patches:

1. This version was only tested with KVM (64-bit) as a guest hypervisor, and Linux as a nested guest.

2. SMP is supported in the code, but is unfortunately buggy in this version and often leads to hangs. Use the "nosmp" option in the L0 (topmost) kernel to avoid this bug (and to reduce your performance ;-))..

3. No modifications are required to user space (qemu). However, qemu does not currently list "VMX" as a CPU feature in its emulated CPUs (even when they are named after CPUs that do normally have VMX). Therefore, the "-cpu host" option should be given to qemu, to tell it to support CPU features which exist in the host - and in particular VMX.
This requirement can be made unnecessary by a trivial patch to qemu (which I will submit in the future).

4. The nested VMX feature is currently disabled by default. It must be explicitly enabled with the "nested=1" option to the kvm-intel module.

5. Nested VPID is not properly supported in this version. You must give the "vpid=0" module options to kvm-intel to turn this feature off.

Patch statistics:
-----------------

 Documentation/kvm/nested-vmx.txt |  237 ++
 arch/x86/include/asm/kvm_host.h  |    2 
 arch/x86/include/asm/vmx.h       |   31 
 arch/x86/kvm/svm.c               |    6 
 arch/x86/kvm/vmx.c               | 2416 ++++++++++++++++++++++++++++-
 arch/x86/kvm/x86.c               |   16 
 arch/x86/kvm/x86.h               |    6 
 7 files changed, 2676 insertions(+), 38 deletions(-)

--
Nadav Har'El
IBM Haifa Research Lab