Bug 215037

Summary: Thinkpad X395: TSC unstable
Product: Platform Specific/Hardware Reporter: Martin Jørgensen (mkj)
Component: x86-64Assignee: platform_x86_64 (platform_x86_64)
Status: RESOLVED ANSWERED    
Severity: normal CC: bp, nix.sasl
Priority: P1    
Hardware: x86-64   
OS: Linux   
Kernel Version: 5.14.16 Subsystem:
Regression: No Bisected commit-id:
Bug Depends on: 202525    
Bug Blocks:    
Attachments: dmesg output after boot

Description Martin Jørgensen 2021-11-15 20:00:30 UTC
Created attachment 299585 [details]
dmesg output after boot

I'm running latest Debian Unstable (kernel ) on a ThinkPad X395 ()

During boot the kernel marks the TSC as unsable.

[    3.608099] clocksource: timekeeping watchdog on CPU6: Marking clocksource 'tsc' as unstable because the skew is too large:
[    3.608108] clocksource:                       'hpet' wd_nsec: 515089627 wd_now: 308a7d6 wd_last: 2981eac mask: ffffffff
[    3.608111] clocksource:                       'tsc' cs_nsec: 516009461 cs_now: 8af414c81 cs_last: 86ec98207 mask: ffffffffffffffff
[    3.608114] clocksource:                       'tsc' is current clocksource.
[    3.608123] tsc: Marking TSC unstable due to clocksource watchdog
[    3.611142] TSC found unstable after boot, most likely due to broken BIOS. Use 'tsc=unstable'.
[    3.611152] sched_clock: Marking unstable (3609109495, 2031636)<-(3614769552, -3628424)
[    3.611387] clocksource: Checking clocksource tsc synchronization from CPU 3 to CPUs 0-1,4,6.
[    3.611738] clocksource: Switched to clocksource hpet

I can't tell if it breaks anything serious. When setting "tsc=unstable" kernel option, dmesg says:

[    0.975959] Unstable clock detected, switching default tracing clock to "global"
               If you want to keep using the local clock, then add:
                 "trace_clock=local"
               on the kernel command line
Comment 1 Martin Jørgensen 2021-11-15 20:05:57 UTC
Forgot to add:
"
I'm running latest Debian Unstable (Linux rw 5.14.0-4-amd64 #1 SMP Debian 5.14.16-1 (2021-11-03) x86_64 GNU/Linux) on a ThinkPad X395 (LENOVO 20NL001RMX/20NL001RMX, BIOS R13ET50W(1.24 ) 06/11/2021, ThinkPad BIOS R13ET50W(1.24 ), EC R13HT50W)
"
Comment 2 Nix\ 2021-12-20 00:01:23 UTC
With acpi=off clocksourcec=tsc in kernel cmdline, the kernel select tsc-early and no mark an unstable, but the 4 cores of the Ryzen 3 3200U dissapear and show only one.
Kernel 5.15.10 and 5.16-rc5
AMD Ryzen 3 3200U Lenovo Ideapad L340-15API

But i remember the same bug with a old Phenom 945 using Fedora 28, so, a firmware amd bug?
Comment 3 Borislav Petkov 2022-01-06 18:38:17 UTC
Lenovo are known to f*ck with the TSC in the BIOS when they should not. At all. I have a T14 here which has the same issue - it actually comes out of reset unsynchronized. AFAIK, some BIOS updates have fixed this but you'll have to update your BIOS and see. Unfortunately, there's nothing we can do in the kernel about it. Sorry.