Skip to content

Commit 51c0122

Browse files
kalyazinbchalios
authored andcommitted
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 <[email protected]> Signed-off-by: Babis Chalios <[email protected]>
1 parent cc4392c commit 51c0122

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/vmm/src/vstate/vcpu/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,15 @@ impl Vcpu {
336336
.send(VcpuResponse::Paused)
337337
.expect("vcpu channel unexpectedly closed");
338338

339-
// TODO: we should call `KVM_KVMCLOCK_CTRL` here to make sure
340-
// TODO continued: the guest soft lockup watchdog does not panic on Resume.
339+
// Calling `KVM_KVMCLOCK_CTRL` to make sure the guest softlockup watchdog
340+
// does not panic on resume, see https://docs.kernel.org/virt/kvm/api.html .
341+
// We do not want to fail if the call is not successful, because depending
342+
// that may be acceptable depending on the workload.
343+
// TODO: add a metric
344+
#[cfg(target_arch = "x86_64")]
345+
if let Err(err) = self.kvm_vcpu.fd.kvmclock_ctrl() {
346+
warn!("KVM_KVMCLOCK_CTRL call failed {}", err);
347+
}
341348

342349
// Move to 'paused' state.
343350
state = StateMachine::next(Self::paused);

0 commit comments

Comments
 (0)