mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf parse-events: Don't report unreadable tracepoint globs as unknown
@ 2026-11-10  3:04 Hang Zhengyang via B4 Relay
  0 siblings, 0 replies; only message 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	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-10  3:05 UTC | newest]

Thread overview: (only message) (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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®