Features/KVMNestedVirtualizationTestsuite
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
- Name: Arthur Chunqi Li
- Email: yzt356@gmail.com
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.
Project status
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.
Key patches
- [PATCH v3 0/2] Basic nested VMX test suite [1]
- [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case [4]
Patches accepted
- [PATCH] kvm-unit-tests: Test case of emulating multibyte NOP [5]
- [PATCH v4 1/3] kvm-unit-tests: Add memcpy to lib/string.c [6]
- [PATCH v2 1/2] KVM : Change location of 3 functions in vmx.c [9]
- [PATCH v2 2/2] KVM : Set success rflags when emulate VMXON/VMXOFF in nested virt [10]
- [PATCH v4] KVM : Fix read/write to IA32_FEATURE_CONTROL MSR in nested virt [11]
- [PATCH v5] KVM: nVMX: Set segment infomation of L1 when L2 exits [12]
- [Qemu-devel] [PATCH] nVMX: Initialize IA32_FEATURE_CONTROL MSR in reset and migration [13]
- [PATCH v3] kvm-unit-tests : Basic architecture of VMX nested test case [14]