From: sashiko-bot@kernel.org
To: "TAKANO Mitsuhiro" <takano32@gmail.com>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v8] perf stat: Refuse a group mixing tool and kernel events
Date: Wed, 25 Nov 2026 18:22:48 +0000 [thread overview]
Message-ID: <sashiko-outbox-233976@kernel.org> (raw)
In-Reply-To: <20261125175450.2373258-1-takano32@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] perf tests stat+tool_group.sh: broken hwmon PMU discovery and
event group test
--
commit de61381e655671f0d4ffde4221e3cc5db6ec0e53
Author: TAKANO Mitsuhiro <takano32@gmail.com>
perf stat: Refuse a group mixing tool and kernel events
This commit refuses event groups that mix kernel events with events not
opened via perf_event_open() (such as tool, hwmon, and drm events), guards
against NULL file descriptor arrays when enabling or disabling group
members or looking up group fds, and adds a shell test covering tool event
groups.
Link: https://lore.kernel.org/all/sashiko-outbox-227849@kernel.org/
Link: https://lore.kernel.org/all/sashiko-outbox-231330@kernel.org/
Link: https://lore.kernel.org/all/sashiko-outbox-232396@kernel.org/
Link: https://lore.kernel.org/all/20261111-tool-pmu-leader-v2-1-3faa0fb98c51@gmail.com/
Link: https://lore.kernel.org/all/awC_aZXD5FBGu4mO@google.com/
Link: https://lore.kernel.org/all/awTXdgY38s2bijW5@google.com/
Link: https://lore.kernel.org/all/20261123071913.653315-7-irogers@google.com/
> diff --git a/tools/perf/tests/shell/stat+tool_group.sh b/tools/perf/tests/shell/stat+tool_group.sh
> new file mode 100755
> index 0000000000000..93860252593c6
> --- /dev/null
> +++ b/tools/perf/tests/shell/stat+tool_group.sh
> @@ -0,0 +1,326 @@
[ ... ]
> +# An hwmon event is read by perf from a sysfs file rather than opened with
> +# perf_event_open(), so it is in the same position as a tool event in a
> +# group. Not every system has an hwmon PMU, and the name differs per chip.
> +hwmon=
> +for dir in /sys/bus/event_source/devices/hwmon_*; do
> + if [ -e "${dir}" ]; then
> + hwmon=$(basename "${dir}")
> + break
> + fi
> +done
[ ... ]
> +# An hwmon event reads a sysfs file, so the group is refused the same way.
> +# The message differs from the tool one, and the PMU has to be there to
> +# exercise it.
> +if [ -n "${hwmon}" ]; then
> + refused "{cycles,${hwmon}}" "${hwmon}"
> +else
> + echo "Testing that perf stat refuses a group of an hwmon event and cycles [Skipped]"
> + skipped=$((skipped + 1))
> +fi
[Severity: Medium]
Can this hwmon test case ever run or pass?
perf synthesizes hwmon PMUs in userspace from /sys/class/hwmon/ in
perf_pmus__read_hwmon_pmus(), so /sys/bus/event_source/devices/hwmon_*
does not exist and the test is always skipped.
Even if an hwmon PMU is discovered, hwmon_pmu__new() leaves pmu.selectable
false, so passing a bare PMU name in "{cycles,${hwmon}}" fails in the
event parser with a syntax error (exit 129) rather than an event term such
as hwmon_<name>/<event>/. In addition, pairing an hwmon event with cycles
is split into two ungrouped events by
parse_events__sort_events_and_fix_groups() because perf_pmu__is_software()
is false for both PMUs; keeping the group intact past the parser so it
reaches check_unopened_in_group() requires pairing the hwmon event with a
software PMU event such as cpu-clock.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261125175450.2373258-1-takano32@gmail.com?part=1
next prev parent reply other threads:[~2026-11-25 18:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 6:04 [PATCH v2] perf stat: Count kernel events in a group led by a tool event Hang Zhengyang via B4 Relay
2026-11-11 6:18 ` sashiko-bot
2026-11-11 11:06 ` [PATCH v3] " TAKANO Mitsuhiro
2026-11-11 11:33 ` sashiko-bot
2026-11-12 3:49 ` Hang Zhengyang
2026-11-19 8:06 ` Namhyung Kim
2026-11-19 10:08 ` TAKANO Mitsuhiro
2026-11-20 21:45 ` Namhyung Kim
2026-11-22 8:59 ` [PATCH v4] perf stat: Refuse a group mixing tool and kernel events TAKANO Mitsuhiro
2026-11-22 9:22 ` sashiko-bot
2026-11-24 13:56 ` [PATCH v5] " TAKANO Mitsuhiro
2026-11-24 14:18 ` sashiko-bot
2026-11-25 1:38 ` [PATCH v6] " TAKANO Mitsuhiro
2026-11-25 2:17 ` sashiko-bot
2026-11-25 13:38 ` [PATCH v7] " TAKANO Mitsuhiro
2026-11-25 13:56 ` sashiko-bot
2026-11-25 17:54 ` [PATCH v8] " TAKANO Mitsuhiro
2026-11-25 18:22 ` sashiko-bot [this message]
2026-11-25 22:27 ` [PATCH v9] " TAKANO Mitsuhiro
2026-11-25 22:59 ` 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-233976@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=takano32@gmail.com \
/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