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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>

---
 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux