mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
[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>
This commit is contained in:
parent
e8eff5ac29
commit
e3920fb42c
8 changed files with 146 additions and 105 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <linux/fs.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/cpu.h>
|
||||
|
||||
#include "power.h"
|
||||
|
||||
|
@ -72,7 +73,10 @@ static int prepare_processes(void)
|
|||
int error;
|
||||
|
||||
pm_prepare_console();
|
||||
disable_nonboot_cpus();
|
||||
|
||||
error = disable_nonboot_cpus();
|
||||
if (error)
|
||||
goto enable_cpus;
|
||||
|
||||
if (freeze_processes()) {
|
||||
error = -EBUSY;
|
||||
|
@ -84,6 +88,7 @@ static int prepare_processes(void)
|
|||
return 0;
|
||||
thaw:
|
||||
thaw_processes();
|
||||
enable_cpus:
|
||||
enable_nonboot_cpus();
|
||||
pm_restore_console();
|
||||
return error;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue