public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* apic and 8254 wraparound ...
@ 2004-12-24  0:11 Herbert Poetzl
  2004-12-23 23:37 ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Herbert Poetzl @ 2004-12-24  0:11 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel


Hi Ingo! Folks!

I was investigating why linux-2.6.10-rc3 wasn't booting
with HZ set to higher values (like 5k,10k or 20k) on
certain machines/configurations and I tracked that down
to the wait_8254_wraparound() which does the following:

/* next tick in 8254 can be caught by catching timer wraparound */
static void __init wait_8254_wraparound(void)
{
        unsigned int curr_count, prev_count=~0;
        int delta;

        curr_count = get_8254_timer_count();

        do {
                prev_count = curr_count;
                curr_count = get_8254_timer_count();
                delta = curr_count-prev_count;

        /*
         * This limit for delta seems arbitrary, but it isn't, it's
         * slightly above the level of error a buggy Mercury/Neptune
         * chipset timer can cause.
         */

        } while (delta < 300);
}

further investigation showed that the inital value for
the timer is lower than 300 for higher HZ values, so
the kernel keeps spinning in this loop (which can be 
easily fixed by 'adjusting' the limit), but I ask myself, 
if this check can be simplified ...

I don't know what kind of errors the buggy Mercury/
Neptune chipset timers can cause, maybe they need some
special handling, but from the available code, what 
about something like this:


@@ -878,22 +878,14 @@ static unsigned int __init get_8254_time
 static void __init wait_8254_wraparound(void)
 {
 	unsigned int curr_count, prev_count=~0;
-	int delta;
 
 	curr_count = get_8254_timer_count();
 
 	do {
 		prev_count = curr_count;
 		curr_count = get_8254_timer_count();
-		delta = curr_count-prev_count;
 
-	/*
-	 * This limit for delta seems arbitrary, but it isn't, it's
-	 * slightly above the level of error a buggy Mercury/Neptune
-	 * chipset timer can cause.
-	 */
-
-	} while (delta < 300);
+	} while (curr_count <= prev_count);
 }
 
 /*


TIA,
Herbert


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-12-26 19:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-24  0:11 apic and 8254 wraparound Herbert Poetzl
2004-12-23 23:37 ` Alan Cox
2004-12-24 20:00   ` Herbert Poetzl
2004-12-24 19:40     ` Alan Cox
2004-12-25 22:48       ` Herbert Poetzl
2004-12-26 18:08         ` Pavel Machek
2004-12-26 19:42           ` Herbert Poetzl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox