[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>
This commit is contained in:

committed by
Linus Torvalds

parent
fb69c3907e
commit
5a72e04df5
@@ -117,8 +117,8 @@ static void finish(void)
|
||||
{
|
||||
device_resume();
|
||||
platform_finish();
|
||||
enable_nonboot_cpus();
|
||||
thaw_processes();
|
||||
enable_nonboot_cpus();
|
||||
pm_restore_console();
|
||||
}
|
||||
|
||||
@@ -131,28 +131,35 @@ static int prepare_processes(void)
|
||||
|
||||
sys_sync();
|
||||
|
||||
disable_nonboot_cpus();
|
||||
|
||||
if (freeze_processes()) {
|
||||
error = -EBUSY;
|
||||
return error;
|
||||
goto thaw;
|
||||
}
|
||||
|
||||
if (pm_disk_mode == PM_DISK_PLATFORM) {
|
||||
if (pm_ops && pm_ops->prepare) {
|
||||
if ((error = pm_ops->prepare(PM_SUSPEND_DISK)))
|
||||
return error;
|
||||
goto thaw;
|
||||
}
|
||||
}
|
||||
|
||||
/* Free memory before shutting down devices. */
|
||||
free_some_memory();
|
||||
|
||||
return 0;
|
||||
thaw:
|
||||
thaw_processes();
|
||||
enable_nonboot_cpus();
|
||||
pm_restore_console();
|
||||
return error;
|
||||
}
|
||||
|
||||
static void unprepare_processes(void)
|
||||
{
|
||||
enable_nonboot_cpus();
|
||||
platform_finish();
|
||||
thaw_processes();
|
||||
enable_nonboot_cpus();
|
||||
pm_restore_console();
|
||||
}
|
||||
|
||||
@@ -160,15 +167,9 @@ static int prepare_devices(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
disable_nonboot_cpus();
|
||||
if ((error = device_suspend(PMSG_FREEZE))) {
|
||||
if ((error = device_suspend(PMSG_FREEZE)))
|
||||
printk("Some devices failed to suspend\n");
|
||||
platform_finish();
|
||||
enable_nonboot_cpus();
|
||||
return error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,9 +186,9 @@ int pm_suspend_disk(void)
|
||||
int error;
|
||||
|
||||
error = prepare_processes();
|
||||
if (!error) {
|
||||
error = prepare_devices();
|
||||
}
|
||||
if (error)
|
||||
return error;
|
||||
error = prepare_devices();
|
||||
|
||||
if (error) {
|
||||
unprepare_processes();
|
||||
@@ -250,7 +251,7 @@ static int software_resume(void)
|
||||
|
||||
if ((error = prepare_processes())) {
|
||||
swsusp_close();
|
||||
goto Cleanup;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
pr_debug("PM: Reading swsusp image.\n");
|
||||
|
Reference in New Issue
Block a user