]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
x86: Defer early TSC timecounter calibration to SI_SUB_CPU
authorMark Johnston <markj@FreeBSD.org>
Sat, 5 Mar 2022 00:34:43 +0000 (19:34 -0500)
committerMark Johnston <markj@FreeBSD.org>
Thu, 31 Mar 2022 16:05:46 +0000 (12:05 -0400)
commitb6c207a8301e3da94b6282bdf4a798f1e898fc29
tree2067aa75240e3ce457ec69314c675663e7d67eb8
parentae95c02d02c29ddbb3767ca13731325be0688a28
x86: Defer early TSC timecounter calibration to SI_SUB_CPU

If we can't determine the TSC frequency using CPU registers, we need to
give a chance for Hyper-V drivers to register a timecounter (during
SI_SUB_HYPERVISOR) since an emulated 8254 might not be available.
Thus, split probe_tsc_freq() into early and late stages, and wait until
the latter to attempt calibration using a reference clock.

Fixes: 84369dd52369 ("x86: Probe the TSC frequency earlier")
Reported and tested by: khng, Shawn Webb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 075e2779aca7cbd8f201ce0e1bb60318d0cbd8b8)
sys/x86/x86/tsc.c