BKM: improve qemu performance: Difference between revisions

From Yocto Project
Jump to navigationJump to search
No edit summary
No edit summary
Line 1: Line 1:
= improve qemu performance =
[[Link title]]= 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
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


Line 9: Line 9:
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).
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 ==
== Enable SMP ==
If workload inside qemu is CPU-intensive, you can enable smp:
If workload inside qemu is CPU-intensive, you can enable smp:
* enable smp configuration in yocto kernel
* enable smp configuration in yocto kernel
Line 26: Line 26:


append this disk image to qemu via '''-hdb'''(need further changes if need virtio block device)
append this disk image to qemu via '''-hdb'''(need further changes if need virtio block device)
== Create network environment ==
Default qemu in yocto talk with host via simple 192.168.7.X, you can use bridge to make the guest act as one true machine, E.g download source code from outside. Pls. see http://www.linux-kvm.org/page/Networking#public_bridge for details
== Enable virtio block and network device ==

Revision as of 13:14, 6 December 2011

Link title= 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)

Create network environment

Default qemu in yocto talk with host via simple 192.168.7.X, you can use bridge to make the guest act as one true machine, E.g download source code from outside. Pls. see http://www.linux-kvm.org/page/Networking#public_bridge for details

Enable virtio block and network device