Commit e462d226 authored by Yazen Ghannam's avatar Yazen Ghannam Committed by Greg Kroah-Hartman

x86/mce: Detect local MCEs properly

commit fead35c6 upstream.

Check the MCG_STATUS_LMCES bit on Intel to verify that current MCE is
local. It is always local on AMD.
Signed-off-by: default avatarYazen Ghannam <Yazen.Ghannam@amd.com>
[ Massaged it a bit. Reflowed comments. Shut up -Wmaybe-uninitialized. ]
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/1462019637-16474-8-git-send-email-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ef111ea3
...@@ -980,11 +980,12 @@ void do_machine_check(struct pt_regs *regs, long error_code) ...@@ -980,11 +980,12 @@ void do_machine_check(struct pt_regs *regs, long error_code)
int i; int i;
int worst = 0; int worst = 0;
int severity; int severity;
/* /*
* Establish sequential order between the CPUs entering the machine * Establish sequential order between the CPUs entering the machine
* check handler. * check handler.
*/ */
int order; int order = -1;
/* /*
* If no_way_out gets set, there is no safe way to recover from this * If no_way_out gets set, there is no safe way to recover from this
* MCE. If mca_cfg.tolerant is cranked up, we'll try anyway. * MCE. If mca_cfg.tolerant is cranked up, we'll try anyway.
...@@ -1000,7 +1001,12 @@ void do_machine_check(struct pt_regs *regs, long error_code) ...@@ -1000,7 +1001,12 @@ void do_machine_check(struct pt_regs *regs, long error_code)
char *msg = "Unknown"; char *msg = "Unknown";
u64 recover_paddr = ~0ull; u64 recover_paddr = ~0ull;
int flags = MF_ACTION_REQUIRED; int flags = MF_ACTION_REQUIRED;
int lmce = 0;
/*
* MCEs are always local on AMD. Same is determined by MCG_STATUS_LMCES
* on Intel.
*/
int lmce = 1;
/* If this CPU is offline, just bail out. */ /* If this CPU is offline, just bail out. */
if (cpu_is_offline(smp_processor_id())) { if (cpu_is_offline(smp_processor_id())) {
...@@ -1039,19 +1045,20 @@ void do_machine_check(struct pt_regs *regs, long error_code) ...@@ -1039,19 +1045,20 @@ void do_machine_check(struct pt_regs *regs, long error_code)
kill_it = 1; kill_it = 1;
/* /*
* Check if this MCE is signaled to only this logical processor * Check if this MCE is signaled to only this logical processor,
* on Intel only.
*/ */
if (m.mcgstatus & MCG_STATUS_LMCES) if (m.cpuvendor == X86_VENDOR_INTEL)
lmce = 1; lmce = m.mcgstatus & MCG_STATUS_LMCES;
else {
/* /*
* Go through all the banks in exclusion of the other CPUs. * Go through all banks in exclusion of the other CPUs. This way we
* This way we don't report duplicated events on shared banks * don't report duplicated events on shared banks because the first one
* because the first one to see it will clear it. * to see it will clear it. If this is a Local MCE, then no need to
* If this is a Local MCE, then no need to perform rendezvous. * perform rendezvous.
*/ */
if (!lmce)
order = mce_start(&no_way_out); order = mce_start(&no_way_out);
}
for (i = 0; i < cfg->banks; i++) { for (i = 0; i < cfg->banks; i++) {
__clear_bit(i, toclear); __clear_bit(i, toclear);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment