mbox series

[PATCHv4,bpf-next,00/10] bpf: Move kernel test kfuncs into bpf_testmod

Message ID 20230515133756.1658301-1-jolsa@kernel.org (mailing list archive)
Headers show
Series bpf: Move kernel test kfuncs into bpf_testmod | expand

Message

Jiri Olsa May 15, 2023, 1:37 p.m. UTC
hi,
I noticed several times in discussions that we should move test kfuncs
into kernel module, now perhaps even more pressing with all the kfunc
effort. This patchset moves all the test kfuncs into bpf_testmod.

I added bpf_testmod/bpf_testmod_kfunc.h header that is shared between
bpf_testmod kernel module and BPF programs.

v4 changes:
  - s390 supports long calls [1] now, so it can call now kfuncs from module [Ilya]
  - added acks [David]
  - cleanups for ptr_to_u64 function [David]
  - use relative path for bpf_testmod_kfunc.h include [Andrii]
  - new libbpf fix (patch 1) for gen_loader

v3 changes:
  - added acks [David]
  - added bpf_testmod.ko make dependency for bpf test progs [David]
  - better handling of __ksym and refcount_t in bpf_testmod_kfunc.h [David]
  - removed 'extern' from kfuncs declarations [David]
  - typo in header guard macro [David]
  - use only stdout in un/load_bpf_testmod

v2 changes:
  - add 74bc3a5acc82 into bpf-next/master CI, so the test would pass
    https://github.com/kernel-patches/vmtest/pull/192
  - remove extra externs [Artem]
  - using un/load_bpf_testmod in other tests
  - rebased

thanks,
jirka


[1] 1cf3bfc60f98 bpf: Support 64-bit pointers to kfuncs
---
Jiri Olsa (10):
      libbpf: Store zero fd to fd_array for loader kfunc relocation
      selftests/bpf: Move kfunc exports to bpf_testmod/bpf_testmod_kfunc.h
      selftests/bpf: Move test_progs helpers to testing_helpers object
      selftests/bpf: Use only stdout in un/load_bpf_testmod functions
      selftests/bpf: Do not unload bpf_testmod in load_bpf_testmod
      selftests/bpf: Use un/load_bpf_testmod functions in tests
      selftests/bpf: Load bpf_testmod for verifier test
      selftests/bpf: Allow to use kfunc from testmod.ko in test_verifier
      selftests/bpf: Remove extern from kfuncs declarations
      bpf: Move kernel test kfuncs to bpf_testmod

 net/bpf/test_run.c                                          | 201 ------------------------------------------------------------------------------------------------------------------------------------------------
 tools/lib/bpf/gen_loader.c                                  |  14 +++++-----
 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c       | 166 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/prog_tests/bpf_mod_race.c       |  34 ++++---------------------
 tools/testing/selftests/bpf/prog_tests/module_attach.c      |  12 +++------
 tools/testing/selftests/bpf/progs/cb_refs.c                 |   4 +--
 tools/testing/selftests/bpf/progs/jit_probe_mem.c           |   4 +--
 tools/testing/selftests/bpf/progs/kfunc_call_destructive.c  |   3 +--
 tools/testing/selftests/bpf/progs/kfunc_call_fail.c         |   9 +------
 tools/testing/selftests/bpf/progs/kfunc_call_race.c         |   3 +--
 tools/testing/selftests/bpf/progs/kfunc_call_test.c         |  17 +------------
 tools/testing/selftests/bpf/progs/kfunc_call_test_subprog.c |   9 ++-----
 tools/testing/selftests/bpf/progs/local_kptr_stash.c        |   5 ++--
 tools/testing/selftests/bpf/progs/map_kptr.c                |   5 +---
 tools/testing/selftests/bpf/progs/map_kptr_fail.c           |   4 +--
 tools/testing/selftests/bpf/test_progs.c                    |  76 +++++++------------------------------------------------
 tools/testing/selftests/bpf/test_progs.h                    |   1 -
 tools/testing/selftests/bpf/test_verifier.c                 | 170 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
 tools/testing/selftests/bpf/testing_helpers.c               |  61 ++++++++++++++++++++++++++++++++++++++++++++
 tools/testing/selftests/bpf/testing_helpers.h               |   9 +++++++
 21 files changed, 521 insertions(+), 386 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h

Comments

patchwork-bot+netdevbpf@kernel.org May 17, 2023, 5:20 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Mon, 15 May 2023 15:37:46 +0200 you wrote:
> hi,
> I noticed several times in discussions that we should move test kfuncs
> into kernel module, now perhaps even more pressing with all the kfunc
> effort. This patchset moves all the test kfuncs into bpf_testmod.
> 
> I added bpf_testmod/bpf_testmod_kfunc.h header that is shared between
> bpf_testmod kernel module and BPF programs.
> 
> [...]

Here is the summary with links:
  - [PATCHv4,bpf-next,01/10] libbpf: Store zero fd to fd_array for loader kfunc relocation
    https://git.kernel.org/bpf/bpf-next/c/10cb8622b695
  - [PATCHv4,bpf-next,02/10] selftests/bpf: Move kfunc exports to bpf_testmod/bpf_testmod_kfunc.h
    https://git.kernel.org/bpf/bpf-next/c/8e9af8217124
  - [PATCHv4,bpf-next,03/10] selftests/bpf: Move test_progs helpers to testing_helpers object
    https://git.kernel.org/bpf/bpf-next/c/45db310984bf
  - [PATCHv4,bpf-next,04/10] selftests/bpf: Use only stdout in un/load_bpf_testmod functions
    https://git.kernel.org/bpf/bpf-next/c/d18decca69e3
  - [PATCHv4,bpf-next,05/10] selftests/bpf: Do not unload bpf_testmod in load_bpf_testmod
    https://git.kernel.org/bpf/bpf-next/c/b58f3f0e6f3c
  - [PATCHv4,bpf-next,06/10] selftests/bpf: Use un/load_bpf_testmod functions in tests
    https://git.kernel.org/bpf/bpf-next/c/11642eb92b3b
  - [PATCHv4,bpf-next,07/10] selftests/bpf: Load bpf_testmod for verifier test
    https://git.kernel.org/bpf/bpf-next/c/b23b385fa18f
  - [PATCHv4,bpf-next,08/10] selftests/bpf: Allow to use kfunc from testmod.ko in test_verifier
    https://git.kernel.org/bpf/bpf-next/c/f26ebdd3e4e4
  - [PATCHv4,bpf-next,09/10] selftests/bpf: Remove extern from kfuncs declarations
    https://git.kernel.org/bpf/bpf-next/c/6e2b50fa818b
  - [PATCHv4,bpf-next,10/10] bpf: Move kernel test kfuncs to bpf_testmod
    https://git.kernel.org/bpf/bpf-next/c/65eb006d85a2

You are awesome, thank you!