Skip to content

Commit ce8e99f

Browse files
kalyazinroypat
authored andcommitted
tmp(vmm): do not attempt kvmclock_ctrl if secret free
kvmclock is currently not supported by Secret Freedom and calling kvmclock_ctrl will always fail. Signed-off-by: Nikita Kalyazin <[email protected]>
1 parent 3885113 commit ce8e99f

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/vmm/src/vstate/vcpu.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,13 @@ impl Vcpu {
328328
// does not panic on resume, see https://docs.kernel.org/virt/kvm/api.html .
329329
// We do not want to fail if the call is not successful, because depending
330330
// that may be acceptable depending on the workload.
331+
// TODO: once kvmclock is supported with Secret Fredom, remove this condition.
331332
#[cfg(target_arch = "x86_64")]
332-
if let Err(err) = self.kvm_vcpu.fd.kvmclock_ctrl() {
333-
METRICS.vcpu.kvmclock_ctrl_fails.inc();
334-
warn!("KVM_KVMCLOCK_CTRL call failed {}", err);
333+
if self.userfault_resolved.is_none() {
334+
if let Err(err) = self.kvm_vcpu.fd.kvmclock_ctrl() {
335+
METRICS.vcpu.kvmclock_ctrl_fails.inc();
336+
warn!("KVM_KVMCLOCK_CTRL call failed {}", err);
337+
}
335338
}
336339

337340
return StateMachine::next(Self::paused);
@@ -357,10 +360,13 @@ impl Vcpu {
357360
// does not panic on resume, see https://docs.kernel.org/virt/kvm/api.html .
358361
// We do not want to fail if the call is not successful, because depending
359362
// that may be acceptable depending on the workload.
363+
// TODO: once kvmclock is supported with Secret Fredom, remove this condition.
360364
#[cfg(target_arch = "x86_64")]
361-
if let Err(err) = self.kvm_vcpu.fd.kvmclock_ctrl() {
362-
METRICS.vcpu.kvmclock_ctrl_fails.inc();
363-
warn!("KVM_KVMCLOCK_CTRL call failed {}", err);
365+
if self.userfault_resolved.is_none() {
366+
if let Err(err) = self.kvm_vcpu.fd.kvmclock_ctrl() {
367+
METRICS.vcpu.kvmclock_ctrl_fails.inc();
368+
warn!("KVM_KVMCLOCK_CTRL call failed {}", err);
369+
}
364370
}
365371

366372
// Move to 'paused' state.

0 commit comments

Comments
 (0)