Re: [PATCH bpf-next 2/2] selftests/bpf: do not update vmlinux.h unnecessarily

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 28, 2024 at 3:02 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote:
>
> On Wed, 2024-08-28 at 17:46 +0000, Ihor Solodrai wrote:
> > %.bpf.o objects depend on vmlinux.h, which makes them transitively
> > dependent on unnecessary libbpf headers. However vmlinux.h doesn't
> > actually change as often.
> >
> > When generating vmlinux.h, compare it to a previous version and update
> > it only if there are changes.
> >
> > Example of build time improvement (after first clean build):
> >   $ touch ../../../lib/bpf/bpf.h
> >   $ time make -j8
> > Before: real  1m37.592s
> > After:  real  0m27.310s
> >
> > Notice that %.bpf.o gen step is skipped if vmlinux.h hasn't changed.
> >
> > Link: https://lore.kernel.org/bpf/CAEf4BzY1z5cC7BKye8=A8aTVxpsCzD=p1jdTfKC7i0XVuYoHUQ@xxxxxxxxxxxxxx
> >
> > Signed-off-by: Ihor Solodrai <ihor.solodrai@xxxxx>
> > ---
>
> Unfortunately, I think that this is a half-measure.
> E.g. the following command forces tests rebuild for me:
>
>   touch ../../../../kernel/bpf/verifier.c; \
>   make -j22 -C ../../../../; \
>   time make test_progs
>
> To workaround this we need to enable reproducible_build option:
>
>     diff --git a/scripts/Makefile.btf b/scripts/Makefile.btf
>     index b75f09f3f424..8cd648f3e32b 100644
>     --- a/scripts/Makefile.btf
>     +++ b/scripts/Makefile.btf
>     @@ -19,7 +19,7 @@ pahole-flags-$(call test-ge, $(pahole-ver), 125)      += --skip_encoding_btf_inconsis
>      else
>
>      # Switch to using --btf_features for v1.26 and later.
>     -pahole-flags-$(call test-ge, $(pahole-ver), 126)  = -j --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs
>     +pahole-flags-$(call test-ge, $(pahole-ver), 126)  = -j --btf_features=encode_force,var,float,enum64,decl_tag,type_tag,optimized_func,consistent_func,decl_tag_kfuncs,reproducible_build
>
>      ifneq ($(KBUILD_EXTMOD),)
>      module-pahole-flags-$(call test-ge, $(pahole-ver), 126) += --btf_features=distilled_base
>
> Question to the mailing list: do we want this?

I don't think so. Too drastic just to save rebuild time.

imo the patch is good enough as-is.





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux