diff options
Diffstat (limited to 'arch/x86/kernel/tsc.c')
-rw-r--r-- | arch/x86/kernel/tsc.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index db483369f10b..c0dd5b603749 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -35,7 +35,7 @@ static int __read_mostly tsc_unstable; | |||
35 | erroneous rdtsc usage on !cpu_has_tsc processors */ | 35 | erroneous rdtsc usage on !cpu_has_tsc processors */ |
36 | static int __read_mostly tsc_disabled = -1; | 36 | static int __read_mostly tsc_disabled = -1; |
37 | 37 | ||
38 | static int tsc_clocksource_reliable; | 38 | int tsc_clocksource_reliable; |
39 | /* | 39 | /* |
40 | * Scheduler clock - returns current time in nanosec units. | 40 | * Scheduler clock - returns current time in nanosec units. |
41 | */ | 41 | */ |
@@ -178,11 +178,11 @@ static unsigned long calc_pmtimer_ref(u64 deltatsc, u64 pm1, u64 pm2) | |||
178 | } | 178 | } |
179 | 179 | ||
180 | #define CAL_MS 10 | 180 | #define CAL_MS 10 |
181 | #define CAL_LATCH (CLOCK_TICK_RATE / (1000 / CAL_MS)) | 181 | #define CAL_LATCH (PIT_TICK_RATE / (1000 / CAL_MS)) |
182 | #define CAL_PIT_LOOPS 1000 | 182 | #define CAL_PIT_LOOPS 1000 |
183 | 183 | ||
184 | #define CAL2_MS 50 | 184 | #define CAL2_MS 50 |
185 | #define CAL2_LATCH (CLOCK_TICK_RATE / (1000 / CAL2_MS)) | 185 | #define CAL2_LATCH (PIT_TICK_RATE / (1000 / CAL2_MS)) |
186 | #define CAL2_PIT_LOOPS 5000 | 186 | #define CAL2_PIT_LOOPS 5000 |
187 | 187 | ||
188 | 188 | ||
@@ -995,3 +995,23 @@ void __init tsc_init(void) | |||
995 | check_system_tsc_reliable(); | 995 | check_system_tsc_reliable(); |
996 | } | 996 | } |
997 | 997 | ||
998 | #ifdef CONFIG_SMP | ||
999 | /* | ||
1000 | * If we have a constant TSC and are using the TSC for the delay loop, | ||
1001 | * we can skip clock calibration if another cpu in the same socket has already | ||
1002 | * been calibrated. This assumes that CONSTANT_TSC applies to all | ||
1003 | * cpus in the socket - this should be a safe assumption. | ||
1004 | */ | ||
1005 | unsigned long __cpuinit calibrate_delay_is_known(void) | ||
1006 | { | ||
1007 | int i, cpu = smp_processor_id(); | ||
1008 | |||
1009 | if (!tsc_disabled && !cpu_has(&cpu_data(cpu), X86_FEATURE_CONSTANT_TSC)) | ||
1010 | return 0; | ||
1011 | |||
1012 | for_each_online_cpu(i) | ||
1013 | if (cpu_data(i).phys_proc_id == cpu_data(cpu).phys_proc_id) | ||
1014 | return cpu_data(i).loops_per_jiffy; | ||
1015 | return 0; | ||
1016 | } | ||
1017 | #endif | ||