Re: [PATCH] perf parse-events: Don't report unreadable tracepoint globs as unknown
From: Ian Rogers
Date: Tue Nov 10 2026 - 13:17:54 EST
On Mon, Nov 9, 2026 at 7:05 PM Hang Zhengyang via B4 Relay
<devnull+hang.zhengyang1010.gmail.com@xxxxxxxxxx> wrote:
>
> From: Hang Zhengyang <hang.zhengyang1010@xxxxxxxxx>
>
> 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@xxxxxxxxx>
> ---
> 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@xxxxxxxxx>
>
>