Features/KVMNestedVirtualizationTestsuite: Difference between revisions

From QEMU
mNo edit summary
No edit summary
 
(5 intermediate revisions by one other user not shown)
Line 37: Line 37:


On the basis of mini hypervisor, some nested virtualization features should be tested including VMX insructions, MSR, memory access and VM-enter & VM-exit tests. Some of test cases are have implemented in the current kvm-unit-tests and can be imported in some special ways.
On the basis of mini hypervisor, some nested virtualization features should be tested including VMX insructions, MSR, memory access and VM-enter & VM-exit tests. Some of test cases are have implemented in the current kvm-unit-tests and can be imported in some special ways.
Currently, the following aspects are tested in test suite:
* PAT & EFER features in vmenter/vmexit
* CR0/4 shadowing
* I/O bitmaps
* Instruction interceptions (HLT/INVLPG/MWAIT/RDPMC/RDTSC/MONITOR/PAUSE/WBINVD/CPUID/INVD etc.)
* Preemption timer


= Project status =
= Project status =


The project is currently in development.
The project is currently in development.
Mini hypervisor is almost finished, and the relevant VMX instructions test cases are involved. Patches are in RFC status.
Mini hypervisor is finished, and the relevant VMX instructions test cases are involved. Some of the test suites are finished and others are pending.


