[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>
This commit is contained in:
parent
08e15e81a4
commit
d04f41e353
|
@ -45,6 +45,7 @@
|
||||||
#include <linux/notifier.h>
|
#include <linux/notifier.h>
|
||||||
#include <linux/cpu.h>
|
#include <linux/cpu.h>
|
||||||
#include <linux/percpu.h>
|
#include <linux/percpu.h>
|
||||||
|
#include <linux/nmi.h>
|
||||||
|
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/mc146818rtc.h>
|
#include <linux/mc146818rtc.h>
|
||||||
|
@ -1278,8 +1279,9 @@ void __cpu_die(unsigned int cpu)
|
||||||
|
|
||||||
int __cpuinit __cpu_up(unsigned int cpu)
|
int __cpuinit __cpu_up(unsigned int cpu)
|
||||||
{
|
{
|
||||||
|
unsigned long flags;
|
||||||
#ifdef CONFIG_HOTPLUG_CPU
|
#ifdef CONFIG_HOTPLUG_CPU
|
||||||
int ret=0;
|
int ret = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We do warm boot only on cpus that had booted earlier
|
* We do warm boot only on cpus that had booted earlier
|
||||||
|
@ -1297,23 +1299,25 @@ int __cpuinit __cpu_up(unsigned int cpu)
|
||||||
/* In case one didn't come up */
|
/* In case one didn't come up */
|
||||||
if (!cpu_isset(cpu, cpu_callin_map)) {
|
if (!cpu_isset(cpu, cpu_callin_map)) {
|
||||||
printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu);
|
printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu);
|
||||||
local_irq_enable();
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
local_irq_enable();
|
|
||||||
|
|
||||||
per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
|
per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
|
||||||
/* Unleash the CPU! */
|
/* Unleash the CPU! */
|
||||||
cpu_set(cpu, smp_commenced_mask);
|
cpu_set(cpu, smp_commenced_mask);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check TSC synchronization with the AP:
|
* Check TSC synchronization with the AP (keep irqs disabled
|
||||||
|
* while doing so):
|
||||||
*/
|
*/
|
||||||
|
local_irq_save(flags);
|
||||||
check_tsc_sync_source(cpu);
|
check_tsc_sync_source(cpu);
|
||||||
|
local_irq_restore(flags);
|
||||||
|
|
||||||
while (!cpu_isset(cpu, cpu_online_map))
|
while (!cpu_isset(cpu, cpu_online_map)) {
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
|
touch_nmi_watchdog();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_X86_GENERICARCH
|
#ifdef CONFIG_X86_GENERICARCH
|
||||||
if (num_online_cpus() > 8 && genapic == &apic_default)
|
if (num_online_cpus() > 8 && genapic == &apic_default)
|
||||||
|
|
|
@ -923,8 +923,9 @@ void __init smp_prepare_boot_cpu(void)
|
||||||
*/
|
*/
|
||||||
int __cpuinit __cpu_up(unsigned int cpu)
|
int __cpuinit __cpu_up(unsigned int cpu)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
int apicid = cpu_present_to_apicid(cpu);
|
int apicid = cpu_present_to_apicid(cpu);
|
||||||
|
unsigned long flags;
|
||||||
|
int err;
|
||||||
|
|
||||||
WARN_ON(irqs_disabled());
|
WARN_ON(irqs_disabled());
|
||||||
|
|
||||||
|
@ -958,7 +959,9 @@ int __cpuinit __cpu_up(unsigned int cpu)
|
||||||
/*
|
/*
|
||||||
* Make sure and check TSC sync:
|
* Make sure and check TSC sync:
|
||||||
*/
|
*/
|
||||||
|
local_irq_save(flags);
|
||||||
check_tsc_sync_source(cpu);
|
check_tsc_sync_source(cpu);
|
||||||
|
local_irq_restore(flags);
|
||||||
|
|
||||||
while (!cpu_isset(cpu, cpu_online_map))
|
while (!cpu_isset(cpu, cpu_online_map))
|
||||||
cpu_relax();
|
cpu_relax();
|
||||||
|
|
Loading…
Reference in a new issue