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. 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>
This commit is contained in:
parent
33937e5994
commit
39f4a913d6
|
@ -236,8 +236,8 @@ int perf_event__synthesize_bpf_events(struct perf_tool *tool,
|
||||||
pr_debug("%s: can't get next program: %s%s",
|
pr_debug("%s: can't get next program: %s%s",
|
||||||
__func__, strerror(errno),
|
__func__, strerror(errno),
|
||||||
errno == EINVAL ? " -- kernel too old?" : "");
|
errno == EINVAL ? " -- kernel too old?" : "");
|
||||||
/* don't report error on old kernel */
|
/* don't report error on old kernel or EPERM */
|
||||||
err = (errno == EINVAL) ? 0 : -1;
|
err = (errno == EINVAL || errno == EPERM) ? 0 : -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
fd = bpf_prog_get_fd_by_id(id);
|
fd = bpf_prog_get_fd_by_id(id);
|
||||||
|
|
Loading…
Reference in New Issue