bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function
@ 2021-03-30  5:41 Martin KaFai Lau
  2021-03-30  5:41 ` [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI Martin KaFai Lau
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Martin KaFai Lau @ 2021-03-30  5:41 UTC (permalink / raw)
  To: bpf; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team, netdev

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI
  2021-03-30  5:41 [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function Martin KaFai Lau
@ 2021-03-30  5:41 ` Martin KaFai Lau
  2021-03-30  6:40   ` Song Liu
  2021-03-30  5:41 ` [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call Martin KaFai Lau
  2021-03-30 16:33 ` [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function Alexei Starovoitov
  2 siblings, 1 reply; 6+ messages in thread
From: Martin KaFai Lau @ 2021-03-30  5:41 UTC (permalink / raw)
  To: bpf; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team, netdev

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 <kafai@fb.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call
  2021-03-30  5:41 [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function Martin KaFai Lau
  2021-03-30  5:41 ` [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI Martin KaFai Lau
@ 2021-03-30  5:41 ` Martin KaFai Lau
  2021-03-30  6:40   ` Song Liu
  2021-03-30 16:33 ` [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function Alexei Starovoitov
  2 siblings, 1 reply; 6+ messages in thread
From: Martin KaFai Lau @ 2021-03-30  5:41 UTC (permalink / raw)
  To: bpf; +Cc: Alexei Starovoitov, Daniel Borkmann, kernel-team, netdev

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 <kafai@fb.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI
  2021-03-30  5:41 ` [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI Martin KaFai Lau
@ 2021-03-30  6:40   ` Song Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Song Liu @ 2021-03-30  6:40 UTC (permalink / raw)
  To: Martin Lau; +Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Kernel Team, netdev



> On Mar 29, 2021, at 10:41 PM, Martin KaFai Lau <kafai@fb.com> 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 <kafai@fb.com>

Acked-by: Song Liu <songliubraving@fb.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call
  2021-03-30  5:41 ` [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call Martin KaFai Lau
@ 2021-03-30  6:40   ` Song Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Song Liu @ 2021-03-30  6:40 UTC (permalink / raw)
  To: Martin Lau; +Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Kernel Team, netdev



> On Mar 29, 2021, at 10:41 PM, Martin KaFai Lau <kafai@fb.com> 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 <kafai@fb.com>

Acked-by: Song Liu <songliubraving@fb.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function
  2021-03-30  5:41 [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function Martin KaFai Lau
  2021-03-30  5:41 ` [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI Martin KaFai Lau
  2021-03-30  5:41 ` [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call Martin KaFai Lau
@ 2021-03-30 16:33 ` Alexei Starovoitov
  2 siblings, 0 replies; 6+ messages in thread
From: Alexei Starovoitov @ 2021-03-30 16:33 UTC (permalink / raw)
  To: Martin KaFai Lau
  Cc: bpf, Alexei Starovoitov, Daniel Borkmann, Kernel Team,
	Network Development

On Mon, Mar 29, 2021 at 10:41 PM Martin KaFai Lau <kafai@fb.com> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-30 16:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-30  5:41 [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function Martin KaFai Lau
2021-03-30  5:41 ` [PATCH bpf-next 1/2] bpf: Update bpf_design_QA.rst to clarify the kfunc call is not ABI Martin KaFai Lau
2021-03-30  6:40   ` Song Liu
2021-03-30  5:41 ` [PATCH bpf-next 2/2] bpf: selftests: Update clang requirement in README.rst for testing kfunc call Martin KaFai Lau
2021-03-30  6:40   ` Song Liu
2021-03-30 16:33 ` [PATCH bpf-next 0/2] bpf: Update doc about calling kernel function Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).