Clocksource changes from TSC to HPET after sleep. Kills performance.

Bug #1821441 reported by Shambler
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
linux-signed-hwe (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

This has been verified with a freshly reset bios. Every time I sleep Ubuntu and wake, the clock gets switched from TSC to HPET - and then processes such as gnome-shell take up an excessive amount of CPU (with trace showing clock_gettime being the culprit) - and general performance is severely degraded.

Here is the relevant part of syslog:
Mar 23 08:18:19 JTR4 kernel: [ 2921.476536] TSC synchronization [CPU#0 -> CPU#4]:
Mar 23 08:18:19 JTR4 kernel: [ 2921.476537] Measured 532 cycles TSC warp between CPUs, turning off TSC clock.
Mar 23 08:18:19 JTR4 kernel: [ 2921.476538] tsc: Marking TSC unstable due to check_tsc_sync_source failed
Mar 23 08:18:19 JTR4 kernel: [ 2921.476545] TSC found unstable after boot, most likely due to broken BIOS. Use 'tsc=unstable'.
Mar 23 08:18:19 JTR4 kernel: [ 2921.476546] sched_clock: Marking unstable (2920879403495, 582702087)<-(2921692577659, -216036333)
Mar 23 08:18:19 JTR4 kernel: [ 2921.476773] cache: parent cpu4 should not be sleeping
Mar 23 08:18:19 JTR4 kernel: [ 2921.476839] microcode: CPU4: patch_level=0x0800820b
Mar 23 08:18:19 JTR4 kernel: [ 2921.477161] CPU4 is up
Mar 23 08:18:19 JTR4 kernel: [ 2921.477177] clocksource: Switched to clocksource hpet

This is in 18.04 LTS HWE, with an Asus Zenith Extreme Alpha motherboard and AMD Threadripper 2990WX CPU.

This looks like it is linked to this bug - as someone in the comments here shows a trace with clock_gettime using up excessive CPU, as well:
https://bugs.launchpad.net/ubuntu/+source/gnome-shell/+bug/1773959

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: linux-image-4.18.0-16-generic 4.18.0-16.17~18.04.1
ProcVersionSignature: Ubuntu 4.18.0-16.17~18.04.1-generic 4.18.20
Uname: Linux 4.18.0-16-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.9-0ubuntu7.5
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Sat Mar 23 08:47:06 2019
InstallationDate: Installed on 2019-03-12 (11 days ago)
InstallationMedia: Ubuntu 18.04.2 LTS "Bionic Beaver" - Release amd64 (20190210)
SourcePackage: linux-signed-hwe
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Shambler (jbarrett847) wrote :
Shambler (jbarrett847)
summary: - Clocksource changes from TRC to HPET after sleep. Kills performance.
+ Clocksource changes from TSC to HPET after sleep. Kills performance.
description: updated
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in linux-signed-hwe (Ubuntu):
status: New → Confirmed
Revision history for this message
Greggth (greggth) wrote :

I'm seeing the same thing. Basically, any use of clock_gettime now requires a syscall (isntead of using vsdo). The applications I'm running do a lot of clock_gettime's, and basically cannot run performantly anymore after this happens.

This machine is a:
System Information
        Manufacturer: Alienware
        Product Name: Alienware Aurora Ryzen Edition
        Version: 1.0.1

cpu:
processor : 31
vendor_id : AuthenticAMD
cpu family : 23
model : 113
model name : AMD Ryzen 9 3950X 16-Core Processor
stepping : 0
microcode : 0x8701013

kernel:
4.15.0-121-generic #123-Ubuntu SMP Mon Oct 5 16:16:40 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

kernel log after resuming from sleep:
Oct 14 15:28:59 viable kernel: [ 3442.068452] Measured 70 cycles TSC warp between CPUs, turning off TSC clock.
Oct 14 15:28:59 viable kernel: [ 3442.068455] tsc: Marking TSC unstable due to check_tsc_sync_source failed
Oct 14 15:28:59 viable kernel: [ 3442.068472] TSC found unstable after boot, most likely due to broken BIOS. Use 'tsc=unstable'.
Oct 14 15:28:59 viable kernel: [ 3442.068473] sched_clock: Marking unstable (3442081459163, -14096408)<-(3442040805073, 27665648)
Oct 14 15:28:59 viable kernel: [ 3442.068582] cache: parent cpu1 should not be sleeping
Oct 14 15:28:59 viable kernel: [ 3442.068845] CPU1 is up
Oct 14 15:28:59 viable kernel: [ 3442.067786] clocksource: Switched to clocksource hpet

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Has the problem been observed in kernel versions 5.x? Like in Ubuntu 20.04 onward?

Changed in linux-signed-hwe (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for linux-signed-hwe (Ubuntu) because there has been no activity for 60 days.]

Changed in linux-signed-hwe (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.