From: sashiko-bot@kernel.org
To: "James Clark" <james.clark@linaro.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 15/19] perf test cs-etm: Remove unused Coresight workloads
Date: Wed, 03 Jun 2026 10:41:29 +0000 [thread overview]
Message-ID: <20260603104130.4C65A1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603-james-cs-context-tracking-fix-v3-15-c392945d9ed5@linaro.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The function `cs_etm__synth_instruction_sample` takes a `packet` argument but ignores it in favor of `tidq->packet` for critical fields, leading to incorrect instruction synthesis.
- [Medium] Incorrect validation of the double pointer `thread` in `cs_etm__etmq_update_thread` breaks the fallback logic and creates a potential segmentation fault hazard.
--
commit b1b29e2b51869a73781c3576698bb30e8e7b0cb9
Author: James Clark <james.clark@linaro.org>
perf test cs-etm: Remove unused Coresight workloads
This commit removes unused CoreSight workloads from the perf tests. These
workloads had issues with out-of-source builds and slow compilation times.
> diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
> index 40c6ddfa8c8d9..ce570913669c1 100644
> --- a/tools/perf/util/cs-etm.c
> +++ b/tools/perf/util/cs-etm.c
> @@ -1490,34 +1508,51 @@ cs_etm__get_trace(struct cs_etm_queue *etmq)
[ ... ]
> +/*
> + * Convert a raw thread number to a thread struct and assign it to **thread.
> + */
> +static int cs_etm__etmq_update_thread(struct cs_etm_queue *etmq,
> + ocsd_ex_level el, pid_t tid,
> + struct thread **thread)
> {
> struct machine *machine = cs_etm__get_machine(etmq, el);
>
> + if (!machine || !*thread)
> + return -EINVAL;
[Severity: Medium]
Will this early return prevent the fallback logic from executing?
If *thread is initially NULL (e.g. from an allocation failure), this check
returns -EINVAL immediately instead of reaching the fallback assignment
*thread = machine__idle_thread(machine) at the bottom of the function.
Additionally, checking !*thread before checking if the pointer thread
itself is valid could lead to a segmentation fault if thread is NULL. Should
this verify !thread instead, or should the !*thread check be removed to
allow the idle thread fallback?
> +
> if (tid != -1) {
> - thread__zput(tidq->thread);
> - tidq->thread = machine__find_thread(machine, -1, tid);
> + thread__zput(*thread);
> + *thread = machine__find_thread(machine, -1, tid);
> }
>
> /* Couldn't find a known thread */
> - if (!tidq->thread)
> - tidq->thread = machine__idle_thread(machine);
> + if (!*thread)
> + *thread = machine__idle_thread(machine);
>
> - tidq->el = el;
> + return 0;
> }
[ ... ]
> @@ -1579,6 +1614,7 @@ static inline u64 cs_etm__resolve_sample_time(struct cs_etm_queue *etmq,
>
> static int cs_etm__synth_instruction_sample(struct cs_etm_queue *etmq,
> struct cs_etm_traceid_queue *tidq,
> + struct cs_etm_packet *packet,
> u64 addr, u64 period)
> {
> int ret = 0;
[ ... ]
> sample.flags = tidq->prev_packet->flags;
> sample.cpumode = event->sample.header.misc;
>
> - cs_etm__copy_insn(etmq, tidq->trace_chan_id, tidq->packet, &sample);
> + cs_etm__copy_insn(etmq, tidq, tidq->packet, &sample);
[Severity: High]
Is the correct packet being used for instruction synthesis here?
The function signature was updated to take a struct cs_etm_packet *packet
argument, but this line explicitly references tidq->packet instead of the
passed packet. Since callers like cs_etm__flush() and cs_etm__end_block()
pass tidq->prev_packet as the argument, referencing tidq->packet here will
use stale or incorrect packet data, potentially corrupting synthesized trace
data.
>
> if (etm->synth_opts.last_branch)
> sample.branch_stack = tidq->last_branch;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-james-cs-context-tracking-fix-v3-0-c392945d9ed5@linaro.org?part=15
next prev parent reply other threads:[~2026-06-03 10:41 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-03 10:17 [PATCH v3 00/19] perf cs-etm: Queue context packets for frontend James Clark
2026-06-03 10:17 ` [PATCH v3 01/19] " James Clark
2026-06-03 10:32 ` sashiko-bot
2026-06-03 20:14 ` Amir Ayupov
2026-06-03 10:17 ` [PATCH v3 02/19] perf test: Add workload-ctl option James Clark
2026-06-03 10:17 ` [PATCH v3 03/19] perf test: Add a workload that forces context switches James Clark
2026-06-03 10:28 ` sashiko-bot
2026-06-03 10:17 ` [PATCH v3 04/19] perf test cs-etm: Test process attribution James Clark
2026-06-03 10:17 ` [PATCH v3 05/19] perf test: Add deterministic workload James Clark
2026-06-03 10:24 ` sashiko-bot
2026-06-03 10:17 ` [PATCH v3 06/19] perf test cs-etm: Replace unroll loop thread with deterministic decode test James Clark
2026-06-03 10:30 ` sashiko-bot
2026-06-03 10:17 ` [PATCH v3 07/19] perf test cs-etm: Remove asm_pure_loop test James Clark
2026-06-03 10:17 ` [PATCH v3 08/19] perf test cs-etm: Replace memcpy test with raw dump stress test James Clark
2026-06-03 10:17 ` [PATCH v3 09/19] perf test: Add named_threads workload James Clark
2026-06-03 10:26 ` sashiko-bot
2026-06-03 10:17 ` [PATCH v3 10/19] perf test cs-etm: Test decoding for concurrent threads test James Clark
2026-06-03 10:17 ` [PATCH v3 11/19] perf test cs-etm: Remove duplicate branch tests James Clark
2026-06-03 10:17 ` [PATCH v3 12/19] perf test cs-etm: Skip if not root James Clark
2026-06-03 10:17 ` [PATCH v3 13/19] perf test cs-etm: Reduce snapshot size James Clark
2026-06-03 10:17 ` [PATCH v3 14/19] perf test cs-etm: Speed up basic test James Clark
2026-06-03 10:17 ` [PATCH v3 15/19] perf test cs-etm: Remove unused Coresight workloads James Clark
2026-06-03 10:41 ` sashiko-bot [this message]
2026-06-03 10:17 ` [PATCH v3 16/19] perf test cs-etm: Make disassembly test use kcore James Clark
2026-06-03 10:36 ` sashiko-bot
2026-06-03 10:17 ` [PATCH v3 17/19] perf test cs-etm: Add all branch instructions to test James Clark
2026-06-03 10:17 ` [PATCH v3 18/19] perf test cs-etm: Speed up disassembly test James Clark
2026-06-03 10:17 ` [PATCH v3 19/19] perf test cs-etm: Move existing tests to coresight folder James Clark
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=20260603104130.4C65A1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=james.clark@linaro.org \
--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