diff options
author | Li Shaohua <shaohua.li@intel.com> | 2005-06-25 17:55:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-25 19:24:32 -0400 |
commit | 5a72e04df5470df0ec646029d31e5528167ab1a7 (patch) | |
tree | 11be00c3ed3d8bad775e6eec44078c9f942537b9 /kernel/power/main.c | |
parent | fb69c3907ead36b9e9f41ea6f0d0e0ae10a38a47 (diff) |
[PATCH] suspend/resume SMP support
Using CPU hotplug to support suspend/resume SMP. Both S3 and S4 use
disable/enable_nonboot_cpus API. The S4 part is based on Pavel's original S4
SMP patch.
Signed-off-by: Li Shaohua<shaohua.li@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r-- | kernel/power/main.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index 4cdebc972ff2..c94cb9e95090 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -55,6 +55,13 @@ static int suspend_prepare(suspend_state_t state) | |||
55 | 55 | ||
56 | pm_prepare_console(); | 56 | pm_prepare_console(); |
57 | 57 | ||
58 | disable_nonboot_cpus(); | ||
59 | |||
60 | if (num_online_cpus() != 1) { | ||
61 | error = -EPERM; | ||
62 | goto Enable_cpu; | ||
63 | } | ||
64 | |||
58 | if (freeze_processes()) { | 65 | if (freeze_processes()) { |
59 | error = -EAGAIN; | 66 | error = -EAGAIN; |
60 | goto Thaw; | 67 | goto Thaw; |
@@ -75,6 +82,8 @@ static int suspend_prepare(suspend_state_t state) | |||
75 | pm_ops->finish(state); | 82 | pm_ops->finish(state); |
76 | Thaw: | 83 | Thaw: |
77 | thaw_processes(); | 84 | thaw_processes(); |
85 | Enable_cpu: | ||
86 | enable_nonboot_cpus(); | ||
78 | pm_restore_console(); | 87 | pm_restore_console(); |
79 | return error; | 88 | return error; |
80 | } | 89 | } |
@@ -113,6 +122,7 @@ static void suspend_finish(suspend_state_t state) | |||
113 | if (pm_ops && pm_ops->finish) | 122 | if (pm_ops && pm_ops->finish) |
114 | pm_ops->finish(state); | 123 | pm_ops->finish(state); |
115 | thaw_processes(); | 124 | thaw_processes(); |
125 | enable_nonboot_cpus(); | ||
116 | pm_restore_console(); | 126 | pm_restore_console(); |
117 | } | 127 | } |
118 | 128 | ||
@@ -150,12 +160,6 @@ static int enter_state(suspend_state_t state) | |||
150 | goto Unlock; | 160 | goto Unlock; |
151 | } | 161 | } |
152 | 162 | ||
153 | /* Suspend is hard to get right on SMP. */ | ||
154 | if (num_online_cpus() != 1) { | ||
155 | error = -EPERM; | ||
156 | goto Unlock; | ||
157 | } | ||
158 | |||
159 | pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); | 163 | pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); |
160 | if ((error = suspend_prepare(state))) | 164 | if ((error = suspend_prepare(state))) |
161 | goto Unlock; | 165 | goto Unlock; |