aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/tsc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/tsc.c')
-rw-r--r--arch/i386/kernel/tsc.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c
index 12fef14995a5..46f752a8bbf3 100644
--- a/arch/i386/kernel/tsc.c
+++ b/arch/i386/kernel/tsc.c
@@ -112,13 +112,10 @@ unsigned long long sched_clock(void)
112 return (*custom_sched_clock)(); 112 return (*custom_sched_clock)();
113 113
114 /* 114 /*
115 * in the NUMA case we dont use the TSC as they are not 115 * Fall back to jiffies if there's no TSC available:
116 * synchronized across all CPUs.
117 */ 116 */
118#ifndef CONFIG_NUMA 117 if (unlikely(tsc_disable))
119 if (!cpu_khz || check_tsc_unstable()) 118 /* No locking but a rare wrong value is not a big deal: */
120#endif
121 /* no locking but a rare wrong value is not a big deal */
122 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); 119 return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);
123 120
124 /* read the Time Stamp Counter: */ 121 /* read the Time Stamp Counter: */
@@ -198,13 +195,13 @@ EXPORT_SYMBOL(recalibrate_cpu_khz);
198void __init tsc_init(void) 195void __init tsc_init(void)
199{ 196{
200 if (!cpu_has_tsc || tsc_disable) 197 if (!cpu_has_tsc || tsc_disable)
201 return; 198 goto out_no_tsc;
202 199
203 cpu_khz = calculate_cpu_khz(); 200 cpu_khz = calculate_cpu_khz();
204 tsc_khz = cpu_khz; 201 tsc_khz = cpu_khz;
205 202
206 if (!cpu_khz) 203 if (!cpu_khz)
207 return; 204 goto out_no_tsc;
208 205
209 printk("Detected %lu.%03lu MHz processor.\n", 206 printk("Detected %lu.%03lu MHz processor.\n",
210 (unsigned long)cpu_khz / 1000, 207 (unsigned long)cpu_khz / 1000,
@@ -212,6 +209,15 @@ void __init tsc_init(void)
212 209
213 set_cyc2ns_scale(cpu_khz); 210 set_cyc2ns_scale(cpu_khz);
214 use_tsc_delay(); 211 use_tsc_delay();
212 return;
213
214out_no_tsc:
215 /*
216 * Set the tsc_disable flag if there's no TSC support, this
217 * makes it a fast flag for the kernel to see whether it
218 * should be using the TSC.
219 */
220 tsc_disable = 1;
215} 221}
216 222
217#ifdef CONFIG_CPU_FREQ 223#ifdef CONFIG_CPU_FREQ