From: Eduard Zingerman <eddyz87@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Ihor Solodrai <ihor.solodrai@pm.me>,
Daniel Borkmann <daniel@iogearbox.net>,
"bpf@vger.kernel.org" <bpf@vger.kernel.org>,
"ast@kernel.org" <ast@kernel.org>,
"andrii@kernel.org" <andrii@kernel.org>,
"mykolal@fb.com" <mykolal@fb.com>
Subject: Re: [PATCH bpf-next v2] selftests/bpf: use auto-dependencies for test objects
Date: Wed, 17 Jul 2024 16:24:19 -0700 [thread overview]
Message-ID: <e33b186a5f728a96987347964a622cab64543189.camel@gmail.com> (raw)
In-Reply-To: <CAEf4BzaLatHkXGZ5pmNSC+b5_iZKBeeGqkS-VE8SwXQySviUHg@mail.gmail.com>
On Wed, 2024-07-17 at 09:41 -0700, Andrii Nakryiko wrote:
[...]
> > I don't really see a point in migrating tests to use skels or
> > elf_bytes if such migration does not simplify the test case itself.
>
> Hm... "simplify tests" isn't the goal of this change. The goal is to
> speed up the build process (while not breaking dependencies). So I
> don't see simplification of any kind as a requirement. I'd say we
> shouldn't complicate tests (too much) just for this, but some light
> changes seem fine to me.
My point is that we don't need to update *any* tests to get 99.9% of
the speed up. Thus, the tests update should have some additional net
benefit. And I don't see much gains after looking through the tests.
> > By test simplification I mean at-least removal of some
> > bpf_object__find_{map,program}_by_name() calls.
>
> Some tests are generic and need (or at least are more natural)
> lookup-by-name kind of APIs. Sure we can completely rewrite tests, but
> why?
Sure, I meant the tests where the above APIs were used to find a
single program or map etc, there are a few such tests.
[...]
> > - by adding a catch-all clause in the makefile, e.g. making test
> > runner depend on all .bpf.o files.
>
> do we actually need to rebuild final binary if we are still just
> loading .bpf.o from disk? We are not embedding such .bpf.o (embedding
> is what skeleton headers are adding), so why rebuild .bpf.o?
>
> Actually thinking about this again, I guess, if we don't want to add
> skel.h to track precise dependencies, we don't really need to do
> anything extra for those progs/*.c files that are not used through
> skeletons. We just need to make sure that they are rebuilt if they are
> changed. The rest will work as is because test runner binary will just
> load them from disk at the next run (and user space part doesn't have
> to be rebuilt, unless it itself changed).
Good point. This can be achieved by making $(OUTPUT)/$(TRUNNER_BINARY)
dependency on $(TRUNNER_BPF_OBJS) order-only, e.g. here is a modified
version of the v2: https://tinyurl.com/4wnhkt32
[...]
> > I assume that the goal here is to encode dependencies via skel.h files
> > inclusion. For bpf selftests presence of skel.h guarantees presence of
> > the freshly built object file. Why bother with elf_bytes rework if
> > just including the skel files would be sufficient?
>
> see above, just because there is no guarantee that we use all the
> dependencies and we didn't miss any. It's not a high risk, but it's
> also trivial to switch to elf_bytes.
>
> another side benefit of completely switching to .skel.h is that we can
> stop copying all .bpf.o files into BPF CI, because test_progs will be
> self-contained (thought that's not 100% true due to btf__* and maybe a
> few files more, which is sad and a bit different problem)
Hm, this might make sense.
There are 410Mb of .bpf.o files generated currently.
On the other hand, as you note, one would still need a list of some
.bpf.o files, because there are at-least several tests that verify
operation on ELF files, not ELF bytes.
[...]
> keep in mind that we do want to rebuild .bpf.o if libbpf's BPF-side
> headers changed, so let's make sure that stays (or happens, if we
> don't do it already)
Commands below cause full rebuild (.test.o, .bpf.o) on v2 of this
patch-set:
$ touch tools/lib/bpf/bpf.h
$ touch tools/lib/bpf/libbpf.h
[...]
next prev parent reply other threads:[~2024-07-17 23:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-12 4:36 [PATCH bpf-next v2] selftests/bpf: use auto-dependencies for test objects Ihor Solodrai
2024-07-12 15:26 ` Daniel Borkmann
2024-07-12 17:48 ` Ihor Solodrai
2024-07-12 19:06 ` Eduard Zingerman
2024-07-12 19:20 ` Andrii Nakryiko
2024-07-12 19:46 ` Eduard Zingerman
2024-07-12 19:52 ` Andrii Nakryiko
2024-07-15 1:17 ` Ihor Solodrai
2024-07-15 17:44 ` Andrii Nakryiko
2024-07-16 23:21 ` Eduard Zingerman
2024-07-17 0:36 ` Ihor Solodrai
2024-07-17 0:57 ` Eduard Zingerman
2024-07-17 1:49 ` Ihor Solodrai
2024-07-17 16:41 ` Andrii Nakryiko
2024-07-17 23:24 ` Eduard Zingerman [this message]
2024-07-18 15:34 ` Andrii Nakryiko
2024-07-18 22:42 ` Ihor Solodrai
2024-07-19 5:02 ` Andrii Nakryiko
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=e33b186a5f728a96987347964a622cab64543189.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=ihor.solodrai@pm.me \
--cc=mykolal@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