diff options
author | Heiko Carstens <heiko.carstens@de.ibm.com> | 2009-01-07 16:19:46 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-07 11:36:14 -0800 |
commit | a0e280e0f33f6c859a235fb69a875ed8f3420388 (patch) | |
tree | c41b0ad22c4195bef2bfdd36437e20d232b9586b /kernel/cpu.c | |
parent | 30aafdba6f78619274a977d67283a681bedbcbbd (diff) | |
download | linux-a0e280e0f33f6c859a235fb69a875ed8f3420388.tar.gz linux-a0e280e0f33f6c859a235fb69a875ed8f3420388.tar.bz2 linux-a0e280e0f33f6c859a235fb69a875ed8f3420388.zip |
stop_machine/cpu hotplug: fix disable_nonboot_cpus
disable_nonboot_cpus calls _cpu_down. But _cpu_down requires that the
caller already created the stop_machine workqueue (like cpu_down does).
Otherwise a call to stop_machine will lead to accesses to random memory
regions.
When introducing this new interface (9ea09af3bd3090e8349ca2899ca2011bd94cda85
"stop_machine: introduce stop_machine_create/destroy") I missed the second
call site of _cpu_down.
So add the missing stop_machine_create/destroy calls to disable_nonboot_cpus
as well.
Fixes suspend-to-ram/disk and also this bug:
[ 286.547348] BUG: unable to handle kernel paging request at 6b6b6b6b
[ 286.548940] IP: [<c0150ca4>] __stop_machine+0x88/0xe3
[ 286.550598] Oops: 0002 [#1] SMP
[ 286.560580] Pid: 3273, comm: halt Not tainted (2.6.28-06127-g238c6d5
[ 286.560580] EIP: is at __stop_machine+0x88/0xe3
[ 286.560580] Process halt (pid: 3273, ti=f1a28000 task=f4530f30
[ 286.560580] Call Trace:
[ 286.560580] [<c03d04e4>] ? _cpu_down+0x10f/0x234
[ 286.560580] [<c012a57e>] ? disable_nonboot_cpus+0x58/0xdc
[ 286.560580] [<c01360c0>] ? kernel_poweroff+0x22/0x39
[ 286.560580] [<c0136301>] ? sys_reboot+0xde/0x14c
[ 286.560580] [<c01331b2>] ? complete_signal+0x179/0x191
[ 286.560580] [<c0133396>] ? send_signal+0x1cc/0x1e1
[ 286.560580] [<c03de418>] ? _spin_unlock_irqrestore+0x2d/0x3c
[ 286.560580] [<c0133b65>] ? group_send_signal_info+0x58/0x61
[ 286.560580] [<c0133b9e>] ? kill_pid_info+0x30/0x3a
[ 286.560580] [<c0133d49>] ? sys_kill+0x75/0x13a
[ 286.560580] [<c01a06cb>] ? mntput_no_expire+ox1f/0x101
[ 286.560580] [<c019b3b3>] ? dput+0x1e/0x105
[ 286.560580] [<c018ef87>] ? __fput+0x150/0x158
[ 286.560580] [<c0157abf>] ? audit_syscall_entry+0x137/0x159
[ 286.560580] [<c010329f>] ? sysenter_do_call+0x12/0x34
Reported-and-tested-by: "Justin P. Mattock" <justinmattock@gmail.com>
Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Tested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/cpu.c')
-rw-r--r-- | kernel/cpu.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 30e74dd6d01b..79e40f00dcb8 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -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; } |