[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1404925766-32253-4-git-send-email-hskinnemoen@google.com>
Date: Wed, 9 Jul 2014 10:09:23 -0700
From: Havard Skinnemoen <hskinnemoen@...gle.com>
To: Tony Luck <tony.luck@...el.com>, Borislav Petkov <bp@...en8.de>
Cc: linux-kernel@...r.kernel.org, Ewout van Bekkum <ewout@...gle.com>,
Havard Skinnemoen <hskinnemoen@...gle.com>
Subject: [PATCH 3/6] x86-mce: Clear CMCI enable on all claimed CMCI banks before reboot.
From: Ewout van Bekkum <ewout@...gle.com>
The existing CMCI code did not call cmci_clear() on each CPU upon
reboot. This meant that a kexec would leave all the CMCI banks
unclaimable and with polling disabled as the cmci_discover() method
relies on the CMCI enable bit for each bank to determine if they can be
claimed.
Signed-off-by: Ewout van Bekkum <ewout@...gle.com>
Signed-off-by: Havard Skinnemoen <hskinnemoen@...gle.com>
---
arch/x86/kernel/cpu/mcheck/mce_intel.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index d015daf..36a1948 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -14,6 +14,8 @@
#include <asm/processor.h>
#include <asm/msr.h>
#include <asm/mce.h>
+#include <linux/reboot.h>
+#include <linux/atomic.h>
#include "mce-internal.h"
@@ -388,6 +390,31 @@ void cmci_disable_bank(int bank)
spin_unlock_irqrestore(&cmci_discover_lock, flags);
}
+/*
+ * Fully disable CMCI on this CPU in case of shutdown.
+ */
+static void cmci_disable(void *dummy)
+{
+ cmci_clear();
+}
+
+static int cmci_reboot_event(struct notifier_block *this,
+ unsigned long event, void *ptr)
+{
+ /*
+ * Disable CMCI on this CPU for all banks it owns so CPUs after the
+ * reboot can reclaim the banks through rediscovery.
+ */
+ on_each_cpu(cmci_disable, NULL, 1);
+ return NOTIFY_OK;
+}
+
+static struct notifier_block cmci_reboot_notifier = {
+ .notifier_call = cmci_reboot_event,
+};
+
+static bool reboot_notifier_registered;
+
static void intel_init_cmci(void)
{
int banks;
@@ -395,6 +422,9 @@ static void intel_init_cmci(void)
if (!cmci_supported(&banks))
return;
+ if (!xchg(&reboot_notifier_registered, true))
+ register_reboot_notifier(&cmci_reboot_notifier);
+
mce_threshold_vector = intel_threshold_interrupt;
cmci_discover(banks);
/*
--
2.0.0.526.g5318336
--
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