Skip to contentSkip to conversation

cpu: create stop machine in disable_nonboot_cpus

PATCH In review Jiri Slaby 2 participants 3 messages Jan 7, 2009 CPU hotplug

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/1 cpu: create stop machine in disable_nonboot_cpus

Commit
772cd49cfa4002439b16dd6b553a11771ac096fd
(stop_machine: introduce stop_machine_create/destroy.) introduced stop_machine_create/destroy, but omitted to call them from disable_nonboot_cpus (it's called only from cpu_down).

Create and destroy the stop machine even in disable_nonboot_cpus (which calls _cpu_down too) to avoid NULL-pointer dereference oops on suspend.

Cc Heiko Carstens <[email protected]>
Cc Rusty Russell <[email protected]>
---
 kernel/cpu.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
kernel/cpu.c +5 -1
index 30e74dd..79e40f0 100644
@@ -379,8 +379,11 @@ static cpumask_var_t frozen_cpus;
 
 int disable_nonboot_cpus(void)
 {
-	int cpu, first_cpu, error = 0;
+	int cpu, first_cpu, error;
 
+	error = stop_machine_create();
+	if (error)
+		return error;
 	cpu_maps_update_begin();
 	first_cpu = cpumask_first(cpu_online_mask);
 	/* We take down all of the non-boot CPUs in one shot to avoid races
@@ -409,6 +412,7 @@ int disable_nonboot_cpus(void)
 		printk(KERN_ERR "Non-boot CPUs are not disabled\n");
 	}
 	cpu_maps_update_done();
+	stop_machine_destroy();
 	return error;
 }
 
Signature · 1 line
1.6.0.6
#1 lore raw
Quoted 6 lines · Jiri Slaby

Commit
772cd49cfa4002439b16dd6b553a11771ac096fd
(stop_machine: introduce stop_machine_create/destroy.) introduced stop_machine_create/destroy, but omitted to call them from disable_nonboot_cpus (it's called only from cpu_down).

Quoted 7 lines

Create and destroy the stop machine even in disable_nonboot_cpus (which calls _cpu_down too) to avoid NULL-pointer dereference oops on suspend.

Cc Heiko Carstens <[email protected]>
Cc Rusty Russell <[email protected]>

Yep, it's exactly the same what I had as well:

http://lkml.org/lkml/2009/1/7/67

Thanks ;)

author
#2 lore raw
Quoted 1 line · Heiko Carstens

Yep, it's exactly the same what I had as well:

Great ;).