KVM Analysis Report
Virtualization Technical Working Group
2008-12-31
KVM Introduction
KVM is Israel's open-source organization the Qumranet development of an open source virtual machine monitor, began to be included in
the Linux kernel from the Linux-2.6.20. KVM is an x86 hardware-based virtualization technology, and its operational requires Intel VT-x
or AMD SVM support.
I t' s generally believed that the virtual machine monitor implementation of the model into two categories: monitoring model (the
hypervisor) and the host model (Host-based). Monitoring model, processor scheduling, but also need to implement the various drivers,
run on the virtual machine to support the generally larger than the host model, so difficult to realize. The host model (Host-based)
implementation of the KVM, KVM is integrated in the Linux kernel, it can be naturally provided by the Linux kernel memory
management, multi-processor support, easy to implement, but can also be with the the development of the Linux kernel development. All
I / O virtualization in KVM, with the Qemu, but also significantly reduced to achieve the workload. Above can be said that the advantages
of KVM.
The organization of this report
Of this report Chapter 2 describes the processor virtualization and KVM implementation, Chapter 3 describes the memory virtualization
and KVM implementation, and Chapter 4 describes the I / O virtualization and KVM implementations.
Explain
This report only analysis KVM associated with Intel VT-x does not consider in KVM and AMD SVM, therefore consistent about the use
of terms, with Intel VT-x.
Processor virtualization
VT-x technology
We know that the processor normally present application programming interface and system programming interface. For x86 processors,
application programming interface exposed only to the application of the general-purpose registers RFLAGS, RIP, and a set of
non-privileged instruction, the system programming interface to the operating system exposes all of the ISA (Instruction Set Architecture).
Traditional process / thread model is a virtualization of the processor, but only on the application programming interface processor
virtualization, the so-called virtualization, system virtualization, running to the virtualization of the processor system programming
interface . From this perspective, compared to system virtualization and process / thread model is not essentially different.
Processor virtualization nature of time-sharing. Virtualization requires two necessary conditions, is able to read and restore the processor
state, the second is a mechanism to prevent the virtual machine to modify the global state of the system.
The first necessary condition is not necessarily the hardware implementation, hardware implementation than software implementation
easier. For example, the x86 processors to multi-task, is the virtualization of application programming interfaces, provides hardware
support, software usually only need to execute an instruction, task switching can be achieved, the processor hardware is responsible to
save the current state of the application programming interface, and objectives and tasks to restore the status of the application
programming interface. But the operating system does not necessarily have to use the processor to provide this virtualization mechanism,
we can use the software to complete the application interface state switch. For example, Linux does not use x86 processors provided at
multi-tasking mechanism, entirely dependent on the software implementation of a task switch.
The second necessary condition must be achieved by the hardware, usually the processor to a multi-mode operation (multi-mode
operation) to ensure this. In traditional x86 processors, there are four kinds of modes of operation is often said 4 privilege level. Virtual
machine (in this case refers to the process / thread) usually run in privilege level 3, while the virtual machine monitor (in this case the
operating system) running at privilege level 0, all access to the overall operation of the process / thread, such as access to shared
operations system address space, access I / O, etc., will lead to the occurrence of abnormal intercepted by the operating system and