All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Dave Marchevsky <davemarchevsky@fb.com>
Cc: Andrii Nakryiko <andrii@kernel.org>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH v2 bpf-next 1/9] selftests/bpf: normalize XDP section names in selftests
Date: Tue, 21 Sep 2021 16:08:59 -0700	[thread overview]
Message-ID: <CAEf4BzbV7M5Uhsw+OtE+JdaJ17ragpfyKXAT9=1yoec4jhq4nA@mail.gmail.com> (raw)
In-Reply-To: <4ab8049e-7e06-17b3-56ab-f1776cdf5e5e@fb.com>

On Mon, Sep 20, 2021 at 9:55 PM Dave Marchevsky <davemarchevsky@fb.com> wrote:
>
> On 9/20/21 7:43 PM, Andrii Nakryiko wrote:
> > Convert almost all SEC("xdp_blah") uses to strict SEC("xdp") to comply
> > with strict libbpf 1.0 logic of exact section name match for XDP program
> > types. There is only one exception, which is only tested through
> > iproute2 and defines multiple XDP programs within the same BPF object.
> > Given iproute2 still works in non-strict libbpf mode and it doesn't have
> > means to specify XDP programs by its name (not section name/title),
> > leave that single file alone for now until iproute2 gains lookup by
> > function/program name.
> >
> > Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
> > ---
>
> Aside from a checkpatch nit which you didn't cause, LGTM. Some general
> comments follow as well, but aren't directly related to the patch.
>
> Acked-by: Dave Marchevsky <davemarchevsky@fb.com>
>
> >  tools/testing/selftests/bpf/progs/test_map_in_map.c         | 2 +-
> >  .../selftests/bpf/progs/test_tcp_check_syncookie_kern.c     | 2 +-
> >  tools/testing/selftests/bpf/progs/test_xdp.c                | 2 +-
> >  .../testing/selftests/bpf/progs/test_xdp_adjust_tail_grow.c | 2 +-
> >  .../selftests/bpf/progs/test_xdp_adjust_tail_shrink.c       | 4 +---
> >  tools/testing/selftests/bpf/progs/test_xdp_devmap_helpers.c | 2 +-
> >  tools/testing/selftests/bpf/progs/test_xdp_link.c           | 2 +-
> >  tools/testing/selftests/bpf/progs/test_xdp_loop.c           | 2 +-
> >  tools/testing/selftests/bpf/progs/test_xdp_noinline.c       | 4 ++--
> >  .../selftests/bpf/progs/test_xdp_with_cpumap_helpers.c      | 4 ++--
> >  .../selftests/bpf/progs/test_xdp_with_devmap_helpers.c      | 4 ++--
> >  tools/testing/selftests/bpf/progs/xdp_dummy.c               | 2 +-
> >  tools/testing/selftests/bpf/progs/xdp_redirect_multi_kern.c | 4 ++--
> >  tools/testing/selftests/bpf/progs/xdping_kern.c             | 4 ++--
> >  tools/testing/selftests/bpf/test_tcp_check_syncookie.sh     | 2 +-
> >  tools/testing/selftests/bpf/test_xdp_redirect.sh            | 4 ++--
> >  tools/testing/selftests/bpf/test_xdp_redirect_multi.sh      | 2 +-
> >  tools/testing/selftests/bpf/test_xdp_veth.sh                | 4 ++--
> >  tools/testing/selftests/bpf/xdping.c                        | 6 +++---
>
> Doesn't look like the test_...sh's here are run by the CI. Confirmed they
> (as well as test_xdping.sh) all passed for me. My test VM isn't doing anything
> special networking-wise, so maybe it's not too difficult to add these to CI.

Thanks for confirming. Yes, they are not run in CI, we only run
test_progs, test_verifier and test_maps. Instead of adding all those
small scripts to be run by CI, we are encouraging everyone to converge
on test_progs, because that's where we invest efforts to make it a
universal test runner for BPF needs. So I'd say let's convert them to
test_progs framework instead.

