apic and 8254 wraparound ...

From: Herbert Poetzl
Date: Thu Dec 23 2004 - 19:13:20 EST



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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/