SMP time warps: count > LATCH - 1

From: dave madden (dhm@mersenne.com)
Date: Tue May 30 2000 - 23:45:57 EST


Hi. I have a long-standing problem with timekeeping on my 2xPIII
machine: sooner or later after a reboot, successive calls to
gettimeofday will return large negative deltas (i.e. time goes
backwards). Several kernel gurus have offered help and patches, but
to no avail; I usually end up just brute-forcing the kernel to never
return a time earlier than one previously returned.

I recently tried 2.3.99-pre7 to see if anything was different (time
is still screwed up); but I added some printk's to see what was
happening. I've found that in the delay_at_last_interrupt calculation
near .../arch/i386/kernel/time.c:523:

                count = ((LATCH-1) - count) * TICK_SIZE;

the value retrieved from the i8253 timer becomes greater than
(LATCH-1) for some reason, and forever after the clock is unstable.
The correlation seems to be good: the system is OK until the first
time (count > (LATCH-1)), and thereafter both (count > (LATCH-1)) and
negative time steps happen 10's to 100's of times per second.

So I wonder:

* Is the count in the 8253 *always* supposed to be less than LATCH-1
  (==11931)?

* Is there anything besides flakey hardware that might cause this
  behaviour?

regards,
d.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:26 EST