Skip to content

Commit df73872

Browse files
committed
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 21bd207 commit df73872

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
@@ -330,10 +330,13 @@ impl Vcpu {
330330
// does not panic on resume, see https://docs.kernel.org/virt/kvm/api.html .
331331
// We do not want to fail if the call is not successful, because depending
332332
// that may be acceptable depending on the workload.
333+
// TODO: once kvmclock is supported with Secret Fredom, remove this condition.
333334
#[cfg(target_arch = "x86_64")]
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);
335+
if self.userfault_resolved.is_none() {
336+
if let Err(err) = self.kvm_vcpu.fd.kvmclock_ctrl() {
337+
METRICS.vcpu.kvmclock_ctrl_fails.inc();
338+
warn!("KVM_KVMCLOCK_CTRL call failed {}", err);
339+
}
337340
}
338341

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

368374
// Move to 'paused' state.

0 commit comments

Comments
 (0)