
Introduc)on to KVM Shang Juh Kao Dept. of Computer Science and Engineering Naonal Chung Hsing University 12/10/11 CSE, NCHU 1 Kernel-based Virtual Machine(KVM) u KVM Support u QEMU u KVM/QUEM Execution Flow u KVM Components 12/10/11 CSE, NCHU 2 KVM Support - 1 u KVM is open source soDware, introduced in October, 2006, is formally supported by Red Hat and Fujitsu (since version 6 of Red Hat Enterprise Linux (RHEL6)). u The kernel component of KVM is included in mainline Linux, as of 2.6.20. u KVM is a full virtualizaon solu)on for Linux on x86 hardware containing Intel Virtualizaon Technology (Intel-VT) and AMD- Virtualizaon (AMD-V). uKVM requires a modified QEMU for hardware emulaon. 12/10/11 CSE, NCHU 3 KVM Support - 2 u KVM consists of a loadable kernel module, kvm.ko, and provides the core virtualizaon infrastructure, and a processor specific module, kvm-intel.ko or kvm-amd.ko. u Using KVM, mul)ple VMs running unmodified Linux or Windows images can be provided. Each VM has private virtualized hardware: NIC, disk, graphics adapter, etc. uKVM can be treated as a loadable Linux kernel module, which handles VM Entry and Exit. 12/10/11 CSE, NCHU 4 Intel VT-x for KVM u By implemen)ng KVM as a func)on in the Linux kernel, so KVM could make use of the Intel VT-x func)ons. u Intel VT-x adds two program execu)on modes: VMX root operaon mode and VMX non-root operaon mode. uVMX non-root operaon mode is the execu)on mode for guest systems. uWhen in VMX root operaon mode (Hypervisor user mode), Intel VT-x executes VMLAUNCH and VMRESUME for VM entry. 12/10/11 CSE, NCHU 5 KVM and QEMU ExecuAon Flow The QUEM/KVM execu)on flow can be described as follows. 0. /dev/kvm is created by the KVM kernel module. 1. QEMU starts up a guest system by making ioctl() system call to instruct KVM kernel module to start. 2. The kernel module performs a VM Entry and begin execu)ng the guest system. 3. When the guest system executes a sensi)ve instruc)on, a VM Exit is ini)ated. 4. If QEMU interven)on is needed for I/O, control is transferred to the QEMU process. 12/10/11 CSE, NCHU 6 KVM and QEMU ExecuAon Flow 12/10/11 CSE, NCHU 7 KVM and QEMU Simple Structure u Implementaon of KVM kernel module transforms the Linux kernel into a hypervisor. u There is one QEMU process for each gust system. u QEMU is a mul)-thread program, and one vCPU of a guest system corresponds to one QEMU thread. u QEMU threads are treated as user processes, and the scheduling is governed by the kernel scheduler. 12/10/11 CSE, NCHU 8 KVM Components 1. virt-manager/virsh for GUI/CUI user interfaces 2. libvirt - a tool-and interface library 3. QEMU – an emulator that interacts with the KVM kernel module and executes guest system processes. 4. KVM kernel module – is a linux kernel module 5. Linux kernel – hypervisor itself 12/10/11 CSE, NCHU 9 Whole Image of KVM 12/10/11 CSE, NCHU 10 KVM Performance Enhancements For performance consideraon, several HW/SW support func)ons are introduced: 1. Extended Page Table (EPT) – extends the address conversion mechanism within the two-part structure. 2. VT-d – provides a memory address conversion table for I/O devices. 3. viro – prepares a buffer to be accessed by both guest system and QEMU. 4. Kernel Samepage Merging (KSM) – monitors and consolidates process-memory usage to merge duplicate pages into a common page. 12/10/11 CSE, NCHU 11 KVM Management Tools Two basic KVM management tools: virsh and virt-manager u Virsh – streamline KVM management using command line. For examples: list, dominfo, shutdown, destroy, suspend, resume, save, and restore. u Virt-manager – graphic user interface for most administrave tasks. Ø The console tab grants access to the VM console and allows users to work directly on the VM. Ø The overview tab permits users to monitor the current VM operaonal status and resource usage. Ø The hardware tab controls the VM hardware sengs. 12/10/11 CSE, NCHU 12 References u Quick Start Guide for installing and running KVM – blueprints by IBM u Kernel-based Virtual Machine Technology – by Yasunori Goto, FUJITSU Sci. Tech., Vol. 47, No. 3, pp. 362-369, July, 2011. 12/10/11 CSE, NCHU 13 實際操作 u 建立 Virtual Machine u 了解各個指令 (尤其是 shell scripts所使用的指令 )的作用 12/10/11 CSE, NCHU 14 .
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages14 Page
-
File Size-