perf parse-events: Don't report unreadable tracepoint globs as unknown
PATCH v2 1/1 perf parse-events: Don't report unreadable tracepoint globs as unknown
As a normal user, a tracepoint glob gets the wrong error:
$ perf stat -e 'syscalls:*' true
event syntax error: 'syscalls:*'
\___ unknown tracepoint Error: File /sys/kernel/tracing//events/syscalls/* not found.
Hint: Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
add_tracepoint_multi_sys() returns ENOENT when nothing matched and drops the error from reading the directories. Return that error instead, so the glob reports what a plain tracepoint name does:
$ perf stat -e 'syscalls:*' true
event syntax error: 'syscalls:*'
\___ can't access trace events Error: No permissions to read /sys/kernel/tracing//events/syscalls/*
Hint: Try 'sudo mount -o remount,mode=755 /sys/kernel/tracing/'
---
Thanks for the review, Ian.
---
Changes in v2:
- Show the output after the fix (Ian)
- Link to v1: https://lore.kernel.org/r/[email protected]
--- tools/perf/util/parse-events.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/perf/util/parse-events.c +4 -2
@@ -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,
Signature · 1 line
Hang Zhengyang <[email protected]>
[email protected]
AI reviewSashiko has reviewed this patch and found no issues.
Quoted 19 lines
From: Hang Zhengyang <[email protected]>
As a normal user, a tracepoint glob gets the wrong error:
$ perf stat -e 'syscalls:*' true event syntax error: 'syscalls:*' \___ unknown tracepointError: File
/sys/kernel/tracing//events/syscalls/*not found.
Hint: Perhaps this kernel misses someCONFIG_setting to enable this feature?.
add_tracepoint_multi_sys()returns ENOENT when nothing matched and drops the error from reading the directories. Return that error instead, so the glob reports what a plain tracepoint name does:$ perf stat -e 'syscalls:*' true event syntax error: 'syscalls:*' \___ can't access trace events
Quoted 6 lines
Error: No permissions to read
/sys/kernel/tracing//events/syscalls/*
Hint: Try 'sudo mount -o remount,mode=755/sys/kernel/tracing/'Fixes d002aab87de8 ("perf tp_pmu: Factor existing tracepoint logic to new file")Assisted-by Claude:claude-opus-5-5Signed-off-by Hang Zhengyang <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 10 lines · Hang Zhengyang
As a normal user, a tracepoint glob gets the wrong error:
$ perf stat -e 'syscalls:*' true event syntax error: 'syscalls:*' \___ unknown tracepointError: File
/sys/kernel/tracing//events/syscalls/*not found.
Hint: Perhaps this kernel misses someCONFIG_setting to enable this feature?.[...]
Applied to perf-tools-next, thanks!
Best regards
Namhyung