x86/MCE: Make correctable error detection look at the Deferred bit
[sfrench/cifs-2.6.git] / arch / x86 / kernel / cpu / mcheck / mce.c
index 3b413065c61308104794db2efe6ab939b39411a1..1b2c114733768744cc0c15d594e031bbeedfb203 100644 (file)
@@ -503,10 +503,8 @@ static int mce_usable_address(struct mce *m)
 bool mce_is_memory_error(struct mce *m)
 {
        if (m->cpuvendor == X86_VENDOR_AMD) {
-               /* ErrCodeExt[20:16] */
-               u8 xec = (m->status >> 16) & 0x1f;
+               return amd_mce_is_memory_error(m);
 
-               return (xec == 0x0 || xec == 0x8);
        } else if (m->cpuvendor == X86_VENDOR_INTEL) {
                /*
                 * Intel SDM Volume 3B - 15.9.2 Compound Error Codes
@@ -530,6 +528,17 @@ bool mce_is_memory_error(struct mce *m)
 }
 EXPORT_SYMBOL_GPL(mce_is_memory_error);
 
+static bool mce_is_correctable(struct mce *m)
+{
+       if (m->cpuvendor == X86_VENDOR_AMD && m->status & MCI_STATUS_DEFERRED)
+               return false;
+
+       if (m->status & MCI_STATUS_UC)
+               return false;
+
+       return true;
+}
+
 static bool cec_add_mce(struct mce *m)
 {
        if (!m)
@@ -537,7 +546,7 @@ static bool cec_add_mce(struct mce *m)
 
        /* We eat only correctable DRAM errors with usable addresses. */
        if (mce_is_memory_error(m) &&
-           !(m->status & MCI_STATUS_UC) &&
+           mce_is_correctable(m)  &&
            mce_usable_address(m))
                if (!cec_add_elem(m->addr >> PAGE_SHIFT))
                        return true;
@@ -1367,13 +1376,12 @@ static void __start_timer(struct timer_list *t, unsigned long interval)
        local_irq_restore(flags);
 }
 
-static void mce_timer_fn(unsigned long data)
+static void mce_timer_fn(struct timer_list *t)
 {
-       struct timer_list *t = this_cpu_ptr(&mce_timer);
-       int cpu = smp_processor_id();
+       struct timer_list *cpu_t = this_cpu_ptr(&mce_timer);
        unsigned long iv;
 
-       WARN_ON(cpu != data);
+       WARN_ON(cpu_t != t);
 
        iv = __this_cpu_read(mce_next_interval);
 
@@ -1763,17 +1771,15 @@ static void mce_start_timer(struct timer_list *t)
 static void __mcheck_cpu_setup_timer(void)
 {
        struct timer_list *t = this_cpu_ptr(&mce_timer);
-       unsigned int cpu = smp_processor_id();
 
-       setup_pinned_timer(t, mce_timer_fn, cpu);
+       timer_setup(t, mce_timer_fn, TIMER_PINNED);
 }
 
 static void __mcheck_cpu_init_timer(void)
 {
        struct timer_list *t = this_cpu_ptr(&mce_timer);
-       unsigned int cpu = smp_processor_id();
 
-       setup_pinned_timer(t, mce_timer_fn, cpu);
+       timer_setup(t, mce_timer_fn, TIMER_PINNED);
        mce_start_timer(t);
 }