>
> >  19 files changed, 28 insertions(+), 30 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/progs/test_map_in_map.c b/tools/testing/selftests/bpf/progs/test_map_in_map.c
> > index 1cfeb940cf9f..5f0e0bfc151e 100644
> > --- a/tools/testing/selftests/bpf/progs/test_map_in_map.c
> > +++ b/tools/testing/selftests/bpf/progs/test_map_in_map.c
> > @@ -23,7 +23,7 @@ struct {

[...]

> >       void *data_end = (void *)(long)xdp->data_end;
> > diff --git a/tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_shrink.c b/tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_shrink.c
> > index 22065a9cfb25..b7448253d135 100644
> > --- a/tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_shrink.c
> > +++ b/tools/testing/selftests/bpf/progs/test_xdp_adjust_tail_shrink.c
> > @@ -9,9 +9,7 @@
> >  #include <linux/if_ether.h>
> >  #include <bpf/bpf_helpers.h>
> >
> > -int _version SEC("version") = 1;
> > -
>
> Didn't realize this was meant to specify kernel version for compat, and that
> it no longer does anything anyways. Maybe this should be removed from all
> selftests + examples to make this more obvious?

Yes, it should, but perhaps in a separate clean up series. Except I'd
leave it for BPF static linker testing, of course.

>
> > -SEC("xdp_adjust_tail_shrink")
> > +SEC("xdp")
> >  int _xdp_adjust_tail_shrink(struct xdp_md *xdp)
> >  {
> >       void *data_end = (void *)(long)xdp->data_end;
> > diff --git a/tools/testing/selftests/bpf/progs/test_xdp_devmap_helpers.c b/tools/testing/selftests/bpf/progs/test_xdp_devmap_helpers.c
> > index b360ba2bd441..807bf895f42c 100644
> > --- a/tools/testing/selftests/bpf/progs/test_xdp_devmap_helpers.c

Note, it's generally a good idea to trim irrelevant parts in your
reply making it easier to see one's replies among the wall of text,
especially outside of gmail UI.

[...]

> > diff --git a/tools/testing/selftests/bpf/xdping.c b/tools/testing/selftests/bpf/xdping.c
> > index 842d9155d36c..f9798ead20a9 100644
> > --- a/tools/testing/selftests/bpf/xdping.c
> > +++ b/tools/testing/selftests/bpf/xdping.c
> > @@ -178,9 +178,9 @@ int main(int argc, char **argv)
> >               return 1;
> >       }
> >
> > -     main_prog = bpf_object__find_program_by_title(obj,
> > -                                                   server ? "xdpserver" :
> > -                                                            "xdpclient");
> > +     main_prog = bpf_object__find_program_by_name(obj,
> > +                                                   server ? "xdping_server" :
> > +                                                            "xdping_client");
>
> checkpatch doesn't like the text alignment here, not that you changed it

yeah, me neither, but not worth re-spin just for this :)

>
> >       if (main_prog)
> >               prog_fd = bpf_program__fd(main_prog);
> >       if (!main_prog || prog_fd < 0) {
> >
>
>

  reply	other threads:[~2021-09-21 23:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-20 23:43 [PATCH v2 bpf-next 0/9] libbpf: stricter BPF program section name handling Andrii Nakryiko
2021-09-20 23:43 ` [PATCH v2 bpf-next 1/9] selftests/bpf: normalize XDP section names in selftests Andrii Nakryiko
2021-09-21  4:55   ` Dave Marchevsky
2021-09-21 23:08     ` Andrii Nakryiko [this message]
2021-09-20 23:43 ` [PATCH v2 bpf-next 2/9] selftests/bpf: normalize SEC("classifier") usage Andrii Nakryiko
2021-09-21  5:20   ` Dave Marchevsky
2021-09-21 23:10     ` Andrii Nakryiko
2021-09-20 23:43 ` [PATCH v2 bpf-next 3/9] selftests/bpf: normalize all the rest SEC() uses Andrii Nakryiko
2021-09-21  5:41   ` Dave Marchevsky
2021-09-21 23:12     ` Andrii Nakryiko
2021-09-20 23:43 ` [PATCH v2 bpf-next 4/9] libbpf: refactor internal sec_def handling to enable pluggability Andrii Nakryiko
2021-09-22  0:42   ` Dave Marchevsky
2021-09-22 22:06     ` Andrii Nakryiko
2021-09-20 23:43 ` [PATCH v2 bpf-next 5/9] libbpf: reduce reliance of attach_fns on sec_def internals Andrii Nakryiko
2021-09-22  1:00   ` Dave Marchevsky
2021-09-20 23:43 ` [PATCH v2 bpf-next 6/9] libbpf: refactor ELF section handler definitions Andrii Nakryiko
2021-09-22  1:34   ` Dave Marchevsky
2021-09-22 21:54     ` Andrii Nakryiko
2021-09-20 23:43 ` [PATCH v2 bpf-next 7/9] libbpf: complete SEC() table unification for BPF_APROG_SEC/BPF_EAPROG_SEC Andrii Nakryiko
2021-09-22  1:42   ` Dave Marchevsky
2021-09-22 21:55     ` Andrii Nakryiko
2021-09-22 22:12       ` Andrii Nakryiko
2021-09-20 23:43 ` [PATCH v2 bpf-next 8/9] libbpf: add opt-in strict BPF program section name handling logic Andrii Nakryiko
2021-09-22  1:53   ` Dave Marchevsky
2021-09-22 21:57     ` Andrii Nakryiko
2021-09-20 23:43 ` [PATCH v2 bpf-next 9/9] selftests/bpf: switch sk_lookup selftests to strict SEC("sk_lookup") use Andrii Nakryiko
2021-09-22  2:37   ` Dave Marchevsky

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='CAEf4BzbV7M5Uhsw+OtE+JdaJ17ragpfyKXAT9=1yoec4jhq4nA@mail.gmail.com' \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davemarchevsky@fb.com \
    --cc=kernel-team@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.