|
@@ -112,13 +112,10 @@ unsigned long long sched_clock(void)
|
|
return (*custom_sched_clock)();
|
|
return (*custom_sched_clock)();
|
|
|
|
|
|
/*
|
|
/*
|
|
- * in the NUMA case we dont use the TSC as they are not
|
|
|
|
- * synchronized across all CPUs.
|
|
|
|
|
|
+ * Fall back to jiffies if there's no TSC available:
|
|
*/
|
|
*/
|
|
-#ifndef CONFIG_NUMA
|
|
|
|
- if (!cpu_khz || check_tsc_unstable())
|
|
|
|
-#endif
|
|
|
|
- /* no locking but a rare wrong value is not a big deal */
|
|
|
|
|
|
+ if (unlikely(tsc_disable))
|
|
|
|
+ /* No locking but a rare wrong value is not a big deal: */
|
|
return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
|
|
return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
|
|
|
|
|
|
/* read the Time Stamp Counter: */
|
|
/* read the Time Stamp Counter: */
|
|
@@ -198,13 +195,13 @@ EXPORT_SYMBOL(recalibrate_cpu_khz);
|
|
void __init tsc_init(void)
|
|
void __init tsc_init(void)
|
|
{
|
|
{
|
|
if (!cpu_has_tsc || tsc_disable)
|
|
if (!cpu_has_tsc || tsc_disable)
|
|
- return;
|
|
|
|
|
|
+ goto out_no_tsc;
|
|
|
|
|
|
cpu_khz = calculate_cpu_khz();
|
|
cpu_khz = calculate_cpu_khz();
|
|
tsc_khz = cpu_khz;
|
|
tsc_khz = cpu_khz;
|
|
|
|
|
|
if (!cpu_khz)
|
|
if (!cpu_khz)
|
|
- return;
|
|
|
|
|
|
+ goto out_no_tsc;
|
|
|
|
|
|
printk("Detected %lu.%03lu MHz processor.\n",
|
|
printk("Detected %lu.%03lu MHz processor.\n",
|
|
(unsigned long)cpu_khz / 1000,
|
|
(unsigned long)cpu_khz / 1000,
|
|
@@ -212,6 +209,15 @@ void __init tsc_init(void)
|
|
|
|
|
|
set_cyc2ns_scale(cpu_khz);
|
|
set_cyc2ns_scale(cpu_khz);
|
|
use_tsc_delay();
|
|
use_tsc_delay();
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+out_no_tsc:
|
|
|
|
+ /*
|
|
|
|
+ * Set the tsc_disable flag if there's no TSC support, this
|
|
|
|
+ * makes it a fast flag for the kernel to see whether it
|
|
|
|
+ * should be using the TSC.
|
|
|
|
+ */
|
|
|
|
+ tsc_disable = 1;
|
|
}
|
|
}
|
|
|
|
|
|
#ifdef CONFIG_CPU_FREQ
|
|
#ifdef CONFIG_CPU_FREQ
|