]> Git Repo - linux.git/commit - net/bpf/test_run.c
bpf: Add __bpf_kfunc_{start,end}_defs macros
authorDave Marchevsky <[email protected]>
Tue, 31 Oct 2023 21:56:24 +0000 (14:56 -0700)
committerAlexei Starovoitov <[email protected]>
Thu, 2 Nov 2023 05:33:53 +0000 (22:33 -0700)
commit391145ba2accc48b596f3d438af1a6255b62a555
treef529f9f2ea3b0c8ad83a4e37a10c00cafa511295
parentcd60f410ddc0cd663045d15936155421b6f708fd
bpf: Add __bpf_kfunc_{start,end}_defs macros

BPF kfuncs are meant to be called from BPF programs. Accordingly, most
kfuncs are not called from anywhere in the kernel, which the
-Wmissing-prototypes warning is unhappy about. We've peppered
__diag_ignore_all("-Wmissing-prototypes", ... everywhere kfuncs are
defined in the codebase to suppress this warning.

This patch adds two macros meant to bound one or many kfunc definitions.
All existing kfunc definitions which use these __diag calls to suppress
-Wmissing-prototypes are migrated to use the newly-introduced macros.
A new __diag_ignore_all - for "-Wmissing-declarations" - is added to the
__bpf_kfunc_start_defs macro based on feedback from Andrii on an earlier
version of this patch [0] and another recent mailing list thread [1].

In the future we might need to ignore different warnings or do other
kfunc-specific things. This change will make it easier to make such
modifications for all kfunc defs.

  [0]: https://lore.kernel.org/bpf/CAEf4BzaE5dRWtK6RPLnjTW-MW9sx9K3Fn6uwqCTChK2Dcb1Xig@mail.gmail.com/
  [1]: https://lore.kernel.org/bpf/ZT+2qCc%2FaXep0%2FLf@krava/

Signed-off-by: Dave Marchevsky <[email protected]>
Suggested-by: Andrii Nakryiko <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Cc: Jiri Olsa <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Acked-by: David Vernet <[email protected]>
Acked-by: Yafang Shao <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>
16 files changed:
Documentation/bpf/kfuncs.rst
include/linux/btf.h
kernel/bpf/bpf_iter.c
kernel/bpf/cgroup_iter.c
kernel/bpf/cpumask.c
kernel/bpf/helpers.c
kernel/bpf/map_iter.c
kernel/bpf/task_iter.c
kernel/trace/bpf_trace.c
net/bpf/test_run.c
net/core/filter.c
net/core/xdp.c
net/ipv4/fou_bpf.c
net/netfilter/nf_conntrack_bpf.c
net/netfilter/nf_nat_bpf.c
net/xfrm/xfrm_interface_bpf.c
This page took 0.071498 seconds and 4 git commands to generate.