[PATCH 0/3] perf: Suppress redundant ITRACE start records for Arm SPE and CoreSight
James Clark
james.clark at linaro.org
Mon Sep 28 02:41:16 PDT 2026
On 01/09/2026 17:36, Leo Yan wrote:
> 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 at 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,
Reviewed-by: James Clark <james.clark at linaro.org>
More information about the linux-arm-kernel
mailing list