[PATCH 2/4] mce, trace: Add decoded string to mce_record's format

From: Borislav Petkov
Date: Sat Mar 27 2010 - 12:25:02 EST


Put the decoded error string into the trace record.

Not-Signed-off-by: Borislav Petkov <petkovbb@xxxxxxxxx>
---
arch/x86/kernel/cpu/mcheck/mce.c | 2 +-
include/trace/events/mce.h | 43 +++++++++++++++++++++----------------
2 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index b57c185..3880f3c 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -161,7 +161,7 @@ void mce_log(struct mce *mce)
unsigned next, entry;

/* Emit the trace record: */
- trace_mce_record(mce);
+ trace_mce_record(mce, "");

mce->finished = 0;
wmb();
diff --git a/include/trace/events/mce.h b/include/trace/events/mce.h
index 7eee778..96b040a 100644
--- a/include/trace/events/mce.h
+++ b/include/trace/events/mce.h
@@ -8,11 +8,13 @@
#include <linux/tracepoint.h>
#include <asm/mce.h>

+#define DECODED_ERR_SZ 200
+
TRACE_EVENT(mce_record,

- TP_PROTO(struct mce *m),
+ TP_PROTO(struct mce *m, char *decoded_err),

- TP_ARGS(m),
+ TP_ARGS(m, decoded_err),

TP_STRUCT__entry(
__field( u64, mcgcap )
@@ -30,27 +32,29 @@ TRACE_EVENT(mce_record,
__field( u32, apicid )
__field( u32, socketid )
__field( u8, cpuvendor )
+ __array( char, decoded_err, DECODED_ERR_SZ)
),

TP_fast_assign(
- __entry->mcgcap = m->mcgcap;
- __entry->mcgstatus = m->mcgstatus;
- __entry->bank = m->bank;
- __entry->status = m->status;
- __entry->addr = m->addr;
- __entry->misc = m->misc;
- __entry->ip = m->ip;
- __entry->cs = m->cs;
- __entry->tsc = m->tsc;
- __entry->walltime = m->time;
- __entry->cpu = m->extcpu;
- __entry->cpuid = m->cpuid;
- __entry->apicid = m->apicid;
- __entry->socketid = m->socketid;
- __entry->cpuvendor = m->cpuvendor;
+ __entry->mcgcap = m->mcgcap;
+ __entry->mcgstatus = m->mcgstatus;
+ __entry->bank = m->bank;
+ __entry->status = m->status;
+ __entry->addr = m->addr;
+ __entry->misc = m->misc;
+ __entry->ip = m->ip;
+ __entry->cs = m->cs;
+ __entry->tsc = m->tsc;
+ __entry->walltime = m->time;
+ __entry->cpu = m->extcpu;
+ __entry->cpuid = m->cpuid;
+ __entry->apicid = m->apicid;
+ __entry->socketid = m->socketid;
+ __entry->cpuvendor = m->cpuvendor;
+ memcpy(__entry->decoded_err, decoded_err, DECODED_ERR_SZ);
),

- TP_printk("CPU: %d, MCGc/s: %llx/%llx, MC%d: %016Lx, ADDR/MISC: %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, ADDR/MISC: %016Lx/%016Lx, RIP: %02x:<%016Lx>, TSC: %llx, PROCESSOR: %u:%x, TIME: %llu, SOCKET: %u, APIC: %x\nErr: %s\n",
__entry->cpu,
__entry->mcgcap, __entry->mcgstatus,
__entry->bank, __entry->status,
@@ -60,7 +64,8 @@ TRACE_EVENT(mce_record,
__entry->cpuvendor, __entry->cpuid,
__entry->walltime,
__entry->socketid,
- __entry->apicid)
+ __entry->apicid,
+ __entry->decoded_err)
);

#endif /* _TRACE_MCE_H */
--
1.6.4.4


--k1lZvvs/B4yU6o8G
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment; filename="0003-edac-mce-Prepare-error-decoded-info.patch"