]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
time: ntp: fix bug in ntp_update_offset() & do_adjtimex()
authorIngo Molnar <mingo@elte.hu>
Sun, 22 Feb 2009 12:38:40 +0000 (13:38 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 25 Feb 2009 17:38:13 +0000 (18:38 +0100)
commit10dd31a7a17254d6ba793305fc590455393e610e
tree7416cf325f40eb27df6f0455807a0a1dfb203c2d
parentc7986acba211e8285e14c9603fb89e6f4ea0b9f8
time: ntp: fix bug in ntp_update_offset() & do_adjtimex()

Impact: change (fix) the way the NTP PLL seconds offset is initialized/tracked

Fix a bug and do a micro-optimization:

When PLL is enabled we do not reset time_reftime. If the PLL
was off for a long time (for example after bootup), this is
arguably the wrong thing to do.

We already had a hack for the common boot-time case in
ntp_update_offset(), in form of:

if (unlikely(time_status & STA_FREQHOLD || time_reftime == 0))
  secs = 0;

But the update delta should be reset later on too - not just when
the PLL is enabled for the first time after bootup.

So do it on !STA_PLL -> STA_PLL transitions.

This changes behavior, as previously if ntpd was disabled for
a long time and we restarted it, we'd run from that last update,
with a very large delta.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/time/ntp.c