From: Thomas Gleixner <tglx@linutronix.de>
Date: Mon, 13 Dec 2010 10:28:02 +0000 (+0100)
Subject: x86: Check tsc available/disabled in the delayed init function
X-Git-Tag: v2.6.38-rc1~480^2
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=a8760ec;p=linux.git

x86: Check tsc available/disabled in the delayed init function

The delayed TSC init function does not check whether the system has no
TSC or TSC is disabled at the kernel command line, which results in a
crash in the work queue based extended calibration due to division by
zero because the basic calibration never happened.

Add the missing checks and do not touch TSC when not available or
disabled.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <johnstul@us.ibm.com>
---

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index dc1393e7cbfb..356a0d455cf9 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -965,6 +965,9 @@ out:
 
 static int __init init_tsc_clocksource(void)
 {
+	if (!cpu_has_tsc || tsc_disabled > 0)
+		return 0;
+
 	if (tsc_clocksource_reliable)
 		clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
 	/* lower the rating if we already know its unstable: */