Re: [PATCH RFC] x86/tsc: Make recalibration default on for TSC_KNOWN_FREQ cases

From: Paul E. McKenney
Date: Fri Jun 02 2023 - 15:08:16 EST


On Fri, Jun 02, 2023 at 11:36:54AM -0700, Dave Hansen wrote:
> On 6/2/23 11:29, Paul E. McKenney wrote:
> >>> One downside is, many VMs also has X86_FEATURE_TSC_KNOWN_FREQ set,
> >>> and they will also do this recalibration.
> >> It's also pointless for those SoCs which lack legacy hardware.
> >>
> >> So why do you force this on everyone?
> > Just for the record, this patch could be helpful in allowing victims
> > of TSC mis-synchronization to more easily provide a more complete bug
> > report to the firmware people. There is of course no point if there is
> > already a fix available.
> >
> > But it is not all that hard to work around not having this patch upstream.
> > This can be hand-applied as needed, NTP drift rates can be pressed
> > into service for those of us having atomic clocks near all our servers,
> > or the firmware guys can be tasked with figuring it out.
> >
> > So this patch would be nice to have, but we could live without it.
>
> Is this the kind of thing we could relegate to a kernel unit test? Like
> make the recalibration logic _available_, but don't have it affect the
> rest of the system.
>
> I love patching my kernel as much as the next guy. But, you know what I
> *don't* love? Explaining how to patch kernels to other people. ;)

One could argue that we already have the TSC equivalent of a kernel unit
test with the tsc=recalibrate kernel boot parameter.

So, would it make sense to have something like tsc=recalibrate (already
present) in the guise of something like hpet=recalibrate and/or
pmtmr=recalibrate in order to allow people to opt into recalibrating
whatever timer is marked unstable?

Thanx, Paul