Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to understand KVM and QEMU in OpenStack

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

OpenStack in how to understand KVM and QEMU, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

I. Overview of KVM

KVM is an acronym for Kernel-based Virtual Machine, that is, virtual machines based on the linux kernel, is a fully virtualized solution, that is, ordinary operating systems can run on KVM without modification. It is managed by linux's own scheduler, so its core source code is relatively small compared to xen. The virtualization of KVM requires hardware support (such as intel VT technology or AMD V technology) and is based on hardware full virtualization.

To be exact, KVM is a module of Linux. You can use modprobe to load the KVM module. After the module is loaded, the KVM module can be used to create a virtual machine to allocate virtual memory, read and write virtual CPU registers and manage the operation of virtual CPU. But the KVM module is far from enough, because the user cannot directly control the kernel module to do things, so there must be a user-space tool. As a user-space tool, developers chose the established open source virtualization software QEMU to simulate the user-space components of PC hardware, simulate the Imax O device model, and provide access to peripherals. QEMU will be introduced in detail later. It would be nice to know that it uses QEMU first.

The basic architecture of KVM is shown in the following figure.

KVM is added to the standard Linux kernel and organized into a standard character device (/ dev/kvm) in Linux. Qemu uses the LibKvm API provided by KVM to create and run virtual machines through ioctl system calls. KVM Driver makes the entire Linux a virtual machine monitor. And on the basis of the original Linux execution mode (kernel mode and user mode), a new client mode is added, which has its own kernel mode and user mode. Under the operation of the virtual machine, the division of labor of the three modes is as follows:

Customer mode: executes the customer code that is not Istroke O, and the virtual machine runs in the customer mode.

Kernel mode: switches to client mode and handles exits from client mode caused by Imax O or other instructions. KVM Driver works in this mode.

User mode: execute the Qemu O instruction on behalf of the customer and run in this mode.

The specific workflow of KVM is as follows:

Qemu in user mode uses libkvm to enter kernel mode through ioctl, kvm module does not create virtual memory by virtual machine, and then executes VMLAUCH instructions to enter guest mode after virtual CPU. Load Guest OS and execute. If there is an external interruption in Guest OS or a page failure in the shadow page table, the execution of Guest OS will be suspended, the client mode trip exception handling will be exited, and then the customer mode will be re-entered to execute the customer code. If an Icano event occurs or if a signal arrives in the signal queue, it goes into user mode processing.

II. Overview of QEMU

QEMU (Quick Emulator) is an independent open source virtual machine software, which simulates the fetch, decoding and execution of the processor on the X86 platform through pure software. The instructions of the virtual client are not directly executed on the physical platform. It uses the micro code generator module to dynamically translate the code architecture of the client that needs to be simulated into the host code architecture and finally executes it. The QEMU virtual machine is a pure software implementation (KVM requires hardware virtualization technical support), so the performance is low. However, the advantage is that the virtual machine can not have the same architecture as the host. Unlike KVM, QEMU has a complete set of virtual machine implementations in its code, including processor virtualization, memory virtualization, and virtual device emulation used by KVM (such as network cards, graphics cards, storage controllers, hard drives, etc.)

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report