Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c9c57929d23e44f258d1b6e7f089e72c85f0bd1c
Commit:     c9c57929d23e44f258d1b6e7f089e72c85f0bd1c
Parent:     ff99e40230d5cdf5e48bcdb4938d0626624bc4cb
Author:     Ravikiran G Thirumalai <[EMAIL PROTECTED]>
AuthorDate: Fri Apr 13 16:28:20 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sat Apr 14 21:44:03 2007 -0700

    failsafe mechanism to HPET clock calibration
    
    Provide a failsafe mechanism to avoid kernel spinning forever at
    read_hpet_tsc during early kernel bootup.
    
    This failsafe mechanism was originally introduced in commit
    2f7a2a79c3ebb44f8b1b7d9b4fd3a650eb69e544, but looks like the hpet split
    from time.c lost it again.
    
    This reintroduces the failsafe mechanism
    
    Signed-off-by: Ravikiran Thirumalai <[EMAIL PROTECTED]>
    Signed-off-by: Shai Fultheim <[EMAIL PROTECTED]>
    Cc: Jack Steiner <[EMAIL PROTECTED]>
    Cc: john stultz <[EMAIL PROTECTED]>
    Cc: Andi Kleen <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 arch/x86_64/kernel/hpet.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/x86_64/kernel/hpet.c b/arch/x86_64/kernel/hpet.c
index 8cf0b8a..b828696 100644
--- a/arch/x86_64/kernel/hpet.c
+++ b/arch/x86_64/kernel/hpet.c
@@ -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;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to