On Mon, Apr 14, 2003 at 05:16:55PM -0700, Jun Sun wrote:
> This patch fixes an ancient timer bug.
> If one uses CPU counter as the system timer, it looses time
> over the time.
> Basically, timer_interrupt() does the following when it serves
> an cpu counter interrupt (only relavent part shown);
> 0) interrupt happens
> 1) read cpu counter;
> 2) add it with cycles_per_jiffy, and set the value to compare
> The problem is that cpu counter could increase between 0) and 1),
> say by delta units. Then the next timer interrupt is set to
> t0 + delta + cycles_per_unit, instead of t0 + cycles_per_unit,
> (where t0 is the current timer interrupt time)
> Similar bug also exists in old-time.c, but anybody really cares? :)
> Especially it has been there for quite a while ....
After a refreshing weekend I realize there exists a much more
elegant fix for the problem. :) See the patch attached.
Unfortuately I have already checked in the not-so-elegant fix.
So the actual patch to check in this time will be diff between
this one and the previous patch.
Description: Text document