From ca58685f4cbe634e1d1c55da16205d7666e137f8 Mon Sep 17 00:00:00 2001 From: CMGS Date: Tue, 31 Mar 2026 06:13:58 +0000 Subject: [PATCH] vmm: call notify_guest_clock_paused for Hyper-V guests Previously, KVM_KVMCLOCK_CTRL was skipped when kvm_hyperv=on because Windows does not use pvclock directly. However, KVM internally uses pvclock data structures as the basis for computing the Hyper-V Reference TSC page parameters. Not calling KVM_KVMCLOCK_CTRL means there is no mechanism to signal time discontinuity to Windows guests after pause/resume, contributing to multi-minute hangs. Remove the kvm_hyperv guard so all guests receive the clock-paused notification. Signed-off-by: CMGS --- vmm/src/cpu.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vmm/src/cpu.rs b/vmm/src/cpu.rs index f8fff2b29..4b15cffc3 100644 --- a/vmm/src/cpu.rs +++ b/vmm/src/cpu.rs @@ -2637,16 +2637,16 @@ impl Pausable for CpuManager { self.signal_vcpus() .map_err(|e| MigratableError::Pause(anyhow!("Error signalling vCPUs: {e}")))?; + // Notify all guests (including Hyper-V / Windows) that the clock was + // paused. KVM_KVMCLOCK_CTRL updates internal KVM state that affects + // both pvclock (Linux) and the Hyper-V TSC reference page, so it must + // be called unconditionally. #[cfg(all(feature = "kvm", target_arch = "x86_64"))] for vcpu in self.vcpus.iter() { let vcpu = vcpu.lock().unwrap(); - if !self.config.kvm_hyperv { - vcpu.vcpu.notify_guest_clock_paused().map_err(|e| { - MigratableError::Pause(anyhow!( - "Could not notify guest it has been paused {e:?}" - )) - })?; - } + vcpu.vcpu.notify_guest_clock_paused().map_err(|e| { + MigratableError::Pause(anyhow!("Could not notify guest it has been paused {e:?}")) + })?; } // The vCPU thread will change its paused state before parking, wait here for each