Skip to content

Commit b83fd19

Browse files
author
Alexei Starovoitov
committed
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: Alexei Starovoitov <ast@kernel.org>
2 parents 7aae231 + 2ba4bad commit b83fd19

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Documentation/bpf/bpf_design_QA.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,18 @@ Q: Can BPF functionality such as new program or map types, new
258258
helpers, etc be added out of kernel module code?
259259

260260
A: NO.
261+
262+
Q: Directly calling kernel function is an ABI?
263+
----------------------------------------------
264+
Q: Some kernel functions (e.g. tcp_slow_start) can be called
265+
by BPF programs. Do these kernel functions become an ABI?
266+
267+
A: NO.
268+
269+
The kernel function protos will change and the bpf programs will be
270+
rejected by the verifier. Also, for example, some of the bpf-callable
271+
kernel functions have already been used by other kernel tcp
272+
cc (congestion-control) implementations. If any of these kernel
273+
functions has changed, both the in-tree and out-of-tree kernel tcp cc
274+
implementations have to be changed. The same goes for the bpf
275+
programs and they have to be adjusted accordingly.

tools/testing/selftests/bpf/README.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,17 @@ types, which was introduced in `Clang 13`__. The older Clang versions will
179179
either crash when compiling these tests, or generate an incorrect BTF.
180180

181181
__ https://reviews.llvm.org/D83289
182+
183+
Kernel function call test and Clang version
184+
===========================================
185+
186+
Some selftests (e.g. kfunc_call and bpf_tcp_ca) require a LLVM support
187+
to generate extern function in BTF. It was introduced in `Clang 13`__.
188+
189+
Without it, the error from compiling bpf selftests looks like:
190+
191+
.. code-block:: console
192+
193+
libbpf: failed to find BTF for extern 'tcp_slow_start' [25] section: -2
194+
195+
__ https://reviews.llvm.org/D93563

0 commit comments

Comments
 (0)