[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200212204652.1489-5-tony.luck@intel.com>
Date: Wed, 12 Feb 2020 12:46:51 -0800
From: Tony Luck <tony.luck@...el.com>
To: Borislav Petkov <bp@...en8.de>
Cc: Tony Luck <tony.luck@...el.com>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 4/5] x86/mce: Fix all mce notifiers to update the mce->handled bitmask
If the handler took any action to log or deal with the error, set
a bit int mce->handled so that the default handler on the end of
the machine check chain can see what has been done.
[!!! What to do about NOTIFY_STOP ... any handler that returns this
value short-circuits calling subsequent entries on the chain. In
some cases this may be the right thing to do ... but it others we
really want to keep calling other functions on the chain]
Signed-off-by: Tony Luck <tony.luck@...el.com>
---
arch/x86/kernel/cpu/mce/core.c | 4 +++-
arch/x86/kernel/cpu/mce/dev-mcelog.c | 1 +
drivers/acpi/acpi_extlog.c | 1 +
drivers/acpi/nfit/mce.c | 1 +
drivers/edac/i7core_edac.c | 1 +
drivers/edac/mce_amd.c | 5 ++++-
drivers/edac/pnd2_edac.c | 1 +
drivers/edac/sb_edac.c | 1 +
drivers/edac/skx_common.c | 1 +
drivers/ras/cec.c | 7 +++++--
10 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c
index 06240cbe6f3e..ce7a78872f8f 100644
--- a/arch/x86/kernel/cpu/mce/core.c
+++ b/arch/x86/kernel/cpu/mce/core.c
@@ -579,8 +579,10 @@ static int uc_decode_notifier(struct notifier_block *nb, unsigned long val,
return NOTIFY_DONE;
pfn = mce->addr >> PAGE_SHIFT;
- if (!memory_failure(pfn, 0))
+ if (!memory_failure(pfn, 0)) {
set_mce_nospec(pfn);
+ mce->handled |= MCE_HANDLED_UC;
+ }
return NOTIFY_OK;
}
diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c
index 7c8958dee103..83d83c210ab9 100644
--- a/arch/x86/kernel/cpu/mce/dev-mcelog.c
+++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c
@@ -67,6 +67,7 @@ static int dev_mce_log(struct notifier_block *nb, unsigned long val,
unlock:
mutex_unlock(&mce_chrdev_read_mutex);
+ mce->handled |= MCE_HANDLED_MCELOG;
return NOTIFY_OK;
}
diff --git a/drivers/acpi/acpi_extlog.c b/drivers/acpi/acpi_extlog.c
index 8596a106a933..f7617831ee74 100644
--- a/drivers/acpi/acpi_extlog.c
+++ b/drivers/acpi/acpi_extlog.c
@@ -176,6 +176,7 @@ static int extlog_print(struct notifier_block *nb, unsigned long val,
}
out:
+ mce->handled |= MCE_HANDLED_EXTLOG;
return NOTIFY_STOP;
}
diff --git a/drivers/acpi/nfit/mce.c b/drivers/acpi/nfit/mce.c
index f0ae48515b48..c81c879610d6 100644
--- a/drivers/acpi/nfit/mce.c
+++ b/drivers/acpi/nfit/mce.c
@@ -76,6 +76,7 @@ static int nfit_handle_mce(struct notifier_block *nb, unsigned long val,
*/
acpi_nfit_ars_rescan(acpi_desc, 0);
}
+ mce->handled |= MCE_HANDLED_NFIT;
break;
}
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index b3135b208f9a..727d444e0ac0 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1834,6 +1834,7 @@ static int i7core_mce_check_error(struct notifier_block *nb, unsigned long val,
i7core_check_error(mci, mce);
/* Advise mcelog that the errors were handled */
+ mce->handled |= MCE_HANDLED_EDAC;
return NOTIFY_STOP;
}
diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
index ea980c556f2e..693b0c00b714 100644
--- a/drivers/edac/mce_amd.c
+++ b/drivers/edac/mce_amd.c
@@ -1067,8 +1067,10 @@ amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
unsigned int fam = x86_family(m->cpuid);
int ecc;
- if (ignore_mce(m))
+ if (ignore_mce(m)) {
+ m->handled |= MCE_HANDLED_EDAC;
return NOTIFY_STOP;
+ }
pr_emerg(HW_ERR "%s\n", decode_error_status(m));
@@ -1170,6 +1172,7 @@ amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
err_code:
amd_decode_err_code(m->status & 0xffff);
+ m->handled |= MCE_HANDLED_EDAC;
return NOTIFY_STOP;
}
diff --git a/drivers/edac/pnd2_edac.c b/drivers/edac/pnd2_edac.c
index 933f7722b893..6c2dee16f4e9 100644
--- a/drivers/edac/pnd2_edac.c
+++ b/drivers/edac/pnd2_edac.c
@@ -1429,6 +1429,7 @@ static int pnd2_mce_check_error(struct notifier_block *nb, unsigned long val, vo
pnd2_mce_output_error(mci, mce, &daddr);
/* Advice mcelog that the error were handled */
+ mce->handled |= MCE_HANDLED_EDAC;
return NOTIFY_STOP;
}
diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index 4957e8ee1879..93dd92f8c9bd 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -3183,6 +3183,7 @@ static int sbridge_mce_check_error(struct notifier_block *nb, unsigned long val,
sbridge_mce_output_error(mci, mce);
/* Advice mcelog that the error were handled */
+ mce->handled |= MCE_HANDLED_EDAC;
return NOTIFY_STOP;
}
diff --git a/drivers/edac/skx_common.c b/drivers/edac/skx_common.c
index 99bbaf629b8d..1501c8aeb980 100644
--- a/drivers/edac/skx_common.c
+++ b/drivers/edac/skx_common.c
@@ -616,6 +616,7 @@ int skx_mce_check_error(struct notifier_block *nb, unsigned long val,
skx_mce_output_error(mci, mce, &res);
+ mce->handled |= MCE_HANDLED_EDAC;
return NOTIFY_DONE;
}
diff --git a/drivers/ras/cec.c b/drivers/ras/cec.c
index d7f6718cbf8d..a993ffacfe9d 100644
--- a/drivers/ras/cec.c
+++ b/drivers/ras/cec.c
@@ -538,9 +538,12 @@ static int cec_notifier(struct notifier_block *nb, unsigned long val,
/* 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))
+ mce_usable_address(m)) {
+ if (!cec_add_elem(m->addr >> PAGE_SHIFT)) {
+ m->handled |= MCE_HANDLED_CEC;
return NOTIFY_STOP;
+ }
+ }
return NOTIFY_DONE;
}
--
2.21.1
Powered by blists - more mailing lists