On Thu, Apr 01, 2021 at 03:41:24PM -0400, Josh Rickmar wrote:
> On Thu, Apr 01, 2021 at 03:22:00PM -0400, Josh Rickmar wrote:
> > On Thu, Apr 01, 2021 at 02:15:48PM -0500, Scott Cheloha wrote:
> > > On Sat, Mar 27, 2021 at 02:20:21AM +0000, Stefmorino wrote:
> > > > > Feel free to share your raw data.
> > > > 
> > > > Also includes some standard sendbug dumps: https://0x0.st/-qng.tgz
> > > 
> > > Thanks!
> > > 
> > > TL;DR:
> > > 
> > > Two things:
> > > 
> > > 1. Could you check whether Linux will use the TSC as a clocksource on
> > >    this machine?  The dmesg output on any given distribution should
> > >    contain lines about the TSC.
> > > 
> > >    [...]
> > > 
> > Hey, thanks for the reminder to try this out with Linux.  Will give it
> > a shot shortly.
> > 
> > As for the BIOS, 1.58 is the current version (found here):
> > 
> > https://support.lenovo.com/us/en/downloads/ds503790
> > 
> > This same issue was happening with all older BIOS versions that I have
> > used as well.

Okay, not great news, but at least the behavior is consistent.

> Seems Linux doesn't like it either:
> 
> localhost:~# dmesg | egrep -i 'tsc|clocksource'
> [    0.000000] tsc: Fast TSC calibration using PIT
> [    0.000000] tsc: Detected 1996.173 MHz processor
> [    0.043227] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 
> 0xffffffff, max_idle_ms: 6370452778343963 ns
> [    0.114728] clocksource: hpet: mask: 0xffffffff max_cycles: 0xffffffff, 
> max_idle_ns: 133484873504 ns
> [    0.131435] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 
> 0x398c1ebcd00, max_idle_ns: 881590807727 ns
> [    0.244772] TSC synchronization [CPU#0 -> CPU#1]:
> [    0.244772] Measured 7296391160 warp between CPUs, turning off TSC clock.
> [    0.244772] tsc: Marking TSC unstable due to check_tsc_sync_source_failed
> [    0.252185] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, 
> max_idle_ns: 6370867519511994 ns
> [    0.316884] clocksource: Switched to clocksource hpet
> [    0.335046] clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, 
> max_idle_ns: 2085701024 ns

Hmmm.  Being able to work around this would be nice.

FreeBSD has code that uses WRMSR to synchronize the TSC:

https://cgit.freebsd.org/src/commit/sys/x86/x86/tsc.c?id=b2c63698d4b81576e0c8842263ee86e86cd34e76

My guess is that support for writing the TSC is not implemented by
every hypervisor, so we would need to be very careful in deciding when
to try it.  Otherwise we end up with protection faults and other crap
we don't want.

Doing this via TSC_ADJUST (instead of writing the TSC directly) is
nicer because you just check for the CPUID level and bit.  No
guesswork.  But we can't in your case because, as I said, no
TSC_ADJUST support on your CPU.

Reply via email to