Skip to contentSkip to conversation

perf utils: silent "Couldn't synthesize bpf events" warning for EPERM

PATCH In review Song Liu 3 participants 4 messages Feb 4, 2019 – Feb 15, 2019 perf events

lore
Share & tools
lore

Song Liu

author
#0 lore raw

PATCH 1/1 perf utils: silent "Couldn't synthesize bpf events" warning for EPERM

Synthesizing BPF events is only supported for root. Silent warning msg when non-root user runs perf-record.

---
 tools/perf/util/bpf-event.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-event.c +2 -2
index 796ef793f4ce..62dda96b0096 100644
@@ -236,8 +236,8 @@ int perf_event__synthesize_bpf_events(struct perf_tool *tool,
 			pr_debug("%s: can't get next program: %s%s",
 				 __func__, strerror(errno),
 				 errno == EINVAL ? " -- kernel too old?" : "");
-			/* don't report error on old kernel */
-			err = (errno == EINVAL) ? 0 : -1;
+			/* don't report error on old kernel or EPERM  */
+			err = (errno == EINVAL || errno == EPERM) ? 0 : -1;
 			break;
 		}
 		fd = bpf_prog_get_fd_by_id(id);
Signature · 1 line
2.17.1
author
#1 lore raw
Quoted 34 lines · Song Liu

Synthesizing BPF events is only supported for root. Silent warning msg when non-root user runs perf-record.

---
tools/perf/util/bpf-event.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-event.c +2 -2
index 796ef793f4ce..62dda96b0096 100644
@@ -236,8 +236,8 @@ int perf_event__synthesize_bpf_events(struct perf_tool *tool,
 			pr_debug("%s: can't get next program: %s%s",
 				 __func__, strerror(errno),
 				 errno == EINVAL ? " -- kernel too old?" : "");
-			/* don't report error on old kernel */
-			err = (errno == EINVAL) ? 0 : -1;
+			/* don't report error on old kernel or EPERM  */
+			err = (errno == EINVAL || errno == EPERM) ? 0 : -1;
 			break;
 		}
 		fd = bpf_prog_get_fd_by_id(id);
Signature · 1 line
2.17.1

CC David.

Tested-by
#2 lore raw
Quoted 6 lines · Song Liu
Quoted 6 lines · Song Liu

Synthesizing BPF events is only supported for root. Silent warning msg when non-root user runs perf-record.

great, it was annoying ;-)

thanks,
jirka

Quoted 30 lines
Quoted 28 lines

---
tools/perf/util/bpf-event.c | 4 ++--

1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-event.c +2 -2
index 796ef793f4ce..62dda96b0096 100644
@@ -236,8 +236,8 @@ int perf_event__synthesize_bpf_events(struct perf_tool *tool,
 			pr_debug("%s: can't get next program: %s%s",
 				 __func__, strerror(errno),
 				 errno == EINVAL ? " -- kernel too old?" : "");
-			/* don't report error on old kernel */
-			err = (errno == EINVAL) ? 0 : -1;
+			/* don't report error on old kernel or EPERM  */
+			err = (errno == EINVAL || errno == EPERM) ? 0 : -1;
 			break;
 		}
 		fd = bpf_prog_get_fd_by_id(id);
Signature · 1 line
2.17.1

CC David.

#3 lore raw

[tip:perf/core] perf utils: Silence "Couldn't synthesize bpf events" warning for EPERM

In reply to Song Liu
perf utils: Silence "Couldn't synthesize bpf events" warning for EPERM
Commit-ID:  39f4a913d6d439178177cae8aa2e9a232160fd51
Gitweb:     https://git.kernel.org/tip/39f4a913d6d439178177cae8aa2e9a232160fd51
Author:     Song Liu <[email protected]>
AuthorDate: Mon, 4 Feb 2019 11:31:40 -0800
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 14 Feb 2019 13:31:11 -0300

perf utils: Silence "Couldn't synthesize bpf events" warning for EPERM

Synthesizing BPF events is only supported for root. Silent warning msg when non-root user runs perf-record.

---
 tools/perf/util/bpf-event.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/bpf-event.c +2 -2
index 796ef793f4ce..62dda96b0096 100644
@@ -236,8 +236,8 @@ int perf_event__synthesize_bpf_events(struct perf_tool *tool,
 			pr_debug("%s: can't get next program: %s%s",
 				 __func__, strerror(errno),
 				 errno == EINVAL ? " -- kernel too old?" : "");
-			/* don't report error on old kernel */
-			err = (errno == EINVAL) ? 0 : -1;
+			/* don't report error on old kernel or EPERM  */
+			err = (errno == EINVAL || errno == EPERM) ? 0 : -1;
 			break;
 		}
 		fd = bpf_prog_get_fd_by_id(id);