= Key patches =
= Key patches =
Line 48: Line 55:
** [PATCH v3 2/2] kvm-unit-tests : The first version of VMX nested test case [http://www.mail-archive.com/kvm@vger.kernel.org/msg93454.html]
** [PATCH v3 2/2] kvm-unit-tests : The first version of VMX nested test case [http://www.mail-archive.com/kvm@vger.kernel.org/msg93454.html]
* [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case [http://www.mail-archive.com/kvm@vger.kernel.org/msg93865.html]
* [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case [http://www.mail-archive.com/kvm@vger.kernel.org/msg93865.html]
* [PATCH] kvm-unit-tests: VMX: Split VMX test suites to separate file [http://www.mail-archive.com/kvm@vger.kernel.org/msg94003.html]


= Patches accepted =
= Patches accepted =
Line 59: Line 67:
* [PATCH v5] KVM: nVMX: Set segment infomation of L1 when L2 exits [http://www.mail-archive.com/kvm@vger.kernel.org/msg93348.html]
* [PATCH v5] KVM: nVMX: Set segment infomation of L1 when L2 exits [http://www.mail-archive.com/kvm@vger.kernel.org/msg93348.html]
* [Qemu-devel] [PATCH] nVMX: Initialize IA32_FEATURE_CONTROL MSR in reset and migration [http://www.mail-archive.com/kvm@vger.kernel.org/msg93022.html]
* [Qemu-devel] [PATCH] nVMX: Initialize IA32_FEATURE_CONTROL MSR in reset and migration [http://www.mail-archive.com/kvm@vger.kernel.org/msg93022.html]
* [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case [http://www.mail-archive.com/kvm@vger.kernel.org/msg93865.html]
** Two related patches abandoned.
** [PATCH v3 0/2] Basic nested VMX test suite [http://www.mail-archive.com/kvm@vger.kernel.org/msg93452.html]
*** [PATCH v3 1/2] kvm-unit-tests : Add setjmp/longjmp to libcflat [http://www.mail-archive.com/kvm@vger.kernel.org/msg93453.html]
*** [PATCH v3 2/2] kvm-unit-tests : The first version of VMX nested test case [http://www.mail-archive.com/kvm@vger.kernel.org/msg93454.html]
* [PATCH] kvm-unit-tests: VMX: Fix confused definition of rflags [http://www.mail-archive.com/kvm@vger.kernel.org/msg93970.html]
* [PATCH] kvm-unit-tests: VMX: Split VMX test suites to separate file [http://www.mail-archive.com/kvm@vger.kernel.org/msg94003.html]


= Patches on the way =
= Patches on the way =
* [PATCH v3 0/2] Basic nested VMX test suite [http://www.mail-archive.com/kvm@vger.kernel.org/msg93452.html]
* [PATCH v2 0/4] kvm-unit-tests: Add a series of test cases [http://www.mail-archive.com/kvm@vger.kernel.org/msg94695.html]
** [PATCH v3 1/2] kvm-unit-tests : Add setjmp/longjmp to libcflat [http://www.mail-archive.com/kvm@vger.kernel.org/msg93453.html]
** [PATCH v2 1/4] kvm-unit-tests: VMX: Add test cases for PAT and EFER [http://www.mail-archive.com/kvm@vger.kernel.org/msg94692.html]
** [PATCH v3 2/2] kvm-unit-tests : The first version of VMX nested test case [http://www.mail-archive.com/kvm@vger.kernel.org/msg93454.html]
** [PATCH v2 2/4] kvm-unit-tests: VMX: Add test cases for CR0/4 shadowing [http://www.mail-archive.com/kvm@vger.kernel.org/msg94693.html]
* [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case [http://www.mail-archive.com/kvm@vger.kernel.org/msg93865.html]
** [PATCH v2 3/4] kvm-unit-tests: VMX: Add test cases for I/O bitmaps [http://www.mail-archive.com/kvm@vger.kernel.org/msg94691.html]
** [PATCH v2 4/4] kvm-unit-tests: VMX: Add test cases for instruction interception [http://www.mail-archive.com/kvm@vger.kernel.org/msg94694.html]
* [PATCH v2] KVM: nVMX: Fully support of nested VMX preemption timer [http://www.mail-archive.com/kvm@vger.kernel.org/msg94943.html]
 
[[Category:Completed feature pages]]

Latest revision as of 15:40, 11 October 2016

Notice

This a GSoC 2013 project accepted by QEMU.org, you can also see my proposal.

Summary

Provide a test suite of nested virtualization for KVM in kvm-unit-tests. It provides a test platform for nested virtualization, including a hypervisor and the link script to integrate current test suites.

Owner

Locations

Feature

This module of kvm-unit-tests aims at providing a suite of test cases for nested virtualization. It consists of two parts:

  • A mini hypervisor
  • Some relevant test cases specified for nested virtualization in KVM

Some codes of current kvm-unit-tests can be reused in the two parts above, e.g. link script to generate flat image. Some specific features will be listed here.

Mini hypervisor

A mini hypervisor is the basis of testing nested virtualization. Here is a mini hypervisor written in C++ named NOVA. But the mini hypervisor neeeded in this project doesn't need so many complicated features (e.g. Buddy system). Only CPU management, memory management, interrupt control and simple communication (hypercall) are necessary.

Now the first patch of hypervisor is on the way with my own tests. Anyone is welcome to review the codes and comments on it. Just checkout the git repository cited above and execute "git checkout v1.0". The mainly part is located in x86/vmx.c and x86/vmx.h. When executing this test case in kvm (e.g. run via kvm-unit-tests/x86-run) you should add -cpu Nehalem,+vmx option (or other types of Intel CPU) to the command line to support nested virtualization environment.

If there are something wrong, please checkout the latest KVM kernel. If error also occurs, please "git checkout queue" and compile again. This may because some patches are accpeted but queued in KVM repo.

Nested virtualization test cases

On the basis of mini hypervisor, some nested virtualization features should be tested including VMX insructions, MSR, memory access and VM-enter & VM-exit tests. Some of test cases are have implemented in the current kvm-unit-tests and can be imported in some special ways.

Currently, the following aspects are tested in test suite:

  • PAT & EFER features in vmenter/vmexit
  • CR0/4 shadowing
  • I/O bitmaps
  • Instruction interceptions (HLT/INVLPG/MWAIT/RDPMC/RDTSC/MONITOR/PAUSE/WBINVD/CPUID/INVD etc.)
  • Preemption timer

Project status

The project is currently in development. Mini hypervisor is finished, and the relevant VMX instructions test cases are involved. Some of the test suites are finished and others are pending.

Key patches

  • [PATCH v3 0/2] Basic nested VMX test suite [1]
    • [PATCH v3 1/2] kvm-unit-tests : Add setjmp/longjmp to libcflat [2]
    • [PATCH v3 2/2] kvm-unit-tests : The first version of VMX nested test case [3]
  • [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case [4]
  • [PATCH] kvm-unit-tests: VMX: Split VMX test suites to separate file [5]

Patches accepted

  • [PATCH] kvm-unit-tests: Test case of emulating multibyte NOP [6]
  • [PATCH v4 1/3] kvm-unit-tests: Add memcpy to lib/string.c [7]
    • [PATCH v4 2/3] kvm-unit-tests: Add a func to run instruction in emulator [8]
    • [PATCH v4 3/3] kvm-unit-tests: Change two cases to use trap_emulator [9]
  • [PATCH v2 1/2] KVM : Change location of 3 functions in vmx.c [10]
    • [PATCH v2 2/2] KVM : Set success rflags when emulate VMXON/VMXOFF in nested virt [11]
  • [PATCH v4] KVM : Fix read/write to IA32_FEATURE_CONTROL MSR in nested virt [12]
  • [PATCH v5] KVM: nVMX: Set segment infomation of L1 when L2 exits [13]
  • [Qemu-devel] [PATCH] nVMX: Initialize IA32_FEATURE_CONTROL MSR in reset and migration [14]
  • [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case [15]
    • Two related patches abandoned.
    • [PATCH v3 0/2] Basic nested VMX test suite [16]
      • [PATCH v3 1/2] kvm-unit-tests : Add setjmp/longjmp to libcflat [17]
      • [PATCH v3 2/2] kvm-unit-tests : The first version of VMX nested test case [18]
  • [PATCH] kvm-unit-tests: VMX: Fix confused definition of rflags [19]
  • [PATCH] kvm-unit-tests: VMX: Split VMX test suites to separate file [20]

Patches on the way

  • [PATCH v2 0/4] kvm-unit-tests: Add a series of test cases [21]
    • [PATCH v2 1/4] kvm-unit-tests: VMX: Add test cases for PAT and EFER [22]
    • [PATCH v2 2/4] kvm-unit-tests: VMX: Add test cases for CR0/4 shadowing [23]
    • [PATCH v2 3/4] kvm-unit-tests: VMX: Add test cases for I/O bitmaps [24]
    • [PATCH v2 4/4] kvm-unit-tests: VMX: Add test cases for instruction interception [25]
  • [PATCH v2] KVM: nVMX: Fully support of nested VMX preemption timer [26]