[PATCH bpf-next 0/2] bpf: Update doc about calling kernel function

STALE1982d

6 messages, 3 authors, 2021-03-30 · open the first message on its own page

[PATCH bpf-next 0/2] bpf: Update doc about calling kernel function

From: Martin KaFai Lau <hidden>
Date: 2021-03-30 05:42:36

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(+)

-- 
2.30.2

[PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI

From: Martin KaFai Lau <hidden>
Date: 2021-03-30 05:43:08

This patch updates bpf_design_QA.rst to clarify that the kernel
function callable by bpf program is not an ABI.

Signed-off-by: Martin KaFai Lau <redacted>
---
 Documentation/bpf/bpf_design_QA.rst | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff --git a/Documentation/bpf/bpf_design_QA.rst b/Documentation/bpf/bpf_design_QA.rst
index 0e15f9b05c9d..437de2a7a5de 100644
--- a/Documentation/bpf/bpf_design_QA.rst
+++ b/Documentation/bpf/bpf_design_QA.rst
@@ -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.
-- 
2.30.2

[PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call

From: Martin KaFai Lau <hidden>
Date: 2021-03-30 05:43:08

This patch updates the README.rst to specify the clang requirement
to compile the bpf selftests that call kernel function.

Signed-off-by: Martin KaFai Lau <redacted>
---
 tools/testing/selftests/bpf/README.rst | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/tools/testing/selftests/bpf/README.rst b/tools/testing/selftests/bpf/README.rst
index 3464161c8eea..65fe318d1e71 100644
--- a/tools/testing/selftests/bpf/README.rst
+++ b/tools/testing/selftests/bpf/README.rst
@@ -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
-- 
2.30.2

Re: [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI

From: Song Liu <hidden>
Date: 2021-03-30 06:41:52

On Mar 29, 2021, at 10:41 PM, Martin KaFai Lau [off-list ref] wrote:

This patch updates bpf_design_QA.rst to clarify that the kernel
function callable by bpf program is not an ABI.

Signed-off-by: Martin KaFai Lau <redacted>
Acked-by: Song Liu <redacted>

Re: [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call

From: Song Liu <hidden>
Date: 2021-03-30 06:41:52

On Mar 29, 2021, at 10:41 PM, Martin KaFai Lau [off-list ref] wrote:

This patch updates the README.rst to specify the clang requirement
to compile the bpf selftests that call kernel function.

Signed-off-by: Martin KaFai Lau <redacted>
Acked-by: Song Liu <redacted>

Re: [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function

From: Alexei Starovoitov <hidden>
Date: 2021-03-30 16:34:16

On Mon, Mar 29, 2021 at 10:41 PM Martin KaFai Lau [off-list ref] wrote:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help