* [PATCH] perf parse-events: Don't report unreadable tracepoint globs as unknown
@ 2026-11-10 3:04 Hang Zhengyang via B4 Relay
2026-11-10 3:11 ` sashiko-bot
2026-11-10 18:14 ` Ian Rogers
0 siblings, 2 replies; 3+ messages in thread
From: Hang Zhengyang via B4 Relay @ 2026-11-10 3:04 UTC (permalink / raw)
To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Ian Rogers, Adrian Hunter, James Clark
Cc: linux-perf-users, linux-kernel, Hang Zhengyang
From: Hang Zhengyang <hang.zhengyang1010@gmail.com>
When the events directory can't be read, a tracepoint glob like
'syscalls:*' is reported as an unknown tracepoint, with a hint about a
missing CONFIG_ option. A plain tracepoint name reports the permission
problem instead:
$ perf stat -e 'syscalls:*' true
event syntax error: 'syscalls:*'
\___ unknown tracepoint
Error: File /sys/kernel/tracing//events/syscalls/* not found.
add_tracepoint_multi_sys() reports ENOENT whenever nothing matched and
ignores the error returned while reading the directories, which got
lost when this code moved to tp_pmu.c. Report that error when there
is one. As a normal user 'syscalls:*' now gets "can't access trace
events" and the remount hint, and perf test 5.1 is skipped again
instead of failing.
Fixes: d002aab87de8 ("perf tp_pmu: Factor existing tracepoint logic to new file")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Hang Zhengyang <hang.zhengyang1010@gmail.com>
---
Found running perf test as a normal user. Tested on perf-tools-next
13a8d580433a. As a normal user, 'syscalls:*', 'sched:*',
'syscalls:sys_enter_open*' and '*:sys_enter_openat' now report the
permission problem, perf test 5 passes with 5.1 skipped, and the rest
of perf test is unchanged. As root, 'nosuchsys:*' still reports an
unknown tracepoint, 'syscalls:sys_enter_open*' counts, and perf test
5.1 passes.
The issue was found and the fix and changelog drafted with Claude; I
reproduced the issue and reviewed and tested the change.
---
tools/perf/util/parse-events.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index f3ba70d4f76b..8a6d5a13863d 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -572,8 +572,10 @@ static int add_tracepoint_multi_sys(struct parse_events_state *parse_state,
ret = tp_pmu__for_each_tp_sys(&args, add_tracepoint_multi_sys_cb);
}
if (args.found == 0) {
- tracepoint_error(err, ENOENT, sys_glob, evt_glob, loc->first_column);
- return -ENOENT;
+ if (!ret)
+ ret = -ENOENT;
+ tracepoint_error(err, ret, sys_glob, evt_glob, loc->first_column);
+ return ret;
}
return ret;
}
---
base-commit: 13a8d580433a3b72b10be34f0e26787fe5659d3c
change-id: 20261110-tp-glob-errno-672ea1eb786b
Best regards,
--
Hang Zhengyang <hang.zhengyang1010@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] perf parse-events: Don't report unreadable tracepoint globs as unknown
2026-11-10 3:04 [PATCH] perf parse-events: Don't report unreadable tracepoint globs as unknown Hang Zhengyang via B4 Relay
@ 2026-11-10 3:11 ` sashiko-bot
2026-11-10 18:14 ` Ian Rogers
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-10 3:11 UTC (permalink / raw)
To: Hang Zhengyang; +Cc: linux-perf-users
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] perf parse-events: event enumeration abort in
add_tracepoint_multi_sys_cb() [1]
--
commit a63217b652c98d06df0265b3b5da9302408c378e
Author: Hang Zhengyang <hang.zhengyang1010@gmail.com>
perf parse-events: Don't report unreadable tracepoint globs as unknown
This commit preserves the directory read error in add_tracepoint_multi_sys()
when no tracepoints match a glob, rather than always reporting -ENOENT.
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index f3ba70d4f76b2..8a6d5a13863d2 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -572,8 +572,10 @@ static int add_tracepoint_multi_sys(struct parse_events_state *parse_state,
> ret = tp_pmu__for_each_tp_sys(&args, add_tracepoint_multi_sys_cb);
> }
> if (args.found == 0) {
> - tracepoint_error(err, ENOENT, sys_glob, evt_glob, loc->first_column);
> - return -ENOENT;
> + if (!ret)
> + ret = -ENOENT;
> + tracepoint_error(err, ret, sys_glob, evt_glob, loc->first_column);
> + return ret;
> }
> return ret;
> }
[Severity: Medium]
This problem wasn't introduced by this patch, but can concurrent removal of a
tracepoint subsystem directory cause add_tracepoint_multi_sys_cb() to abort
the entire enumeration [1]?
While tp_pmu__for_each_tp_sys() iterates over subsystem directories,
add_tracepoint_multi_sys_cb() calls add_tracepoint_multi_event() ->
tp_pmu__for_each_tp_event(). If a matching subsystem directory is removed
before open(), tp_pmu__for_each_tp_event() returns -ENOENT, which stops the
loop in tp_pmu__for_each_tp_sys() instead of skipping the missing directory
and continuing to enumerate the remaining tracepoints.
[1] https://sashiko.dev/#/bug/linux-0b2ec2f2-377b-4c58-91d0-b8dd34e637ac
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261110-tp-glob-errno-v1-1-6c2cb609c590@gmail.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] perf parse-events: Don't report unreadable tracepoint globs as unknown
2026-11-10 3:04 [PATCH] perf parse-events: Don't report unreadable tracepoint globs as unknown Hang Zhengyang via B4 Relay
2026-11-10 3:11 ` sashiko-bot
@ 2026-11-10 18:14 ` Ian Rogers
1 sibling, 0 replies; 3+ messages in thread
From: Ian Rogers @ 2026-11-10 18:14 UTC (permalink / raw)
To: hang.zhengyang1010
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
Adrian Hunter, James Clark, linux-perf-users, linux-kernel
On Mon, Nov 9, 2026 at 7:05 PM Hang Zhengyang via B4 Relay
<devnull+hang.zhengyang1010.gmail.com@kernel.org> wrote:
>
> From: Hang Zhengyang <hang.zhengyang1010@gmail.com>
>
> When the events directory can't be read, a tracepoint glob like
> 'syscalls:*' is reported as an unknown tracepoint, with a hint about a
> missing CONFIG_ option. A plain tracepoint name reports the permission
> problem instead:
>
> $ perf stat -e 'syscalls:*' true
> event syntax error: 'syscalls:*'
> \___ unknown tracepoint
>
> Error: File /sys/kernel/tracing//events/syscalls/* not found.
Thanks Hang! The Sashiko feedback seems like overkill to fix here.
Could you give a before and after comparison of the console output for
this change?
Thanks,
Ian
> add_tracepoint_multi_sys() reports ENOENT whenever nothing matched and
> ignores the error returned while reading the directories, which got
> lost when this code moved to tp_pmu.c. Report that error when there
> is one. As a normal user 'syscalls:*' now gets "can't access trace
> events" and the remount hint, and perf test 5.1 is skipped again
> instead of failing.
>
> Fixes: d002aab87de8 ("perf tp_pmu: Factor existing tracepoint logic to new file")
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Hang Zhengyang <hang.zhengyang1010@gmail.com>
> ---
> Found running perf test as a normal user. Tested on perf-tools-next
> 13a8d580433a. As a normal user, 'syscalls:*', 'sched:*',
> 'syscalls:sys_enter_open*' and '*:sys_enter_openat' now report the
> permission problem, perf test 5 passes with 5.1 skipped, and the rest
> of perf test is unchanged. As root, 'nosuchsys:*' still reports an
> unknown tracepoint, 'syscalls:sys_enter_open*' counts, and perf test
> 5.1 passes.
>
> The issue was found and the fix and changelog drafted with Claude; I
> reproduced the issue and reviewed and tested the change.
> ---
> tools/perf/util/parse-events.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index f3ba70d4f76b..8a6d5a13863d 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -572,8 +572,10 @@ static int add_tracepoint_multi_sys(struct parse_events_state *parse_state,
> ret = tp_pmu__for_each_tp_sys(&args, add_tracepoint_multi_sys_cb);
> }
> if (args.found == 0) {
> - tracepoint_error(err, ENOENT, sys_glob, evt_glob, loc->first_column);
> - return -ENOENT;
> + if (!ret)
> + ret = -ENOENT;
> + tracepoint_error(err, ret, sys_glob, evt_glob, loc->first_column);
> + return ret;
> }
> return ret;
> }
>
> ---
> base-commit: 13a8d580433a3b72b10be34f0e26787fe5659d3c
> change-id: 20261110-tp-glob-errno-672ea1eb786b
>
> Best regards,
> --
> Hang Zhengyang <hang.zhengyang1010@gmail.com>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-10 18:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-10 3:04 [PATCH] perf parse-events: Don't report unreadable tracepoint globs as unknown Hang Zhengyang via B4 Relay
2026-11-10 3:11 ` sashiko-bot
2026-11-10 18:14 ` Ian Rogers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox