[LinuxPPS] still some offset and jitter though using pps
Hal V. Engel
hvengel at astound.net
Thu Oct 30 01:49:50 CET 2008
On Monday 20 October 2008 01:59:21 Nicola Berndt wrote:
> My kernel is a preembile kernel, timer_frequency is configured to 100 hz
> and I don't have a tickless system nor high resolution timer support
> enabled. I also tried the different available clocksources on the kernel
> command line but that didn't help. Strangely clocksource acpi_pm is not
> available under
> /sys/devices/clocksource/clocksource0/available_clocksource , only tsc,
> pit and jiffies.
This peaked my interest and I spent some time checking my configuration and
doing a some testing. I have the following timer related kernel
configuration:
# cat /usr/src/linux/.config | grep TIMER
CONFIG_TIMERFD=y
CONFIG_HIGH_RES_TIMERS=y
CONFIG_HPET_TIMER=y
CONFIG_X86_PM_TIMER=y
CONFIG_HANGCHECK_TIMER=m
# CONFIG_PPS_CLIENT_KTIMER is not set
CONFIG_SND_TIMER=y
# CONFIG_SND_RTCTIMER is not set
CONFIG_LEDS_TRIGGER_TIMER=m
So I have high resolution timers enabled as well as hpet and X86_PM
(=acpi_pm). When I checked my timers I found the following:
# cat /sys/devices/system/clocksource/clocksource0/available_clocksource
acpi_pm jiffies tsc
and
# cat /sys/devices/system/clocksource/clocksource0/current_clocksource
acpi_pm
I had thought that it would have been using the hpet timer since I knew my
chip set had one. Checking my BIOS there was no option to enable the hpet
timer. So I tried the hpet=force boot parm. This changed the above too:
# cat /sys/devices/system/clocksource/clocksource0/available_clocksource
hpet acpi_pm jiffies tsc
and
# cat /sys/devices/system/clocksource/clocksource0/current_clocksource
hpet
OK now I was using the hpet timer. But ntpd would not sync with my GPS (reach
was always 0) and I found that the "when" value displayed when running ntpq -p
kept increasing. I found that setting minpoll and maxpoll for the refclock
corrected this and ntp started working again with my OnCore and the hpet
timer.
At first the clock drifted to a significant degree but eventually it
stabilized. The reason for this was that the drift of the acpi_pm timer and
the hpet were significantly different. With the acpi_pm timer the ntp
frequency was around -52.3 ppm and with the hpet timer it is now around -39.5
ppm so this was almost a 12ppm difference. Once ntp had established the new
drift rate the clock is now at least as stable as it had been with the acpi_pm
timer.
I also noticed some other differences that may be of interest.
1. The one that is perhaps the most interesting is that now the offset
converges on zero much more quickly than it had with the acpi_pm timer after
system start up. It now only takes perhaps 10 minute after system start up
for the clock offset to be <100us. Before it was taking several hours to get
to that point.
2. Once the clock offset gets <30us the two timers have about the same level
of stability and react to things like changing temperatures and system loads
in about the same way based on casual observations.
3. Jitter numbers with the hpet timer are a little lower. It stabilizes at
1us where as with the acpi_pm timer was around 2us and sometimes as high as
3us once it had stabilized.
4. When running ntpq -c rv there is a significant difference in the
"precision" reported. For the acpi_pm timer this was -19 (IE. 2us). For the
hpet timer this is now -23 (125ns) which indicates that ntp at least thinks
that the system clock is significantly more precise. The clock frequency of
my hpet timer is 25MHz which is a 40ns resolution. The spec for hpet timers
calls for a minimum frequency of 10MHz. You can check this with with
# dmesg | grep hpet
hpet clockevent registered
hpet0: at MMIO 0xfed00000, IRQs 2, 8, 31
hpet0: 3 32-bit timers, 25000000 Hz
From the above I have decided that for my system that the hpet timer is better
than the acpi-pm timer in most respects and in particular how quickly ntp gets
the clock down to lower offsets after start up. This may not be the case for
other machines with other chip sets but it may be worth while to test
different timers to see which timer on your machine gives the best results.
My machine has an Nvidia nForce4 chip set.
Hal
More information about the LinuxPPS
mailing list