Skip to content

Instantly share code, notes, and snippets.

@mdcallag
Last active October 24, 2022 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdcallag/d31458db32e8ca460aef09eb43a4e2ec to your computer and use it in GitHub Desktop.
Save mdcallag/d31458db32e8ca460aef09eb43a4e2ec to your computer and use it in GitHub Desktop.
# I am not the only one using an AMD who has this problem
# https://www.reddit.com/r/linuxquestions/comments/ts1hgw/zen_3_tsc_unstable_which_part_to_blame
# Maybe kernel changes made it worse, and now might make it better
# https://lore.kernel.org/lkml/20211027164352.GA23273@incl/
# And more via https://www.google.com/search?q=amd+read_hpet
# Output from "perf top" on slower system -> why is read_hpet.part.0 using so much CPU
Samples: 59K of event 'cycles', 4000 Hz, Event count (approx.): 29054393413 lost: 0/0 drop: 0/0
Overhead Shared Object Symbol
43.08% [kernel] [k] read_hpet.part.0
1.82% [kernel] [k] psi_group_change
1.45% [kernel] [k] copy_user_generic_string
# slower system
[ 2.164887] clocksource: timekeeping watchdog on CPU3: Marking clocksource 'tsc' as unstable because the skew is too large:
[ 2.164903] clocksource: 'hpet' wd_nsec: 511824407 wd_now: 1bfd1b4 wd_last: 14fff2a mask: ffffffff
[ 2.164913] clocksource: 'tsc' cs_nsec: 507936081 cs_now: 941afb6f4 cs_last: 904c95d80 mask: ffffffffffffffff
[ 2.164921] clocksource: 'tsc' is current clocksource.
[ 2.164932] tsc: Marking TSC unstable due to clocksource watchdog
[ 2.164947] TSC found unstable after boot, most likely due to broken BIOS. Use 'tsc=unstable'.
[ 2.164953] sched_clock: Marking unstable (2164461887, 485058)<-(2168194753, -3247949)
[ 2.165100] clocksource: Checking clocksource tsc synchronization from CPU 3 to CPUs 0-2.
[ 2.614948] clocksource: Switched to clocksource hpet
# faster system
[ 1.352218] tsc: Refined TSC clocksource calibration: 1996.248 MHz
[ 1.352239] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x398cac3bdaf, max_idle_ns: 881590646346 ns
[ 1.352300] clocksource: Switched to clocksource tsc
# slower system after:
1) edit /etc/default/grub -> GRUB_CMDLINE_LINUX_DEFAULT="clocksource=tsc tsc=reliable"
2) update-grub
3) reboot
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-5.15.0-52-generic root=UUID=b74a55d4-c21f-461b-924e-ce580094c502 ro clocksource=tsc tsc=reliable
[ 0.000000] tsc: Fast TSC calibration using PIT
[ 0.000000] tsc: Detected 1996.316 MHz processor
[ 0.045873] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-5.15.0-52-generic root=UUID=b74a55d4-c21f-461b-924e-ce580094c502 ro clocksource=tsc tsc=reliable
[ 0.135487] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x398d2ccd6f0, max_idle_ns: 881590761034 ns
[ 0.328800] clocksource: Switched to clocksource tsc-early
[ 1.359537] tsc: Refined TSC clocksource calibration: 2011.757 MHz
[ 1.359559] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x1cff90860c8, max_idle_ns: 440795227807 ns
[ 1.359609] clocksource: Switched to clocksource tsc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment