]> git.ipfire.org Git - thirdparty/postgresql.git/commit
instrumentation: Avoid CPUID 0x15/0x16 for Hypervisor TSC frequency
authorAndres Freund <andres@anarazel.de>
Thu, 9 Apr 2026 15:50:24 +0000 (11:50 -0400)
committerAndres Freund <andres@anarazel.de>
Thu, 9 Apr 2026 15:50:46 +0000 (11:50 -0400)
commit7fc36c5db55016f7a1d89b5e2efd82fe6fd39632
tree9a9871ec87a4a118b3d0b8f56c4def8d5990c0da
parent60165db6e1f21ec6cbfce4fd8fd1e521a043d954
instrumentation: Avoid CPUID 0x15/0x16 for Hypervisor TSC frequency

This restricts the retrieval of the TSC frequency whilst under a Hypervisor to
either Hypervisor-specific CPUID registers (0x40000010), or TSC
calibration. We previously allowed retrieving from the traditional CPUID
registers for TSC frequency (0x15/0x16) like on bare metal, but it turns out
that they are not trustworthy when virtualized and can report wildly incorrect
frequencies, like 7 kHz when the actual calibrated frequencty is 2.5 GHz.

Per report from buildfarm member drongo.

Author: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/jr4hk2sxhqcfpb67ftz5g4vw33nm67cgf7go3wwmqsafu5aclq%405m67ukuhyszz
src/port/pg_cpu_x86.c