* [PATCH] selftests/liveupdate: Prefer KVM and HVF over TCG in vmtest.sh
@ 2026-10-08 13:28 David Matlack
2026-10-08 13:33 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: David Matlack @ 2026-10-08 13:28 UTC (permalink / raw)
To: kexec, linux-kernel, linux-kselftest
Cc: Jordan Richards, Mike Rapoport, Pasha Tatashin, Pratyush Yadav,
Shuah Khan, David Matlack
Pass the -accel options to QEMU in the order KVM, HVF, TCG, so that
vmtest.sh prefers to use KVM and HVF over TCG when they are available.
QEMU uses the first accelerator in the list that initializes, and TCG
always initializes, so the tests currently always run under TCG, even
though the commit that added vmtest.sh describes "automatic accelerator
detection (KVM, HVF, or TCG)".
Fixes: 89dd1421c554 ("selftests/liveupdate: add end to end test infrastructure and scripts")
Signed-off-by: David Matlack <dmatlack@google.com>
---
Tested by running run-vmtests.sh and then observed that arm64 correctly
fell back to using TCG after trying to use KVM and HVF, and that x86
reported no warnings.
arm64:
qemu-system-aarch64: -accel kvm: invalid accelerator kvm
qemu-system-aarch64: -accel hvf: invalid accelerator hvf
qemu-system-aarch64: falling back to tcg
x86:
(not warnings)
tools/testing/selftests/liveupdate/vmtest.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/liveupdate/vmtest.sh b/tools/testing/selftests/liveupdate/vmtest.sh
index 64fd2ab55b76..69beda6c961d 100755
--- a/tools/testing/selftests/liveupdate/vmtest.sh
+++ b/tools/testing/selftests/liveupdate/vmtest.sh
@@ -180,7 +180,7 @@ function run_qemu() {
echo "# Serial Log: $serial"
timeout 30s \
$qemu_cmd -m 1G -smp 2 -no-reboot -nographic -nodefaults \
- -accel tcg -accel hvf -accel kvm \
+ -accel kvm -accel hvf -accel tcg \
-serial file:"$serial" \
-append "$cmdline" \
-kernel "$kernel_path" \
base-commit: 80cf37169daef112b6bea9ae7d9808355a045475
--
2.56.0.360.g66cac248cb-goog
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] selftests/liveupdate: Prefer KVM and HVF over TCG in vmtest.sh
2026-10-08 13:28 [PATCH] selftests/liveupdate: Prefer KVM and HVF over TCG in vmtest.sh David Matlack
@ 2026-10-08 13:33 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-08 13:33 UTC (permalink / raw)
To: linux-kernel, David Matlack, linux-kselftest
Cc: Jordan Richards, Mike Rapoport, Pratyush Yadav, kexec,
Pasha Tatashin, Shuah Khan
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] selftests: KVM accelerator preference breaks arm64 vmtest on GICv3 hosts
--
commit 5b52122d5a64c0b3471d0fed69b32ec99d464203
Author: David Matlack <dmatlack@google.com>
selftests/liveupdate: Prefer KVM and HVF over TCG in vmtest.sh
This commit reorders the QEMU accelerator options to prefer KVM and HVF over
TCG. It aims to utilize hardware acceleration when available instead of always
defaulting to TCG.
> Tested by running run-vmtests.sh and then observed that arm64 correctly
> fell back to using TCG after trying to use KVM and HVF, and that x86
> reported no warnings.
Will the arm64 test actually fall back to TCG when run natively on modern arm64
hardware?
In get_arch_conf(), the arm64 QEMU command is defined without specifying a GIC
version:
QEMU_CMD="qemu-system-aarch64 -M virt -cpu max"
Because the virt machine type defaults to GICv2 for backward compatibility,
running this natively on modern arm64 hardware (which typically only supports
GICv3) will cause the KVM accelerator to successfully initialize, preventing
the fallback to TCG. However, KVM will then fail to create the default GICv2
in-kernel interrupt controller and QEMU will abort with a fatal error.
Was the observation of falling back to TCG made on a cross-compilation host
where the KVM accelerator itself failed to initialize?
> diff --git a/tools/testing/selftests/liveupdate/vmtest.sh b/tools/testing/selftests/liveupdate/vmtest.sh
> index 64fd2ab55b765..69beda6c961d7 100755
> --- a/tools/testing/selftests/liveupdate/vmtest.sh
> +++ b/tools/testing/selftests/liveupdate/vmtest.sh
> @@ -180,7 +180,7 @@ function run_qemu() {
> echo "# Serial Log: $serial"
> timeout 30s \
> $qemu_cmd -m 1G -smp 2 -no-reboot -nographic -nodefaults \
> - -accel tcg -accel hvf -accel kvm \
> + -accel kvm -accel hvf -accel tcg \
[Severity: Medium]
Does this change break native arm64 execution on modern hardware?
Since get_arch_conf() lacks the gic-version=max parameter for arm64, QEMU will
default to GICv2. On modern arm64 hosts, KVM won't be able to emulate GICv2,
causing a hard failure during machine initialization rather than a fallback to
TCG.
Should gic-version=max be added to the arm64 QEMU_CMD to safely enable KVM
acceleration on modern hosts?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261008132813.1966023-1-dmatlack@google.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-08 13:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-08 13:28 [PATCH] selftests/liveupdate: Prefer KVM and HVF over TCG in vmtest.sh David Matlack
2026-10-08 13:33 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®