Re: [PATCH 1/4] perf vendor events amd: Add Zen 5 core events
From: Sandipan Das
Date: Tue Mar 12 2024 - 05:59:48 EST
On 3/11/2024 11:10 PM, Ian Rogers wrote:
> On Sun, Mar 10, 2024 at 10:23 PM Sandipan Das <sandipan.das@xxxxxxx> wrote:
>>
>> Add core events taken from Section 1.4 "Core Performance Monitor
>> Counters" of the Performance Monitor Counters for AMD Family 1Ah Model
>> 00h-0Fh Processors document available at the link below. This
>> constitutes events which capture information on op dispatch, execution
>> and retirement, branch prediction, L1 and L2 cache activity,
>> TLB activity, etc.
>>
>> Link: https://bugzilla.kernel.org/attachment.cgi?id=305974
>> Signed-off-by: Sandipan Das <sandipan.das@xxxxxxx>
>> ---
>> .../pmu-events/arch/x86/amdzen5/branch.json | 82 ++
>> .../pmu-events/arch/x86/amdzen5/cache.json | 605 +++++++++++++
>> .../pmu-events/arch/x86/amdzen5/core.json | 122 +++
>> .../arch/x86/amdzen5/floating-point.json | 830 ++++++++++++++++++
>> .../pmu-events/arch/x86/amdzen5/memory.json | 180 ++++
>> .../pmu-events/arch/x86/amdzen5/other.json | 168 ++++
>> 6 files changed, 1987 insertions(+)
>> create mode 100644 tools/perf/pmu-events/arch/x86/amdzen5/branch.json
>> create mode 100644 tools/perf/pmu-events/arch/x86/amdzen5/cache.json
>> create mode 100644 tools/perf/pmu-events/arch/x86/amdzen5/core.json
>> create mode 100644 tools/perf/pmu-events/arch/x86/amdzen5/floating-point.json
>> create mode 100644 tools/perf/pmu-events/arch/x86/amdzen5/memory.json
>> create mode 100644 tools/perf/pmu-events/arch/x86/amdzen5/other.json
>>
>> diff --git a/tools/perf/pmu-events/arch/x86/amdzen5/branch.json b/tools/perf/pmu-events/arch/x86/amdzen5/branch.json
>> new file mode 100644
>> index 000000000000..208c646c59ca
>> --- /dev/null
>> +++ b/tools/perf/pmu-events/arch/x86/amdzen5/branch.json
>> @@ -0,0 +1,82 @@
>> +[
>> + {
>> + "EventName": "bp_l2_btb_correct",
>> + "EventCode": "0x8b",
>> + "BriefDescription": "L2 branch prediction overrides existing prediction (speculative)."
>> + },
>> + {
>> + "EventName": "bp_dyn_ind_pred",
>> + "EventCode": "0x8e",
>> + "BriefDescription": "Dynamic indirect predictions (branch used the indirect predictor to make a prediction)."
>> + },
>> + {
>> + "EventName": "bp_de_redirect",
>> + "EventCode": "0x91",
>> + "BriefDescription": "Instruction decoder corrects the predicted target and resteers the branch predictor."
>> + },
>> + {
>> + "EventName": "ex_ret_brn",
>> + "EventCode": "0xc2",
>> + "BriefDescription": "Retired branch instructions (all types of architectural control flow changes, including exceptions and interrupts)."
>> + },
>
> So the "bp_" prefix means branch predictor, but here this is an "ex_"
> prefix. You've put them both in the topic "branch".
>
> [ ... snip ... ]
>
>> diff --git a/tools/perf/pmu-events/arch/x86/amdzen5/other.json b/tools/perf/pmu-events/arch/x86/amdzen5/other.json
>> new file mode 100644
>> index 000000000000..9d49a23622e9
>> --- /dev/null
>> +++ b/tools/perf/pmu-events/arch/x86/amdzen5/other.json
>> @@ -0,0 +1,168 @@
>> +[
>> + {
>> + "EventName": "bp_redirects.resync",
>> + "EventCode": "0x9f",
>> + "BriefDescription": "Redirects of the branch predictor caused by resyncs.",
>> + "UMask": "0x01"
>> + },
>
> Here is a branch predictor "bp_" event but the topic is "other", why
> isn't it a topic of branch?
>
> Given the number of events categorized as topic "other" wouldn't it be
> better to regenerate the events just using the prefix to set the
> topic?
>
Sure, I'll reorganize them.