[ntp:questions] Clock skew changes drastically between reboots

Spoon devnull at localhost.com
Fri Apr 6 08:29:56 UTC 2007

Hal Murray wrote:

> Spoon wrote:
>> I've noticed something I find very strange on the systems I have to work
>> with. Every time I reboot the computer, the clock skew of the local
>> clock changes, sometimes by what seems to be a huge amount.
>> For example, I boot the computer, let ntpd run for 12 hours, and the
>> value recorded in the drift file is 35 ppm. I reboot the computer, let
>> ntpd run for 12 hours, and I get 5 ppm...
> I'm chasing the same glitch.

I'm relieved to know I am not alone :-)

> I've seen it on two systems, both i386 running Linux 2.6 kernel.
> I think I've tracked it to tsc_init which calls calculate_cpu_khz
> both are in ./arch/i386/kernel/tsc.c

Take a look at init/calibrate.c too.
They use the timestamp counter to calibrate lpj (loops per jiffy).
You can skip the calibration by providing lpj at boot-time.

If you don't provide lpj, it is estimated, and the kernel prints:

Calibrating delay using timer specific routine..
   2535.19 BogoMIPS (lpj=12675953)

If you specify lpj=N on the boot command, the kernel prints:

Calibrating delay loop (skipped)... 2535.16 BogoMIPS preset

> tsc_init prints a line like this:
>   kernel: Detected 2793.226 MHz processor.
> The problem is that calculate_cpu_khz doesn't return the
> same answer.  I hacked the code to call/print it 10 times
> and I get things like this:
>  kernel: Detected 2793.287 MHz processor.
>  kernel: Detected 2793.225 MHz processor.
>  kernel: Detected 2793.228 MHz processor.
>  kernel: Detected 2793.304 MHz processor.
>  kernel: Detected 2793.242 MHz processor.
>  kernel: Detected 2793.192 MHz processor.
>  kernel: Detected 2793.334 MHz processor.
>  kernel: Detected 2793.203 MHz processor.
>  kernel: Detected 2793.292 MHz processor.
>  kernel: Detected 2793.237 MHz processor.
> That's a spread of about 50 ppm which matches what I've seen
> before I started looking for this glitch.

I will definitely take a look!


More information about the questions mailing list