From: Ravikiran G Thirumalai <kiran@scalex86.org>
To: Andi Kleen <ak@suse.de>
Cc: torvalds@linux-foundation.org,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, Jack Steiner <steiner@sgi.com>,
john stultz <johnstul@us.ibm.com>,
shai@scalex86.org, benzi@scalex86.org, discuss@x86-64.org
Subject: [patch 2.6.21-rc6] failsafe mechanism to HPET clock calibration
Date: Fri, 13 Apr 2007 16:28:20 -0700 [thread overview]
Message-ID: <20070413232820.GA9496@localhost.localdomain> (raw)
Provide a failsafe mechanism to avoid kernel spinning for ever at read_hpet_tsc
during early kernel bootup.
This failsafe mechanism was introduced in 21-rc,
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=2f7a2a79c3ebb44f8b1b7d9b4fd3a650eb69e544
But looks like the hpet split from time.c lost the commit.
This patch reintroduces the failsafe mechanism
Signed-off-by: Ravikiran Thirumalai <kiran@scalex86.org>
Signed-off-by: Shai Fultheim <shai@scalex86.org>
Cc: Jack Steiner <steiner@sgi.com>
Cc: john stultz <johnstul@us.ibm.com>
Cc: Andi Kleen <ak@suse.de>
Index: linux-2.6.21-rc5/arch/x86_64/kernel/hpet.c
===================================================================
--- linux-2.6.21-rc5.orig/arch/x86_64/kernel/hpet.c 2007-04-11 16:03:05.000000000 -0700
+++ linux-2.6.21-rc5/arch/x86_64/kernel/hpet.c 2007-04-11 18:49:36.000000000 -0700
@@ -191,6 +191,7 @@ int hpet_reenable(void)
#define TICK_COUNT 100000000
#define TICK_MIN 5000
+#define MAX_TRIES 5
/*
* Some platforms take periodic SMI interrupts with 5ms duration. Make sure none
@@ -198,13 +199,15 @@ int hpet_reenable(void)
*/
static void __init read_hpet_tsc(int *hpet, int *tsc)
{
- int tsc1, tsc2, hpet1;
+ int tsc1, tsc2, hpet1, i;
- do {
+ for (i = 0; i < MAX_TRIES; i++) {
tsc1 = get_cycles_sync();
hpet1 = hpet_readl(HPET_COUNTER);
tsc2 = get_cycles_sync();
- } while (tsc2 - tsc1 > TICK_MIN);
+ if (tsc2 - tsc1 > TICK_MIN)
+ break;
+ }
*hpet = hpet1;
*tsc = tsc2;
}
next reply other threads:[~2007-04-13 23:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-13 23:28 Ravikiran G Thirumalai [this message]
2007-04-14 0:46 ` [patch 2.6.21-rc6] failsafe mechanism to HPET clock calibration Andi Kleen
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=20070413232820.GA9496@localhost.localdomain \
--to=kiran@scalex86.org \
--cc=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=benzi@scalex86.org \
--cc=discuss@x86-64.org \
--cc=johnstul@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shai@scalex86.org \
--cc=steiner@sgi.com \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.