Re: [PATCH v2 1/2] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for accurate KVM clock migration

From: Paul Durrant
Date: Wed Apr 10 2024 - 08:43:55 EST


On 10/04/2024 13:09, David Woodhouse wrote:
On 10 April 2024 11:29:13 BST, Paul Durrant <xadimgnik@xxxxxxxxx> wrote:
On 10/04/2024 10:52, Jack Allister wrote:
+ * It's possible that this vCPU doesn't have a HVCLOCK configured
+ * but the other vCPUs may. If this is the case calculate based
+ * upon the time gathered in the seqcount but do not update the
+ * vCPU specific PVTI. If we have one, then use that.

Given this is a per-vCPU ioctl, why not fail in the case the vCPU doesn't have HVCLOCK configured? Or is your intention that a GET/SET should always work if TSC is stable?

It definitely needs to work for SET even when the vCPU hasn't been run yet (and doesn't have a hvclock in vcpu->arch.hv_clock).

So would it make sense to set up hvclock earlier?