Re: [PATCH v7 31/36] KVM: x86: Add KVM_[GS]ET_CLOCK_GUEST for accurate KVM clock migration

David Woodhouse <[email protected]>
Newsgroups gmane.comp.emulators.xen.devel,gmane.comp.emulators.kvm.devel,gmane.linux.documentation,gmane.linux.kernel
Message-ID <[email protected]>
On Fri, 2026-07-31 at 16:24 -0700, Sean Christopherson wrote:
> 
> > +	/*
> > +	 * Allow for a discrepancy of 1 kHz either way between the TSC
> > +	 * frequency used to generate the user's pvclock and the current
> > +	 * host's measured frequency, since they may not precisely match.
> > +	 */
> > +	if (user_tsc_hz < curr_tsc_hz - 1000 ||
> > +	    user_tsc_hz > curr_tsc_hz + 1000) {
> 
> I don't follow, why is KVM restricting what frequency userspace can set?

Userspace actually sets the frequency with KVM_SET_TSC_KHZ. What KVM is
insisting upon here is that the input to KVM_SET_CLOCK_GUEST is
*consistent* with the guest's TSC frequency (within a little slop
caused by different host TSCs).

I think the comment above it is fairly badly worded though ("host's
measured frequency"), so I'll fix that.
smime.p7s (application/pkcs7-signature, 6 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.