From: sashiko-bot@kernel.org
To: "Hang Zhengyang" <hang.zhengyang1010@gmail.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2] perf stat: Count kernel events in a group led by a tool event
Date: Wed, 11 Nov 2026 06:18:29 +0000 [thread overview]
Message-ID: <sashiko-outbox-208426@kernel.org> (raw)
In-Reply-To: <20261111-tool-pmu-leader-v2-1-3faa0fb98c51@gmail.com>
> From: Hang Zhengyang <hang.zhengyang1010@gmail.com>
>
> A tool event like user_time has no perf event in the kernel, but
> get_group_fd() still passes its fd, the /proc/stat fd, as the group_fd
> of the members. The kernel rejects each member with EBADF and nothing
> is counted:
>
> $ perf stat -a -e '{user_time,cycles,instructions}' -- sleep 0.05
> 0 user_time
> <not supported> cycles
> <not supported> instructions
>
> Open the members with group_fd = -1, as the enable/disable code already
> assumes. They are then on their own, so read them without
> PERF_FORMAT_GROUP and open them disabled like a leader, so that -D,
> --control and enable_on_exec still apply. Keep reporting a broken
> group when the leader failed to open.
>
> $ perf stat -a -e '{user_time,cycles,instructions}' -- sleep 0.05
> 0 user_time
> 38257394 cycles
> 21228043 instructions
>
> The kernel events in such a group are no longer scheduled together.
>
> Fixes: 6828d6929b76 ("perf evsel: Refactor tool events")
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Hang Zhengyang <hang.zhengyang1010@gmail.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111-tool-pmu-leader-v2-1-3faa0fb98c51@gmail.com?part=1
next prev parent reply other threads:[~2026-11-11 6:18 UTC|newest]
Thread overview: 5+ 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 [this message]
2026-11-11 11:06 ` [PATCH v3] " TAKANO Mitsuhiro
2026-11-11 11:33 ` sashiko-bot
2026-11-12 3:49 ` Hang Zhengyang
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-208426@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=hang.zhengyang1010@gmail.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