OSDN Git Service

perf: Make perf_event_output() propagate the output() return
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 11 Jan 2019 16:20:20 +0000 (13:20 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 21 Jan 2019 20:00:57 +0000 (17:00 -0300)
commit5620196951192f7cd2da0a04e7c0113f40bfc14e
treea2e4e124393e702649392595a14f4d4efab79d01
parent8dabe9c43af7aa78b16ce0d61bc595eca20c7a70
perf: Make perf_event_output() propagate the output() return

For the original mode of operation it isn't needed, since we report back
errors via PERF_RECORD_LOST records in the ring buffer, but for use in
bpf_perf_event_output() it is convenient to return the errors, basically
-ENOSPC.

Currently bpf_perf_event_output() returns an error indication, the last
thing it does, which is to push it to the ring buffer is that can fail
and if so, this failure won't be reported back to its users, fix it.

Reported-by: Jamal Hadi Salim <jhs@mojatatu.com>
Tested-by: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/r/20190118150938.GN5823@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
include/linux/perf_event.h
kernel/events/core.c
kernel/trace/bpf_trace.c
tools/perf/examples/bpf/augmented_raw_syscalls.c
tools/perf/examples/bpf/augmented_syscalls.c
tools/perf/examples/bpf/etcsnoop.c