public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Leo Yan <leo.yan@arm.com>, Namhyung Kim <namhyung@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	James Clark <james.clark@linaro.org>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf record: Make logs more readable for event open failures
Date: Thu, 5 Feb 2026 18:41:55 -0300	[thread overview]
Message-ID: <aYUOowQ_CZf3BDKo@x1> (raw)
In-Reply-To: <CAP-5=fUQxuVK+6GObmqVdBmTLzu06FyNaLdLsW6tcgNv5=7gxw@mail.gmail.com>

On Wed, Feb 04, 2026 at 09:29:14AM -0800, Ian Rogers wrote:
> On Wed, Feb 4, 2026 at 6:26 AM Leo Yan <leo.yan@arm.com> wrote:
> >
> > Since commit ee27476fa300 ("perf record: Skip don't fail for events that
> > don't open"), if a user does not have permission to access a PMU event,
> > perf reports:
> >
> >   perf record -e cs_etm// -C 3 -- ls
> >   Error:
> >   Failure to open event 'cs_etm//u' on PMU 'cs_etm' which will be removed.
> >   No fallback found for 'cs_etm//u' for error 13
> >   Error:
> >   Failure to open event 'dummy:u' on PMU 'software' which will be removed.
> >   No fallback found for 'dummy:u' for error 13
> >   Error:
> >   Failure to open any events for recording.
> >
> > The log is not very helpful, as no clear indication of what "error 13"
> > means or how to address the issue.
> >
> > This commit restores evsel__open_strerror() to generate a readable error
> > message and print it out:

I'm applying this one, maybe we can at least suppress the one for dummy
when it is auto added?

- Arnaldo

> >   perf record -e cs_etm// -C 3 -- ls
> >   Error:
> >   Failure to open event 'cs_etm//' on PMU 'cs_etm' which will be removed.
> >   Access to performance monitoring and observability operations is limited.
> >   Consider adjusting /proc/sys/kernel/perf_event_paranoid setting to open
> >   access to performance monitoring and observability operations for processes
> >   without CAP_PERFMON, CAP_SYS_PTRACE or CAP_SYS_ADMIN Linux capability.
> >   More information can be found at 'Perf events and tool security' document:
> >   https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html
> >   perf_event_paranoid setting is 1:
> >     -1: Allow use of (almost) all events by all users
> >         Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK
> >   >= 0: Disallow raw and ftrace function tracepoint access
> >   >= 1: Disallow CPU event access
> >   >= 2: Disallow kernel profiling
> >   To make the adjusted perf_event_paranoid setting permanent preserve it
> >   in /etc/sysctl.conf (e.g. kernel.perf_event_paranoid = <setting>)
> >   Error:
> >   Failure to open event 'dummy:u' on PMU 'software' which will be removed.
> >   Access to performance monitoring and observability operations is limited.
> >   Consider adjusting /proc/sys/kernel/perf_event_paranoid setting to open
> >   access to performance monitoring and observability operations for processes
> >   without CAP_PERFMON, CAP_SYS_PTRACE or CAP_SYS_ADMIN Linux capability.
> >   More information can be found at 'Perf events and tool security' document:
> >   https://www.kernel.org/doc/html/latest/admin-guide/perf-security.html
> >   perf_event_paranoid setting is 1:
> >     -1: Allow use of (almost) all events by all users
> >         Ignore mlock limit after perf_event_mlock_kb without CAP_IPC_LOCK
> >   >= 0: Disallow raw and ftrace function tracepoint access
> >   >= 1: Disallow CPU event access
> >   >= 2: Disallow kernel profiling
> >   To make the adjusted perf_event_paranoid setting permanent preserve it
> >   in /etc/sysctl.conf (e.g. kernel.perf_event_paranoid = <setting>)
> >   Error:
> >   Failure to open any events for recording.
> >
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> 
> Lgtm and sorry for making things worse - I believe it was motivated by
> trying to avoid spammy warnings.
> 
> Reviewed-by: Ian Rogers <irogers@google.com>
> 
> Thanks,
> Ian
> 
> > ---
> >  tools/perf/builtin-record.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> > index 2584d0d8bc820676da60bdf5f59d41371d85a93a..aa8dc3e18190dd7db1ed5e3c7673fde8d5785a26 100644
> > --- a/tools/perf/builtin-record.c
> > +++ b/tools/perf/builtin-record.c
> > @@ -1404,6 +1404,7 @@ static int record__open(struct record *rec)
> >                         }
> >  #endif
> >                         if (report_error || verbose > 0) {
> > +                               evsel__open_strerror(pos, &opts->target, errno, msg, sizeof(msg));
> >                                 ui__error("Failure to open event '%s' on PMU '%s' which will be "
> >                                           "removed.\n%s\n",
> >                                           evsel__name(pos), evsel__pmu_name(pos), msg);
> >
> > ---
> > base-commit: 5fd0a1df5d05ad066e5618ccdd3d0fa6cb686c27
> > change-id: 20260204-perf_improve_log_for_open_event_failures-deda2c61b93d
> >
> > Best regards,
> > --
> > Leo Yan <leo.yan@arm.com>
> >

  parent reply	other threads:[~2026-02-05 21:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 14:26 [PATCH] perf record: Make logs more readable for event open failures Leo Yan
2026-02-04 17:29 ` Ian Rogers
2026-02-05 10:30   ` Leo Yan
2026-02-05 17:07     ` Ian Rogers
2026-02-05 21:41   ` Arnaldo Carvalho de Melo [this message]
2026-02-05 22:33     ` Ian Rogers
2026-02-06 16:32       ` Leo Yan

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=aYUOowQ_CZf3BDKo@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=leo.yan@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /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