Re: [PATCH/RFC] Make perf_event_open() propagate errors for use in bpf_perf_event_open()

From: Peter Zijlstra
Date: Fri Jan 18 2019 - 11:20:15 EST


On Fri, Jan 18, 2019 at 12:09:38PM -0300, Arnaldo Carvalho de Melo wrote:
> commit 1b3b3dee572d0b77a316ab6715091201be6832de
> Author: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Date: Fri Jan 11 13:20:20 2019 -0300
>
> 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@xxxxxxxxxxxx>
> Tested-by: Jamal Hadi Salim <jhs@xxxxxxxxxxxx>
> Cc: Adrian Hunter <adrian.hunter@xxxxxxxxx>
> Cc: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx>
> Cc: Daniel Borkmann <daniel@xxxxxxxxxxxxx>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Link: https://lkml.kernel.org/r/20190111155538.GX22483@xxxxxxxxxx
> Signed-off-by: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>

/me hates on git-format :-)

Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>