public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	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>
Subject: Re: [PATCH bpf-next 1/5] selftests/bpf: Move kfunc exports to bpf_testmod/bpf_testmod_kfunc.h
Date: Wed, 25 Jan 2023 22:33:42 +0100	[thread overview]
Message-ID: <Y9GgNhLiqeX7E3Ib@krava> (raw)
In-Reply-To: <Y9EFAqdLED3TT43M@samus.usersys.redhat.com>

On Wed, Jan 25, 2023 at 11:31:30AM +0100, Artem Savkov wrote:
> On Tue, Jan 24, 2023 at 03:36:22PM +0100, Jiri Olsa wrote:
> > Move all kfunc exports into separate header file and include it
> > in tests that need it.
> > 
> > We will move all test kfuncs into bpf_testmod in following change,
> > so it's convenient to have declarations in single place.
> > 
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> >  .../bpf/bpf_testmod/bpf_testmod_kfunc.h       | 89 +++++++++++++++++++
> >  tools/testing/selftests/bpf/progs/cb_refs.c   |  1 +
> >  .../selftests/bpf/progs/jit_probe_mem.c       |  3 +-
> >  .../bpf/progs/kfunc_call_destructive.c        |  3 +-
> >  .../selftests/bpf/progs/kfunc_call_fail.c     |  9 +-
> >  .../selftests/bpf/progs/kfunc_call_race.c     |  3 +-
> >  .../selftests/bpf/progs/kfunc_call_test.c     | 15 +---
> >  .../bpf/progs/kfunc_call_test_subprog.c       | 17 +++-
> >  tools/testing/selftests/bpf/progs/map_kptr.c  |  1 +
> >  .../selftests/bpf/progs/map_kptr_fail.c       |  1 +
> >  10 files changed, 111 insertions(+), 31 deletions(-)
> >  create mode 100644 tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h
> > 
> > diff --git a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h
> > new file mode 100644
> > index 000000000000..41d4f8543a25
> > --- /dev/null
> > +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod_kfunc.h
> > @@ -0,0 +1,89 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +
> > +#ifndef _BPF_TESTMOD_KFUNC_H
> > +#define _BPF_TESTMOD_KFUNC_H
> > +
> > +#ifndef __ksym
> > +#define __ksym __attribute__((section(".ksyms")))
> > +#endif
> 
> ...
> 
> > +extern void bpf_kfunc_call_test_pass_ctx(struct __sk_buff *skb) __ksym;
> > +extern void bpf_kfunc_call_test_pass1(struct prog_test_pass1 *p) __ksym;
> > +extern void bpf_kfunc_call_test_pass2(struct prog_test_pass2 *p) __ksym;
> > +extern void bpf_kfunc_call_test_mem_len_fail2(__u64 *mem, int len) __ksym;
> > +
> > +extern void bpf_kfunc_call_test_destructive(void) __ksym;
> > +
> > +#endif /* _BPF_TESTMOD_KFUNC_H */
> 
> This is missing bpf_kfunc_call_test_kptr_get() prototype, the function is
> moved with the rest in the 5th patch.

ok, will add that one as well

> 
> > diff --git a/tools/testing/selftests/bpf/progs/cb_refs.c b/tools/testing/selftests/bpf/progs/cb_refs.c
> > index 7653df1bc787..b905833dc9d3 100644
> > --- a/tools/testing/selftests/bpf/progs/cb_refs.c
> > +++ b/tools/testing/selftests/bpf/progs/cb_refs.c
> > @@ -2,6 +2,7 @@
> >  #include <vmlinux.h>
> >  #include <bpf/bpf_tracing.h>
> >  #include <bpf/bpf_helpers.h>
> > +#include "bpf_testmod/bpf_testmod_kfunc.h"
> >  
> >  struct map_value {
> >  	struct prog_test_ref_kfunc __kptr_ref *ptr;
> > diff --git a/tools/testing/selftests/bpf/progs/map_kptr.c b/tools/testing/selftests/bpf/progs/map_kptr.c
> > index eb8217803493..753305c22c2f 100644
> > --- a/tools/testing/selftests/bpf/progs/map_kptr.c
> > +++ b/tools/testing/selftests/bpf/progs/map_kptr.c
> > @@ -2,6 +2,7 @@
> >  #include <vmlinux.h>
> >  #include <bpf/bpf_tracing.h>
> >  #include <bpf/bpf_helpers.h>
> > +#include "bpf_testmod/bpf_testmod_kfunc.h"
> >  
> >  struct map_value {
> >  	struct prog_test_ref_kfunc __kptr *unref_ptr;
> > diff --git a/tools/testing/selftests/bpf/progs/map_kptr_fail.c b/tools/testing/selftests/bpf/progs/map_kptr_fail.c
> > index 760e41e1a632..3b5076d951df 100644
> > --- a/tools/testing/selftests/bpf/progs/map_kptr_fail.c
> > +++ b/tools/testing/selftests/bpf/progs/map_kptr_fail.c
> > @@ -4,6 +4,7 @@
> >  #include <bpf/bpf_helpers.h>
> >  #include <bpf/bpf_core_read.h>
> >  #include "bpf_misc.h"
> > +#include "bpf_testmod/bpf_testmod_kfunc.h"
> >  
> >  struct map_value {
> >  	char buf[8];
> 
> These three are missing old prototype removal.

right, will remove, thanks

jirka

  reply	other threads:[~2023-01-25 21:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 14:36 [PATCH bpf-next 0/5] bpf: Move kernel test kfuncs into bpf_testmod Jiri Olsa
2023-01-24 14:36 ` [PATCH bpf-next 1/5] selftests/bpf: Move kfunc exports to bpf_testmod/bpf_testmod_kfunc.h Jiri Olsa
2023-01-25 10:31   ` Artem Savkov
2023-01-25 21:33     ` Jiri Olsa [this message]
2023-01-24 14:36 ` [PATCH bpf-next 2/5] selftests/bpf: Move test_progs helpers to testing_helpers object Jiri Olsa
2023-01-24 14:36 ` [PATCH bpf-next 3/5] selftests/bpf: Load bpf_testmod for verifier test Jiri Olsa
2023-01-24 14:36 ` [PATCH bpf-next 4/5] selftests/bpf: Allow to use kfunc from testmod.ko in test_verifier Jiri Olsa
2023-01-24 14:36 ` [PATCH bpf-next 5/5] bpf: Move kernel test kfuncs to bpf_testmod Jiri Olsa
2023-01-25  3:49 ` [PATCH bpf-next 0/5] bpf: Move kernel test kfuncs into bpf_testmod Alexei Starovoitov
2023-01-25  7:41   ` Jiri Olsa
2023-01-26 14:45     ` 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=Y9GgNhLiqeX7E3Ib@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --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=sdf@google.com \
    --cc=songliubraving@fb.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