Virtualization of QEMU and KVM

Source: Internet
Author: User
Tags svm virtual environment amd processors
QEMU is a completely separate virtual environment, because the presence of KVM makes some students (including myself) not very clear about the relationship between Qemu and KVM. QEMU itself can be independent of KVM, but if there is a KVM presence and hardware (processor) support such as the Intel VT feature, QEMU can use KVM-enabled functionality to improve performance in the case of processor virtualization. This blog post focuses on Qemu, the early stage is mainly to explore its use, as well as the relationship with the KVM, subsequent blog will involve some of the implementation mechanism between the two.

QEMU is currently the latest version of 1.1.0 (http://www.qemu.org), download to local, such as/home/dennis/workspace/linux under the qemu-1.1.0-1.tar.bz2, After decompression to get a qemu-1.1.0 directory, for the purposes of the experiment, I do not want it to replace the set of QEMU tools already installed in my system (bin tools set), so I/home/dennis/workspace/ Linux to re-establish a directory below, such as qemu-bin-dbg. First go to the/home/dennis/workspace/linux/qemu-1.10 directory, and then execute it sequentially:
1)./configure--prefix=/home/dennis/workspace/linux/qemu-bin-dbg--enable-debug
This step requires that the environment I am experimenting with is Ubuntu 12.04, the kernel version is my own updated 3.4.3, the Intel i3 processor, the following error occurred during my actual operation:
Error:zlib check failed
Make sure to have the Zlib Libs and headers installed.
----------------------------------------------------------
Google a bit, this error is easy to solve:
Apt-get Install Zlib1g-dev
Apt-get Install Libglib2.0-dev
2) Make
3) make install

Then we went to the/home/dennis/workspace/linux/qemu-bin-dbg directory and found that QEMU's toolset was placed in the bin directory, which would have qemu-i386 and qemu-system-i386, The former is just a simulation of the processor (instruction), while the latter simulates a i386 based PC. If you do not have KVM support, such as Rmmod Kvm_intel, and then run qemu-system-i386, you will receive a message like this:

Could not access KVM kernel module:no such file or directory
Failed to initialize kvm:no such file or directory
Back to TCG accelerator.

Because I've been browsing through some of the KVM code before, the KVM kernel module generates a "/DEV/KVM" device file for use by the user space program, which is prompted because QEMU is unable to find the "/DEV/KVM" file during the initialization phase. Therefore, it is considered that the current system does not provide KVM support, so QEMU is back to the so-called TCG Accelerator mode, which suggests that the standalone QEMU virtualization scenario does not necessarily require KVM support.

My understanding is that the presence of a KVM module can be considered a accelerator for QEMU's I386 processor emulation, as the GPU does for 3D hardware acceleration (in the absence of a GPU, software can also implement certain 3D functions, But the performance is obviously much slower, such as Mesa. So, even if Kvm_intel.ko doesn't exist, QEMU can do a PC virtualization.

KVM is the kernel-based virtual Machine, from the presence of the form, is two kernel modules Kvm.ko and Kvm_intel.ko (for AMD processors, is Kvm_amd.ko), these two modules to achieve the virtualization of the CPU, If you want to allow a user to perform a virtual machine-related operation on a KVM, obviously requires user space, but also includes IO virtualization, so the KVM solution borrows something from QEMU and makes some modifications to form its own KVM virtual machine toolset and IO virtualization support, Which is called QUMU-KVM.

So the summary is that QEMU is an independent virtualization solution that doesn't rely on KVM at this point. The KVM is another set of virtualization solutions, but because the solution actually only implements the kernel's support for the virtualization features of the processor (Intel VT, AMD SVM), in other words, it lacks device virtualization and the corresponding user-space-managed virtual machine tools, So it borrowed QEMU's code and streamlined it, together with the KVM to form another stand-alone virtualization solution, which might be called: Kvm+qemu. In my opinion, the KVM tool in user space is actually a subset of the QEMU Virtual Machine management tool (the QEMU code used by KVM can be downloaded on Http://www.linux-kvm.org/page/Code): KVM User space virtual Machine management tool has KVM, Kvm-img, KVM-NBD, Kvm-ok and Kvm_stat, in fact KVM is a symbolic link to the qemu-system-x86_64, kvm-img is a symbolic link to the qemu-img, at least in my system. In terms of scope, the QEMU virtualization scenario supports many other architectures in addition to the x86 architecture, as can be seen from the file names in the/home/dennis/workspace/linux/qemu-bin-dbg/bin directory above. such as Qemu-system-m68k,qemu-system-mips64, QEMU-SYSTEM-PPC64, Qemu-system-arm and so on. However, the current reference to KVM, generally refers to the x86 on the Intel VT and AMD SVM Solutions, although currently the KVM porting to arm, PPC work is underway.

Of course since Redhat has started supporting KVM, it thinks kvm+ QEMU's solution to user space virtual machine management tool is not very good, or not very versatile (refer to the October 2011 China Core Developers Conference held at Nanjing University, Daniel Veillard, a senior expert from Redhat engaged in libvirt work) PPT document for the day's speech: http://v.csdn.hudong.com/linuxkernal2011/ page2.html), so Redhat wanted to make a big game of chess, so it got a libvirt, a library of the API for managing virtual machines, not just for KVM, but also for virtual machines under Xen. Regarding Libvirt, this is something, I will discuss in the following posting.

In summary: QEMU virtualization (Emulator) solution does not rely on KVM, and KVM virtualization scheme must rely on QEMU (at least for now), even if Redhat developed Libvirt, but the latter can be simply considered a virtual machine management tool, Libvirt still needs qemu for user space to interact with KVM

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.