From: Jiri Olsa <jolsa@kernel.org>
To: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, Martin KaFai Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
David Vernet <void@manifault.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Artem Savkov <asavkov@redhat.com>
Subject: [PATCHv2 bpf-next 0/7] bpf: Move kernel test kfuncs into bpf_testmod
Date: Mon, 30 Jan 2023 09:55:33 +0100 [thread overview]
Message-ID: <20230130085540.410638-1-jolsa@kernel.org> (raw)
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, which brings some difficulties
with __ksym define. But I'm not sure having separate headers for BPF
programs and for kernel module would be better.
This patchset also needs:
74bc3a5acc82 bpf: Add missing btf_put to register_btf_id_dtor_kfuncs
which is only in bpf/master now.
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
---
Jiri Olsa (7):
selftests/bpf: Move kfunc exports to bpf_testmod/bpf_testmod_kfunc.h
selftests/bpf: Move test_progs helpers to testing_helpers object
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
bpf: Move kernel test kfuncs to bpf_testmod
net/bpf/test_run.c | 262 +------------------------------------------------------------------------------------------
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c | 198 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h | 92 ++++++++++++++++++++++++++++++++
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 | 16 +-----
tools/testing/selftests/bpf/progs/kfunc_call_test_subprog.c | 17 ++++--
tools/testing/selftests/bpf/progs/map_kptr.c | 6 +--
tools/testing/selftests/bpf/progs/map_kptr_fail.c | 5 +-
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 | 10 ++++
19 files changed, 549 insertions(+), 434 deletions(-)
create mode 100644 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h
next reply other threads:[~2023-01-30 8:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 8:55 Jiri Olsa [this message]
2023-01-30 8:55 ` [PATCHv2 bpf-next 1/7] selftests/bpf: Move kfunc exports to bpf_testmod/bpf_testmod_kfunc.h Jiri Olsa
2023-01-30 15:15 ` David Vernet
2023-01-30 23:16 ` Jiri Olsa
2023-01-30 8:55 ` [PATCHv2 bpf-next 2/7] selftests/bpf: Move test_progs helpers to testing_helpers object Jiri Olsa
2023-01-30 15:23 ` David Vernet
2023-01-30 23:16 ` Jiri Olsa
2023-01-30 8:55 ` [PATCHv2 bpf-next 3/7] selftests/bpf: Do not unload bpf_testmod in load_bpf_testmod Jiri Olsa
2023-01-30 15:28 ` David Vernet
2023-01-30 8:55 ` [PATCHv2 bpf-next 4/7] selftests/bpf: Use un/load_bpf_testmod functions in tests Jiri Olsa
2023-01-30 15:32 ` David Vernet
2023-01-30 8:55 ` [PATCHv2 bpf-next 5/7] selftests/bpf: Load bpf_testmod for verifier test Jiri Olsa
2023-01-30 8:55 ` [PATCHv2 bpf-next 6/7] selftests/bpf: Allow to use kfunc from testmod.ko in test_verifier Jiri Olsa
2023-01-30 8:55 ` [PATCHv2 bpf-next 7/7] bpf: Move kernel test kfuncs to bpf_testmod Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230130085540.410638-1-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=andrii@kernel.org \
--cc=asavkov@redhat.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=memxor@gmail.com \
--cc=sdf@google.com \
--cc=songliubraving@fb.com \
--cc=void@manifault.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox