qemu: use 4 cores in qemu guests
PATCH 1/2 qemu: use 4 cores in qemu guests
From: Alexander Kanavin <[email protected]>
Each of the cores is mapped to a thread on the host, this should speed up things inside qemu which can take advantage of that.
Signed-off-by Alexander Kanavin <[email protected]>
Signed-off-by Richard Purdie <[email protected]>
--- meta/classes/qemuboot.bbclass | 4 ++++ scripts/runqemu | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-)
meta/classes/qemuboot.bbclass +4 -0
@@ -19,6 +19,9 @@ # QB_CPU_KVM: the similar to QB_CPU, but used when kvm, e.g., '-cpu kvm64', # set it when support kvm. # +# QB_SMP: amount of CPU cores inside qemu guest, each mapped to a thread on the host, +# e.g. "-smp 8". +# # QB_KERNEL_CMDLINE_APPEND: options to append to kernel's -append # option, e.g., "console=ttyS0 console=tty" #
@@ -80,6 +83,7 @@ # See "runqemu help" for more info QB_MEM ?= "-m 256" +QB_SMP ?= "-smp 4" QB_SERIAL_OPT ?= "-serial mon:stdio -serial null" QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}" QB_DEFAULT_FSTYPE ?= "ext4"
scripts/runqemu +2 -2
@@ -540,13 +540,13 @@ class BaseConfig(object): def check_kvm(self): """Check kvm and kvm-host""" if not (self.kvm_enabled or self.vhost_enabled): - self.qemu_opt_script += ' %s %s' % (self.get('QB_MACHINE'), self.get('QB_CPU')) + self.qemu_opt_script += ' %s %s %s' % (self.get('QB_MACHINE'), self.get('QB_CPU'), self.get('QB_SMP')) return if not self.get('QB_CPU_KVM'): raise RunQemuError("QB_CPU_KVM is NULL, this board doesn't support kvm") - self.qemu_opt_script += ' %s %s' % (self.get('QB_MACHINE'), self.get('QB_CPU_KVM')) + self.qemu_opt_script += ' %s %s %s' % (self.get('QB_MACHINE'), self.get('QB_CPU_KVM'), self.get('QB_SMP')) yocto_kvm_wiki = "https://wiki.yoctoproject.org/wiki/How_to_enable_KVM_for_Poky_qemu" yocto_paravirt_kvm_wiki = "https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM" dev_kvm = '/dev/kvm'
Signature · 1 line
2.30.2
PATCH 2/2 qemu: Set SMP to 4 cpus for arm/x86 only
Only qemux86* and qemuarm* support SMP with our current configurations so rework qemu SMP enabling to account for that and only use it on the architectures where it works.
Signed-off-by Richard Purdie <[email protected]>
--- meta/classes/qemuboot.bbclass | 2 +- meta/conf/machine/include/qemuboot-x86.inc | 1 + meta/conf/machine/qemuarm.conf | 1 + meta/conf/machine/qemuarm64.conf | 1 + 4 files changed, 4 insertions(+), 1 deletion(-)
meta/classes/qemuboot.bbclass +1 -1
@@ -83,7 +83,7 @@ # See "runqemu help" for more info QB_MEM ?= "-m 256" -QB_SMP ?= "-smp 4" +QB_SMP ?= "" QB_SERIAL_OPT ?= "-serial mon:stdio -serial null" QB_DEFAULT_KERNEL ?= "${KERNEL_IMAGETYPE}" QB_DEFAULT_FSTYPE ?= "ext4"
meta/conf/machine/include/qemuboot-x86.inc +1 -0
@@ -1,5 +1,6 @@ # For runqemu IMAGE_CLASSES += "qemuboot" +QB_SMP = "-smp 4" QB_CPU_x86 = "-cpu core2duo" QB_CPU_KVM_x86 = "-cpu core2duo"
meta/conf/machine/qemuarm.conf +1 -0
@@ -16,6 +16,7 @@ SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}" QB_SYSTEM_NAME = "qemu-system-arm" QB_MACHINE = "-machine virt,highmem=off" QB_CPU = "-cpu cortex-a15" +QB_SMP = "-smp 4" # Standard Serial console QB_KERNEL_CMDLINE_APPEND = "vmalloc=256" # For graphics to work we need to define the VGA device as well as the necessary USB devices
meta/conf/machine/qemuarm64.conf +1 -0
@@ -16,6 +16,7 @@ SERIAL_CONSOLES_CHECK = "${SERIAL_CONSOLES}" QB_SYSTEM_NAME = "qemu-system-aarch64" QB_MACHINE = "-machine virt" QB_CPU = "-cpu cortex-a57" +QB_SMP = "-smp 4" QB_CPU_KVM = "-cpu host -machine gic-version=3" # For graphics to work we need to define the VGA device as well as the necessary USB devices QB_GRAPHICS = "-device VGA,edid=on"
Signature · 1 line
2.30.2