xref: /linux/include/trace/events/mce.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM mce
4 
5 #if !defined(_TRACE_MCE_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_MCE_H
7 
8 #include <linux/ktime.h>
9 #include <linux/tracepoint.h>
10 #include <asm/mce.h>
11 
12 /*
13  * MCE Event Record.
14  *
15  * Only very relevant and transient information which cannot be
16  * gathered from a system by any other means or which can only be
17  * acquired arduously should be added to this record.
18  */
19 
20 TRACE_EVENT(mce_record,
21 
22 	TP_PROTO(struct mce_hw_err *err),
23 
24 	TP_ARGS(err),
25 
26 	TP_STRUCT__entry(
27 		__field(	u64,		mcgcap		)
28 		__field(	u64,		mcgstatus	)
29 		__field(	u64,		status		)
30 		__field(	u64,		addr		)
31 		__field(	u64,		misc		)
32 		__field(	u64,		synd		)
33 		__field(	u64,		ipid		)
34 		__field(	u64,		ip		)
35 		__field(	u64,		tsc		)
36 		__field(	u64,		ppin		)
37 		__field(	u64,		walltime	)
38 		__field(	u32,		cpu		)
39 		__field(	u32,		cpuid		)
40 		__field(	u32,		apicid		)
41 		__field(	u32,		socketid	)
42 		__field(	u8,		cs		)
43 		__field(	u8,		bank		)
44 		__field(	u8,		cpuvendor	)
45 		__field(	u32,		microcode	)
46 		__dynamic_array(u8, v_data, sizeof(err->vendor))
47 	),
48 
49 	TP_fast_assign(
50 		__entry->mcgcap		= err->m.mcgcap;
51 		__entry->mcgstatus	= err->m.mcgstatus;
52 		__entry->status		= err->m.status;
53 		__entry->addr		= err->m.addr;
54 		__entry->misc		= err->m.misc;
55 		__entry->synd		= err->m.synd;
56 		__entry->ipid		= err->m.ipid;
57 		__entry->ip		= err->m.ip;
58 		__entry->tsc		= err->m.tsc;
59 		__entry->ppin		= err->m.ppin;
60 		__entry->walltime	= err->m.time;
61 		__entry->cpu		= err->m.extcpu;
62 		__entry->cpuid		= err->m.cpuid;
63 		__entry->apicid		= err->m.apicid;
64 		__entry->socketid	= err->m.socketid;
65 		__entry->cs		= err->m.cs;
66 		__entry->bank		= err->m.bank;
67 		__entry->cpuvendor	= err->m.cpuvendor;
68 		__entry->microcode	= err->m.microcode;
69 		memcpy(__get_dynamic_array(v_data), &err->vendor, sizeof(err->vendor));
70 	),
71 
72 	TP_printk("CPU: %d, MCGc/s: %llx/%llx, MC%d: %016llx, IPID: %016llx, ADDR: %016llx, MISC: %016llx, SYND: %016llx, RIP: %02x:<%016llx>, TSC: %llx, PPIN: %llx, vendor: %u, CPUID: %x, time: %llu, socket: %u, APIC: %x, microcode: %x, vendor data: %s",
73 		__entry->cpu,
74 		__entry->mcgcap, __entry->mcgstatus,
75 		__entry->bank, __entry->status,
76 		__entry->ipid,
77 		__entry->addr,
78 		__entry->misc,
79 		__entry->synd,
80 		__entry->cs, __entry->ip,
81 		__entry->tsc,
82 		__entry->ppin,
83 		__entry->cpuvendor,
84 		__entry->cpuid,
85 		__entry->walltime,
86 		__entry->socketid,
87 		__entry->apicid,
88 		__entry->microcode,
89 		__print_dynamic_array(v_data, sizeof(u8)))
90 );
91 
92 #endif /* _TRACE_MCE_H */
93 
94 /* This part must be outside protection */
95 #include <trace/define_trace.h>
96