perf utils: Silence "Couldn't synthesize bpf events" warning for EPERM
authorSong Liu <songliubraving@fb.com>
Mon, 4 Feb 2019 19:31:40 +0000 (11:31 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 14 Feb 2019 16:31:11 +0000 (13:31 -0300)
Synthesizing BPF events is only supported for root. Silent warning msg
when non-root user runs perf-record.

Reported-by: David Carrillo-Cisneros <davidca@fb.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Tested-by: David Carrillo-Cisneros <davidca@fb.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: kernel-team@fb.com
Link: http://lkml.kernel.org/r/20190204193140.719740-1-songliubraving@fb.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/bpf-event.c

index 796ef793f4cea05695b8f20569f528d5e08a3e37..62dda96b0096d1aede32dcfc434d66b3bcba9c12 100644 (file)
@@ -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);