From: James Clark <james.clark@linaro.org>
To: sashiko-reviews@lists.linux.dev
Cc: linux-perf-users@vger.kernel.org, Leo Yan <leo.yan@arm.com>,
"coresight@lists.linaro.org" <coresight@lists.linaro.org>
Subject: Re: [PATCH v2 03/14] perf cs-etm: Turn on context packet timestamps in per-thread mode
Date: Fri, 21 Aug 2026 11:09:54 +0100 [thread overview]
Message-ID: <6f2ed85c-cbda-4014-827c-272ea2206830@linaro.org> (raw)
In-Reply-To: <20260821100151.6E3241F000E9@smtp.kernel.org>
On 21/08/2026 11:01, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Unconditionally enabling timestamps in per-thread mode breaks recording out-of-the-box on hardware without timestamp support (e.g., ETMv3 or ETMv4 without TRCIDR0.TSSIZE).
> --
>
> --- Patch [3]: [PATCH v2 03/14] perf cs-etm: Turn on context packet timestamps in per-thread mode ---
> commit 23dc37429523715cdb26c5647b22b1a9dc0c89ab
> Author: James Clark <james.clark@linaro.org>
>
> perf cs-etm: Turn on context packet timestamps in per-thread mode
>
> This enables context packet timestamps in per-thread mode, replacing the
> previous unset default. It helps keep samples in order when supporting
> multiple per-thread mode threads.
>
>> diff --git a/tools/perf/arch/arm/util/cs-etm.c b/tools/perf/arch/arm/util/cs-etm.c
>> index acfdb3f53821e..d0486a164a700 100644
>> --- a/tools/perf/arch/arm/util/cs-etm.c
>> +++ b/tools/perf/arch/arm/util/cs-etm.c
>> @@ -453,13 +453,22 @@ static int cs_etm_recording_options(struct auxtrace_record *itr,
> [ ... ]
>> if (!perf_cpu_map__is_any_cpu_or_is_empty(cpus)) {
>> + /*
>> + * Timestamps are required to interleave samples from different
>> + * CPUs.
>> + */
>> evsel__set_config_if_unset(cs_etm_evsel, "timestamp", 1);
>> + /* Context IDs are required to associate trace to a process */
>> evsel__set_config_if_unset(cs_etm_evsel, "contextid", 1);
>> + } else {
>> + /*
>> + * Enable context packet timestamps only (no periodic
>> + * timestamps). Even in per-thread mode with a single process we
>> + * still need to correlate trace to a specific mmap around
>> + * execs, which can be done with just context packet timestamps.
>> + */
>> + evsel__set_config_if_unset(cs_etm_evsel, "timestamp", UINT64_MAX);
>
> [Severity: Medium]
> Will unconditionally setting this timestamp break recording out-of-the-box on
> hardware without timestamp support, like ETMv3?
>
> Looking at cs_etm_validate_timestamp(), if the timestamp config is set but
> unsupported, it aborts the trace:
>
> tools/perf/arch/arm/util/cs-etm.c:cs_etm_validate_timestamp() {
> if (!val)
> return 0;
>
> if (cs_etm_get_version(cs_etm_pmu, cpu) == CS_ETMV3) {
> pr_err("%s: timestamp not supported in ETMv3...\n");
> return -EINVAL;
> }
> }
>
> Does this mean users running perf record --per-thread on such hardware will
> now get an error by default unless they explicitly pass timestamp=0?
>
Yes but the behavior is the same in per-CPU mode so this isn't a new
issue. It's easily worked around and nobody has ever complained.
>> }
>>
>> /*
>
next prev parent reply other threads:[~2026-08-21 10:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 9:48 [PATCH v2 00/14] perf cs-etm: Per-thread mode fixes and snapshot wrap support James Clark
2026-08-21 9:48 ` [PATCH v2 01/14] perf cs-etm: Fix nVHE per-thread decoding James Clark
2026-08-21 10:00 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 02/14] perf cs-etm: Warn for invalid timestamp option James Clark
2026-08-21 9:56 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 03/14] perf cs-etm: Turn on context packet timestamps in per-thread mode James Clark
2026-08-21 10:01 ` sashiko-bot
2026-08-21 10:09 ` James Clark [this message]
2026-08-21 9:49 ` [PATCH v2 04/14] perf cs-etm: Use per-CPU queues for " James Clark
2026-08-21 10:04 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 05/14] perf cs-etm: Increase default timestamp generation period James Clark
2026-08-21 9:58 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 06/14] perf auxtrace: Turn Intel BTS snapshot search into a generic one James Clark
2026-08-21 10:00 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 07/14] perf arm-spe: Use generic snapshot search James Clark
2026-08-21 9:57 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 08/14] perf auxtrace: intel-pt: Use new snapshot_has_wrapped callback James Clark
2026-08-21 10:00 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 09/14] perf cs-etm: Queue partial AUX records James Clark
2026-08-21 9:56 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 10/14] perf cs-etm: Don't print missing buffers in snapshot mode James Clark
2026-08-21 10:01 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 11/14] perf auxtrace: cs-etm: Capture wrapped snapshots James Clark
2026-08-21 10:00 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 12/14] perf test: Allow infinite named_thread loops James Clark
2026-08-21 10:03 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 13/14] perf test: Add test for per-thread mode James Clark
2026-08-21 10:04 ` sashiko-bot
2026-08-21 9:49 ` [PATCH v2 14/14] perf cs-etm: Test multiple per-thread threads James Clark
2026-08-21 10:40 ` sashiko-bot
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=6f2ed85c-cbda-4014-827c-272ea2206830@linaro.org \
--to=james.clark@linaro.org \
--cc=coresight@lists.linaro.org \
--cc=leo.yan@arm.com \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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