From: sashiko-bot@kernel.org
To: "Arnaldo Carvalho de Melo" <acme@kernel.org>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 11/18] perf tests record: Exercise more record options
Date: Fri, 27 Nov 2026 01:52:17 +0000 [thread overview]
Message-ID: <sashiko-outbox-236418@kernel.org> (raw)
In-Reply-To: <20261127013801.14841-12-acme@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] perf tests record: always-true test -s on sysfs cpulist in
threads_numa_supported()
- [Medium] perf tests record: unreliable 4K switch threshold in
test_switch_output()
--
commit 9516ae4b075b086c3162b32da08e72df6c1965fa
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
perf tests record: Exercise more record options
This commit adds a new shell test script that exercises additional perf
record command-line options.
> diff --git a/tools/perf/tests/shell/record_options.sh b/tools/perf/tests/shell/record_options.sh
> new file mode 100755
> index 0000000000000..ccedb1ebc3dad
> --- /dev/null
> +++ b/tools/perf/tests/shell/record_options.sh
> @@ -0,0 +1,215 @@
[ ... ]
> +test_switch_output() {
> + echo "Record switch output"
> + if ! perf record -q -e cpu-clock -c 1 --switch-output=4K \
> + -o "${temp_dir}/sw" -- sleep 0.2
> + then
> + echo "Record switch output [Failed: perf record failed]"
> + err=1
> + return
> + fi
> + # --switch-output also timestamps the file at exit, so checking for
> + # a sw.<timestamp> file is not enough, there has to be more than one.
> + if [ "$(find "${temp_dir}" -maxdepth 1 -name 'sw.*' | wc -l)" -lt 2 ]
> + then
> + echo "Record switch output [Failed: no switch happened]"
> + err=1
> + return
> + fi
> + echo "Record switch output [Success]"
> +}
[Severity: Medium]
Can test_switch_output() produce only one sw.<timestamp> file and fail on
systems with few or no loaded kernel modules?
Without -a, cpu-clock only fires while sleep 0.2 is on-CPU during exec
and exit, so reaching the 4K threshold before the workload finishes
depends on synthesized startup module MMAP events exceeding 4KB. When
startup synthesis is smaller than 4KB, any threshold switch is deferred
until ring-buffer drain at child exit and runs back-to-back with the
final at-exit switch; because fetch_current_timestamp() uses 10ms
granularity, both switches generate the same sw.<timestamp> filename and
rename() overwrites the first file.
[ ... ]
> +# perf record --threads=numa needs every online NUMA node to have CPUs,
> +# a memory-only node (empty cpulist) makes the NUMA topology setup fail,
> +# so only run the test when that is the case.
> +threads_numa_supported() {
> + local range lo hi n
> +
> + [ -r /sys/devices/system/node/online ] || return 1
> +
> + local IFS=,
> + for range in $(cat /sys/devices/system/node/online); do
> + lo=${range%%-*}
> + hi=${range##*-}
> + for ((n = lo; n <= hi; n++)); do
> + [ -s "/sys/devices/system/node/node${n}/cpulist" ] || return 1
> + done
> + done
> + return 0
> +}
[Severity: Medium]
Does [ -s "/sys/devices/system/node/node${n}/cpulist" ] always evaluate
to true, even on memory-only NUMA nodes?
In drivers/base/node.c, cpulist is declared with BIN_ATTR_RO(cpulist,
CPULIST_FILE_MAX_BYTES), so stat() always reports st_size >= PAGE_SIZE
(and reading an empty node's cpulist outputs a single newline byte). On
a system with an online CPU-less NUMA node, threads_numa_supported()
still returns 0 and perf record --threads=numa fails in
record__init_thread_masks_spec() with -EINVAL. Checking that the file
contents are non-empty after stripping the newline (for example,
[ -n "$(cat "/sys/devices/system/node/node${n}/cpulist")" ]) would detect
CPU-less nodes.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261127013801.14841-1-acme@kernel.org?part=11
next prev parent reply other threads:[~2026-11-27 1:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 1:37 [PATCH v2 00/18] perf tests: Add coverage for the untested perf subcommands Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 01/18] perf kmem: Use the allocation order when matching page frees Arnaldo Carvalho de Melo
2026-11-27 1:53 ` sashiko-bot
2026-11-27 1:37 ` [PATCH v2 02/18] perf tests top: Pin the ring buffer size Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 03/18] perf tests sched: Exercise the sched views and options Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 04/18] perf tests help: Add a basic perf help test Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 05/18] perf tests config: Exercise the config file and list options Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 06/18] perf tests script: Exercise the list, fields and dump options Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 07/18] perf tests sort: Exercise the report and diff sort keys Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 08/18] perf tests diff: Exercise the output options Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 09/18] perf tests annotate: Exercise the output and filter options Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 10/18] perf tests report: Exercise the output and format options Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 11/18] perf tests record: Exercise more record options Arnaldo Carvalho de Melo
2026-11-27 1:52 ` sashiko-bot [this message]
2026-11-27 1:37 ` [PATCH v2 12/18] perf tests trace: Exercise the tracing options Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 13/18] perf tests timechart: Exercise the report options Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 14/18] perf tests kmem: Add a basic perf kmem test Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 15/18] perf tests bench: Add smoke tests for perf bench Arnaldo Carvalho de Melo
2026-11-27 1:37 ` [PATCH v2 16/18] perf tests lock: Exercise perf lock report and info Arnaldo Carvalho de Melo
2026-11-27 1:38 ` [PATCH v2 17/18] perf tests probe: Exercise the variable and line listing Arnaldo Carvalho de Melo
2026-11-27 1:38 ` [PATCH v2 18/18] perf tests report: Exercise the TUI browsers Arnaldo Carvalho de Melo
2026-11-27 1:53 ` [PATCH v2 00/18] perf tests: Add coverage for the untested perf subcommands 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=sashiko-outbox-236418@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=acme@kernel.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