tools/perf/builtin-record.c | 1 + 1 file changed, 1 insertion(+)
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:
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>
---
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>
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:
>
> 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>
>
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>
> >
On Thu, Feb 5, 2026 at 1:42 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
>
> 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?
IIRC it was left in as "perf record -e dummy" can be a way of just
tracking sideband data and you'd want errors opening dummy to be
warned upon in that case.
Thanks,
Ian
> - 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>
> > >
On Thu, Feb 05, 2026 at 02:33:04PM -0800, Ian Rogers wrote:
> On Thu, Feb 5, 2026 at 1:42 PM Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> >
> > 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?
>
> IIRC it was left in as "perf record -e dummy" can be a way of just
> tracking sideband data and you'd want errors opening dummy to be
> warned upon in that case.
As Arnaldo said this patch has been picked, I sent a following patch
for simplifying the logs:
https://lore.kernel.org/linux-perf-users/20260206-perf_improve_log_for_open_event_failures-v1-1-366903bebcd7@arm.com/T/#u
If want me to resend two patches in a series, or squash into one,
please let me know. Thanks!
Leo
On Wed, Feb 04, 2026 at 09:29:14AM -0800, Ian Rogers wrote:
[...]
> > This commit restores evsel__open_strerror() to generate a readable error
> > message and print it out:
> 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 for review, Ian.
Just wander if we can go a bit further. My understanding is that now we only
handle the special case of duplicate "cycles" naming on Arm/Arm64, it is
not necessarily to tolerate other failure cases.
So could we report errors and directly bail out for other PMU event failure?
This somehow reverts to old neat log rather the duplicated error logs for
each events. Something like:
---8<---
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 2584d0d8bc82..ca7d6805840a 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1404,10 +1404,21 @@ 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);
+
+ /*
+ * Only tolerate Arm cycle failures and bail out
+ * on any other event failures.
+ */
+ if (report_error) {
+ rc = -errno;
+ goto out;
+ }
}
If this is okay for you, I can send a updated patch.
Thanks,
Leo
On Thu, Feb 5, 2026 at 2:30 AM Leo Yan <leo.yan@arm.com> wrote:
>
> On Wed, Feb 04, 2026 at 09:29:14AM -0800, Ian Rogers wrote:
>
> [...]
>
> > > This commit restores evsel__open_strerror() to generate a readable error
> > > message and print it out:
>
> > 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 for review, Ian.
>
> Just wander if we can go a bit further. My understanding is that now we only
> handle the special case of duplicate "cycles" naming on Arm/Arm64, it is
> not necessarily to tolerate other failure cases.
>
> So could we report errors and directly bail out for other PMU event failure?
> This somehow reverts to old neat log rather the duplicated error logs for
> each events. Something like:
>
> ---8<---
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 2584d0d8bc82..ca7d6805840a 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -1404,10 +1404,21 @@ 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);
> +
> + /*
> + * Only tolerate Arm cycle failures and bail out
> + * on any other event failures.
> + */
> + if (report_error) {
> + rc = -errno;
> + goto out;
> + }
> }
>
>
> If this is okay for you, I can send a updated patch.
My main concern is to not have a code path for ARM that we can't test
on x86. Currently opening an uncore event with a core event on x86
exercises same the cycles event problem as on ARM. The logic I worry
about bit rotting is the evlist clean up, etc:
https://web.git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/builtin-record.c?h=perf-tools-next#n1422
If your concern is log spam then we could by default make report_error
true only when no other errors have been reported, but then we may go
on to do the record and be missing removed events that weren't warned
about unless you are in verbose mode.
I think in your patch you'd need to save the errno value to avoid it
being clobbered.
Thanks,
Ian
> Thanks,
> Leo
© 2016 - 2026 Red Hat, Inc.