From: James Clark <james.clark@linaro.org>
To: Amir Ayupov <aaupov@fb.com>
Cc: linux-doc@vger.kernel.org, Mike Leach <mike.leach@arm.com>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Swapnil Sapkal <swapnil.sapkal@amd.com>,
linux-perf-users@vger.kernel.org, coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Leo Yan <leo.yan@arm.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>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
John Garry <john.g.garry@oracle.com>,
Will Deacon <will@kernel.org>
Subject: Re: [PATCH v2 0/5] perf: Add CoreSight branch history to existing samples
Date: Tue, 18 Aug 2026 14:56:19 +0100 [thread overview]
Message-ID: <eecfa618-6bc8-451f-ac9e-9ae5b08e865b@linaro.org> (raw)
In-Reply-To: <cover.1787005265.git.aaupov@fb.com>
On 17/08/2026 23:22, Amir Ayupov wrote:
> CoreSight ETM can synthesize branch samples from an instruction trace, but
> context-sensitive PGO needs the branch history leading to an existing PMU
> sample together with that sample's event identity and callchain. This series
> implements that mode as --itrace=L, following the corresponding Intel PT
> behavior.
>
> The series first separates timestamped queue setup and teardown from the ETM
> decode loop so decoding can stop at an existing sample's timestamp. It then
> reconstructs branch history in the thread stack and attaches it to eligible
> samples without replacing their IP, event, or callchain. The attached history
> is consumed after use so a later sample cannot reuse an earlier trace window.
>
> This enables a context-sensitive PGO workflow where a cycles event supplies a
> frame-pointer callchain while duty-cycled ETM supplies the path leading to the
> sample. A dlfilter removes samples for which no ETM history was available, and
> the documentation describes the complete recording and decoding workflow.
>
> Changes since v1:
>
> - Rebased onto perf-tools-next at d17c5b770972.
> - Dropped the HEADER_GROUP_DESC reader workaround. The issue is in the writer
> and should be fixed separately.
Doesn't it still need to be part of this patchset regardless of where
the issue is? Running the new test is blocked on this. Also is this a
regression? I noticed there was no fixes: tag on V1 for this commit.
> - Dropped the branch-stack hw_idx patch after review established that zero is
> appropriate for age-ordered CoreSight branch stacks.
This doesn't seem to match what happened. The original patch initialized
all branch stacks to hw_idx = -1, which I think was a good fix so
shouldn't have been dropped.
Coresight still sets -1 which I said should be changed to 0, but there
doesn't seem to be a change for that in V2. So now we're missing both
changes.
> - Dropped the local wrapped branch-stack copy fix in favor of upstream commit
> ab9c84d1cd59 ("perf thread-stack: Fix heap buffer overflow on branch stack
> wrap copy").
> - Added James Clark's Reviewed-by tag to the dlfilter patch.
> - Consume branch history after attaching it so samples with no newly decoded
> trace cannot reuse a window from before an untraced AUX pause interval.
> - Flush all trace-ID frontend thread stacks when their physical ETM queue is
> exhausted, preventing stale history from surviving a trace gap.
> - Check every matching CoreSight event when deciding whether kernel trace is
> enabled.
Were these changes due to my comment about the test not working? Might
be worth some discussion about what the issue was on the V1 thread so
it's easier to follow along with why these changes were made to V2.
> - Reworked the shell test to use FIFO recording control, removed the invalid
> bare timestamp option, reduced the workload to 10000 iterations, and check
> proc1 and proc2 callchains independently with bounded failure diagnostics.
> - Renamed decoded test outputs to script-L4 and script-L64.
>
> Amir Ayupov (5):
> perf dlfilter: Add non-empty branch stack filter
> perf cs-etm: Split up cs_etm__process_timestamped_queues()
> perf cs-etm: Add branch history to existing samples
> perf test cs-etm: Test branch history on existing samples
> Documentation: coresight: Document context-sensitive PGO workflow
>
> .../trace/coresight/coresight-perf.rst | 62 +++++
> tools/perf/Makefile.perf | 1 +
> .../dlfilters/dlfilter-nonempty-brstack.c | 26 ++
> .../tests/shell/coresight/add_last_branch.sh | 203 ++++++++++++++
> tools/perf/util/cs-etm.c | 252 ++++++++++++++++--
> tools/perf/util/thread-stack.c | 17 ++
> tools/perf/util/thread-stack.h | 1 +
> 7 files changed, 546 insertions(+), 16 deletions(-)
> create mode 100644 tools/perf/dlfilters/dlfilter-nonempty-brstack.c
> create mode 100755 tools/perf/tests/shell/coresight/add_last_branch.sh
>
>
> base-commit: d17c5b770972854a4fe4cf5cc22e17eb21cdc787
prev parent reply other threads:[~2026-08-18 13:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 22:22 [PATCH v2 0/5] perf: Add CoreSight branch history to existing samples Amir Ayupov
2026-08-17 22:22 ` [PATCH v2 1/5] perf dlfilter: Add non-empty branch stack filter Amir Ayupov
2026-08-17 22:22 ` [PATCH v2 2/5] perf cs-etm: Split up cs_etm__process_timestamped_queues() Amir Ayupov
2026-08-18 14:38 ` James Clark
2026-08-17 22:22 ` [PATCH v2 3/5] perf cs-etm: Add branch history to existing samples Amir Ayupov
2026-08-18 15:09 ` James Clark
2026-08-18 15:13 ` James Clark
2026-08-17 22:22 ` [PATCH v2 4/5] perf test cs-etm: Test branch history on " Amir Ayupov
2026-08-18 14:24 ` James Clark
2026-08-17 22:22 ` [PATCH v2 5/5] Documentation: coresight: Document context-sensitive PGO workflow Amir Ayupov
2026-08-18 13:56 ` 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=eecfa618-6bc8-451f-ac9e-9ae5b08e865b@linaro.org \
--to=james.clark@linaro.org \
--cc=aaupov@fb.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=corbet@lwn.net \
--cc=coresight@lists.linaro.org \
--cc=irogers@google.com \
--cc=john.g.garry@oracle.com \
--cc=jolsa@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mike.leach@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=suzuki.poulose@arm.com \
--cc=swapnil.sapkal@amd.com \
--cc=will@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