From 1700bb05901bda99d3e17fee8b051888ce41c9b0 Mon Sep 17 00:00:00 2001 From: Jordan Bonser Date: Tue, 10 Dec 2024 09:47:58 +0000 Subject: [PATCH] perf(qemu): qemu emulator kvm optimisation using the `-accel kvm` and then attempting OS specific accelerators before falling back onto the default `-accel tcg`, which gives a performance increase when those accelerators are available for their respective platforms such as in cases where the cpu arch for the host and guest match. relates to #6, #12 --- e2e/BUILD.bazel | 5 ++++- e2e/qemu/BUILD.bazel | 2 +- labgrid/toolchain/config/qemu/amd64/config.yaml | 2 +- labgrid/toolchain/config/qemu/arm64/config.yaml | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/e2e/BUILD.bazel b/e2e/BUILD.bazel index d3242e79..484ba516 100644 --- a/e2e/BUILD.bazel +++ b/e2e/BUILD.bazel @@ -1,4 +1,7 @@ test_suite( name = "ci", - tests = ["//localhost"], + tests = [ + "//localhost", + "//qemu:test", + ], ) diff --git a/e2e/qemu/BUILD.bazel b/e2e/qemu/BUILD.bazel index 5f5dc15c..8fe645de 100644 --- a/e2e/qemu/BUILD.bazel +++ b/e2e/qemu/BUILD.bazel @@ -3,7 +3,7 @@ load("@rules_labgrid//labgrid/genrule:defs.bzl", "labgrid_genrule") load("@rules_labgrid//labgrid/test:defs.bzl", "labgrid_test") load("@rules_python//python:defs.bzl", "py_binary") -CPUS = ("amd64",) +CPUS = ("amd64", "arm64") [ labgrid_genrule( diff --git a/labgrid/toolchain/config/qemu/amd64/config.yaml b/labgrid/toolchain/config/qemu/amd64/config.yaml index d49584b1..d79eb3a7 100644 --- a/labgrid/toolchain/config/qemu/amd64/config.yaml +++ b/labgrid/toolchain/config/qemu/amd64/config.yaml @@ -12,7 +12,7 @@ targets: cpu: "max" memory: "2G" nic: "user,model=e1000" - extra_args: !template "-snapshot -drive file=$LG_QEMU_QCOW2_IMAGE,format=qcow2 -cdrom $LG_QEMU_VIRT_IMAGE" + extra_args: !template "-accel kvm -accel xen -accel tcg -snapshot -drive file=$LG_QEMU_QCOW2_IMAGE,format=qcow2 -cdrom $LG_QEMU_VIRT_IMAGE" ShellDriver: prompt: " login: " login_prompt: " login: " diff --git a/labgrid/toolchain/config/qemu/arm64/config.yaml b/labgrid/toolchain/config/qemu/arm64/config.yaml index f5cebcd7..ebcc016c 100644 --- a/labgrid/toolchain/config/qemu/arm64/config.yaml +++ b/labgrid/toolchain/config/qemu/arm64/config.yaml @@ -8,12 +8,12 @@ targets: drivers: QEMUDriver: qemu_bin: "qemu" - machine: "virt,virtualization=on" - cpu: "max,pauth-impdef=on" + machine: "virt" + cpu: "max" memory: "2G" bios: "efi" nic: "user,model=virtio-net-pci" - extra_args: !template "-snapshot -smp 4 -drive file=$LG_QEMU_QCOW2_IMAGE,format=qcow2 -cdrom $LG_QEMU_VIRT_IMAGE" + extra_args: !template "-accel kvm -accel hvf -accel tcg -snapshot -smp 4 -drive file=$LG_QEMU_QCOW2_IMAGE,format=qcow2 -cdrom $LG_QEMU_VIRT_IMAGE" ShellDriver: prompt: " login: " login_prompt: " login: " -- GitLab