[PATCH] CPU HOTPLUG: Avoid hotadd when proper possible_map isn'tspecified.

From: KAMEZAWA Hiroyuki
Date: Fri Sep 28 2007 - 02:57:20 EST


cpu-hot-add should be fail if cpu is not set in cpu_possible_map.
If go ahead, the system will panic soon.

Especially, arch which requires additional_cpus= parameter should handle this.
Tested on ia64.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>

---
kernel/cpu.c | 8 ++++++++
1 file changed, 8 insertions(+)

Index: linux-2.6.23-rc8-mm2/kernel/cpu.c
===================================================================
--- linux-2.6.23-rc8-mm2.orig/kernel/cpu.c
+++ linux-2.6.23-rc8-mm2/kernel/cpu.c
@@ -265,6 +265,14 @@ out_notify:
int __cpuinit cpu_up(unsigned int cpu)
{
int err = 0;
+ if (!cpu_isset(cpu, cpu_possible_map)) {
+ printk("can't online cpu %d because it is not configured "
+ "as may-hotadded at boot time\n", cpu);
+#if defined(CONFIG_IA64) || defined (CONFIG_X86_64) || defined(CONFIG_S390)
+ printk("please check additional_cpus= boot parameter\n");
+#endif
+ return -EINVAL;
+ }

mutex_lock(&cpu_add_remove_lock);
if (cpu_hotplug_disabled)

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/