[time-nuts] x86 CPU Timekeeping and clock generation

Kasper Pedersen time-nuts at kasperkp.dk
Wed Jan 6 18:39:22 UTC 2021


On 06.01.2021 06.35, Luiz Paulo Damaceno wrote:
> Hi all,
> 
> I'm studying computer's timekeeping and i'm on level of remove the base
> crystal that feeds the entire PLL logic of the motherboard (24 MHz on
> motherboard that i'm using) and compare system's time with an NTP server.
> 

(After reading your posts, and your plot, and guessing at PCish
motherboard and Linux for the board under test)

I did the same thing many moons ago now, and back then it was much
worse. It turned out to be a painful rounding error in the kernel:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a386b5af8edda1c742ce9f77891e112eefffc005

After that quick-fix there was 5e-9 left, about what your plot shows.
After later cleanup that should now be be less than 3e-10.


What clocksource are you using? see

/sys/devices/system/clocksource/clocksource0/current_clocksource
and
/sys/devices/system/clocksource/clocksource0/available_clocksource

You should pick the one that has the least unpredictable
(rounding-error-prone in hardware) PLL ratios between the crystal
oscillator and the clocksource. On most PCs that is hpet, which is
typically driven directly from the crystal, though in your case this may
be a synthesized 14.31818 MHz (the most common hpet frequency).


A short run here using the latest kernel gives an error of < +/- 2e-10
on 14.31818MHz hpet, and 0.5ppm on tsc.


/Kasper Pedersen




More information about the Time-nuts_lists.febo.com mailing list