From: sashiko-bot@kernel.org
To: "Chun-Tse Shao" <ctshao@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v6 1/2] perf: Reveal PMU type in fdinfo
Date: Mon, 18 May 2026 18:12:28 +0000 [thread overview]
Message-ID: <20260518181228.BB80CC2BCC6@smtp.kernel.org> (raw)
In-Reply-To: <20260518174159.1177549-1-ctshao@google.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The `perf_show_fdinfo` function omits the `config4` field from the `perf_event_attr` struct.
- [Medium] Lockless read of `event->attr` fields can lead to data tearing and inconsistent output.
--
commit ec3f500bd8b814c602df062a02b83af7397b6b5d
Author: Chun-Tse Shao <ctshao@google.com>
perf: Reveal PMU type in fdinfo
This commit adds fdinfo output to reveal the PMU configuration for a process.
It exposes perf_event_attr fields such as type, config, config1, config2,
and config3 through the /proc/*/fdinfo/ interface.
> diff --git a/kernel/events/core.c b/kernel/events/core.c
> index 6d1f8bad7e1c5..d88947e9f7740 100644
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
[ ... ]
> @@ -7506,6 +7507,20 @@ static int perf_fasync(int fd, struct file *filp, int on)
> return 0;
> }
>
> +static void perf_show_fdinfo(struct seq_file *m, struct file *f)
> +{
> + struct perf_event *event = f->private_data;
> +
> + seq_printf(m, "perf_event_attr.type:\t%u\n", event->orig_type);
> + seq_printf(m, "perf_event_attr.config:\t0x%llx\n", (unsigned long long)event->attr.config);
> + seq_printf(m, "perf_event_attr.config1:\t0x%llx\n",
> + (unsigned long long)event->attr.config1);
> + seq_printf(m, "perf_event_attr.config2:\t0x%llx\n",
> + (unsigned long long)event->attr.config2);
Can these fields be read safely without locking or READ_ONCE()?
Since event->attr.config1 (which aliases bp_addr) and event->attr.config2
(which aliases bp_len) can be concurrently modified via the
PERF_EVENT_IOC_MODIFY_ATTRIBUTES ioctl, there could be data tearing on
32-bit architectures if they are updated locklessly with respect to VFS
readers.
> + seq_printf(m, "perf_event_attr.config3:\t0x%llx\n",
> + (unsigned long long)event->attr.config3);
Does this code need to print config4 as well?
The perf_event_attr struct has been extended to include config4.
By omitting it from the fdinfo output, we might be missing information for
users relying on this interface for events and PMUs that utilize this newer
attribute field.
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260518174159.1177549-1-ctshao@google.com?part=1
prev parent reply other threads:[~2026-05-18 18:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 17:41 [PATCH v6 1/2] perf: Reveal PMU type in fdinfo Chun-Tse Shao
2026-05-18 17:41 ` [PATCH v6 2/2] perf evsel: Find process with busy PMUs for EBUSY Chun-Tse Shao
2026-05-18 18:27 ` sashiko-bot
2026-05-18 18:12 ` sashiko-bot [this message]
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=20260518181228.BB80CC2BCC6@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ctshao@google.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