From: Borislav Petkov <bp@alien8.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: linux-edac <linux-edac@vger.kernel.org>, X86 ML <x86@kernel.org>,
Tony Luck <tony.luck@intel.com>
Subject: [RFC PATCH 2/3] MCE, CE: Wire in the CE collector
Date: Tue, 27 May 2014 15:27:14 +0200 [thread overview]
Message-ID: <1401197235-13440-3-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1401197235-13440-1-git-send-email-bp@alien8.de>
From: Borislav Petkov <bp@suse.de>
Add the CE collector to the polling path which collects the correctable
errors. Collect only DRAM ECC errors for now.
Signed-off-by: Borislav Petkov <bp@suse.de>
---
arch/x86/kernel/cpu/mcheck/mce.c | 62 +++++++++++++++++++++++++++++++++++-----
1 file changed, 55 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 882e79bb0cb6..732fbe61416d 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -579,6 +579,46 @@ static void mce_read_aux(struct mce *m, int i)
DEFINE_PER_CPU(unsigned, mce_poll_count);
+static bool is_a_memory_error(struct mce *m)
+{
+ struct cpuinfo_x86 *c = &boot_cpu_data;
+
+ if (c->x86_vendor == X86_VENDOR_AMD) {
+ /* ErrCodeExt[20:16] */
+ u8 xec = (m->status >> 16) & 0x1f;
+
+ return (xec == 0x0 || xec == 0x8);
+ } else if (c->x86_vendor == X86_VENDOR_INTEL)
+ return m->status & BIT(7);
+ else
+ return false;
+}
+
+static void __log_ce(struct mce *m, enum mcp_flags flags)
+{
+ int ret;
+
+ /*
+ * Don't get the IP here because it's unlikely to have anything to do
+ * with the actual error location.
+ */
+ if ((flags & MCP_DONTLOG) || mca_cfg.dont_log_ce)
+ return;
+
+ if (is_a_memory_error(m)) {
+ ret = ce_add_elem(m->addr >> PAGE_SHIFT);
+ if (ret < 0) {
+ u64 pfn = ce_del_lru_elem();
+ if (pfn)
+ mce_ring_add(pfn);
+
+ ce_add_elem(m->addr >> PAGE_SHIFT);
+ }
+ } else
+ mce_log(m);
+}
+
+
/*
* Poll for corrected events or events that happened before reset.
* Those are just logged through /dev/mcelog.
@@ -632,12 +672,8 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
if (!(flags & MCP_TIMESTAMP))
m.tsc = 0;
- /*
- * Don't get the IP here because it's unlikely to
- * have anything to do with the actual error location.
- */
- if (!(flags & MCP_DONTLOG) && !mca_cfg.dont_log_ce)
- mce_log(&m);
+
+ __log_ce(&m, flags);
/*
* Clear state for this bank.
@@ -2530,5 +2566,17 @@ static int __init mcheck_debugfs_init(void)
return 0;
}
-late_initcall(mcheck_debugfs_init);
+#else
+static int __init mcheck_debugfs_init(void) {}
#endif
+
+static int __init mcheck_late_init(void)
+{
+ if (mcheck_debugfs_init())
+ pr_err("Error creating debugfs nodes!\n");
+
+ ce_init();
+
+ return 0;
+}
+late_initcall(mcheck_late_init);
--
1.9.0
next prev parent reply other threads:[~2014-05-27 13:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-27 13:27 [RFC PATCH 0/3] RAS: Correctable Errors Collector thing Borislav Petkov
2014-05-27 13:27 ` [RFC PATCH 1/3] MCE, CE: Corrected errors collecting thing Borislav Petkov
2014-05-27 13:27 ` Borislav Petkov [this message]
2014-05-27 17:48 ` [RFC PATCH 2/3] MCE, CE: Wire in the CE collector Tony Luck
2014-05-27 18:48 ` Borislav Petkov
2014-05-27 13:27 ` [RFC PATCH 3/3] MCE, CE: Add debugging glue Borislav Petkov
2014-05-28 2:49 ` [RFC PATCH 0/3] RAS: Correctable Errors Collector thing Chen Yucong
2014-05-28 16:53 ` Max Asbock
2014-05-28 17:21 ` Luck, Tony
2014-05-28 17:23 ` Borislav Petkov
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=1401197235-13440-3-git-send-email-bp@alien8.de \
--to=bp@alien8.de \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.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
Powered by JetHome