hypervisor: stop calling WHvSuspendPartitionTime.

In Vcpu::on_suspend for WHPX, we were calling WHvSuspendPartitionTime
which didn't make sense for several reasons:
* on_suspend is intended to help with guest timekeeping. We don't need
  this on WHPX because the clock is managed via virtio-pvclock.
* WHvSuspendPartitionTime is a partition (read: VM) wide operation.
  That means it should be called once on the VM, not on every VCPU.
  Calling it on every VCPU yields errors on subsequent VCPUs.

BUG=b:294134741
TEST=ran virtio-pvclock enabled VM across a S3 and S4 host suspend. No
complaints from the guest kernel in the serial logs.

Change-Id: Ic5f71d277bf393db74e809cf8e0de3d95b4f895b
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4752840
Reviewed-by: Colin Downs-Razouk <colindr@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Noah Gold <nkgold@google.com>
This commit is contained in:
Noah Gold 2023-08-07 10:56:19 -07:00 committed by crosvm LUCI
parent 7b5a98de2b
commit 654447f562

View file

@ -530,12 +530,11 @@ impl Vcpu for WhpxVcpu {
}
}
/// Signals to the hypervisor that this guest is being paused by userspace. This suspends the
/// entire VM, not just this VCPU. NO virtual processor may be running when this is called.
/// Signals to the hypervisor that this guest is being paused by userspace. On some hypervisors,
/// this is used to control the pvclock. On WHPX, we handle it separately with virtio-pvclock.
/// So the correct implementation here is to do nothing.
fn on_suspend(&self) -> Result<()> {
// TODO: this isn't in capability features, but only available in 19H1 windows.
// safe because we asssume the vm partition is still valid.
check_whpx!(unsafe { WHvSuspendPartitionTime(self.vm_partition.partition) })
Ok(())
}
/// Enables a hypervisor-specific extension on this Vcpu. `cap` is a constant defined by the