From: sashiko-bot@kernel.org
To: "James Clark" <james.clark@linaro.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v3 06/19] perf test cs-etm: Replace unroll loop thread with deterministic decode test
Date: Wed, 03 Jun 2026 10:30:20 +0000 [thread overview]
Message-ID: <20260603103020.A5B731F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603-james-cs-context-tracking-fix-v3-6-c392945d9ed5@linaro.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Signed integer overflow in `deterministic` workload causes Undefined Behavior.
--
commit 4589a67d2fd8e0ec516cb0f0c6ed8dd3e2079b76
Author: James Clark <james.clark@linaro.org>
perf test cs-etm: Replace unroll loop thread with deterministic decode test
This commit replaces the unroll loop thread test with a new deterministic
decode test. It introduces a shell script that records and validates the
deterministic workload to ensure decoding always yields the same result for
a given code sequence.
> diff --git a/tools/perf/tests/shell/coresight/deterministic.sh b/tools/perf/tests/shell/coresight/deterministic.sh
> new file mode 100755
> index 0000000000000..52e033fd6b82a
> --- /dev/null
> +++ b/tools/perf/tests/shell/coresight/deterministic.sh
> @@ -0,0 +1,71 @@
> +#!/bin/bash -e
[ ... ]
> +cf="$tmpdir/ctl"
> +af="$tmpdir/ack"
> +mkfifo "$cf" "$af"
> +
> +# Start disabled and use the control FIFO to only record the workload and not
> +# startup.
> +perf record -o "$tmpdir/data" -e cs_etm//u -D -1 --control fifo:"$cf","$af" -- \
> + perf test --workload-ctl fifo:"$cf","$af" -w deterministic > /dev/null 2>&1
[Severity: Medium]
Does executing the deterministic workload here cause a regression by
triggering undefined behavior?
Looking at the workload in tools/perf/tests/workloads/deterministic.c,
dt_work is initialized to 1234 and then multiplied by 7 twelve times
across deterministic(), function1(), and function2():
tools/perf/tests/workloads/deterministic.c:deterministic() {
dt_work *= 7;
dt_work *= 7;
dt_work *= 7;
function1();
dt_work *= 7;
dt_work *= 7;
...
On the 8th execution (the second multiplication after returning from
function1() to deterministic()), the value reaches 7,113,764,434, which
exceeds the maximum value for a 32-bit signed integer.
This causes a signed integer overflow regression. When the perf tool is
compiled with the undefined behavior sanitizer enabled, this workload will
trap or crash, breaking the test's strict deterministic execution behavior
and resulting in test failures.
Could dt_work be modified to an unsigned int to avoid this overflow?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-james-cs-context-tracking-fix-v3-0-c392945d9ed5@linaro.org?part=6
next prev parent reply other threads:[~2026-06-03 10:30 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 [this message]
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
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=20260603103020.A5B731F00893@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