Kernel KVM virtualization development
 help / color / mirror / Atom feed
* Re: Bug Report Linux kvm/qemu: Frequent Boot Issues with Windows 11 ARM64 VMs on NVIDIA DGX Spark due to Potential KVM PMU Migration Issues
       [not found] <af150d64-feff-4ef0-905a-14ab55b074fa@web.de>
@ 2026-11-23  9:18 ` Jens Neubert
  2026-11-23  9:39 ` Marc Zyngier
  1 sibling, 0 replies; 2+ messages in thread
From: Jens Neubert @ 2026-11-23  9:18 UTC (permalink / raw)
  To: kvm; +Cc: maz, pbonzini

Hello,

I am experiencing frequent boot failures when starting Windows 11 ARM64 
VMs on an NVIDIA DGX Spark system with a heterogeneous CPU topology 
(Cortex-A725 and Cortex-X925 clusters).
The failures can consistently be resolved by pinning the vCPU threads to 
a single CPU cluster (using taskset), which points to a PMU migration 
issue between clusters with different PMU types.
I suspect a KVM bug where the PMU state (specifically PMCCNTR) is not 
handled correctly when a vCPU thread migrates between physical CPUs with 
different PMU architecture versions.
My KVM host:
NVIDIA DGX Spark (aarch64)
CPU:
Cluster 0: Cortex-A725 cores (IDs 0–4, 10–14) – PMU type armv8_pmuv3_0
Cluster 1: Cortex-X925 cores (IDs 5–9, 15–19) – PMU type armv8_pmuv3_1

Kernel: 6.17.0-1032-nvidia (Ubuntu 24.04 LTS aarch64)
KVM: Enabled, all relevant performance event and PMU configurations are 
present:

CONFIG_PERF_EVENTS=y
CONFIG_HW_PERF_EVENTS=y
CONFIG_GUEST_PERF_EVENTS=y

Guest VM:

QEMU: 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18)
Machine: virt,accel=kvm,gic-version=3,-cpu host
vCPUs: 4 (sockets=1, cores=4, threads=1)
Firmware: EDK2 (latest upstream with LPA2 workarounds)
Operating system: Windows 11 ARM64

During the UEFI boot process, the Windows Boot Manager (bootmgfw.efi) 
calibrates the PMU cycle counter (PMCCNTR).
If a vCPU thread is migrated by the host scheduler from a Cortex-A725 
core to a Cortex-X925 core (or vice versa) while
the guest is accessing the PMU, reading PMCCNTR returns zero. This 
causes the VM to get stuck indefinitely in the
calibration loop (at the TianoCore splash screen).

There is no crash or kernel panic; the guest simply fails to boot.
The issue occurs almost every time (>90% of cold boots), depending on 
the state of the host scheduler.

The same VM boots reliably when the vCPU threads are pinned to cores 
within a single CPU cluster (e.g. taskset -c 5-9,15-19).

Claude suspects (yes, I burned $50 worth of tokens for the analysis) 
that KVM's perf-event context does not survive migration
between CPUs with incompatible PMUs correctly. This could cause the 
virtual PMCCNTR to become inaccessible and return zero
when read.
my QEMU launch command:

swtpm socket --tpm2 --tpmstate dir=$VM/tpm --ctrl 
type=unixio,path=$VM/swtpm-sock --daemon && \
qemu-system-aarch64 \
-name "Windows 11 ARM" \
-machine virt,accel=kvm,gic-version=3 \
-cpu host \
-m 8G \
-smp 4,sockets=1,cores=4,threads=1 \
-drive 
if=pflash,format=raw,readonly=on,file="/usr/share/AAVMF/AAVMF_CODE.ms.fd" \
-drive if=pflash,format=raw,file="$VM/AAVMF_VARS.fd" \
-chardev socket,id=chrtpm,path="$VM/swtpm-sock" \
-tpmdev emulator,id=tpm0,chardev=chrtpm \
-device tpm-tis-device,tpmdev=tpm0 \
-drive 
if=none,id=nvmedisk,format=qcow2,file="$VM/win11-arm.qcow2",cache=writeback,discard=unmap 
\
-device nvme,drive=nvmedisk,serial=WIN11ARM001 \
-device qemu-xhci,id=xhci \
-device usb-tablet \
-device usb-kbd \
-device usb-audio,audiodev=audio0 \
-audiodev pa,id=audio0 \
-netdev 
user,id=net0,hostfwd=tcp:127.0.0.1:3389-:3389,hostfwd=tcp:127.0.0.1:2222-:22,hostfwd=tcp:127.0.0.1:4445-:445 
\
-device virtio-net-pci,netdev=net0 \
-device virtio-serial-pci \
-chardev spicevmc,id=vdagent,name=vdagent \
-device virtserialport,chardev=vdagent,name=com.redhat.spice.0 \
-spice port=5930,addr=127.0.0.1,disable-ticketing=on \
-device virtio-gpu-pci \
-boot order=c \
-qmp unix:/tmp/qmp-win11.sock,server,nowait \
-display gtk,gl=off \
-serial mon:stdio

