Virtualization

QEMU/KVM guests log 'unexpected NMI' and suffer network stalls after host resume with nested KVM enabled

viggovpn
1mo ago
Environment

Environment

Host: Debian 12, kernel 6.1, QEMU 7.1, KVM enabled, nested virtualization (intel_iommu + nested=1), guests: multiple Linux VMs with virtio-net, suspended (system suspend) then resumed; nested guests run lightweight workloads

Symptoms

Symptoms

After resuming the host from suspend, affected guests produce kernel logs with 'unexpected NMI' and 'watchdog: hpet' warnings; guest network stalls (incoming packets halted but vNICs remain up), some guests require libvirt restart to restore network I/O. Problem appears only when nested KVM was in use prior to suspend.

Observations

Observations

Host dmesg shows VT‑x reinitialization messages; IOMMU mappings present before suspend but not restored identically; QEMU processes still running; restarting libvirtd or restarting the single guest recovers networking. No hardware errors logged. Disabling nested KVM before suspend prevented the issue in tests.

Already attempted

Already attempted

Updated kernel and QEMU, applied latest microcode, toggled SR‑IOV off, tested different sleep states (s2idle vs deep), tried 'virsh managedsave' and restore instead of host suspend (works), captured kernel and libvirt logs around suspend/resume.

Question

Question

What host resume interactions with nested virtualization can cause unexpected NMIs and vNIC stalls inside guests, and what safe configuration changes restore reliable resume without disabling suspend?

COMMUNITY RESPONSES

Verified community troubleshooting

1 reply
0
novanetwork Answer
user
Posted 1mo ago • 0 confirmations

This commonly comes from VMX/IOMMU state not being restored across host suspend. Easiest safe mitigation: don't suspend the host while nested VMs are active — shut down or migrate them first. For a test workaround, after resume try unloading and reloading the kvm_intel module (sudo modprobe -r kvm_intel && sudo modprobe kvm_intel) — that often reinitializes VMX state and can clear NMIs without rebooting. To verify, resume host, run the unload/reload and watch guest networking; if it recovers, script the module reload on resume and gather logs to report upstream. Beware: unloading kvm while guests are running will fail; shut down guests before module reload.

Showing 1 of 1 community responses
AI DIAGNOSTICS

Incident analysis

Updated 1mo ago• Trouble ID

Most likely causes

Host kernel or KVM module fails to restore nested VMX state (VMCS) on resume, leading to guest NMIs and stalled virtio queues 75%
IOMMU/VFIO mappings not reattached correctly after resume, breaking DMA for virtio-net devices 45%
QEMU process lost access to host IRQ routing post-resume and needs rebind of eventfds leading to stalled packet handling 40%

Summary

Nested KVM plus host suspend can leave VMCS or CPU virtualization state inconsistent after resume, causing NMIs and watchdog triggers in guests. IOMMU and VFIO mappings may not be re-established properly, causing virtio queues to stall. The fact that restarting libvirt or guests restores networking points to userspace/kernel resources needing reinitialization post‑resume. Disabling nested mitigates the issue, implicating VMX state handling by the kernel/QEMU across suspend/resume boundaries.

Suggested Fixes

Diagnostic step 1
Avoid suspend while VMs with nested KVM are running; use 'virsh shutdown' or migrate VMs before host suspend as a mitigation
Diagnostic step 2
Collect kernel logs and 'dmesg -T' before and after resume, and capture /sys/module/kvm/parameters and IOMMU dmesg to file for vendor escalation
Diagnostic step 3
Try unloading and reloading kvm_intel (modprobe -r kvm_intel; modprobe kvm_intel) after resume to see if reinitializing KVM state recovers guests without full libvirt restart

Continue troubleshooting

Matched from the title, description and tags