Re: [PATCH] x86/tsc: Require a deviating refined calibration to be reproduced

From: Ruka Yoshida

Date: Thu Dec 03 2026 - 03:12:29 EST


On Tue, 22 Sep 2026, Alexander Warth wrote:
> Not tested
> - One machine, one model, one BIOS revision.
> I have no second affected system.

Hi Alexander,

I have reproduced what appears to be the same TSC calibration issue on
an AMD Zen 3 system while investigating the reproducibility of
post-quantum cryptographic benchmarks.

My system configuration is:

CPU: AMD Ryzen 9 5900HS (Cezanne)
System: ASUS ROG Zephyrus G15 (GA503QR)
BIOS: 416 and 418 (reproduced on both)
Microcode: 0xa500012
Kernel: Ubuntu 7.0.0-44-generic (based on 7.0.14)
CPUIdle driver: acpi_idle

A representative failing boot:

[0.000000] tsc: Detected 3294.109 MHz processor
[1.712331] tsc: Refined TSC clocksource calibration: 3299.119 MHz
[2.667337] Clocksource 'tsc' skewed -829645 ns (0 ms) over
watchdog 'hpet' interval of 515632992 ns (515 ms)
[2.667364] tsc: Marking TSC unstable due to clocksource watchdog
[2.668009] clocksource: Switched to clocksource hpet

The normal refined frequency is approximately 3293.812 MHz.

On my system, processor.max_cstate=2 also appears sufficient
to avoid the issue.
My preliminary boot testswith BIOS 418 yielded the following failure counts:

Maximum C-state HPET enabled HPET disabled
C1 or C2 0/5 0/1
C3 or default 5/5 1/1

With hpet=disable, the kernel falls back to acpi_pm instead.
Booting from power off has also avoided the issue.

I also investigated the practical impact on cryptographic benchmarks
using a locally optimized x86-64 implementation of HQC, a post-quantum
key encapsulation mechanism.

Upstream implementation: https://gitlab.com/pqc-hqc/hqc

The measurements were performed by switching between TSC and HPET
within the same boot, using the same executable pinned to CPU4.

Median of four per-run medians (ns/op):

Workload TSC HPET
Empty interval 20 1397
GF(2^8) inversion 70 1397
GF inversion (batch of 256) 44.91 50.20

For HQC-1 decapsulation, enclosing two clock_gettime() calls within
the RDTSC/RDTSCP measurement interval increased the measured TSC
tick count from 283256 to 291654 (+2.96%). Measurements using the
TSC alone differed by less than 1%.

Using strace, I confirmed that 40,000 clock_gettime() calls resulted
in zero system calls with TSC and 40,000 system calls with HPET.

This additional measurement overhead can obscure small performance
improvements in cryptographic implementations and makes benchmark
results less reproducible across boots.

I have not yet directly observed a TSC discontinuity. I am currently
building an unmodified baseline kernel from the matching Ubuntu
sources and intend to test your patch on this system.

Is the September 22 patch still the preferred version for testing?

The experiments were performed on my own hardware, with ChatGPT
used to assist with the investigation and benchmark implementation.


Best regards,
Ruka Yoshida