All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Chun-Tse Shao" <ctshao@google.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v9] perf evsel: Find process with busy PMUs for EBUSY
Date: Tue, 15 Sep 2026 20:58:35 +0000	[thread overview]
Message-ID: <20260915205836.654691F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915204951.2935261-2-ctshao@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] perf: missing POSIX header inclusions for libc functions
--

commit d5be35562f4cbefd7876eec8560215b17ee34b81
Author: Chun-Tse Shao <ctshao@google.com>

perf evsel: Find process with busy PMUs for EBUSY

This commit parses fdinfo with PMU type, comparing it with the event which
failed to open, and reports the processes causing EBUSY errors.

> diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
> index d4cb455f4a7d4..e6d67d522ebf3 100644
> --- a/tools/perf/util/evsel.c
> +++ b/tools/perf/util/evsel.c

[ ... ]

> @@ -4288,12 +4300,51 @@ static int dump_perf_event_processes(char *msg, size_t size)

[ ... ]

> +			/* Let's check the PMU type reserved by this process */
> +			scnprintf(buf, sizeof(buf), "%s/fdinfo/%s",
> +				  proc_entry->d_name, fd_entry->d_name);
> +			fdinfo_fd = openat(dirfd(proc_dir), buf, O_RDONLY | O_NONBLOCK);

[Severity: Low]
Will this compile under musl libc without explicitly including <fcntl.h> for
openat and O_NONBLOCK, as well as <unistd.h> for read and close?

> +			if (fdinfo_fd == -1)
> +				continue;
> +			fdinfo_size = read(fdinfo_fd, fdinfo_buf, sizeof(fdinfo_buf) - 1);
> +			close(fdinfo_fd);
> +			if (fdinfo_size < 0)
> +				continue;
> +			fdinfo_buf[fdinfo_size] = '\0';
> +
> +			line = strtok_r(fdinfo_buf, "\n", &saveptr);
> +			while (line) {
> +				if (sscanf(line,

[Severity: Low]
Does this require <stdio.h> to be explicitly included for sscanf to prevent
musl libc build failures?

> +					   "perf_event_attr.type:\t%u",
> +					   &perf_event_type) == 1) {
> +					/* continue parsing */
> +				} else if (sscanf(line,
> +						  "pmu_type:\t%u",
> +						  &pmu_type) == 1) {
> +					/* continue parsing */
> +				}
> +				line = strtok_r(NULL, "\n", &saveptr);
> +			}

[ ... ]

> @@ -4304,10 +4355,12 @@ static int dump_perf_event_processes(char *msg, size_t size)
>  				for (ssize_t i = 0; i < cmdline_size; i++) {
>  					if (buf[i] == '\0')
>  						buf[i] = ' ';
> +					else if (!isprint((unsigned char)buf[i]))

[Severity: Low]
Does this require <ctype.h> to be explicitly included for isprint to ensure
compatibility with musl libc builds?

> +						buf[i] = '.';
>  				}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915204951.2935261-2-ctshao@google.com?part=1

  reply	other threads:[~2026-09-15 20:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAP-5=fVzG-2oJ1gN=s-W+2r58k8P4M-E3r8aP9zJ2aK_w-K9vQ@mail.gmail.com>
2026-09-15 20:49 ` [PATCH v9] perf evsel: Find process with busy PMUs for EBUSY Chun-Tse Shao
2026-09-15 20:58   ` sashiko-bot [this message]
2026-09-16 14:02     ` Arnaldo Carvalho de Melo
2026-09-16 13:57   ` Arnaldo Carvalho de Melo

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=20260915205836.654691F000FF@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.