[RFC][PATCH] make mis-configured cpu hotplug safer

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

 



When we want to hot-add a new cpu,  it should be on cpu_possible_map.
On some archs, we have to specify additional_cpus= boot option.
(x86_64, ia64, s390 seems to need this. others ?)

If a user enable a cpu which is not counted as possible_cpu, the system
will panic. This patch disables to register cpu control if cpu is not in
possible_map.

Works as expected on ia64/cpu-hotplug-by-ACPI case.

Consideration:
handling this issue in cpu_up() is an another way. 

Signed-off-by: KAMEZAWA Hiroyuki <[email protected]>


---
 drivers/base/cpu.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: linux-2.6.23-rc6-mm1/drivers/base/cpu.c
===================================================================
--- linux-2.6.23-rc6-mm1.orig/drivers/base/cpu.c
+++ linux-2.6.23-rc6-mm1/drivers/base/cpu.c
@@ -113,6 +113,17 @@ static SYSDEV_ATTR(crash_notes, 0400, sh
 int __devinit register_cpu(struct cpu *cpu, int num)
 {
 	int error;
+
+#ifdef CONFIG_HOTPLUG_CPU
+	if (!cpu_isset(num, cpu_possible_map)) {
+		printk("Newly added cpu is not configured"
+			"as hot-add-candidate at boot time\n");
+#if defined(CONFIG_X86_64) || defined(CONFIG_IA64) || defined(CONFIG_S390)
+		printk("please check additional_cpus= boot option\n");
+#endif
+		return -EINVAL;
+	}
+#endif
 	cpu->node_id = cpu_to_node(num);
 	cpu->sysdev.id = num;
 	cpu->sysdev.cls = &cpu_sysdev_class;

-
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