diff --git a/vmm/src/vm.rs b/vmm/src/vm.rs index 430c9bdc7..c1e21a5ac 100644 --- a/vmm/src/vm.rs +++ b/vmm/src/vm.rs @@ -3111,7 +3111,8 @@ impl Pausable for Vm { .valid_transition(new_state) .map_err(|e| MigratableError::Resume(anyhow!("Invalid transition: {e:?}")))?; - self.cpu_manager.lock().unwrap().resume()?; + // Restore KVM clock BEFORE vCPUs start running, so they see correct + // TSC/kvmclock from the first instruction after resume. #[cfg(target_arch = "x86_64")] { if let Some(clock) = &self.saved_clock { @@ -3128,6 +3129,7 @@ impl Pausable for Vm { } self.device_manager.lock().unwrap().resume()?; + self.cpu_manager.lock().unwrap().resume()?; // And we're back to the Running state. self.state = new_state;