Linux--KVM Technology Introduction

Source: Internet
Author: User

    • Linux operating system and kernel

The operating system kernel design has been divided into two camps: Microkernel and single core.

A single core is a simpler design in two camps, meaning that the entire kernel is implemented as a single large process in its entirety and runs in a separate address space. All kernel services run in such a large kernel space that communication between the cores can simply be implemented as function calls. This design has the characteristics of simple and efficient. However, if you use a single-core design, each time you make changes to the kernel (such as adding or removing drivers), you must recompile the source code and generate a new binary file, causing problems with usage and deployment.

The microkernel is not implemented as a single big process, instead, the kernel functions are divided into separate processes, each of which is called a server. Multiple server programs run in their own address space, and only a small number of core servers run in privileged mode, and communication between servers uses interprocess communication mechanisms. Independent server processes improve the robustness of the system, but inter-process communication is much more expensive than a function call because of context switching involving kernel space and user space.

Linux employs a pragmatic design. To meet performance requirements, the Linux kernel is designed as a single core. However, the Linux kernel also draws on the essence of microkernel: Modular design and the ability to dynamically load kernel modules. In addition to core functions such as process switching and memory management, most kernel functions are designed and implemented as separate kernel modules. These kernel modules are compiled to exist as separate binaries, and the kernel is dynamically loaded and chained into the kernel space as needed during the run. Modules that are not used can also be dynamically unloaded during the run. This design ensures the performance of the kernel and improves the flexibility of the traditional single-core design.

The open source features and modular design of the Linux kernel make it a typical example for many developers and computer majors to study the operating system kernel. Developers can take full advantage of the Linux kernel has been implemented by the mature features, on the basis of the design, implementation of their own kernel modules, in order to expand the functionality of the kernel to meet their own requirements. KVM, for example, exists as a kernel module, adding virtualization functionality to the Linux kernel.


    • Basic model of X86 platform virtualization

650) this.width=650; "src=" Http://s7.51cto.com/wyfs01/M00/32/4C/wKioJlJ7QhLRCEXRAAA_ZJrDie8920.jpg "alt=" Wkiojlj7qhlrcexraaa_zjrdie8920.jpg "/>

when using the term "virtualization", if there is no special description, it refers to the virtualization of the X86 platform. Figure 2-1 shows you the basic virtualization model.

At the bottom is the entire physical system, which is what we normally see and touch the system hardware, mainly including processors, memory and input (this is believed to have the host DIY experience of the reader is very familiar with).

On top of the physical system, unlike the previously familiar operating system model, a Virtual machine monitor (abbreviated to VMM or hypervisor) is running. The main function of the virtual machine monitor is to manage the real physical hardware platform and provide the corresponding virtual hardware platform for each virtual client.

Figure 2-1 Draws an example of 3 virtual machines, each of which looks like a small but complete computer system with its own "system hardware", including its own processor, memory, and input. On this computer system, the virtual machine runs its own operating system, such as Linux and Windows.

The core of a X86 platform is the processor in which the processor runs the program code, accessing memory and input. Therefore, the core part of X86 platform virtualization Technology is the virtualization of the processor. As long as processor virtualization technology supports "intercept and redirect", both memory and input virtualization can be based on processor virtualization technology. On the basis of processor virtualization technology, in order to enhance the performance of virtual machine, the new technology of memory virtualization and IO virtualization has been added to the X86 platform virtualization technology. X86 platform Virtualization technology starts with a single processor that involves the virtualization of chipsets, network cards, storage devices, and GPUs. In section 2.6, we will take the Intel hardware platform as an example to elaborate on the evolution of hardware virtualization-related technologies for the X86 platform.

    • Technical architecture of KVM

From the basic architecture of the virtual machine to differentiate, virtual machines are generally divided into two kinds, we call type one and type two.

Where the "type one" virtual machine is loaded to run the hypervisor first after the system is power on, while the traditional operating system is running in the virtual machine it was created in.

Unlike the "type one" virtual machine, the "type two" hypervisor, after power on the system still runs the general operating system (known as the host operating system), the hypervisor as a special application, can be regarded as an extension of operating system functions.

KVM is a type two virtual machine based on the host operating system. Here, once again we see the practical first Linux design philosophy, since the type two virtual machine is the most concise and easy to implement virtual machine monitoring program, then through the form of kernel modules can be done. The rest of the section uses the existing implementations of the Linux kernel as much as possible to maximize the reuse of the code. in Figure 2-2, the left part is a standard Linux operating system, which can be Rhel, Fedora, Ubuntu, and so on. The KVM kernel module runs on demand and enters kernel space at run time.

650) this.width=650; "src=" Http://s1.51cto.com/wyfs01/M00/32/4D/wKioOVJ7QkCSSUh7AABBoEEBhU8819.jpg "alt=" Wkioovj7qkcssuh7aabboeebhu8819.jpg "/>

    • Components of KVM

KVM module is a core part of a KVM virtual machine. Its main function is to initialize the CPU hardware, turn on the virtualization mode, then run the virtual client in virtual machine mode and provide some support for the operation of the virtual client.

  1. KVM module detects the current CPU of the system, then turns on the virtualization mode switch in the CPU control register CR4 and places the host operating system (including the KVM module itself) in the root mode of the virtualization mode by executing the vmxon instruction;

  2. Next, the creation and operation of the virtual machine will be a process of interacting with the user-space application (QEMU) and the KVM module.

KVM module and user space Qemu is mainly a series of IOCTL calls for special device files.

qemu itself is not a part of KVM, it is itself a famous open-source virtual machine software. Unlike KVM, the QEMU virtual machine is a pure software implementation, so performance is low. However, the advantage is that virtual machine functionality can be implemented on platforms that support QEMU's own build run, and even virtual machines may not be the same architecture as host hosts. As a long-established virtual machine, QEMU's code includes a complete set of virtual machine implementations, including processor virtualization, memory virtualization, and virtual device simulations used by KVM (such as network cards, video cards, storage controllers, hard drives, and so on).

      KVM implementation relies on hardware virtualization Technology Evolution Blueprint

intel virtualization Technology is actually a collection of hardware technology, virtual machine monitor software through the choice of the use of various technologies, so as to improve the performance of virtualization software or to achieve a variety of functions.

intel virtualization technology can be broadly divided into three categories: the first class is processor-related, called Vt-x, is to implement the hardware expansion of processor virtualization, which is the basis of hardware virtualization; the second class is chipset-related and becomes vt-d, which provides the necessary support for virtualization from the chipset level, through which You can implement functions such as assigning physical devices directly to clients, and the third is input related, and the main purpose is to define new input and output protocols so that the next generation of input can better support the work in a virtualized environment. For example, the Intel network card has its own VMDQ technology and the PCI organization-defined single-root device Virtualization Protocol (SR-Iov).

Reference: http://book.51cto.com/art/201311/416131.htm

This article comes from the "Ricky's blog" blog, please be sure to keep this source http://57388.blog.51cto.com/47388/1554794

Linux--KVM Technology Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.