mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-16 21:34:10 +00:00
c2705ceaeb
Prior to this commit, the TSC and local APIC frequencies were calibrated at boot time by measuring the clocks before and after a one-second sleep. This was simple and effective, but had the disadvantage of *requiring a one-second sleep*. Rather than making two clock measurements (before and after sleeping) we now perform many measurements; and rather than simply subtracting the starting count from the ending count, we calculate a best-fit regression between the target clock and the reference clock (for which the current best available timecounter is used). While we do this, we keep track of an estimate of the uncertainty in the regression slope (aka. the ratio of clock speeds), and stop measuring when we believe the uncertainty is less than 1 PPM. In order to avoid the risk of aliasing resulting from the data-gathering loop synchronizing with (a multiple of) the frequency of the reference clock, we add some additional spinning depending upon the iteration number. For numerical stability and simplicity of implementation, we make use of floating-point arithmetic for the statistical calculations. On the author's Dell laptop, this reduces the time spent in calibration from 2000 ms to 29 ms; on an EC2 c5.xlarge instance, it is reduced from 2000 ms to 2.5 ms. Reviewed by: bde (previous version), kib MFC after: 1 month Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D33802 |
||
---|---|---|
.. | ||
config.mk | ||
dtb.build.mk | ||
dtb.mk | ||
files | ||
files.amd64 | ||
files.arm | ||
files.arm64 | ||
files.i386 | ||
files.powerpc | ||
files.riscv | ||
files.x86 | ||
kern.mk | ||
kern.opts.mk | ||
kern.post.mk | ||
kern.pre.mk | ||
kmod.mk | ||
kmod.opts.mk | ||
kmod_syms.awk | ||
kmod_syms_prefix.awk | ||
ldscript.amd64 | ||
ldscript.arm | ||
ldscript.arm64 | ||
ldscript.i386 | ||
ldscript.kmod.amd64 | ||
ldscript.kmod.i386 | ||
ldscript.powerpc | ||
ldscript.powerpc64 | ||
ldscript.powerpc64le | ||
ldscript.powerpcspe | ||
ldscript.riscv | ||
Makefile.amd64 | ||
Makefile.arm | ||
Makefile.arm64 | ||
Makefile.i386 | ||
Makefile.powerpc | ||
Makefile.riscv | ||
newvers.sh | ||
NOTES | ||
options | ||
options.amd64 | ||
options.arm | ||
options.arm64 | ||
options.i386 | ||
options.powerpc | ||
options.riscv | ||
std.nodebug | ||
sysent.mk | ||
systags.sh | ||
vdso_amd64.ldscript | ||
vdso_amd64_ia32.ldscript | ||
WITHOUT_SOURCELESS | ||
WITHOUT_SOURCELESS_HOST | ||
WITHOUT_SOURCELESS_UCODE |