Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Ravikiran G Thirumalai and committed by
Linus Torvalds
c9c57929 ff99e402

+6 -3
+6 -3
arch/x86_64/kernel/hpet.c
··· 191 191 192 192 #define TICK_COUNT 100000000 193 193 #define TICK_MIN 5000 194 + #define MAX_TRIES 5 194 195 195 196 /* 196 197 * Some platforms take periodic SMI interrupts with 5ms duration. Make sure none ··· 199 198 */ 200 199 static void __init read_hpet_tsc(int *hpet, int *tsc) 201 200 { 202 - int tsc1, tsc2, hpet1; 201 + int tsc1, tsc2, hpet1, i; 203 202 204 - do { 203 + for (i = 0; i < MAX_TRIES; i++) { 205 204 tsc1 = get_cycles_sync(); 206 205 hpet1 = hpet_readl(HPET_COUNTER); 207 206 tsc2 = get_cycles_sync(); 208 - } while (tsc2 - tsc1 > TICK_MIN); 207 + if (tsc2 - tsc1 > TICK_MIN) 208 + break; 209 + } 209 210 *hpet = hpet1; 210 211 *tsc = tsc2; 211 212 }