From 8fbd6852da4e364e068efecb66013f2042217ef0 Mon Sep 17 00:00:00 2001 From: Nikita Kalyazin Date: Fri, 16 Feb 2024 17:53:22 +0000 Subject: [PATCH] fix(vmm): call KVMCLOCK_CTRL when pausing This is to avoid guest kernel panic on resume path due to softlockup detection. Signed-off-by: Nikita Kalyazin --- src/vmm/src/vstate/vcpu/mod.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/vmm/src/vstate/vcpu/mod.rs b/src/vmm/src/vstate/vcpu/mod.rs index 1e07f437138a..9f54c2dea38b 100644 --- a/src/vmm/src/vstate/vcpu/mod.rs +++ b/src/vmm/src/vstate/vcpu/mod.rs @@ -296,8 +296,11 @@ impl Vcpu { .send(VcpuResponse::Paused) .expect("vcpu channel unexpectedly closed"); - // TODO: we should call `KVM_KVMCLOCK_CTRL` here to make sure - // TODO continued: the guest soft lockup watchdog does not panic on Resume. + // Calling `KVM_KVMCLOCK_CTRL` to make sure the guest softlockup watchdog + // does not panic on resume, see https://docs.kernel.org/virt/kvm/api.html . + // Unwrapping to exit immediately if we fail to do that. + #[cfg(target_arch = "x86_64")] + self.kvm_vcpu.fd.kvmclock_ctrl().unwrap(); // Move to 'paused' state. state = StateMachine::next(Self::paused);