From: Avadhut Naik <avadnaik@amd.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: x86@kernel.org, linux-trace-kernel@vger.kernel.org,
linux-edac@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, bp@alien8.de, tony.luck@intel.com,
rafael@kernel.org, tglx@linutronix.de, mingo@redhat.com,
lenb@kernel.org, mchehab@kernel.org, james.morse@arm.com,
airlied@gmail.com, yazen.ghannam@amd.com, john.allen@amd.com,
Avadhut Naik <avadhut.naik@amd.com>
Subject: [PATCH v4 2/4] x86/mce, EDAC/mce_amd: Add support for new MCA_SYND{1,2} registers
Date: Wed, 21 Aug 2024 13:55:00 -0500 [thread overview]
Message-ID: <9189a857-8c7b-42ac-958b-89a3d6a7ded5@amd.com> (raw)
In-Reply-To: <20240821134057.6fc50940@gandalf.local.home>
On 8/21/24 12:40, Steven Rostedt wrote:
> On Thu, 15 Aug 2024 16:16:33 -0500
> Avadhut Naik <avadhut.naik@amd.com> wrote:
>
>> 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.
>
That helps! Will remove the len field.
>> + __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
>
Thanks for the patch! Will incorporate it this set.
I did, however, have another question. This was actually raised in an earlier
version of this set by Boris and Tony. Not very sure about the answer though.
Is there a way through which we can make the tracepoints smarter i.e. have
conditional checks in them?
To provide some more context, as of now, the v_data dynamic array above will
contain vendor-specific data only on AMD systems. On Intel systems, IIUC,
its contents will be 0x0.
Consequently, the tracepoint output on Intel systems will have some thing like
"0x0,0x0,0x0" at the end.
Is there some way through which we can work around this? Can we perform a
vendor check inside the tracepoint so that the above dynamic array is logged
only on AMD systems and not on Intel systems?
--
Thanks,
Avadhut Naik
next prev parent reply other threads:[~2024-08-21 18:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-15 21:16 [PATCH v4 0/4] MCE wrapper and support for new SMCA syndrome MSRs Avadhut Naik
2024-08-15 21:16 ` [PATCH v4 1/4] x86/mce: Add wrapper for struct mce to export vendor specific info Avadhut Naik
2024-08-15 21:16 ` [PATCH v4 2/4] x86/mce, EDAC/mce_amd: Add support for new MCA_SYND{1,2} registers Avadhut Naik
2024-08-21 17:40 ` Steven Rostedt
2024-08-21 17:48 ` [PATCH] tracing: Add __print_dynamic_array() helper Steven Rostedt
2024-08-21 18:55 ` Avadhut Naik [this message]
2024-08-15 21:16 ` [PATCH v4 3/4] x86/mce/apei: Handle variable register array size Avadhut Naik
2024-08-15 21:16 ` [PATCH v4 4/4] EDAC/mce_amd: Add support for FRU Text in MCA Avadhut Naik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9189a857-8c7b-42ac-958b-89a3d6a7ded5@amd.com \
--to=avadnaik@amd.com \
--cc=airlied@gmail.com \
--cc=avadhut.naik@amd.com \
--cc=bp@alien8.de \
--cc=james.morse@arm.com \
--cc=john.allen@amd.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mingo@redhat.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=yazen.ghannam@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox