Skip to content

[26.04_linux-nvidia-bos] Backport perf: Add NVIDIA Tegra410 uncore PMU events and metrics - #715

Closed
nvmochs wants to merge 9 commits into
NVIDIA:26.04_linux-nvidia-bosfrom
nvmochs:pmu_t410_uncore_events_70bos
Closed

nvmochs wants to merge 9 commits into
NVIDIA:26.04_linux-nvidia-bosfrom
nvmochs:pmu_t410_uncore_events_70bos

Conversation

@nvmochs

@nvmochs nvmochs commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Backport seven linux-next perf updates for NVIDIA Tegra410 (Vera). These add event aliases and derived metrics for UCF, PCIe, PCIe-TGT, CPU memory latency, and C2C PMUs.

Also include the Linux 7.2 aggr_nr() runtime-parser and Python-generator prerequisites (e565ceb and ca156ab) as the first two commits. These are required to build and evaluate the imported metric expressions on 7.0.

The series also fixes multi-instance reporting:

• Preserve valid zero-count results on secondary sockets when uncore PMUs are merged.
• Handle both socket and root-complex suffixes in NVIDIA PCIe PMU names, correcting canonical-name matching, sorting, and aggregation.

All changes are confined to tools/perf; kernel drivers and the kernel ABI are unchanged. The patches applied cleanly to the 7.0-bos-based branch.

Testing

• Built the ARM64 perf binary with GCC 15.2 and vendor event generation enabled.
• Tested on dual-socket Vera running Ubuntu 26.04 and kernel 7.0.0-2024-nvidia-bos-64k.
• Passed all 12 selected upstream PMU self-tests, including event-table sanity, alias mapping, PMU naming, uncore sorting, and Tegra410 metric parsing.
• Ran the three new GLT cases end-to-end: 3 passed, 0 failed, 0 skipped, covering aliases/frequency metadata, secondary-socket zero counts, and PCIe naming/global merging.
• Confirmed hardware counter reads across both sockets. Older installed perf 7.0.14 reproduced the missing secondary zero row and rejected canonical PCIe PMU names; the backported binary handles both correctly.


Target platform: Vera
LP: https://bugs.launchpad.net/ubuntu/+source/linux-nvidia/+bug/2174797

Chun-Tse Shao and others added 9 commits November 17, 2026 18:04
Introduce the `aggr_nr` function to the metric expression parser.
`aggr_nr` allows metric formulas to dynamically utilize the number of
aggregated targets (`aggr->nr`) instead of relying on the static
`source_count` (which represents the static socket or node count).

This adds the `AGGR_NR` token to the lexer and parser, updates the
expression parsing context helpers to store `aggr_nr`, and feeds
`aggr->nr` from the aggregation structure in `prepare_metric`.

Assisted-by: Gemini:gemini-3.1-pro-preview
Signed-off-by: Chun-Tse Shao <[email protected]>
Tested-by: Zide Chen <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sandipan Das <[email protected]>
Cc: Thomas Falcon <[email protected]>
Cc: Yang Li <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
(cherry picked from commit e565ceb)
Signed-off-by: Matthew R. Ochs <[email protected]>
Update `metric.py` to support the new `aggr_nr` keyword in the python
metric generator. Replace the usage of `source_count` with `aggr_nr` in
`IntelMissLat` inside `intel_metrics.py` so that uncore latency metrics
(like `lpm_miss_lat`) scale correctly on multi-socket and SNC systems when
aggregated globally.

Additionally, update the validation bypass logic in `CheckEveryEvent()`
inside `metric.py` to whitelist 'cha' and 'uncore' events. This
prevents validation failures when compiling metrics referencing these
PMU-specific uncore events.

Assisted-by: Gemini:gemini-3.1-pro-preview
Signed-off-by: Chun-Tse Shao <[email protected]>
Tested-by: Zide Chen <[email protected]>
Acked-by: Namhyung Kim <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Ian Rogers <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: James Clark <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Leo Yan <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Sandipan Das <[email protected]>
Cc: Thomas Falcon <[email protected]>
Cc: Yang Li <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
(cherry picked from commit ca156ab)
Signed-off-by: Matthew R. Ochs <[email protected]>
Add alias support for NVIDIA Tegra410 UCF PMU events and metrics.

Signed-off-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit 10eb6a6db5f5332c99bf93dcfb8f660359f628b6 linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
Add alias support for NVIDIA Tegra410 PCIE PMU events and metrics.

Signed-off-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit 458a33f5618cea1873213b956f928376cfdb34b3 linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
Add alias support for NVIDIA Tegra410 PCIE-TGT PMU events and metrics.

Signed-off-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit 86ee08cc2bb00117549cd5d0de4ae05e36591d02 linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
…aliasing