A725 cores only:
taskset -c 0-4,10-14 qemu-system-aarch64 ...
 > Boots reliably.

X925 cluster only:
taskset -c 5-9,15-19 qemu-system-aarch64 ...
 > Boots reliably.
Without taskset:
qemu-system-aarch64 ...
 > VM usually fails to boot (in more than 90% of cases).

The hang occurs early in the UEFI boot sequence, before the OS loader is 
started.

The issue is independent of firmware patches (LPA2 workarounds). It 
occurs with both original and patched EDK2 builds.

Additionally, I have observed a second, potentially related issue: in 
approximately 20% of cold boots (when launching
with taskset -c ... included), the VM hangs for about 50 seconds after 
the UEFI boot screen with the message "Display
output is not active" and then automatically reboots. Windows boots 
reliably after this unexpected reboot.

I have not investigated this issue in further detail yet.
I can provide serial debug logs, QMP traces, and host-side perf-event 
dumps upon request.


Best regards,
--
Jens Neubert

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug Report Linux kvm/qemu: Frequent Boot Issues with Windows 11 ARM64 VMs on NVIDIA DGX Spark due to Potential KVM PMU Migration Issues
       [not found] <af150d64-feff-4ef0-905a-14ab55b074fa@web.de>
  2026-11-23  9:18 ` Bug Report Linux kvm/qemu: Frequent Boot Issues with Windows 11 ARM64 VMs on NVIDIA DGX Spark due to Potential KVM PMU Migration Issues Jens Neubert
@ 2026-11-23  9:39 ` Marc Zyngier
  1 sibling, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2026-11-23  9:39 UTC (permalink / raw)
  To: Jens Neubert; +Cc: kvm, pbonzini

On Mon, 23 Nov 2026 09:07:00 +0000,
Jens Neubert <10jens@web.de> wrote:
> 
> Hello,
> 
> I am experiencing frequent boot failures when starting Windows 11
> ARM64 VMs on an NVIDIA DGX Spark system with a heterogeneous CPU
> topology (Cortex-A725 and Cortex-X925 clusters).
> The failures can consistently be resolved by pinning the vCPU threads
> to a single CPU cluster (using taskset), which points to a PMU
> migration issue between clusters with different PMU types.
> I suspect a KVM bug where the PMU state (specifically PMCCNTR) is not
> handled correctly when a vCPU thread migrates between physical CPUs
> with different PMU architecture versions.

Not a bug. Actually a feature.

Different implementations have different events, and an event count on
one CPU type doesn't mean the same thing on another. Therefore,
migrating between PMUs is not supposed to work, and KVM makes a point
in honouring the stupidity of the architecture (and of the
implementations that lob two incompatible designs together).

There is a vague plan to allow incompatible PMUs to be used by
limiting them to the cycle counter only, but I haven't looked at the
patches (life is too short for heterogeneous systems).

Pinning threads to a single implementation is the correct approach.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-23  9:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <af150d64-feff-4ef0-905a-14ab55b074fa@web.de>
2026-11-23  9:18 ` Bug Report Linux kvm/qemu: Frequent Boot Issues with Windows 11 ARM64 VMs on NVIDIA DGX Spark due to Potential KVM PMU Migration Issues Jens Neubert
2026-11-23  9:39 ` Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox