Features/KVMNestedVirtualizationTestsuite

From QEMU
Revision as of 09:55, 16 July 2013 by Xelatex (talk | contribs)

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 above [1] 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.

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 now in development.

Patches accepted

  • [PATCH v2 1/2] KVM : Change location of 3 functions in vmx.c [2]
    • Previous version : v1
  • [PATCH v2 2/2] KVM : Set success rflags when emulate VMXON/VMXOFF in nested virt [3]
    • Previous version : v1
  • [PATCH v4] KVM : Fix read/write to IA32_FEATURE_CONTROL MSR in nested virt [4]

Patches on the way

  • [Qemu-devel] [PATCH] nVMX: Initialize IA32_FEATURE_CONTROL MSR in reset and migration [5]
    • Previous version : v1 v2
  • [PATCH] KVM: nVMX: Set segment infomation of L1 when L2 exits [6]
  • [PATCH] kvm-unit-tests : The first version of VMX nested test case [7]

Other accepted patches

  • [PATCH] kvm-unit-tests: Test case of emulating multibyte NOP [8]
  • [PATCH v4 1/3] kvm-unit-tests: Add memcpy to lib/string.c [9]
  • [PATCH v4 2/3] kvm-unit-tests: Add a func to run instruction in emulator [10]
  • [PATCH v4 3/3] kvm-unit-tests: Change two cases to use trap_emulator [11]