]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Refactor perf_event_set_bpf_prog() to use struct bpf_prog input
authorAndrii Nakryiko <andrii@kernel.org>
Sun, 15 Aug 2021 07:05:56 +0000 (00:05 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 16 Aug 2021 22:45:07 +0000 (00:45 +0200)
commit26a675308e028288610b4c8ca17443c06669af23
treed4c4f634ab8cefc26a85c4ea225936a551e509ac
parentebc9c44b1bc4a5643c69a7297ce42cfc995e097f
bpf: Refactor perf_event_set_bpf_prog() to use struct bpf_prog input

Make internal perf_event_set_bpf_prog() use struct bpf_prog pointer as an
input argument, which makes it easier to re-use for other internal uses
(coming up for BPF link in the next patch). BPF program FD is not as
convenient and in some cases it's not available. So switch to struct bpf_prog,
move out refcounting outside and let caller do bpf_prog_put() in case of an
error. This follows the approach of most of the other BPF internal functions.

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20210815070609.987780-4-andrii@kernel.org
kernel/events/core.c