All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@arm.com>
To: James Clark <james.clark@linaro.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Ingo Molnar <mingo@kernel.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sashiko AI <sashiko-bot@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	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>
Subject: Re: [PATCH] perf/core: Fix ITRACE start suppression for inherited events
Date: Tue, 29 Sep 2026 15:53:05 +0100	[thread overview]
Message-ID: <20260929145305.GI14479@e132581.arm.com> (raw)
In-Reply-To: <f0aa7195-9c79-4ac7-8bb0-d508927a01cf@linaro.org>

On Mon, Sep 28, 2026 at 10:38:42AM +0100, James Clark wrote:
> 
> On 03/09/2026 10:35, Leo Yan wrote:
> > 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.
> 
> This last part would need an earlier fixes: commit. The problem of
> suppressing child ITRACE_START records existed since the beginning on
> ec0d772 ("perf: Add ITRACE_START record to indicate that tracing has
> started").
> 
> Although the fixes: commit would be correct if the only problem was that
> setting and getting are on different events.

Makes sense. However, if follow your suggestion to change the setter to
fix the setter/checker mismatch, 9a6694cfa239 remains the appropriate
Fixes tag, since it introduced that mismatch; and it is a feasible
point for back port.

> > 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.
> > 
> 
> It's probably harmless to emit more ITRACE_STARTs, but it doesn't fit the
> original purpose of why it was added. It seems to be for when tracing first
> starts, which would be _after_ the corresponding sched event. Once tracing
> has started you can follow the subsequent sched events, so you don't need
> more ITRACE_START records for each child. Could we not fix it by changing
> the setter to follow the parent event to match, which would respect the
> original meaning?

My concern was whether an inherited event and its parent could trace
concurrently on different CPUs.

Normal inherited AUX recording uses CPU restricted events (cpu != -1),
children inherit the parent event’s CPU restriction, a particular parent
event and its children cannot trace concurrently on different CPUs.

Since inherit with cpu == -1 prevents buffer mapping [1], my concern for
this case is also not valid.

I will update the patch to update setter. Thanks for suggestion.

[1] https://man7.org/linux/man-pages/man2/perf_event_open.2.html

      reply	other threads:[~2026-09-29 14:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  9:35 [PATCH] perf/core: Fix ITRACE start suppression for inherited events Leo Yan
2026-09-03  9:45 ` sashiko-bot
2026-09-28  8:33 ` Leo Yan
2026-09-28  9:38 ` James Clark
2026-09-29 14:53   ` Leo Yan [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=20260929145305.GI14479@e132581.arm.com \
    --to=leo.yan@arm.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.