Skip to content

perf/x86: Fix perf_event_print_debug() on non-Intel PMUs

Sandipan Das linux-perf-users lkml sashiko-reviews stable 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 3 repliesIn review
  2. v13 patches 4 repliesSuperseded

Changes in v2 from the cover letter

* Address build issue reported by Sashiko.
* Use a static_call as suggested by Dapeng.
* Pick up Tested-by from Petr.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3perf/x86: Add x86_pmu::print_debugarch/x86/events/core.c arch/x86/events/perf_event.h+31 -80 replies
2/3perf/x86: Move MSR_CORE_PERF_GLOBAL_* dump to vendor codearch/x86/events/core.c arch/x86/events/intel/core.c arch/x86/events/zhaoxin/core.c+52 -251 reply
3/3perf/x86/amd: Implement x86_pmu::print_debugarch/x86/events/amd/core.c+20 -00 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPetr TesarikDapeng Mi
SeriesR-b
1/3
2/3
3/3T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] perf/x86: Fix perf_event_print_debug() on non-Intel PMUs

Petr Tesarik reported that reading MSR_ARCH_PERFMON_FIXED_CTR_CTRL raises a #GP on AMD processors that support PerfMonV2, and proposed skipping that register when no fixed counters are implemented [1].

However, perf_event_print_debug() also dumps the global control and status registers whenever x86_pmu.version >= 2, and reads Intel Architectural PerfMon MSRs to do so. That condition used to be Intel-specific, but since commit 21d59e3e2c40 ("perf/x86/amd/core:
Detect PerfMonV2 support"), x86_pmu.version is also set to 2 on AMD processors that support PerfMonV2, where none of those registers are available.

The same reasoning therefore applies to the other registers read here, so rather than special-casing each one or reinstating a vendor check, this series makes the global register dump a vendor-specific operation.

[1] https://lore.kernel.org/all/[email protected]/

Previous versions can be found at
v1: https://lore.kernel.org/all/[email protected]/

Changes in v2:
* Address build issue reported by Sashiko.
* Use a static_call as suggested by Dapeng.
* Pick up Tested-by from Petr.

Sandipan Das (3):
perf/x86: Add x86_pmu::print_debug
perf/x86: Move MSR_CORE_PERF_GLOBAL_* dump to vendor code perf/x86/amd: Implement x86_pmu::print_debug

 arch/x86/events/amd/core.c     | 20 ++++++++++++
 arch/x86/events/core.c         | 60 ++++++++++++++++------------------
 arch/x86/events/intel/core.c   | 32 ++++++++++++++++++
 arch/x86/events/perf_event.h   |  4 +++
 arch/x86/events/zhaoxin/core.c | 18 ++++++++++
 5 files changed, 102 insertions(+), 32 deletions(-)
Signature · 1 line
2.53.0