From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>
Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
Stephane Eranian <eranian@google.com>
Subject: [RFC PATCH v1 0/2] perf sysinfo: Add subcommand to probe and summarize PMU capabilities
Date: Fri, 16 Oct 2026 14:32:56 -0700 [thread overview]
Message-ID: <20261016213258.945737-1-irogers@google.com> (raw)
Determining what performance monitoring hardware, driver capabilities,
and event/metric support are available on a system currently requires
piecing together sysfs files under /sys/bus/event_source/devices/,
perf list output, and trial-and-error perf_event_open() calls. Across
architectures and SoCs, support varies widely: an advanced system
provides core PMUs with zero-skid precise event sampling (PEBS/IBS/SPE),
hardware branch stack recording (LBR/BRBE), user-space counter reading
(rdpmc), memory profiling (DATA_SRC), hardware AUX trace PMUs, memory
and PCIe/IO interconnect bandwidth PMUs, and multi-level pipeline metric
drill-down hierarchies, whereas a minimal system may only offer software
timer sampling.
This RFC series introduces 'perf sysinfo' to inspect, actively probe,
and summarize the PMU and performance monitoring capabilities of a live
system or a recorded perf.data file:
- Patch 1 adds PMU environment reconstruction from perf_env headers
(perf_pmus__read_from_env()), public duplicate-collapsing PMU scan
helpers, and active live capability probing via perf_event_open()
(perf_pmu__probe()). Probing tests counting, sampling, branch stack
sampling, precise_ip levels (:p, :pp, :ppp) and empirically measured
branch instruction skid across an 8,192-nop runway, supported
perf_event_sample_format bits, user/intr general-purpose and SIMD
register masks, memory profiling events, privilege exclusion
modifiers, execution features (leader sampling, sw_grouping,
auto-counter reload, AUX pause/resume/sample), user-space rdpmc
availability/enablement and PMC bit-width, and maximum event group
sizes (both openable and simultaneously active without multiplexing).
- Patch 2 adds the 'perf sysinfo' subcommand, documentation, and shell
test. By default, 'perf sysinfo' outputs a colorized system capability
summary, pipeline metric drill-down hierarchy (via <metric>_group
chains), overall system rating (Advanced, Standard, Basic, Minimal),
and any missing baseline features. Passing '-p'/'--pmus' (or a PMU
glob filter, '-v'/'--verbose', '-a'/'--all', or '-j'/'--json')
displays detailed per-PMU static and probed attributes.
Example default output on an Intel AlderLake hybrid system:
$ perf sysinfo
Summary:
Core PMUs (2, hybrid): cpu_atom, cpu_core
Core features:
Interrupt-based sampling: supported
Precise event sampling: supported (max_precise: 3 [3 - SAMPLE_IP must have 0 skid, or uses randomization])
Branch stack sampling (LBR/BRBE): supported (depth: 32 branches)
User-space counter reading (rdpmc): supported
Leader sampling: supported
Memory profiling events (DATA_SRC): supported
Hardware AUX trace PMUs: intel_bts, intel_pt
Bus & uncore monitoring:
Memory bandwidth PMUs: uncore_imc, uncore_imc_free_running
PCIe / IO interconnect bandwidth PMUs: uncore_arb
Events & metrics:
Available events: 3161 total (76 sysfs, 3085 json) across 28 PMUs
Available metrics: 438 metrics in 192 groups (advanced)
Metric drill-down levels (6): L1 (TopdownL1: 7 metrics), L2 (TopdownL2: 14 metrics), L3 (TopdownL3: 44 metrics), L4 (TopdownL4: 45 metrics), L5 (TopdownL5: 15 metrics), L6 (TopdownL6: 9 metrics)
System rating: Advanced (core PMU with precise sampling, branch stack (LBR), user rdpmc, bus PMUs, and metric drill-down)
Example filtered per-PMU output:
$ perf sysinfo cpu_core
cpu_core (type: 4 [PERF_TYPE_RAW], core):
CPUs: 0-15 (16 CPUs)
Capabilities: branches=32, max_precise=3, pmu_name=alderlake_hybrid
Formats: event (config:0-7), pc (config:19), edge (config:18), offcore_rsp (config1:0-63), ldlat (config1:0-15), inv (config:23), umask (config:8-15), frontend (config1:0-23), cmask (config:24-31)
Events: 1563 total (20 sysfs, 1543 json)
Memory events: ldlat-loads ({cpu_core/mem-loads-aux/,cpu_core/mem-loads,ldlat=30/}:P), ldlat-stores (cpu_core/mem-stores/P)
Probed capabilities (event: cpu_core/cycles/):
Modes: counting, sampling, branch_stack
Precise sampling: :p (1 - SAMPLE_IP must have constant skid), :pp (2 - SAMPLE_IP requested to have 0 skid), :ppp (3 - SAMPLE_IP must have 0 skid, or uses randomization) (max_precise: 3)
Measured branch skid (instructions from branch):
level 0 (no :p): min 105, max 174, avg 156.8 (0/32 exact_ip)
level 1 (:p) : min 1, max 1, avg 1.0 (0/31 exact_ip)
level 2 (:pp) : min 0, max 0, avg 0.0 (31/31 exact_ip)
level 3 (:ppp) : min 0, max 0, avg 0.0 (32/32 exact_ip)
Sample types: ip, tid, time, addr, read, callchain, id, cpu, period, stream_id, raw, branch_stack, regs_user, stack_user, weight, data_src, identifier, transaction, regs_intr, aux, cgroup, data_page_size, code_page_size, weight_struct
User registers: AX, BX, CX, DX, SI, DI, BP, SP, IP, FLAGS, CS, SS, R8, R9, R10, R11, R12, R13, R14, R15
Intr registers: AX, BX, CX, DX, SI, DI, BP, SP, IP, FLAGS, CS, SS, R8, R9, R10, R11, R12, R13, R14, R15, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15
Memory events (probed): ldlat-loads, ldlat-stores (sample types: addr, weight, data_src, transaction, data_page_size, weight_struct)
Exclusion modifiers: exclude_user, exclude_kernel, exclude_hv, exclude_idle, exclude_host, exclude_guest
Features: leader_sampling, sw_grouping, inherit, sample_freq, write_backward, callchain, data_src, weight, pinned, exclusive, format_lost, user_rdpmc, user_time, user_time_zero
User space counter reading (rdpmc): available, enabled, working (width: 48 bits)
Max event group size: 18 (active: 8)
Max GP event group size: 16 (active: 7)
This patch series was generated with the assistance of antigravity and
Gemini 4.0.
Ian Rogers (2):
perf pmus: Add PMU environment loading and live capability probing
perf sysinfo: Add sysinfo subcommand, documentation, and test
tools/perf/Build | 1 +
tools/perf/Documentation/perf-sysinfo.txt | 109 ++
tools/perf/Documentation/perf.txt | 2 +-
tools/perf/builtin-help.c | 3 +-
tools/perf/builtin-sysinfo.c | 1958 ++++++++++++++++++++
tools/perf/builtin.h | 1 +
tools/perf/perf.c | 1 +
tools/perf/tests/shell/sysinfo.sh | 71 +
tools/perf/util/mem-events.c | 14 +-
tools/perf/util/mem-events.h | 3 +
tools/perf/util/pmu.c | 1976 ++++++++++++++++++++-
tools/perf/util/pmu.h | 135 +-
tools/perf/util/pmus.c | 221 ++-
tools/perf/util/pmus.h | 4 +
14 files changed, 4486 insertions(+), 13 deletions(-)
create mode 100644 tools/perf/Documentation/perf-sysinfo.txt
create mode 100644 tools/perf/builtin-sysinfo.c
create mode 100755 tools/perf/tests/shell/sysinfo.sh
--
2.56.0.212.g129ede20d9-goog
next reply other threads:[~2026-10-16 21:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 21:32 Ian Rogers [this message]
2026-10-16 21:32 ` [RFC PATCH v1 1/2] perf pmus: Add PMU environment loading and live capability probing Ian Rogers
2026-10-16 21:56 ` sashiko-bot
2026-10-16 21:32 ` [RFC PATCH v1 2/2] perf sysinfo: Add sysinfo subcommand, documentation, and test Ian Rogers
2026-10-16 21:45 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 0/9] perf sysinfo: Add subcommand to probe and summarize PMU capabilities Ian Rogers
2026-10-17 18:54 ` [RFC PATCH v2 1/9] perf pmu: Add from_env parameter to perf_pmu__init() Ian Rogers
2026-10-17 19:06 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 2/9] perf pmus: Add perf_pmus__read_from_env() Ian Rogers
2026-10-17 19:15 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 3/9] perf pmus: Expose duplicate uncore PMU scanning helpers Ian Rogers
2026-10-17 18:58 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 4/9] perf mem-events: Expose PMU init and name formatting helpers Ian Rogers
2026-10-17 18:58 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 5/9] perf pmu: Add perf_pmu__probe() for live capability probing Ian Rogers
2026-10-17 19:18 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 6/9] perf pmu: Probe registers, memory events, rdpmc, and branch skid Ian Rogers
2026-10-17 19:15 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 7/9] perf sysinfo: Add sysinfo subcommand Ian Rogers
2026-10-17 19:14 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 8/9] perf docs: Add perf-sysinfo man page Ian Rogers
2026-10-17 18:57 ` sashiko-bot
2026-10-17 18:54 ` [RFC PATCH v2 9/9] perf test: Add perf sysinfo shell test Ian Rogers
2026-10-17 18:58 ` sashiko-bot
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=20261016213258.945737-1-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=eranian@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.