[LinuxPPS] testing PPS with ktimer
Ken MacLeod
ken at bitsko.slc.ut.us
Tue Nov 9 20:54:37 CET 2010
On Tue, Nov 9, 2010 at 11:09 AM, Ken MacLeod <ken at bitsko.slc.ut.us> wrote:
> I'm tracing through the ntpd code and it currently is discarding the
> PPS time source around line 1310 of ntp_refclock.c in refclock_pps()
> in this test:
>
> /*
> * There can be zero, one or two PPS pulses between polls,
> * depending on the poll interval relative to the PPS interval.
> * The pulse must be newer and within the range gate relative
> * to the last pulse.
> */
> if (ap->ts.tv_sec <= timeout.tv_sec || abs(ap->ts.tv_nsec -
> timeout.tv_nsec) > RANGEGATE)
> return (0);
>
> I'm digging around here now to find out what the pattern is.
Problem found: the issue is in pps-ktimer.c, pps_ktimer_event().
pps_ktimer_event reschedules itself with mod_timer(&ktimer, jiffies +
HZ) which _should_ reschedule in one second, but due to delays (most
specifically the pr_info in that routine) it ends up being more than a
second each time. Enough that it is greater than RANGEGATE. You can
see this with ppstest by watching the time skew.
I made a quick fix to calculate the delay from getnstimeofday and ntpd
is now using the pps-ktimer source.
More information about the LinuxPPS
mailing list