Commit b83fd195 authored by Alexei Starovoitov's avatar Alexei Starovoitov

Merge branch 'bpf: Update doc about calling kernel function'

Martin KaFai says:

====================

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.
====================
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parents 7aae231a 2ba4badc
...@@ -258,3 +258,18 @@ Q: Can BPF functionality such as new program or map types, new ...@@ -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? helpers, etc be added out of kernel module code?
A: NO. 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.
...@@ -179,3 +179,17 @@ types, which was introduced in `Clang 13`__. The older Clang versions will ...@@ -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. either crash when compiling these tests, or generate an incorrect BTF.
__ https://reviews.llvm.org/D83289 __ 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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment