Re: [PATCH v2 04/11] KVM: x86: Process "guest stopped request" once per guest time update

From: Paul Durrant
Date: Tue Feb 04 2025 - 04:20:11 EST


On 01/02/2025 01:38, Sean Christopherson wrote:
Handle "guest stopped" requests once per guest time update in preparation
of restoring KVM's historical behavior of setting PVCLOCK_GUEST_STOPPED
for kvmclock and only kvmclock. For now, simply move the code to minimize
the probability of an unintentional change in functionally.

Note, in practice, all clocks are guaranteed to see the request (or not)
even though each PV clock processes the request individual, as KVM holds
vcpu->mutex (blocks KVM_KVMCLOCK_CTRL) and it should be impossible for
KVM's suspend notifier to run while KVM is handling requests. And because
the helper updates the reference flags, all subsequent PV clock updates
will pick up PVCLOCK_GUEST_STOPPED.

Note #2, once PVCLOCK_GUEST_STOPPED is restricted to kvmclock, the
horrific #ifdef will go away.


:-)

Cc: Paul Durrant <pdurrant@xxxxxxxxxx>
Cc: David Woodhouse <dwmw@xxxxxxxxxxxx>
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/kvm/x86.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)


Reviewed-by: Paul Durrant <paul@xxxxxxx>