Skip to content

Commit

Permalink
[PATCH] x86-64: - Ignore long SMI interrupts in clock calibration cod…
Browse files Browse the repository at this point in the history
…e - update 1

Add failsafe mechanism to HPET/TSC clock calibration.

	Signed-off-by: Jack Steiner <steiner@sgi.com>

Updated to include failsafe mechanism & additional community feedback.
Patch built on latest 2.6.20-rc4-mm1 tree.

Signed-off-by: Andi Kleen <ak@suse.de>
  • Loading branch information
Jack Steiner authored and Andi Kleen committed Feb 13, 2007
1 parent 6c5806c commit 2f7a2a7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions arch/x86_64/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,20 +657,25 @@ core_initcall(cpufreq_tsc);

#define TICK_COUNT 100000000
#define TICK_MIN 5000
#define MAX_READ_RETRIES 5

/*
* Some platforms take periodic SMI interrupts with 5ms duration. Make sure none
* occurs between the reads of the hpet & TSC.
*/
static void __init read_hpet_tsc(int *hpet, int *tsc)
{
int tsc1, tsc2, hpet1;
int tsc1, tsc2, hpet1, retries = 0;
static int msg;

do {
tsc1 = get_cycles_sync();
hpet1 = hpet_readl(HPET_COUNTER);
tsc2 = get_cycles_sync();
} while (tsc2 - tsc1 > TICK_MIN);
} while (tsc2 - tsc1 > TICK_MIN && retries++ < MAX_READ_RETRIES);
if (retries >= MAX_READ_RETRIES && !msg++)
printk(KERN_WARNING
"hpet.c: exceeded max retries to read HPET & TSC\n");
*hpet = hpet1;
*tsc = tsc2;
}
Expand Down

0 comments on commit 2f7a2a7

Please sign in to comment.