Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH 0/3] perf: Suppress redundant ITRACE start records for Arm SPE and CoreSight
@ 2026-09-01 16:36 Leo Yan
  2026-09-01 16:36 ` [PATCH 1/3] perf/core: Export perf_event_itrace_started() Leo Yan
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Leo Yan @ 2026-09-01 16:36 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Will Deacon, Suzuki K Poulose,
	Mark Rutland, Adrian Hunter, James Clark, Mike Leach, Tamas Petz,
	Tamas Zsoldos
  Cc: linux-perf-users, linux-kernel, linux-arm-kernel, coresight,
	Leo Yan

Thanks to Tamas Petz for noticing that Arm CoreSight perf data can contain
many PERF_RECORD_ITRACE_START records.

PERF_RECORD_ITRACE_START provides the decoder with the initial thread
context when that information is absent from the trace stream. Once
tracing has started, Arm SPE and CoreSight decoders track subsequent
context changes using context packets or recorded sched_switch events.

Have both drivers call perf_event_itrace_started() after successfully
starting event. This prevents perf core from emitting redundant
PERF_RECORD_ITRACE_START records when an event is scheduled in again.

Since the Arm SPE and CoreSight drivers can be built as modules, export
perf_event_itrace_started() before using it in those drivers.

This series was verified with Arm CoreSight using the commands below.
The perf data contains 100 sched_switch events but only one
PERF_RECORD_ITRACE_START record:

  taskset -c 2 perf record -e cs_etm//u -e sched:sched_switch -- \
	  taskset -c 2 bash -c 'while true; do sleep 0.01; done'
  ^C

  perf script -D 2>&1 | grep -c sched_switch
  100

  perf script -D 2>&1 | grep -c PERF_RECORD_ITRACE_START
  1

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
Leo Yan (3):
      perf/core: Export perf_event_itrace_started()
      perf: arm_spe: Suppress redundant ITRACE start records
      coresight: perf: Suppress ITRACE start records

 drivers/hwtracing/coresight/coresight-etm-perf.c | 2 ++
 drivers/perf/arm_spe_pmu.c                       | 2 ++
 kernel/events/core.c                             | 1 +
 3 files changed, 5 insertions(+)
---
base-commit: 786262be6048deab760f68c8acc2c85607165894
change-id: 20260901-perf_suppress_itrace_start_records-42faf45e9ce9

Best regards,
-- 
Leo Yan <leo.yan@arm.com>


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

end of thread, other threads:[~2026-09-02 16:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-01 16:36 [PATCH 0/3] perf: Suppress redundant ITRACE start records for Arm SPE and CoreSight Leo Yan
2026-09-01 16:36 ` [PATCH 1/3] perf/core: Export perf_event_itrace_started() Leo Yan
2026-09-01 16:48   ` sashiko-bot
2026-09-01 16:36 ` [PATCH 2/3] perf: arm_spe: Suppress redundant ITRACE start records Leo Yan
2026-09-01 16:47   ` sashiko-bot
2026-09-02 16:39     ` Leo Yan
2026-09-01 16:36 ` [PATCH 3/3] coresight: perf: Suppress " Leo Yan
2026-09-01 16:45   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox