Linux Perf Users
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: sashiko-reviews@lists.linux.dev
Cc: Chun-Tse Shao <ctshao@google.com>, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v9] perf evsel: Find process with busy PMUs for EBUSY
Date: Wed, 16 Sep 2026 11:02:19 -0300	[thread overview]
Message-ID: <aqqha44XgcO_qQjp@x2> (raw)
In-Reply-To: <20260915205836.654691F000FF@smtp.kernel.org>

On Tue, Sep 15, 2026 at 08:58:35PM +0000, sashiko-bot@kernel.org wrote:
> 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
 
> [ ... ]
 
> > +			/* 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?

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

... ditto ...
 
> > +					   "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?

⬢ [acme@tb-five-perf perf-tools-next]$ grep ctype tools/perf/util/evs
evsel.c          evsel_config.h   evsel_fprintf.c  evsel_fprintf.h  evsel.h          evswitch.c       evswitch.h       
⬢ [acme@tb-five-perf perf-tools-next]$ grep ctype tools/perf/util/evsel.c 
#include <linux/ctype.h>
⬢ [acme@tb-five-perf perf-tools-next]$ grep -w isprint tools/include/linux/ctype.h 
#define isprint(c)	((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
⬢ [acme@tb-five-perf perf-tools-next]$

We need to update review-prompts to cover this case.

Anyway:

Thanks, applied to perf-tools-next, for v7.4.

- Arnaldo

  reply	other threads:[~2026-09-16 14:02 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
2026-09-16 14:02     ` Arnaldo Carvalho de Melo [this message]
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=aqqha44XgcO_qQjp@x2 \
    --to=acme@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