x86: disable TSC for sched_clock() when calibration failed
authorThomas Gleixner <tglx@linutronix.de>
Sun, 18 May 2008 20:17:59 +0000 (22:17 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 23 May 2008 12:08:06 +0000 (14:08 +0200)
When the TSC calibration fails then TSC is still used in
sched_clock(). Disable it completely in that case.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@kernel.org
arch/x86/kernel/tsc_32.c

index b087d691f165842836fe362b65c361f57669841e..068759db63ddebca0ed5561a1306a302dc38f474 100644 (file)
@@ -413,6 +413,11 @@ void __init tsc_init(void)
 
        if (!cpu_khz) {
                mark_tsc_unstable("could not calculate TSC khz");
+               /*
+                * We need to disable the TSC completely in this case
+                * to prevent sched_clock() from using it.
+                */
+               tsc_disabled = 1;
                return;
        }