From: Andi Kleen <andi@firstfloor.org>
To: akpm@linux-foundation.org, x86@firstfloor.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] [7/10] x86: MCE: Disable machine checks on suspend v2
Date: Thu, 12 Feb 2009 13:37:26 +0100 (CET) [thread overview]
Message-ID: <20090212123726.5D9213E6673@basil.firstfloor.org> (raw)
In-Reply-To: <20090212137.750180365@firstfloor.org>
Impact: Bug fix
During suspend it is not reliable to process machine check
exceptions, because CPUs disappear but can still get machine check
broadcasts. Also the system is slightly more likely to
machine check them, but the handler is typically not a position
to handle them in a meaningfull way.
So disable them during suspend and enable them during resume.
Also make sure they are always disabled on hot-unplugged CPUs.
This new code assumes that suspend always hotunplugs all
non BP CPUs.
v2: Remove the WARN_ONs Thomas objected to.
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
arch/x86/kernel/cpu/mcheck/mce_64.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
Index: linux/arch/x86/kernel/cpu/mcheck/mce_64.c
===================================================================
--- linux.orig/arch/x86/kernel/cpu/mcheck/mce_64.c 2009-02-12 11:30:51.000000000 +0100
+++ linux/arch/x86/kernel/cpu/mcheck/mce_64.c 2009-02-12 12:10:20.000000000 +0100
@@ -735,6 +735,29 @@
* Sysfs support
*/
+/*
+ * Disable machine checks on suspend and shutdown. We can't really handle
+ * them later.
+ */
+static int mce_disable(void)
+{
+ int i;
+
+ for (i = 0; i < banks; i++)
+ wrmsrl(MSR_IA32_MC0_CTL + i*4, 0);
+ return 0;
+}
+
+static int mce_suspend(struct sys_device *dev, pm_message_t state)
+{
+ return mce_disable();
+}
+
+static int mce_shutdown(struct sys_device *dev)
+{
+ return mce_disable();
+}
+
/* On resume clear all MCE state. Don't want to see leftovers from the BIOS.
Only one CPU is active at this time, the others get readded later using
CPU hotplug. */
@@ -761,6 +784,8 @@
}
static struct sysdev_class mce_sysclass = {
+ .suspend = mce_suspend,
+ .shutdown = mce_shutdown,
.resume = mce_resume,
.name = "machinecheck",
};
next prev parent reply other threads:[~2009-02-12 12:41 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-12 12:37 [PATCH] [0/10] x86: MCE: machine check bug fix series Andi Kleen
2009-02-12 12:37 ` [PATCH] [1/10] x86: MCE: Reinitialize per cpu features on resume v3 Andi Kleen
2009-02-12 12:37 ` [PATCH] [2/10] x86: MCE: Don't disable machine checks during code patching Andi Kleen
2009-02-12 12:37 ` [PATCH] [3/10] x86: MCE: Always use separate work queue to run trigger Andi Kleen
2009-02-12 12:37 ` [PATCH] [4/10] x86: MCE: Switch machine check polling to per CPU timer v3 Andi Kleen
2009-02-13 5:27 ` Tim Hockin
2009-02-12 12:37 ` [PATCH] [5/10] x86: MCE: Don't set up mce sysdev devices with mce=off Andi Kleen
2009-02-12 12:37 ` [PATCH] [6/10] x86: MCE: Disable machine checks on offlined CPUs Andi Kleen
2009-02-12 12:37 ` Andi Kleen [this message]
2009-02-12 12:37 ` [PATCH] [8/10] x86: MCE: Use force_sig_info to kill process in machine check Andi Kleen
2009-02-12 12:37 ` [PATCH] [9/10] x86: MCE: Fix a race condition in mce_read() Andi Kleen
2009-02-12 12:37 ` [PATCH] [10/10] x86: MCE: Fix ifdef for 64bit thermal apic vector clear on shutdown Andi Kleen
-- strict thread matches above, loose matches on Subject: below --
2009-02-12 12:39 [PATCH] [0/10] x86: MCE: machine check bug fix series Andi Kleen
2009-02-12 12:39 ` [PATCH] [7/10] x86: MCE: Disable machine checks on suspend v2 Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090212123726.5D9213E6673@basil.firstfloor.org \
--to=andi@firstfloor.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@firstfloor.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox