public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Herbert Poetzl <herbert@13thfloor.at>
To: Ingo Molnar <mingo@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: apic and 8254 wraparound ...
Date: Fri, 24 Dec 2004 01:11:44 +0100	[thread overview]
Message-ID: <20041224001144.GA5192@mail.13thfloor.at> (raw)


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


             reply	other threads:[~2004-12-24  0:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-24  0:11 Herbert Poetzl [this message]
2004-12-23 23:37 ` apic and 8254 wraparound 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

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=20041224001144.GA5192@mail.13thfloor.at \
    --to=herbert@13thfloor.at \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    /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