[PATCH] perf/core: Fix ITRACE start suppression for inherited events
From: Leo Yan
Date: Thu Sep 03 2026 - 07:26:12 EST
PMU drivers call perf_event_itrace_started() for the event that has
started tracing. This sets PERF_ATTACH_ITRACE in that event's
attach_state.
For inherited events, however, perf_log_itrace_start() replaces the
child event with its parent before checking PERF_ATTACH_ITRACE. The
setter and checker therefore operate on different events. If the
parent's flag is clear, the child continues to emit ITRACE_START
records on subsequent schedule-ins. If the parent has already started,
its flag can instead suppress the child's initial record.
Remove the parent substitution so that perf_log_itrace_start() checks
the same event that the PMU driver marks as started.
This is safe for tool consumers. Intel PT uses the ITRACE_START record
to set the current thread context. CoreSight ETM uses the record only
to find or create the corresponding thread. Neither decoder depends on
the parent event.
Reported-by: Sashiko AI <sashiko-bot@xxxxxxxxxx>
Closes: https://lore.kernel.org/linux-perf-users/20260901164705.042781F000E9@xxxxxxxxxxxxxxx/
Fixes: 9a6694cfa239 ("perf/x86/intel/pt: Do not force sync packets on every schedule-in")
Signed-off-by: Leo Yan <leo.yan@xxxxxxx>
---
kernel/events/core.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c
index a6c8e38a311042afab6b65814a84c67b87ba929b..991ae214d46ebe8b0d9de497255f25a4ad12397f 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -10572,9 +10572,6 @@ static void perf_log_itrace_start(struct perf_event *event)
} rec;
int ret;
- if (event->parent)
- event = event->parent;
-
if (!(event->pmu->capabilities & PERF_PMU_CAP_ITRACE) ||
event->attach_state & PERF_ATTACH_ITRACE)
return;
---
base-commit: 940de590b839f71d6dc846160534bf202401b8b7
change-id: 20260903-perf_core_itrace_start_fix_inherit_event-a8930d792899
Best regards,
--
Leo Yan <leo.yan@xxxxxxx>