Add alias support for NVIDIA Tegra410 CPU Memory Latency PMU events.

Signed-off-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit af4fd99bbf63be260b7c0da4098d640193025ef1 linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
Add alias support for NVIDIA Tegra410 C2C PMU events.

Signed-off-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit 98a3a883e6b557d417fbfe0d468d7170f46a602b linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
…unts

Commit dd15480 ("perf stat: Hide invalid uncore event output for
aggr mode") hides a 0 count of an uncore event in an aggregation id
that the event is not counted in, using the event's cpumask. When an
uncore event has more than one PMU instance, the evsels of the other
instances are merged into the evsel of the first one, and only the
cpumask of the first instance is checked. A 0 count in an aggregation
id covered only by another instance is then hidden, while a non-zero
count in the same id is printed.

For example, on a dual-socket NVIDIA Tegra410 with one UCF PMU per
socket (nvidia_ucf_pmu_0 on CPU 0, nvidia_ucf_pmu_1 on CPU 88):

Before:
  $ perf stat -a --per-socket -e UCF_SLC_ACCESS_ATOMIC,UCF_SLC_ACCESS_RD -- sleep 1
  S268435456    1                  0      UCF_SLC_ACCESS_ATOMIC
  S268435456    1          3,407,373      UCF_SLC_ACCESS_RD
  S285212672    1          2,086,640      UCF_SLC_ACCESS_RD

After:
  $ perf stat -a --per-socket -e UCF_SLC_ACCESS_ATOMIC,UCF_SLC_ACCESS_RD -- sleep 1
  S268435456    1                  0      UCF_SLC_ACCESS_ATOMIC
  S268435456    1          2,669,279      UCF_SLC_ACCESS_RD
  S285212672    1                  0      UCF_SLC_ACCESS_ATOMIC
  S285212672    1          1,006,579      UCF_SLC_ACCESS_RD

Also check the cpumasks of the evsels merged into the counter. Zero
counts are still hidden in aggregation ids that none of the instances
count in, such as the other cores in --per-core mode. Core PMUs and
--no-aggr output are unchanged.

Fixes: dd15480 ("perf stat: Hide invalid uncore event output for aggr mode")
Signed-off-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit 1de8706aa07782c7f825f05bdfec2a58ab4bfff4 linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
The NVIDIA PCIe and PCIe target PMUs are named <name>_<socket>_rc_<rc>,
like nvidia_pcie_pmu_1_rc_3. pmu_name_len_no_suffix() only strips the
last number, so perf treats the PMUs of each socket as a different PMU.
An event or metric on all PCIe PMUs then gives one result per socket,
each labelled with the first RC of its socket.

Make pmu_name_len_no_suffix() strip both numbers of these names, so the
instances on all sockets are merged as one PMU, nvidia_pcie_pmu or
nvidia_pcie_tgt_pmu. Also accept that name on the command line, as perf
list shows it, and sort these PMUs by socket and then by RC.

Suggested-by: Ian Rogers <[email protected]>
Signed-off-by: Besar Wicaksono <[email protected]>
Reviewed-by: Ian Rogers <[email protected]>
Signed-off-by: Namhyung Kim <[email protected]>
(cherry picked from commit 38539b1099923eeb9ef9ee5c6e842e9d8f7b1962 linux-next)
Signed-off-by: Matthew R. Ochs <[email protected]>
@nirmoy nirmoy added the help wanted Extra attention is needed label Nov 18, 2026
@nirmoy

nirmoy commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

BaseOS Kernel Review

Caution

⚠️ Review incomplete

Boro could not review 2 commits.

Findings: Critical 0 · High 0 · Medium 1 · Low 0
Review failures: 2

🔍 Review artifacts

📦 Build checks — 🔴 1/4 passed

Note

Build reports and debs are retained for 10 days after the PR closes.

  • ⚪ PR Illustrated: inactive
Review metadata
  • Reviewed head: 72145dafa07e
  • Overall status: incomplete
  • Build checks: 1/4 passed

This comment is maintained by BaseOS Reviewer and updated when the GitHub watcher publishes a newer review.

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

PR Validation Report

Patchscan ✅ No Missing Fixes

All cherry-picked commits checked — no missing upstream fixes found.

PR Lint ❌ Errors found

Details
Checking 9 commits...

Cherry-pick digest:
E: 72145dafa07e ("perf pmus: Treat both numbers of NVIDIA "): linux-next cherry-pick needs a public patch Link: trailer (patch.msgid.link, lore.kernel.org or patchwork.kernel.org); SHA 38539b109992 is not resolvable
E: 3255e3d345f0 ("perf stat: Check merged PMU instance's c"): linux-next cherry-pick needs a public patch Link: trailer (patch.msgid.link, lore.kernel.org or patchwork.kernel.org); SHA 1de8706aa077 is not resolvable
E: cba740b4a810 ("perf jevents: Add support for NVIDIA Teg"): linux-next cherry-pick needs a public patch Link: trailer (patch.msgid.link, lore.kernel.org or patchwork.kernel.org); SHA 98a3a883e6b5 is not resolvable
E: 6ef44f88b22f ("perf jevents: Add support for NVIDIA Teg"): linux-next cherry-pick needs a public patch Link: trailer (patch.msgid.link, lore.kernel.org or patchwork.kernel.org); SHA af4fd99bbf63 is not resolvable
E: 9e29168d5973 ("perf jevents: Add support for NVIDIA Teg"): linux-next cherry-pick needs a public patch Link: trailer (patch.msgid.link, lore.kernel.org or patchwork.kernel.org); SHA 86ee08cc2bb0 is not resolvable
E: 356fae68f05f ("perf jevents: Add support for NVIDIA Teg"): linux-next cherry-pick needs a public patch Link: trailer (patch.msgid.link, lore.kernel.org or patchwork.kernel.org); SHA 458a33f5618c is not resolvable
E: 9ba9abfcd35b ("perf jevents: Add support for NVIDIA Teg"): linux-next cherry-pick needs a public patch Link: trailer (patch.msgid.link, lore.kernel.org or patchwork.kernel.org); SHA 10eb6a6db5f5 is not resolvable
┌──────────────┬──────────────────────────────────────────────────────────────────┬────────────┬─────────┬───────────────────────────┐
│ Local        │ Referenced upstream / Patch subject                              │ Patch-ID   │ Subject │ SoB chain                 │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 72145dafa07e │ 38539b109992                                                     │ ERROR      │ ERROR   │ ERROR                     │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 3255e3d345f0 │ 1de8706aa077                                                     │ ERROR      │ ERROR   │ ERROR                     │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ cba740b4a810 │ 98a3a883e6b5                                                     │ ERROR      │ ERROR   │ ERROR                     │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 6ef44f88b22f │ af4fd99bbf63                                                     │ ERROR      │ ERROR   │ ERROR                     │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9e29168d5973 │ 86ee08cc2bb0                                                     │ ERROR      │ ERROR   │ ERROR                     │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 356fae68f05f │ 458a33f5618c                                                     │ ERROR      │ ERROR   │ ERROR                     │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 9ba9abfcd35b │ 10eb6a6db5f5                                                     │ ERROR      │ ERROR   │ ERROR                     │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7330bcdf32e6 │ ca156ab12b2e perf stat: Use aggr_nr scaling for Intel uncore mis │ match      │ match   │ preserved + mochs added   │
├──────────────┼──────────────────────────────────────────────────────────────────┼────────────┼─────────┼───────────────────────────┤
│ 7d41bd83af69 │ e565ceb48bbf perf stat: Add aggr_nr metric parser support        │ match      │ match   │ preserved + mochs added   │
└──────────────┴──────────────────────────────────────────────────────────────────┴────────────┴─────────┴───────────────────────────┘

Lint results:
W: 3255e3d345f0 ("perf stat: Check merged PMU instance's cpumasks wh"): subject 73 chars (>72)
W: 6ef44f88b22f ("perf jevents: Add support for NVIDIA Tegra410 CPU "): subject 77 chars (>72)

@jamieNguyenNVIDIA

Copy link
Copy Markdown
Collaborator

Acked-by: Jamie Nguyen <[email protected]>

@clsotog

clsotog commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Acked-by: Carol L Soto <[email protected]>

@nirmoy nirmoy added has_2_acks and removed help wanted Extra attention is needed has_1_ack labels Nov 18, 2026
@nvmochs

nvmochs commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator Author

Merged, closing PR.

f280994fb0e6 (nresolute/nvidia-bos-next) perf pmus: Treat both numbers of NVIDIA PCIe PMU names as suffix
e7cb5bd9e29a perf stat: Check merged PMU instance's cpumasks when skipping zero counts
f2844fb7193a perf jevents: Add support for NVIDIA Tegra410 C2C PMU aliasing
b6c3b396c300 perf jevents: Add support for NVIDIA Tegra410 CPU Memory Latency PMU aliasing
d504fe3ad09d perf jevents: Add support for NVIDIA Tegra410 PCIE-TGT PMU aliasing
c4dcfec23818 perf jevents: Add support for NVIDIA Tegra410 PCIE PMU aliasing
fdd6356a31d6 perf jevents: Add support for NVIDIA Tegra410 UCF PMU aliasing
98c314295e25 perf stat: Use aggr_nr scaling for Intel uncore miss latency metrics
55c6749a9452 perf stat: Add aggr_nr metric parser support

@nvmochs nvmochs closed this Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants