diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-03-07 12:12:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-07 13:07:24 -0500 |
commit | d04f41e35343f1d788551fd3f753f51794f4afcf (patch) | |
tree | 50f22b1deab312476254868e8ec8c0c592c3d3e0 | |
parent | 08e15e81a40e3241ce93b4a43886f3abda184aa6 (diff) |
[PATCH] CPU hotplug: call check_tsc_sync_source() with irqs off
check_tsc_sync_source() depends on being called with irqs disabled (it
checks whether the TSC is coherent across two specific CPUs). This is
incidentally true during bootup, but not during cpu hotplug __cpu_up().
This got found via smp_processor_id() debugging.
disable irqs explicitly and remove the unconditional enabling of
interrupts. Add touch_nmi_watchdog() to the cpu_online_map busy loop.
this bug is present both on i386 and on x86_64.
Reported-by: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/i386/kernel/smpboot.c | 16 | ||||
-rw-r--r-- | arch/x86_64/kernel/smpboot.c | 5 |
2 files changed, 14 insertions, 7 deletions
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 9b0dd2744c82..4ff55e675576 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/notifier.h> | 45 | #include <linux/notifier.h> |
46 | #include <linux/cpu.h> | 46 | #include <linux/cpu.h> |
47 | #include <linux/percpu.h> | 47 | #include <linux/percpu.h> |
48 | #include <linux/nmi.h> | ||
48 | 49 | ||
49 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
50 | #include <linux/mc146818rtc.h> | 51 | #include <linux/mc146818rtc.h> |
@@ -1278,8 +1279,9 @@ void __cpu_die(unsigned int cpu) | |||
1278 | 1279 | ||
1279 | int __cpuinit __cpu_up(unsigned int cpu) | 1280 | int __cpuinit __cpu_up(unsigned int cpu) |
1280 | { | 1281 | { |
1282 | unsigned long flags; | ||
1281 | #ifdef CONFIG_HOTPLUG_CPU | 1283 | #ifdef CONFIG_HOTPLUG_CPU |
1282 | int ret=0; | 1284 | int ret = 0; |
1283 | 1285 | ||
1284 | /* | 1286 | /* |
1285 | * We do warm boot only on cpus that had booted earlier | 1287 | * We do warm boot only on cpus that had booted earlier |
@@ -1297,23 +1299,25 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
1297 | /* In case one didn't come up */ | 1299 | /* In case one didn't come up */ |
1298 | if (!cpu_isset(cpu, cpu_callin_map)) { | 1300 | if (!cpu_isset(cpu, cpu_callin_map)) { |
1299 | printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); | 1301 | printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); |
1300 | local_irq_enable(); | ||
1301 | return -EIO; | 1302 | return -EIO; |
1302 | } | 1303 | } |
1303 | 1304 | ||
1304 | local_irq_enable(); | ||
1305 | |||
1306 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; | 1305 | per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; |
1307 | /* Unleash the CPU! */ | 1306 | /* Unleash the CPU! */ |
1308 | cpu_set(cpu, smp_commenced_mask); | 1307 | cpu_set(cpu, smp_commenced_mask); |
1309 | 1308 | ||
1310 | /* | 1309 | /* |
1311 | * Check TSC synchronization with the AP: | 1310 | * Check TSC synchronization with the AP (keep irqs disabled |
1311 | * while doing so): | ||
1312 | */ | 1312 | */ |
1313 | local_irq_save(flags); | ||
1313 | check_tsc_sync_source(cpu); | 1314 | check_tsc_sync_source(cpu); |
1315 | local_irq_restore(flags); | ||
1314 | 1316 | ||
1315 | while (!cpu_isset(cpu, cpu_online_map)) | 1317 | while (!cpu_isset(cpu, cpu_online_map)) { |
1316 | cpu_relax(); | 1318 | cpu_relax(); |
1319 | touch_nmi_watchdog(); | ||
1320 | } | ||
1317 | 1321 | ||
1318 | #ifdef CONFIG_X86_GENERICARCH | 1322 | #ifdef CONFIG_X86_GENERICARCH |
1319 | if (num_online_cpus() > 8 && genapic == &apic_default) | 1323 | if (num_online_cpus() > 8 && genapic == &apic_default) |
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c index 35443729aad8..cd4643a37022 100644 --- a/arch/x86_64/kernel/smpboot.c +++ b/arch/x86_64/kernel/smpboot.c | |||
@@ -923,8 +923,9 @@ void __init smp_prepare_boot_cpu(void) | |||
923 | */ | 923 | */ |
924 | int __cpuinit __cpu_up(unsigned int cpu) | 924 | int __cpuinit __cpu_up(unsigned int cpu) |
925 | { | 925 | { |
926 | int err; | ||
927 | int apicid = cpu_present_to_apicid(cpu); | 926 | int apicid = cpu_present_to_apicid(cpu); |
927 | unsigned long flags; | ||
928 | int err; | ||
928 | 929 | ||
929 | WARN_ON(irqs_disabled()); | 930 | WARN_ON(irqs_disabled()); |
930 | 931 | ||
@@ -958,7 +959,9 @@ int __cpuinit __cpu_up(unsigned int cpu) | |||
958 | /* | 959 | /* |
959 | * Make sure and check TSC sync: | 960 | * Make sure and check TSC sync: |
960 | */ | 961 | */ |
962 | local_irq_save(flags); | ||
961 | check_tsc_sync_source(cpu); | 963 | check_tsc_sync_source(cpu); |
964 | local_irq_restore(flags); | ||
962 | 965 | ||
963 | while (!cpu_isset(cpu, cpu_online_map)) | 966 | while (!cpu_isset(cpu, cpu_online_map)) |
964 | cpu_relax(); | 967 | cpu_relax(); |