mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: Leo Yan <leo.yan@arm.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sashiko AI <sashiko-bot@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>
Subject: Re: [PATCH v2] perf/core: Fix ITRACE start suppression for inherited events
Date: Tue, 29 Sep 2026 16:31:49 +0100	[thread overview]
Message-ID: <0b657642-0770-4fb4-a9d8-4dc59d5407df@linaro.org> (raw)
In-Reply-To: <20260929-perf_core_itrace_start_fix_inherit_event-v2-1-9361a946ed56@arm.com>



On 29/09/2026 16:08, Leo Yan wrote:
> perf_log_itrace_start() follows event->parent before checking
> PERF_ATTACH_ITRACE, but perf_event_itrace_started() sets the flag on the
> event passed by the PMU driver. If an inherited event starts tracing
> before its parent, the parent's flag remains clear and the child emits
> redundant ITRACE_START records on subsequent schedule-ins.
> 
> Follow event->parent in perf_event_itrace_started() as well, so that the
> setter and checker use the same event. This preserves the original
> suppression policy: ITRACE_START supplies the initial task context when
> tracing begins, while subsequent task switches are tracked through
> context-switch records or trace context packets.
> 
> Reported-by: Sashiko AI <sashiko-bot@kernel.org>
> Closes: https://lore.kernel.org/linux-perf-users/20260901164705.042781F000E9@smtp.kernel.org/
> Fixes: 9a6694cfa239 ("perf/x86/intel/pt: Do not force sync packets on every schedule-in")
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> Changes in v2:
> - Changed setter to fetch parent event instead (James).
> - Link to v1: https://lore.kernel.org/r/20260903-perf_core_itrace_start_fix_inherit_event-v1-1-6bff7e675af5@arm.com
> ---
>   kernel/events/core.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 634d2ccbab82d8bfe9d1bd7f8c6745f60260dbd9..85d924cce387f88de0c1efe6c22754d38430c9d6 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -10568,6 +10568,9 @@ void perf_event_text_poke(const void *addr, const void *old_bytes,
>   
>   void perf_event_itrace_started(struct perf_event *event)
>   {
> +	if (event->parent)
> +		event = event->parent;
> +
>   	WRITE_ONCE(event->attach_state, event->attach_state | PERF_ATTACH_ITRACE);
>   }
>   
> 
> ---
> base-commit: 6f8319e3e9a44dd537d17f41565a8453c560a581
> change-id: 20260903-perf_core_itrace_start_fix_inherit_event-a8930d792899
> 
> Best regards,

Reviewed-by: James Clark <james.clark@linaro.org>

      reply	other threads:[~2026-09-29 15:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 15:08 Leo Yan
2026-09-29 15:31 ` James Clark [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b657642-0770-4fb4-a9d8-4dc59d5407df@linaro.org \
    --to=james.clark@linaro.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sashiko-bot@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®