Skip to content

Commit c6aab66

Browse files
mhiramatacmel
authored andcommitted
perf probe: Accept the instance number of kretprobe event
Since the commit 6a13a0d ("ftrace/kprobe: Show the maxactive number on kprobe_events") introduced to show the instance number of kretprobe events, the length of the 1st format of the kprobe event will not 1, but it can be longer. This caused a parser error in perf-probe. Skip the length check the 1st format of the kprobe event to accept this instance number. Without this fix: # perf probe -a vfs_read%return Added new event: probe:vfs_read__return (on vfs_read%return) You can now use it in all perf tools, such as: perf record -e probe:vfs_read__return -aR sleep 1 # perf probe -l Semantic error :Failed to parse event name: r16:probe/vfs_read__return Error: Failed to show event list. And with this fixes: # perf probe -a vfs_read%return ... # perf probe -l probe:vfs_read__return (on vfs_read%return) Fixes: 6a13a0d ("ftrace/kprobe: Show the maxactive number on kprobe_events") Reported-by: Yuxuan Shui <[email protected]> Signed-off-by: Masami Hiramatsu <[email protected]> Tested-by: Yuxuan Shui <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: [email protected] Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207587 Link: http://lore.kernel.org/lkml/158877535215.26469.1113127926699134067.stgit@devnote2 Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 7d1e239 commit c6aab66

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tools/perf/util/probe-event.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1765,8 +1765,7 @@ int parse_probe_trace_command(const char *cmd, struct probe_trace_event *tev)
17651765
fmt1_str = strtok_r(argv0_str, ":", &fmt);
17661766
fmt2_str = strtok_r(NULL, "/", &fmt);
17671767
fmt3_str = strtok_r(NULL, " \t", &fmt);
1768-
if (fmt1_str == NULL || strlen(fmt1_str) != 1 || fmt2_str == NULL
1769-
|| fmt3_str == NULL) {
1768+
if (fmt1_str == NULL || fmt2_str == NULL || fmt3_str == NULL) {
17701769
semantic_error("Failed to parse event name: %s\n", argv[0]);
17711770
ret = -EINVAL;
17721771
goto out;

0 commit comments

Comments
 (0)