RE: [PATCH 4/6] perf jevents: Add support for NVIDIA Tegra410 PCIE-TGT PMU aliasing
From: Besar Wicaksono
Date: Tue Oct 20 2026 - 18:02:18 EST
> -----Original Message-----
> From: Ian Rogers <irogers@xxxxxxxxxx>
> Sent: Monday, October 19, 2026 11:18 PM
> To: Besar Wicaksono <bwicaksono@xxxxxxxxxx>
> Cc: acme@xxxxxxxxxx; namhyung@xxxxxxxxxx; linux-tegra@xxxxxxxxxxxxxxx;
> linux-arm-kernel@xxxxxxxxxxxxxxxxxxx; linux-perf-users@xxxxxxxxxxxxxxx;
> linux-kernel@xxxxxxxxxxxxxxx; Vikram Sethi <vsethi@xxxxxxxxxx>; Rich Wiley
> <rwiley@xxxxxxxxxx>; Sean Kelley <skelley@xxxxxxxxxx>; Matt Ochs
> <mochs@xxxxxxxxxx>; Raj Joshi <rajjoshi@xxxxxxxxxx>; Thierry Reding
> <treding@xxxxxxxxxx>; Jon Hunter <jonathanh@xxxxxxxxxx>;
> john.garry@xxxxxxxxx; will@xxxxxxxxxx; james.clark@xxxxxxxxxx;
> mike.leach@xxxxxxx; leo.yan@xxxxxxxxx; mark.rutland@xxxxxxx;
> alexander.shishkin@xxxxxxxxxxxxxxx; jolsa@xxxxxxxxxx;
> adrian.hunter@xxxxxxxxx; ctshao@xxxxxxxxxx
> Subject: Re: [PATCH 4/6] perf jevents: Add support for NVIDIA Tegra410
> PCIE-TGT PMU aliasing
>
> External email: Use caution opening links or attachments
>
>
> On Mon, Oct 19, 2026 at 9:45 AM Besar Wicaksono
> <bwicaksono@xxxxxxxxxx> wrote:
> >
> > Add alias support for NVIDIA Tegra410 PCIE-TGT PMU events and metrics.
> >
> > Signed-off-by: Besar Wicaksono <bwicaksono@xxxxxxxxxx>
> > ---
> > .../nvidia/t410/sys/uncore-pcie_tgt.json | 93 +++++++++++++++++++
> > 1 file changed, 93 insertions(+)
> > create mode 100644 tools/perf/pmu-
> events/arch/arm64/nvidia/t410/sys/uncore-pcie_tgt.json
> >
> > diff --git a/tools/perf/pmu-events/arch/arm64/nvidia/t410/sys/uncore-
> pcie_tgt.json b/tools/perf/pmu-
> events/arch/arm64/nvidia/t410/sys/uncore-pcie_tgt.json
> > new file mode 100644
> > index 000000000000..74786fc3d578
> > --- /dev/null
> > +++ b/tools/perf/pmu-events/arch/arm64/nvidia/t410/sys/uncore-
> pcie_tgt.json
> > @@ -0,0 +1,93 @@
> > +[
> > + {
> > + "EventCode": "0x4",
> > + "EventName": "PCIE_TGT_CYCLES",
> > + "BriefDescription": "Counts cycles at the PCIe interface to the Tegra
> SoC data fabric.",
> > + "PublicDescription": "Counts cycles at the PCIe interface to the Tegra
> SoC data fabric.",
> > + "Compat": "1070036b",
> > + "Unit": "nvidia_pcie_tgt_pmu_,rc_"
>
> It looks like the PMU names are broken because of the _rc_ in their names:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree
> /drivers/perf/arm_cspmu/nvidia_cspmu.c#n901
> ```
> .name_pattern = "nvidia_pcie_pmu_%u_rc_%u",
> ```
> The convention is for either a numeric (preferable) or hexadecimal suffix:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree
> /Documentation/ABI/testing/sysfs-bus-event_source-devices
> Extra information about the PMU belongs in a caps file.
>
Hi Ian,
Thanks for the pointers.
My interpretation is the ABI document doesn’t prevent driver from naming
the PMU with multiple numbering format. Other PMUs already did this,
e.g. HiSilicon hisi_sccl<sccl>_ddrc<n>, Arm NI arm_ni_<ni>_cd_<cd> and
Qualcomm l3cache_<x>_<y>.
> By definition nothing can work with wildcard matching using the
> existing PMU name, so please rename it. If a new suffix convention is
> necessary then you should update the ABI and perf tool suffix
> matching logic like pmu_name_len_no_suffix:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree
> /tools/perf/util/pmus.c#n65
>
The JSON "Unit" attribute takes a comma-separated form:
"nvidia_pcie_pmu_,rc_", like HiSilicon's "hisi_sccl,ddrc", which
perf_pmu__match_wildcard_uncore() matches against "socketX_pmunameY"
names. The issues seem to be on the reporting side. The counting looks ok.
I guess JSON "Unit" matching logic is not applied everywhere in perf.
For example below is the counting from my 2-socket machine.
Test workload: read 4 GiB from an NVMe on socket 0 RC 0 and 8 GiB from an NVMe
on socket 1 RC 0, in parallel (dd ... of=/dev/null iflag=direct).
Counting is correct with the wildcards:
$ perf stat -a -e 'nvidia_pcie_pmu_0_rc*/PCIE_WR_BYTES/,nvidia_pcie_pmu_1_rc*/PCIE_WR_BYTES/' -- <workload>
4,362,223,228 nvidia_pcie_pmu_0_rc*/PCIE_WR_BYTES/
8,623,751,168 nvidia_pcie_pmu_1_rc*/PCIE_WR_BYTES/
$ perf stat -a --per-socket -e 'nvidia_pcie_pmu_*_rc_0/PCIE_WR_BYTES/' -- <workload>
S268435456 1 4,362,207,232 nvidia_pcie_pmu_0_rc_0/nvidia_pcie_pmu_*_rc_0,PCIE_WR_BYTES/
S285212672 1 8,724,414,784 nvidia_pcie_pmu_1_rc_0/nvidia_pcie_pmu_*_rc_0,PCIE_WR_BYTES/
The reporting is where it goes wrong:
1) RC 0 of all sockets is not merged into one line, and the wildcard
ends up in the event name:
$ perf stat -a -e 'nvidia_pcie_pmu_*_rc_0/PCIE_WR_BYTES/' -- <workload>
4,311,875,584 nvidia_pcie_pmu_0_rc_0/nvidia_pcie_pmu_*_rc_0,PCIE_WR_BYTES/
8,623,751,168 nvidia_pcie_pmu_1_rc_0/nvidia_pcie_pmu_*_rc_0,PCIE_WR_BYTES/
2) The json event is split per socket, and each line is labelled with
RC 0 although it is the sum of all RCs of that socket:
$ perf stat -a -e PCIE_WR_BYTES -- <workload>
4,311,880,848 nvidia_pcie_pmu_0_rc_0/PCIE_WR_BYTES/
8,724,414,784 nvidia_pcie_pmu_1_rc_0/PCIE_WR_BYTES/
3) The metric is computed per socket, instead of total. With --metric-only both values
end up under one header, and the reader can't tell which socket is
which:
$ perf stat -a -M pcie_avg_wr_bandwidth_to_all_dst --metric-only -- <workload>
MB/s pcie_avg_wr_bandwidth_to_all_dst
3113.5 6227.0
4) With --per-socket, each row shows both copies: the other socket's
copy prints nan, and socket 1's counters is 0 instead of 6:
$ perf stat -a --per-socket -M pcie_avg_wr_bandwidth_to_all_dst --metric-only -- <workload>
MB/s pcie_avg_wr_bandwidth_to_all_dst
S268435456 6 3127.5 nan
S285212672 0 nan 6182.8
$ perf stat -a --per-socket -j -M pcie_avg_wr_bandwidth_to_all_dst --metric-only -- <workload>
{"socket" : "S268435456", "counters" : 6, "MB/s pcie_avg_wr_bandwidth_to_all_dst" : "3087.8", "MB/s pcie_avg_wr_bandwidth_to_all_dst" : "none"}
{"socket" : "S285212672", "counters" : 0, "MB/s pcie_avg_wr_bandwidth_to_all_dst" : "none", "MB/s pcie_avg_wr_bandwidth_to_all_dst" : "6247.8"}
All of these, I think, come from perf treating nvidia_pcie_pmu_0_rc_* and
nvidia_pcie_pmu_1_rc_* as two different PMUs instead of one PMU, i.e
nvidia_pcie_pmu.
I will investigate further and see if I can come up with a perf patch to fix this.
Regards,
Besar
> Thanks,
> Ian Rogers
>