Re: [PATCH v4 2/4] x86/mce, EDAC/mce_amd: Add support for new MCA_SYND{1,2} registers
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2024-08-21 17:40:30
Also in:
linux-acpi, linux-edac, lkml
On Thu, 15 Aug 2024 16:16:33 -0500 Avadhut Naik [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/include/trace/events/mce.h b/include/trace/events/mce.h index 65aba1afcd07..1e7d5696b3ba 100644 --- a/include/trace/events/mce.h +++ b/include/trace/events/mce.h@@ -43,6 +43,8 @@ TRACE_EVENT(mce_record, __field( u8, bank ) __field( u8, cpuvendor ) __field( u32, microcode ) + __field( u8, len )
You don't need to save the length. It's already saved in the __dynamic_array meta data.
quoted hunk ↗ jump to hunk
+ __dynamic_array(u8, v_data, sizeof(err->vendor)) ), TP_fast_assign(@@ -65,9 +67,11 @@ TRACE_EVENT(mce_record, __entry->bank = err->m.bank; __entry->cpuvendor = err->m.cpuvendor; __entry->microcode = err->m.microcode; + __entry->len = sizeof(err->vendor); + memcpy(__get_dynamic_array(v_data), &err->vendor, sizeof(err->vendor)); ), - TP_printk("CPU: %d, MCGc/s: %llx/%llx, MC%d: %016Lx, IPID: %016Lx, ADDR: %016Lx, MISC: %016Lx, SYND: %016Lx, RIP: %02x:<%016Lx>, TSC: %llx, PPIN: %llx, vendor: %u, CPUID: %x, time: %llu, socket: %u, APIC: %x, microcode: %x", + 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", __entry->cpu, __entry->mcgcap, __entry->mcgstatus, __entry->bank, __entry->status,@@ -83,7 +87,8 @@ TRACE_EVENT(mce_record, __entry->walltime, __entry->socketid, __entry->apicid, - __entry->microcode) + __entry->microcode, + __print_array(__get_dynamic_array(v_data), __entry->len / 8, 8))
You can replace the __entry->len with: __print_array(__get_dynamic_array(v_data), __get_dynamic_array_len(v_data) / 8, 8)) Hmm, I should add a helper function that would do the same with just: __print_dynamic_array(vdata, 8); Where it will have __print_dynamic_array(array-name, el-size) -- Steve
); #endif /* _TRACE_MCE_H */