linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] perf: Rework event forwarding logic
@ 2023-04-25 14:22 Ravi Bangoria
  2023-04-25 14:22 ` [PATCH v3 1/3] perf/core: Rework forwarding of {task|cpu}-clock events Ravi Bangoria
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Ravi Bangoria @ 2023-04-25 14:22 UTC (permalink / raw)
  To: peterz
  Cc: ravi.bangoria, namhyung, eranian, acme, mark.rutland, jolsa,
	irogers, bp, kan.liang, adrian.hunter, maddy, x86,
	linux-perf-users, linux-kernel, sandipan.das, ananth.narayan,
	santosh.shukla

Usually events are opened on the same pmu as requested by user via
perf_event_attr->type argument. But certain special events are
internally redirected to different pmu. Currently such pmus needs to
be treated specially and thus requires some gruesome hacks.

An approach, suggested by Peter Zijlstra, to get rid of these hacks
was to overwrite event attributes with new pmu's attribute values
within the kernel and let perf_event_init() retry opening the event
with overwritten values. This patch series implements it.

v2: https://lore.kernel.org/r/20230309101111.444-1-ravi.bangoria@amd.com
v2->v3:
 - Both uses different approach to solve the problem. v2 was using new
   error value -ESRCH to let perf_event_init() try opening event with
   all pmus, hoping that the event will get forwarded to right pmu.
   OTOH, v3 uses different approach as described in the description.
 - v3 also fixes SW pmu to task-clock/cpu-clock pmu event forwarding.

Patches are prepared on v6.3.

Ravi Bangoria (3):
  perf/core: Rework forwarding of {task|cpu}-clock events
  perf/ibs: Fix interface via core pmu events
  perf test: Add selftest to test IBS invocation via core pmu events

 arch/x86/events/amd/core.c              |  2 +-
 arch/x86/events/amd/ibs.c               | 53 ++++++++---------
 arch/x86/include/asm/perf_event.h       |  2 +
 include/linux/perf_event.h              | 11 ++++
 kernel/events/core.c                    | 79 +++++++++++--------------
 tools/perf/tests/Build                  |  1 +
 tools/perf/tests/amd-ibs-via-core-pmu.c | 72 ++++++++++++++++++++++
 tools/perf/tests/builtin-test.c         |  1 +
 tools/perf/tests/tests.h                |  1 +
 9 files changed, 151 insertions(+), 71 deletions(-)
 create mode 100644 tools/perf/tests/amd-ibs-via-core-pmu.c

-- 
2.40.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-05-03  8:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-25 14:22 [PATCH v3 0/3] perf: Rework event forwarding logic Ravi Bangoria
2023-04-25 14:22 ` [PATCH v3 1/3] perf/core: Rework forwarding of {task|cpu}-clock events Ravi Bangoria
2023-05-02 15:34   ` Peter Zijlstra
2023-05-03  8:32     ` Ravi Bangoria
2023-04-25 14:22 ` [PATCH v3 2/3] perf/ibs: Fix interface via core pmu events Ravi Bangoria
2023-05-02 15:37   ` Peter Zijlstra
2023-05-03  8:33     ` Ravi Bangoria
2023-04-25 14:22 ` [PATCH v3 3/3] perf test: Add selftest to test IBS invocation " Ravi Bangoria
2023-04-29 21:09   ` Ian Rogers
2023-05-02  3:08     ` Ravi Bangoria

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).