BKM: improve qemu performance

From Yocto Project
Revision as of 08:31, 6 December 2011 by Gzhai (talk | contribs)
Jump to navigationJump to search

improve qemu performance

Qemu in yocto is emulator, and is slow when running huge task inside. E.g. running yocto build inside qemu. This article illustrate possible performance improvement to accelerate it

Enable KVM

If you have processor with VTx support, you can enable KVM so that virtualization rather than emulation is used for performance. Pls. refer following:

Add big memory

Sometimes, workload inside qemu requires huge memory. Fail to do this lead performance drop. So pls. add enough memory to qemu via -m 2048 (2G).

enable SMP

If workload inside qemu is CPU-intensive, you can enable smp:

  • enable smp configuration in yocto kernel
  • enable smp option for qemu, like -smp 4 to give 4 vcpu to guest.

Add extra disk space

If workload inside qemu is disk-intensive, it may requires huge disk space. You can set up NFS server or add extra disk image, which is preferred as NFS server introduce extra network workload. Following steps to create a new disk image(10G) with ext3 file system:

$ sudo dd if=/dev/zero of=b.img bs=1G count=10
$ sudo losetup /dev/loop0 b.img
$ sudo fdisk /dev/loop0
 Then create one new single partition
$ sudo mkfs.ext3 /dev/loop0
 to create ext3 file system
$ sudo losetup -d /dev/loop0

append this disk image to qemu via -hdb(need further changes if need virtio block device)