From c5d65600aa68f3dd150752753a2009792a1216a4 Mon Sep 17 00:00:00 2001 From: Andi Kleen Date: Wed, 11 Jan 2006 22:45:15 +0100 Subject: [PATCH] --- yaml --- r: 17983 b: refs/heads/master c: 737c5c3bde5641af9c24e3a60366674af72a43ef h: refs/heads/master i: 17981: dcb67846080f31106b02650e5e2a8e45b0936d9b 17979: feb353210af55f17587f56b8de7c69e87b89a3a7 17975: 13672911cef925e3fcc17702a916c2516383c989 17967: f8e8f2eea703d1c6df0ce55c589ee313d9c71f0d 17951: 79bf74f69ec70f52e5424b7992d9f0f2e88d9f4f 17919: 75e8ca1c5d5316a0863a96672c14ecfbc0182bed v: v3 --- [refs] | 2 +- trunk/arch/x86_64/kernel/smpboot.c | 8 +++++++- trunk/arch/x86_64/kernel/time.c | 4 ++-- trunk/include/asm-x86_64/proto.h | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 5613f7be2447..57742805f117 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 3c0217511313a46039137d2dab30fdb1c5a65e64 +refs/heads/master: 737c5c3bde5641af9c24e3a60366674af72a43ef diff --git a/trunk/arch/x86_64/kernel/smpboot.c b/trunk/arch/x86_64/kernel/smpboot.c index e6af93b51dce..994728564d6b 100644 --- a/trunk/arch/x86_64/kernel/smpboot.c +++ b/trunk/arch/x86_64/kernel/smpboot.c @@ -335,7 +335,13 @@ static __cpuinit void sync_tsc(unsigned int master) static void __cpuinit tsc_sync_wait(void) { - if (notscsync || !cpu_has_tsc) + /* + * When the CPU has synchronized TSCs assume the BIOS + * or the hardware already synced. Otherwise we could + * mess up a possible perfect synchronization with a + * not-quite-perfect algorithm. + */ + if (notscsync || !cpu_has_tsc || !unsynchronized_tsc()) return; sync_tsc(0); } diff --git a/trunk/arch/x86_64/kernel/time.c b/trunk/arch/x86_64/kernel/time.c index 211bf0e51d9d..f8d4b69388d2 100644 --- a/trunk/arch/x86_64/kernel/time.c +++ b/trunk/arch/x86_64/kernel/time.c @@ -953,7 +953,7 @@ void __init time_init(void) * Make an educated guess if the TSC is trustworthy and synchronized * over all CPUs. */ -static __init int unsynchronized_tsc(void) +__init int unsynchronized_tsc(void) { #ifdef CONFIG_SMP if (oem_force_hpet_timer()) @@ -964,7 +964,7 @@ static __init int unsynchronized_tsc(void) return 0; #endif /* Assume multi socket systems are not synchronized */ - return num_online_cpus() > 1; + return num_present_cpus() > 1; } /* diff --git a/trunk/include/asm-x86_64/proto.h b/trunk/include/asm-x86_64/proto.h index 56dc70b7a6e4..115e496c6139 100644 --- a/trunk/include/asm-x86_64/proto.h +++ b/trunk/include/asm-x86_64/proto.h @@ -89,6 +89,8 @@ extern void check_efer(void); extern int unhandled_signal(struct task_struct *tsk, int sig); +extern int unsynchronized_tsc(void); + extern void select_idle_routine(const struct cpuinfo_x86 *c); extern void gart_parse_options(char *);