* [RFC][PATCH] linux-2.4.23-pre9_cyclone-lpj-fix_A0
@ 2003-11-03 22:31 john stultz
0 siblings, 0 replies; only message in thread
From: john stultz @ 2003-11-03 22:31 UTC (permalink / raw)
To: lkml; +Cc: marcelo, andrea
Marcelo, All,
In working to resolve an issue in SLES8 SP3, Andrea caught a bug in the
cyclone counter's lost-tick compensation code. In the code, we use the
calibrated loops_per_jiffies to detect the number of ticks that have
passed, however the lost-ticks code begins running before
loops_per_jiffies is calculated. This circular dependency that can cause
loops_per_jiffies to be occasionally mis-calculated.
The fix drops use of loops_per_jiffies and uses code from 2.5 to do the
same thing. This patch only affects x440/x445 machines.
Many thanks for Andrea for catching this.
Any comments and feedback on the patch is welcome.
thanks
-john
diff -Nru a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
--- a/arch/i386/kernel/time.c Mon Nov 3 13:47:16 2003
+++ b/arch/i386/kernel/time.c Mon Nov 3 13:47:16 2003
@@ -279,6 +279,7 @@
static inline void mark_timeoffset_cyclone(void)
{
int count;
+ unsigned long lost;
unsigned long delta = last_cyclone_timer;
spin_lock(&i8253_lock);
/* quickly read the cyclone timer */
@@ -293,11 +294,12 @@
spin_unlock(&i8253_lock);
/*lost tick compensation*/
- delta = last_cyclone_timer - delta;
- if(delta > loops_per_jiffy+2000){
- delta = (delta/loops_per_jiffy)-1;
- jiffies += delta;
- }
+ delta = last_cyclone_timer - delta;
+ delta /= (CYCLONE_TIMER_FREQ/1000000);
+ delta += delay_at_last_interrupt;
+ lost = delta/(1000000/HZ);
+ if (lost >= 2)
+ jiffies += lost-1;
count = ((LATCH-1) - count) * TICK_SIZE;
delay_at_last_interrupt = (count + LATCH/2) / LATCH;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-11-03 22:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-03 22:31 [RFC][PATCH] linux-2.4.23-pre9_cyclone-lpj-fix_A0 john stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).