From: "tip-bot2 for Tony Luck" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Tony Luck <tony.luck@intel.com>, Borislav Petkov <bp@suse.de>,
x86 <x86@kernel.org>, LKML <linux-kernel@vger.kernel.org>
Subject: [tip: ras/core] x86/mce: Convert the CEC to use the MCE notifier
Date: Wed, 15 Apr 2020 09:49:48 -0000 [thread overview]
Message-ID: <158694418890.28353.11828147027206185087.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20200214222720.13168-3-tony.luck@intel.com>
The following commit has been merged into the ras/core branch of tip:
Commit-ID: 9554bfe403bdfc084823df8695a01f28c680af61
Gitweb: https://git.kernel.org/tip/9554bfe403bdfc084823df8695a01f28c680af61
Author: Tony Luck <tony.luck@intel.com>
AuthorDate: Fri, 14 Feb 2020 14:27:15 -08:00
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Tue, 14 Apr 2020 15:58:08 +02:00
x86/mce: Convert the CEC to use the MCE notifier
The CEC code has its claws in a couple of routines in mce/core.c.
Convert it to just register itself on the normal MCE notifier chain.
[ bp: Make cec_add_elem() and cec_init() static. ]
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20200214222720.13168-3-tony.luck@intel.com
---
arch/x86/kernel/cpu/mce/core.c | 19 -------------------
drivers/ras/cec.c | 30 ++++++++++++++++++++++++++++--
include/linux/ras.h | 5 -----
3 files changed, 28 insertions(+), 26 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 43b1519..b033b35 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -544,21 +544,6 @@ bool mce_is_correctable(struct mce *m)
}
EXPORT_SYMBOL_GPL(mce_is_correctable);
-static bool cec_add_mce(struct mce *m)
-{
- if (!m)
- return false;
-
- /* We eat only correctable DRAM errors with usable addresses. */
- if (mce_is_memory_error(m) &&
- mce_is_correctable(m) &&
- mce_usable_address(m))
- if (!cec_add_elem(m->addr >> PAGE_SHIFT))
- return true;
-
- return false;
-}
-
static int mce_early_notifier(struct notifier_block *nb, unsigned long val,
void *data)
{
@@ -567,9 +552,6 @@ static int mce_early_notifier(struct notifier_block *nb, unsigned long val,
if (!m)
return NOTIFY_DONE;
- if (cec_add_mce(m))
- return NOTIFY_STOP;
-
/* Emit the trace record: */
trace_mce_record(m);
@@ -2612,7 +2594,6 @@ static int __init mcheck_late_init(void)
static_branch_inc(&mcsafe_key);
mcheck_debugfs_init();
- cec_init();
/*
* Flush out everything that has been logged during early boot, now that
diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index c09cf55..6b42040 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -309,7 +309,7 @@ static bool sanity_check(struct ce_array *ca)
return ret;
}
-int cec_add_elem(u64 pfn)
+static int cec_add_elem(u64 pfn)
{
struct ce_array *ca = &ce_arr;
unsigned int to = 0;
@@ -527,7 +527,30 @@ err:
return 1;
}
-void __init cec_init(void)
+static int cec_notifier(struct notifier_block *nb, unsigned long val,
+ void *data)
+{
+ struct mce *m = (struct mce *)data;
+
+ if (!m)
+ return NOTIFY_DONE;
+
+ /* We eat only correctable DRAM errors with usable addresses. */
+ if (mce_is_memory_error(m) &&
+ mce_is_correctable(m) &&
+ mce_usable_address(m))
+ if (!cec_add_elem(m->addr >> PAGE_SHIFT))
+ return NOTIFY_STOP;
+
+ return NOTIFY_DONE;
+}
+
+static struct notifier_block cec_nb = {
+ .notifier_call = cec_notifier,
+ .priority = MCE_PRIO_CEC,
+};
+
+static void __init cec_init(void)
{
if (ce_arr.disabled)
return;
@@ -546,8 +569,11 @@ void __init cec_init(void)
INIT_DELAYED_WORK(&cec_work, cec_work_fn);
schedule_delayed_work(&cec_work, CEC_DECAY_DEFAULT_INTERVAL);
+ mce_register_decode_chain(&cec_nb);
+
pr_info("Correctable Errors collector initialized.\n");
}
+late_initcall(cec_init);
int __init parse_cec_param(char *str)
{
diff --git a/include/linux/ras.h b/include/linux/ras.h
index 7c3debb..1f4048b 100644
--- a/include/linux/ras.h
+++ b/include/linux/ras.h
@@ -17,12 +17,7 @@ static inline int ras_add_daemon_trace(void) { return 0; }
#endif
#ifdef CONFIG_RAS_CEC
-void __init cec_init(void);
int __init parse_cec_param(char *str);
-int cec_add_elem(u64 pfn);
-#else
-static inline void __init cec_init(void) { }
-static inline int cec_add_elem(u64 pfn) { return -ENODEV; }
#endif
#ifdef CONFIG_RAS
next prev parent reply other threads:[~2020-04-15 9:50 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-12 20:46 [RFC PATCH 0/5] New way to track mce notifier chain actions Tony Luck
2020-02-12 20:46 ` [PATCH 1/5] x86/mce: Rename "first" function as "early" Tony Luck
2020-02-12 20:46 ` [PATCH 2/5] x86/mce: Convert corrected error collector to use mce notifier Tony Luck
2020-02-12 20:46 ` [PATCH 3/5] x86/mce: Add new "handled" field to "struct mce" Tony Luck
2020-02-13 16:56 ` Borislav Petkov
2020-02-13 22:09 ` Luck, Tony
2020-02-14 8:50 ` Borislav Petkov
2020-02-12 20:46 ` [PATCH 4/5] x86/mce: Fix all mce notifiers to update the mce->handled bitmask Tony Luck
2020-02-13 17:03 ` Borislav Petkov
2020-02-13 22:19 ` Luck, Tony
2020-02-13 22:27 ` Andy Lutomirski
2020-02-13 23:08 ` Luck, Tony
2020-02-14 9:02 ` Borislav Petkov
2020-02-14 0:18 ` Thomas Gleixner
2020-02-14 8:59 ` Borislav Petkov
2020-02-12 20:46 ` [PATCH 5/5] x86/mce: Change default mce logger to check mce->handled Tony Luck
2020-02-13 17:08 ` Borislav Petkov
2020-02-13 22:27 ` Luck, Tony
2020-02-14 9:05 ` Borislav Petkov
2020-02-12 23:08 ` [RFC PATCH 0/5] New way to track mce notifier chain actions Luck, Tony
2020-02-13 5:52 ` Andy Lutomirski
2020-02-13 6:09 ` Borislav Petkov
2020-02-13 16:05 ` Andy Lutomirski
2020-02-14 22:27 ` [PATCH v2 0/7] " Tony Luck
2020-02-14 22:27 ` [PATCH v2 1/7] x86/mce: Rename "first" function as "early" Tony Luck
2020-04-15 9:49 ` [tip: ras/core] " tip-bot2 for Tony Luck
2020-02-14 22:27 ` [PATCH v2 2/7] x86/mce: Convert corrected error collector to use mce notifier Tony Luck
2020-04-15 9:49 ` tip-bot2 for Tony Luck [this message]
2020-02-14 22:27 ` [PATCH v2 3/7] x86/mce: Add new "kflags" field to "struct mce" Tony Luck
2020-04-15 9:49 ` [tip: ras/core] x86/mce: Add a struct mce.kflags field tip-bot2 for Tony Luck
2020-04-15 18:19 ` Luck, Tony
2020-04-15 18:36 ` Borislav Petkov
2020-04-15 19:58 ` [PATCH] x86/mce: Drop bogus comment about mce.kflags Luck, Tony
2020-04-17 9:21 ` [tip: ras/core] " tip-bot2 for Tony Luck
2020-04-20 8:06 ` [tip: ras/core] x86/mce: Add a struct mce.kflags field Christoph Hellwig
2020-04-20 8:42 ` Borislav Petkov
2020-02-14 22:27 ` [PATCH v2 4/7] x86/mce: Fix all mce notifiers to update the mce->kflags bitmask Tony Luck
2020-04-07 8:21 ` Borislav Petkov
2020-04-15 9:49 ` [tip: ras/core] " tip-bot2 for Tony Luck
2020-02-14 22:27 ` [PATCH v2 5/7] x86/mce: Change default mce logger to check mce->kflags Tony Luck
2020-04-07 11:10 ` Borislav Petkov
2020-04-07 16:43 ` Luck, Tony
2020-04-07 19:37 ` Borislav Petkov
2020-04-07 19:44 ` Luck, Tony
2020-04-15 9:49 ` [tip: ras/core] x86/mce: Change default MCE " tip-bot2 for Tony Luck
2020-02-14 22:27 ` [PATCH v2 6/7] x86/mce: Add mce=print_all option Tony Luck
2020-04-15 9:49 ` [tip: ras/core] " tip-bot2 for Tony Luck
2020-02-14 22:27 ` [PATCH v2 7/7] x86/mce: Drop the EDAC report status checks Tony Luck
2020-04-15 9:49 ` [tip: ras/core] EDAC: " tip-bot2 for Tony Luck
2020-04-07 16:34 ` [PATCH 0/9 v3] New way to track mce notifier chain actions Borislav Petkov
2020-04-07 16:34 ` [PATCH 1/9] x86/mce/amd, edac: Remove report_gart_errors Borislav Petkov
2020-04-15 9:49 ` [tip: ras/core] " tip-bot2 for Borislav Petkov
2020-04-07 16:34 ` [PATCH 2/9] x86/mce: Rename "first" function as "early" Borislav Petkov
2020-04-07 16:34 ` [PATCH 3/9] x86/mce: Convert the CEC to use the MCE notifier Borislav Petkov
2020-04-07 16:34 ` [PATCH 4/9] x86/mce: Add a struct mce.kflags field Borislav Petkov
2020-04-07 16:34 ` [PATCH 5/9] x86/mce: Fix all mce notifiers to update the mce->kflags bitmask Borislav Petkov
2020-04-07 16:34 ` [PATCH 6/9] x86/mce: Change default MCE logger to check mce->kflags Borislav Petkov
2020-04-07 16:34 ` [PATCH 7/9] x86/mce: Add mce=print_all option Borislav Petkov
2020-04-07 16:34 ` [PATCH 8/9] EDAC: Drop the EDAC report status checks Borislav Petkov
2020-04-07 16:34 ` [PATCH 9/9] x86/mce: Fixup exception only for the correct MCEs Borislav Petkov
2020-04-15 9:49 ` [tip: ras/core] " tip-bot2 for Borislav Petkov
2020-04-07 19:53 ` [PATCH 0/9 v3] New way to track mce notifier chain actions Luck, Tony
2020-04-07 19:56 ` 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=158694418890.28353.11828147027206185087.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@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;
as well as URLs for NNTP newsgroup(s).