diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2006-09-26 02:32:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-09-26 11:48:59 -0400 |
commit | e3920fb42c8ddfe63befb54d95c0e13eabacea9b (patch) | |
tree | 08371a71e58e6e9d3ec62dfa6a22b3b5e6ff0fd5 /kernel/power/disk.c | |
parent | e8eff5ac294e12531c4195e0c15a222d3c9015e5 (diff) |
[PATCH] Disable CPU hotplug during suspend
The current suspend code has to be run on one CPU, so we use the CPU
hotplug to take the non-boot CPUs offline on SMP machines. However, we
should also make sure that these CPUs will not be enabled by someone else
after we have disabled them.
The functions disable_nonboot_cpus() and enable_nonboot_cpus() are moved to
kernel/cpu.c, because they now refer to some stuff in there that should
better be static. Also it's better if disable_nonboot_cpus() returns an
error instead of panicking if something goes wrong, and
enable_nonboot_cpus() has no reason to panic(), because the CPUs may have
been enabled by the userland before it tries to take them online.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/disk.c')
-rw-r--r-- | kernel/power/disk.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index e13e74067845..7c7b9b65e365 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/mount.h> | 19 | #include <linux/mount.h> |
20 | #include <linux/pm.h> | 20 | #include <linux/pm.h> |
21 | #include <linux/cpu.h> | ||
21 | 22 | ||
22 | #include "power.h" | 23 | #include "power.h" |
23 | 24 | ||
@@ -72,7 +73,10 @@ static int prepare_processes(void) | |||
72 | int error; | 73 | int error; |
73 | 74 | ||
74 | pm_prepare_console(); | 75 | pm_prepare_console(); |
75 | disable_nonboot_cpus(); | 76 | |
77 | error = disable_nonboot_cpus(); | ||
78 | if (error) | ||
79 | goto enable_cpus; | ||
76 | 80 | ||
77 | if (freeze_processes()) { | 81 | if (freeze_processes()) { |
78 | error = -EBUSY; | 82 | error = -EBUSY; |
@@ -84,6 +88,7 @@ static int prepare_processes(void) | |||
84 | return 0; | 88 | return 0; |
85 | thaw: | 89 | thaw: |
86 | thaw_processes(); | 90 | thaw_processes(); |
91 | enable_cpus: | ||
87 | enable_nonboot_cpus(); | 92 | enable_nonboot_cpus(); |
88 | pm_restore_console(); | 93 | pm_restore_console(); |
89 | return error; | 94 | return error; |