Speed up QEMU with KVM

If you have been using QEMU for emulating other operating systems, you will find that it runs fairly slow. QEMU does not take advantage of your hardware to speed anything up, so all of the load comes from translating between processors. On average, QEMU will only run at about 20% of the speed of your host system.

Obviously, this is a problem. If you want reliable testing of any OS in a virtual machine, you'll want it to run at near-full speed. This is where KVM comes in. No, not those hardware input switches, but rather the Kernel-based Virtual Machine. KVM allows you to take advantage of your processor to achieve near-native speeds.

None of this comes without a catch, however. First off, KVM only allows you to emulate and run on x86 and x86_64 systems. Second, your processor must support it. To check, run the following command, taken from the KVM package itself:

egrep '^flags.*(vmx|svm)' /proc/cpuinfo

If you don't get anything from that command, you might as well stop reading. But if you get a line or two with a bunch of seemingly random words, then you're all set to run KVM.

The neat thing about KVM is that it works as a drop-in replacement for QEMU. So, if you were running QEMU from the terminal to begin with, all you have to do is replace qemu with kvm.

When running kvm in a terminal, you may get a "permission denied" error. To fix this, add yourself to the kvm group:

adduser username kvm

You can also chmod 0777 /dev/kvm if you are the only user on the system or do not care who has access to it.

If you are using Qemu Launcher or another GUI, all you have to do is change the path to QEMU from /usr/bin/qemu to /usr/bin/kvm. There you have it, now go run your VMs in full speed!

Avatar for jacob Jacob Peddicord - http://jacob.peddicord.net/

Jacob is a web developer, student, and programmer from Ohio. He is a staff member at the Ubuntu Forums and is most likely a fanboy of the distribution. He loves to write in code and words, play video games, and rant about topics most would have abandoned long ago. Jacob uses GNOME and is never seen running stable software, much to the demise of his laptop.

Home » Articles »

Discussion: Speed up QEMU with KVM

  1. Peter (guest)

    # Posted on 24 February 2008 at 06:01 PM

    <code>peter@blackhole:~/Desktop$ egrep '^flags.*(vmx|svm)' /proc/cpuinfo peter@blackhole:~/Desktop$</code>

    I hate my Pentium 4. :(



  2. # Posted on 25 February 2008 at 02:44 PM

    <strong>Story added...</strong>

    This story has been submitted to fsdaily.com! If you think this story should be read by the free software community, come vote it up and discuss it here:

    http://www.fsdaily.com/HighEnd/Speed_up_QEMU_with_KVM...



  3. ambar (guest)

    # Posted on 08 May 2009 at 05:11 AM

    where i can get kvm? thanks



Home » Articles » Speed up QEMU with KVM