KVM or QEMU: Which Runs My Virtual Machine?

While working with Openstack on both VMware virtual machines (with no virtualization instruction set exposed) and physical machines, I found virtual machine instances can be deployed seamlessly. On a machine that does not have virtualization instruction set exposed, KVM falls back to QEMU silently. That is why could I try out OpenStack on virtual machines before my hardware was ready. Because both KVM and QEMU support the same libvirt APIs, you would not notice any difference using command line like virsh, or Virtualization Manager. That is the beauty of standard APIs with different implementations, similar to the standard vSphere APIs that are implemented by both vCenter and ESXi.

That being said, the performance difference between KVM and QEMU could be big. As you may have known, QEMU is really emulation therefore it’s much slower than KVM. If you are running something for testing, you may not notice the difference. But in production, you definitely want to use KVM over QEMU.

Bothered by SLOW Web UI to manage vSphere? Want to manage ALL your VMware vCenters, AWS, Azure, Openstack, container behind a SINGLE pane of glass? Want to search, analyze, report, visualize VMs, hosts, networks, datastores, events as easily as Google the Web? Find out more about vSearch 3.0: the search engine for all your private and public clouds.

Anyway, I was curious whether if KVM is really running on my physical deployment. So I started to research a bit and here are my findings.

Hardware Readiness

Because of the performance advantage, KVM is always preferred over QEMU. But KVM has to run with virtualization instruction set, meaning if the hardware support is not there it must be QEMU that runs your virtual machines.

On the machine you run KVM/QEMU, you can examine the cpuinfo as follows. If you see a non-zero value, it has virtualization support. It of course does not mean it has KVM running. The BIOS has to be configured as well.

[root@node1 ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
24

If you see a zero value, it means it must be QEMU. If you install KVM/QEMU on a virtual machine that does not have virtualization set exposed, that is what you’ll see. Nowadays, it’s hard to find physical servers without virtualization instruction set. When you see zero value, check the BIOS.

[root@hq ~]# egrep -c '(vmx|svm)' /proc/cpuinfo
0

Software Modules

You can list the modules in the Linux Kernel using the lsmod command as follows. If KVM is running, you should be able to see something like the following; otherwise, nothing after the command.

[root@node1 ~]# lsmod | grep kvm
kvm_intel              53484  6
kvm                   316634  1 kvm_intel
 
[root@hq ~]# lsmod | grep kvm

Also, when KVM is running, you should see the /dev/kvm in your filesystem as the following.

[root@node1 ~]# ls -al /dev/kvm
crw-rw-rw-+ 1 root kvm 10, 232 Jun 14 16:10 /dev/kvm

When QEMU is running, you should not see the file as shown below.

[root@hq ~]# ls -al /dev/kvm
ls: cannot access /dev/kvm: No such file or directory
This entry was posted in Virtualization and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Vikram Darsi
    Posted April 24, 2015 at 7:25 am | Permalink

    Hi Steve

    I have a small query

    In the first para, it was mentioned that KVM falls back to QEMU silently if the machine does not have virtualization instruction set exposed

    In my openstack , I was forced to do this change in the file /etc/nova/nova-compute.conf when I am not able to launch network instance from horizon UI
    I was facing the issue “not a valid host found”

    FYI: I ran the command mentioned in the article to see the virtualization instruction support, result is zero

  2. Posted April 24, 2015 at 10:48 am | Permalink

    Hi Vikram, haven’t touched the KVM and QEMU for a while therefore I don’t remember details now. Neither do I have a setup to try it out. You may want to search elsewhere.

    Steve

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

  • NEED HELP?


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__ doublecloud.org.

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.