Skip to contentSkip to conversation

arch/CPU hotplug: Add missing CPU Hotplug bits to fix nasty issues

PATCH RESEND New Srivatsa S. Bhat 1 participant 3 messages May 15, 2012 PA-RISC architecture

lore
Share & tools
lore
#0 lore raw

cover arch/CPU hotplug: Add missing CPU Hotplug bits to fix nasty issues

Unfortunately, some of the CPU Hotplug code has been duplicated in all of the architectures. And in some cases, very poorly (some architectures left out some of the important bits), to add to the woes.

Commit 5fbd036b552f633abb394a319f7c62a5c86a9cd7 (sched: Cleanup cpu_active madness) introduced some changes that made the scheduler rely on the CPU_STARTING notifier. And hence those architectures which forgot to send out the CPU_STARTING notification will almost surely get into trouble. (Xen is one example[1]).

The proper fix would be to pull out these bits into generic CPU Hotplug code. But for now, fix this regression by adding the missing bits in the respective architectures.

[1].https://lkml.org/lkml/2012/3/20/459
--
Srivatsa S. Bhat (2):
parisc/CPU hotplug: Add missing call to notify_cpu_starting() mn10300/CPU hotplug: Add missing call to notify_cpu_starting()

  arch/mn10300/kernel/smp.c |    9 ++++++---
 arch/parisc/kernel/smp.c  |    8 +++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)

Thanks,
Srivatsa S. Bhat
IBM Linux Technology Center

#1 lore raw

PATCH RESEND 1/2 parisc/CPU hotplug: Add missing call to notify_cpu_starting()

The scheduler depends on receiving the CPU_STARTING notification, without which we end up into a lot of trouble. So add the missing call to notify_cpu_starting() in the bringup code.

---

 arch/parisc/kernel/smp.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
arch/parisc/kernel/smp.c +7 -1
index 0bb1d63..4dc7b79 100644
@@ -31,6 +31,7 @@
 #include <linux/delay.h>
 #include <linux/bitops.h>
 #include <linux/ftrace.h>
+#include <linux/cpu.h>
 
 #include <linux/atomic.h>
 #include <asm/current.h>
@@ -295,8 +296,13 @@ smp_cpu_init(int cpunum)
 
 		printk(KERN_CRIT "CPU#%d already initialized!\n", cpunum);
 		machine_halt();
-	}  
+	}
+
+	notify_cpu_starting(cpunum);
+
+	ipi_call_lock();
 	set_cpu_online(cpunum, true);
+	ipi_call_unlock();
 
 	/* Initialise the idle task for this CPU */
 	atomic_inc(&init_mm.mm_count);
#2 lore raw

PATCH RESEND 2/2 mn10300/CPU hotplug: Add missing call to notify_cpu_starting()

In reply to Srivatsa S. Bhat

The scheduler depends on receiving the CPU_STARTING notification, without which we end up into a lot of trouble. So add the missing call to notify_cpu_starting() in the bringup code.

---

 arch/mn10300/kernel/smp.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
arch/mn10300/kernel/smp.c +6 -3
index 910dddf..9cd69ad 100644
@@ -24,6 +24,7 @@
 #include <linux/sched.h>
 #include <linux/profile.h>
 #include <linux/smp.h>
+#include <linux/cpu.h>
 #include <asm/tlbflush.h>
 #include <asm/bitops.h>
 #include <asm/processor.h>
@@ -38,7 +39,6 @@
 #include "internal.h"
 
 #ifdef CONFIG_HOTPLUG_CPU
-#include <linux/cpu.h>
 #include <asm/cacheflush.h>
 
 static unsigned long sleep_mode[NR_CPUS];
@@ -874,10 +874,13 @@ static void __init smp_online(void)
 
 	cpu = smp_processor_id();
 
-	local_irq_enable();
+	notify_cpu_starting(cpu);
 
+	ipi_call_lock();
 	set_cpu_online(cpu, true);
-	smp_wmb();
+	ipi_call_unlock();
+
+	local_irq_enable();
 }
 
 /**