linux-mips
[Top] [All Lists]

[PATCH] loosing time with CPU counter timer

To: linux-mips@linux-mips.org
Subject: [PATCH] loosing time with CPU counter timer
From: Jun Sun <jsun@mvista.com>
Date: Mon, 14 Apr 2003 17:16:55 -0700
Cc: jsun@mvista.com
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.2.5i
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
   register.

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 ....

Jun

Attachment: 030414.loosing-time-with-cpu-counter-timer.patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>