[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1320444241-834-7-git-send-email-fenghua.yu@intel.com>
Date: Fri, 4 Nov 2011 15:03:58 -0700
From: "Fenghua Yu" <fenghua.yu@...el.com>
To: "Thomas Gleixner" <tglx@...utronix.de>,
"H Peter Anvin" <hpa@...or.com>, "Ingo Molnar" <mingo@...e.hu>,
"Linus Torvalds" <torvalds@...ux-foundation.org>,
"Andrew Morton" <akpm@...ux-foundation.org>,
"Tony Luck" <tony.luck@...el.com>,
"Suresh B Siddha" <suresh.b.siddha@...el.com>,
"Len Brown" <len.brown@...el.com>,
"Srivatsa S. Bhat" <srivatsa.bhat@...ux.vnet.ibm.com>,
Peter Zijlstra <peterz@...radead.org>
Cc: "linux-kernel" <linux-kernel@...r.kernel.org>,
"Fenghua Yu" <fenghua.yu@...el.com>
Subject: [PATCH 6/9] kernel/power/suspend.c,hibernate.c: Don't hibernate/suspend if CPU0 is offline
From: Fenghua Yu <fenghua.yu@...el.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@...el.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists