x86: if we cannot calibrate the TSC, we panic.
[sfrench/cifs-2.6.git] / arch / x86 / kernel / tsc_32.c
index 43517e324be83e73096fe28a39ec5275c9a378e0..68657d8526fb89b43d6e55eb3e316b6625549dc3 100644 (file)
@@ -28,7 +28,8 @@ EXPORT_SYMBOL_GPL(tsc_khz);
 static int __init tsc_setup(char *str)
 {
        printk(KERN_WARNING "notsc: Kernel compiled with CONFIG_X86_TSC, "
-                               "cannot disable TSC.\n");
+                               "cannot disable TSC completely.\n");
+       mark_tsc_unstable("user disabled TSC");
        return 1;
 }
 #else
@@ -255,9 +256,7 @@ time_cpufreq_notifier(struct notifier_block *nb, unsigned long val, void *data)
                                                ref_freq, freq->new);
                        if (!(freq->flags & CPUFREQ_CONST_LOOPS)) {
                                tsc_khz = cpu_khz;
-                               preempt_disable();
-                               set_cyc2ns_scale(cpu_khz, smp_processor_id());
-                               preempt_enable();
+                               set_cyc2ns_scale(cpu_khz, freq->cpu);
                                /*
                                 * TSC based sched_clock turns
                                 * to junk w/ cpufreq
@@ -393,13 +392,15 @@ void __init tsc_init(void)
        int cpu;
 
        if (!cpu_has_tsc)
-               goto out_no_tsc;
+               return;
 
        cpu_khz = calculate_cpu_khz();
        tsc_khz = cpu_khz;
 
-       if (!cpu_khz)
-               goto out_no_tsc;
+       if (!cpu_khz) {
+               mark_tsc_unstable("could not calculate TSC khz");
+               return;
+       }
 
        printk("Detected %lu.%03lu MHz processor.\n",
                                (unsigned long)cpu_khz / 1000,
@@ -432,9 +433,4 @@ void __init tsc_init(void)
                tsc_enabled = 1;
 
        clocksource_register(&clocksource_tsc);
-
-       return;
-
-out_no_tsc:
-       setup_clear_cpu_cap(X86_FEATURE_TSC);
 }