]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86/mce/AMD: Save MCA_IPID in MCE struct on SMCA systems
authorYazen Ghannam <Yazen.Ghannam@amd.com>
Mon, 12 Sep 2016 07:59:37 +0000 (09:59 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 13 Sep 2016 13:23:12 +0000 (15:23 +0200)
The MCA_IPID register uniquely identifies a bank's type and instance
on Scalable MCA systems. We should save the value of this register
in struct mce along with the other relevant error information. This
ensures that we can decode errors without relying on system software to
correlate the bank to the type.

Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: http://lkml.kernel.org/r/1472680624-34221-1-git-send-email-Yazen.Ghannam@amd.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/include/uapi/asm/mce.h
arch/x86/kernel/cpu/mcheck/mce.c
arch/x86/kernel/cpu/mcheck/mce_amd.c
include/trace/events/mce.h

index 8c75fbc94c3f109ea063e9a4331e0780a5083ec8..69a6e07e3149a5851757550c2a0c2780d955bd76 100644 (file)
@@ -27,6 +27,7 @@ struct mce {
        __u32 apicid;   /* CPU initial apic ID */
        __u64 mcgcap;   /* MCGCAP MSR: machine check capabilities of CPU */
        __u64 synd;     /* MCA_SYND MSR: only valid on SMCA systems */
+       __u64 ipid;     /* MCA_IPID MSR: only valid on SMCA systems */
 };
 
 #define MCE_GET_RECORD_LEN   _IOR('M', 1, int)
index 91a179b95fd08ec6fcdf79f841d2eba3d7dac209..17e9ff011c0ed40fadc850b55ab85af86cdf2021 100644 (file)
@@ -583,8 +583,12 @@ static void mce_read_aux(struct mce *m, int i)
                }
        }
 
-       if (mce_flags.smca && (m->status & MCI_STATUS_SYNDV))
-               m->synd = mce_rdmsrl(MSR_AMD64_SMCA_MCx_SYND(i));
+       if (mce_flags.smca) {
+               m->ipid = mce_rdmsrl(MSR_AMD64_SMCA_MCx_IPID(i));
+
+               if (m->status & MCI_STATUS_SYNDV)
+                       m->synd = mce_rdmsrl(MSR_AMD64_SMCA_MCx_SYND(i));
+       }
 }
 
 static bool memory_error(struct mce *m)
index 16766e09c2b7fc2ac8e2b1dd3b491664c3359b0a..d2f92ab5322fb750d58b7e01b8dc5c5629a05d61 100644 (file)
@@ -564,8 +564,12 @@ __log_error(unsigned int bank, bool deferred_err, bool threshold_err, u64 misc)
        if (m.status & MCI_STATUS_ADDRV)
                rdmsrl(msr_addr, m.addr);
 
-       if (mce_flags.smca && (m.status & MCI_STATUS_SYNDV))
-               rdmsrl(MSR_AMD64_SMCA_MCx_SYND(bank), m.synd);
+       if (mce_flags.smca) {
+               rdmsrl(MSR_AMD64_SMCA_MCx_IPID(bank), m.ipid);
+
+               if (m.status & MCI_STATUS_SYNDV)
+                       rdmsrl(MSR_AMD64_SMCA_MCx_SYND(bank), m.synd);
+       }
 
        mce_log(&m);
 
index 8be5268caf28632e9ff75e376d9075dbccecc558..70f02149808c561fccb7dfd11d81051cfedfb944 100644 (file)
@@ -21,6 +21,7 @@ TRACE_EVENT(mce_record,
                __field(        u64,            addr            )
                __field(        u64,            misc            )
                __field(        u64,            synd            )
+               __field(        u64,            ipid            )
                __field(        u64,            ip              )
                __field(        u64,            tsc             )
                __field(        u64,            walltime        )
@@ -40,6 +41,7 @@ TRACE_EVENT(mce_record,
                __entry->addr           = m->addr;
                __entry->misc           = m->misc;
                __entry->synd           = m->synd;
+               __entry->ipid           = m->ipid;
                __entry->ip             = m->ip;
                __entry->tsc            = m->tsc;
                __entry->walltime       = m->time;
@@ -52,10 +54,11 @@ TRACE_EVENT(mce_record,
                __entry->cpuvendor      = m->cpuvendor;
        ),
 
-       TP_printk("CPU: %d, MCGc/s: %llx/%llx, MC%d: %016Lx, ADDR/MISC/SYND: %016Lx/%016Lx/%016Lx, RIP: %02x:<%016Lx>, TSC: %llx, PROCESSOR: %u:%x, TIME: %llu, SOCKET: %u, APIC: %x",
+       TP_printk("CPU: %d, MCGc/s: %llx/%llx, MC%d: %016Lx, IPID: %016Lx, ADDR/MISC/SYND: %016Lx/%016Lx/%016Lx, RIP: %02x:<%016Lx>, TSC: %llx, PROCESSOR: %u:%x, TIME: %llu, SOCKET: %u, APIC: %x",
                __entry->cpu,
                __entry->mcgcap, __entry->mcgstatus,
                __entry->bank, __entry->status,
+               __entry->ipid,
                __entry->addr, __entry->misc, __entry->synd,
                __entry->cs, __entry->ip,
                __entry->tsc,