linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: john stultz <johnstul@us.ibm.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: marcelo <marcelo.tosatti@cyclades.com.br>, andrea <andrea@suse.de>
Subject: [RFC][PATCH] linux-2.4.23-pre9_cyclone-lpj-fix_A0
Date: 03 Nov 2003 14:31:07 -0800	[thread overview]
Message-ID: <1067898667.11436.43.camel@cog.beaverton.ibm.com> (raw)

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;




                 reply	other threads:[~2003-11-03 22:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1067898667.11436.43.camel@cog.beaverton.ibm.com \
    --to=johnstul@us.ibm.com \
    --cc=andrea@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).