bpf: Update doc about calling kernel function
Subsystems (6)
cover bpf: Update doc about calling kernel function
This set updates the document about the bpf program calling kernel function. In particular, updates are regarding to the clang requirement in selftests and kfunc-call not an ABI.
Martin KaFai Lau (2):
bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI
bpf: selftests: Update clang requirement in README.rst for testing
kfunc call
Documentation/bpf/bpf_design_QA.rst | 15 +++++++++++++++ tools/testing/selftests/bpf/README.rst | 14 ++++++++++++++ 2 files changed, 29 insertions(+)
Signature · 1 line
2.30.2
PATCH 1/2 bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI
This patch updates bpf_design_QA.rst to clarify that the kernel function callable by bpf program is not an ABI.
--- Documentation/bpf/bpf_design_QA.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
Documentation/bpf/bpf_design_QA.rst +15 -0
@@ -258,3 +258,18 @@ Q: Can BPF functionality such as new program or map types, new helpers, etc be added out of kernel module code? A: NO. + +Q: Directly calling kernel function is an ABI? +---------------------------------------------- +Q: Some kernel functions (e.g. tcp_slow_start) can be called +by BPF programs. Do these kernel functions become an ABI? + +A: NO. + +The kernel function protos will change and the bpf programs will be +rejected by the verifier. Also, for example, some of the bpf-callable +kernel functions have already been used by other kernel tcp +cc (congestion-control) implementations. If any of these kernel +functions has changed, both the in-tree and out-of-tree kernel tcp cc +implementations have to be changed. The same goes for the bpf +programs and they have to be adjusted accordingly.
Signature · 1 line
2.30.2
Re: [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI
Quoted 8 lines · Martin KaFai Lau
This patch updates
bpf_design_QA.rstto clarify that the kernel function callable by bpf program is not an ABI.Signed-off-by Martin KaFai Lau <[email protected]>
PATCH 2/2 bpf: selftests: Update clang requirement in README.rst for testing kfunc call
In reply to Martin KaFai LauThis patch updates the README.rst to specify the clang requirement to compile the bpf selftests that call kernel function.
--- tools/testing/selftests/bpf/README.rst | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tools/testing/selftests/bpf/README.rst +14 -0
@@ -179,3 +179,17 @@ types, which was introduced in `Clang 13`__. The older Clang versions will either crash when compiling these tests, or generate an incorrect BTF. __ https://reviews.llvm.org/D83289 + +Kernel function call test and Clang version +=========================================== + +Some selftests (e.g. kfunc_call and bpf_tcp_ca) require a LLVM support +to generate extern function in BTF. It was introduced in `Clang 13`__. + +Without it, the error from compiling bpf selftests looks like: + +.. code-block:: console + + libbpf: failed to find BTF for extern 'tcp_slow_start' [25] section: -2 + +__ https://reviews.llvm.org/D93563
Signature · 1 line
2.30.2
Re: [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call
Quoted 8 lines · Martin KaFai Lau
This patch updates the
README.rstto specify the clang requirement to compile the bpf selftests that call kernel function.Signed-off-by Martin KaFai Lau <[email protected]>
Alexei Starovoitov
AppliedQuoted 4 lines · Martin KaFai Lau
This set updates the document about the bpf program calling kernel function. In particular, updates are regarding to the clang requirement in selftests and kfunc-call not an ABI.
Applied.