x86/mce: Take action on UCNA/Deferred errors again
authorJan H. Schönherr <jschoenh@amazon.de>
Fri, 3 Jan 2020 15:07:17 +0000 (16:07 +0100)
committerBorislav Petkov <bp@suse.de>
Mon, 13 Jan 2020 09:07:23 +0000 (10:07 +0100)
Commit

  fa92c5869426 ("x86, mce: Support memory error recovery for both UCNA
and Deferred error in machine_check_poll")

added handling of UCNA and Deferred errors by adding them to the ring
for SRAO errors.

Later, commit

  fd4cf79fcc4b ("x86/mce: Remove the MCE ring for Action Optional errors")

switched storage from the SRAO ring to the unified pool that is still
in use today. In order to only act on the intended errors, a filter
for MCE_AO_SEVERITY is used -- effectively removing handling of
UCNA/Deferred errors again.

Extend the severity filter to include UCNA/Deferred errors again.
Also, generalize the naming of the notifier from SRAO to UC to capture
the extended scope.

Note, that this change may cause a message like the following to appear,
as the same address may be reported as SRAO and as UCNA:

 Memory failure: 0x5fe3284: already hardware poisoned

Technically, this is a return to previous behavior.

Signed-off-by: Jan H. Schönherr <jschoenh@amazon.de>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Tony Luck <tony.luck@intel.com>
Link: https://lkml.kernel.org/r/20200103150722.20313-2-jschoenh@amazon.de
arch/x86/include/asm/mce.h
arch/x86/kernel/cpu/mce/core.c

index dc2d4b206ab7e2417c244050764ef2e0c4953fee..c8ff6f6750ef80a6635988d6897f67bca715403f 100644 (file)
@@ -144,7 +144,7 @@ struct mce_log_buffer {
 
 enum mce_notifier_prios {
        MCE_PRIO_FIRST          = INT_MAX,
-       MCE_PRIO_SRAO           = INT_MAX - 1,
+       MCE_PRIO_UC             = INT_MAX - 1,
        MCE_PRIO_EXTLOG         = INT_MAX - 2,
        MCE_PRIO_NFIT           = INT_MAX - 3,
        MCE_PRIO_EDAC           = INT_MAX - 4,
index 68dd4b35874013dc5feb90dcd10f2d820ce7893b..d061753354eceef5fff34edc7a1e46d85adae7e1 100644 (file)
@@ -156,10 +156,8 @@ void mce_log(struct mce *m)
 }
 EXPORT_SYMBOL_GPL(mce_log);
 
-static struct notifier_block mce_srao_nb;
-
 /*
- * We run the default notifier if we have only the SRAO, the first and the
+ * We run the default notifier if we have only the UC, the first and the
  * default notifier registered. I.e., the mandatory NUM_DEFAULT_NOTIFIERS
  * notifiers registered on the chain.
  */
@@ -585,26 +583,29 @@ static struct notifier_block first_nb = {
        .priority       = MCE_PRIO_FIRST,
 };
 
-static int srao_decode_notifier(struct notifier_block *nb, unsigned long val,
-                               void *data)
+static int uc_decode_notifier(struct notifier_block *nb, unsigned long val,
+                             void *data)
 {
        struct mce *mce = (struct mce *)data;
        unsigned long pfn;
 
-       if (!mce)
+       if (!mce || !mce_usable_address(mce))
                return NOTIFY_DONE;
 
-       if (mce_usable_address(mce) && (mce->severity == MCE_AO_SEVERITY)) {
-               pfn = mce->addr >> PAGE_SHIFT;
-               if (!memory_failure(pfn, 0))
-                       set_mce_nospec(pfn);
-       }
+       if (mce->severity != MCE_AO_SEVERITY &&
+           mce->severity != MCE_DEFERRED_SEVERITY)
+               return NOTIFY_DONE;
+
+       pfn = mce->addr >> PAGE_SHIFT;
+       if (!memory_failure(pfn, 0))
+               set_mce_nospec(pfn);
 
        return NOTIFY_OK;
 }
-static struct notifier_block mce_srao_nb = {
-       .notifier_call  = srao_decode_notifier,
-       .priority       = MCE_PRIO_SRAO,
+
+static struct notifier_block mce_uc_nb = {
+       .notifier_call  = uc_decode_notifier,
+       .priority       = MCE_PRIO_UC,
 };
 
 static int mce_default_notifier(struct notifier_block *nb, unsigned long val,
@@ -2032,7 +2033,7 @@ int __init mcheck_init(void)
 {
        mcheck_intel_therm_init();
        mce_register_decode_chain(&first_nb);
-       mce_register_decode_chain(&mce_srao_nb);
+       mce_register_decode_chain(&mce_uc_nb);
        mce_register_decode_chain(&mce_default_nb);
        mcheck_vendor_init_severity();