lkml.org 
[lkml]   [2011]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 6/9] kernel/power/suspend.c,hibernate.c: Don't hibernate/suspend if CPU0 is offline
Date
From: Fenghua Yu <fenghua.yu@intel.com>

Because x86 BIOS requires CPU0 to resume from sleep, suspend/resume or hibernate
can't be executed if CPU0 is detected offline.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
kernel/power/hibernate.c | 5 +++++
kernel/power/main.c | 5 +++++
kernel/power/suspend.c | 4 ++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
index 1c53f7f..b9d1a37 100644
--- a/kernel/power/hibernate.c
+++ b/kernel/power/hibernate.c
@@ -612,6 +612,11 @@ int hibernate(void)
int error;

mutex_lock(&pm_mutex);
+
+ error = arch_state_check();
+ if (error)
+ goto Unlock;
+
/* The snapshot device should not be opened while we're running */
if (!atomic_add_unless(&snapshot_device_available, -1, 0)) {
error = -EBUSY;
diff --git a/kernel/power/main.c b/kernel/power/main.c
index a52e884..863d05d 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -447,4 +447,9 @@ static int __init pm_init(void)
return sysfs_create_group(power_kobj, &attr_group);
}

+int __weak arch_state_check(void)
+{
+ return 0;
+}
+
core_initcall(pm_init);
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index fdd4263..f86ff6b 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -284,6 +284,10 @@ int enter_state(suspend_state_t state)
if (!mutex_trylock(&pm_mutex))
return -EBUSY;

+ error = arch_state_check();
+ if (error)
+ goto Unlock;
+
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");
--
1.6.0.3


\
 
 \ /
  Last update: 2011-11-04 23:25    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site