My blog has been moved to ariya.ofilabs.com.

Saturday, May 19, 2007

QEMU 0.9 with acceleration on SUSE 10.2

QEMU version 0.9 is already out for some time, but AFAIK no official package is available for openSUSE Linux 10.2 yet. Here are some steps I did to have QEMU 0.9 with accelerator (kqemu) on SUSE 10.2. The motivation is simple: I'd like to have a faster system for filter development.

QEMU 0.9 comes, among others, in binary package. I found out that this works well, so just download qemu-0.9.0-i386.tar.gz then unpack it to /. You'll see some new stuff in /usr/local/.

Next step is to install and use accelerator. This time I did compile it from source. First, get kqemu-1.3.0pre11.tar.gz, unpack it, then run the usual steps: ./configure follows by make and sudo make install. Don't forget to have kernel sources (install kernel-source package from YaST if necessary) in your system before doing this.

Now do the following:

export device="/dev/kqemu"
sudo rm -f $device
sudo mknod --mode=0666 $device c 250 0

After that, load the accelerator (kqemu) kernel module:

sudo /sbin/modprobe kqemu major=250

Now, run your virtual machine using the extra -kernel-kqemu option, e.g:

qemu -hda vdisk.qcow -kernel-kqemu

If you forget to load the kqemu kernel module, you'll get the following error message:

Could not open '/dev/kqemu' - QEMU acceleration layer not activated

otherwise, nothing shows up and your virtual machine is executed as usual.

To verify that kqemu works, activate the monitor using Ctrl+Alt+2, then type in info kqemu followed by Enter. You should see:

kqemu support: enabled for user and kernel code

(Exit from the monitor using Ctrl+Alt+1)

If, for some reason, you don't want to run the virtual machine with acceleration, use the option -no-kqemu, e.g.:

qemu -hda vdisk.qcow -no-kqemu

Now, info kqemu on the monitor would give:

kqemu support: disabled

I tested QEMU 0.9 with Windows NT 4.0 as the guest operating system. Even without acceleration, I've seen performance improvement compared to previous versions of QEMU. With acceleration (kqemu), it was even faster, although the kqemu documentation says only Windows 2000 and XP are supported. Benchmark done using CPUBench showed that the virtual machine runs roughly equal to a 300 Mhz and 1.3 GHz system without and with kqemu, respectively. Now, that's an improvement!

Happy virtualizing...

Sources:
http://fabrice.bellard.free.fr/qemu/kqemu-doc.html
http://fabrice.bellard.free.fr/qemu/kqemu-doc.html
http://kidsquid.com/cgi-bin/moin.cgi/QemuOnLinux

4 comments:

famewolf said...

Take a look at Virtualbox ( http://www.virtualbox.org ) which actually uses some of the qemu code but has a nice gui and some enhancements...I found it to be even faster then qemu or virtual pc when running XP in a VM.

Ariya Hidayat said...

Rudi: I've been using VirtualBox since its very first release. However, for this particular purpose, VirtualBox is not a good choice because somehow its support for NT is not good, if not actually quite bad. YMMV.

Anonymous said...

have you tried these packages from the build service?

http://software.opensuse.org/download/Virtualization:/Qemu/openSUSE_10.2/repodata/

i've not had chance myself yet

Ariya Hidayat said...

David: yes, I'm aware of these but do not give it a try yet. At the time (some weeks ago) I did these steps, these RPMs were not available yet.