Re: [PATCH 6/9] bpf: Compile bpfwl tool at kernel compilation start

Jiri Olsa
2020-05-15T14:58:09Z

On Thu, May 14, 2020 at 03:38:57PM -0700, Andrii Nakryiko wrote:
> On Wed, May 6, 2020 at 6:31 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > The bpfwl tool will be used during the vmlinux linking,
> > so it's necessary it's ready.
> >
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > Makefile | 21 +++++++++++++++++----
> > tools/Makefile | 3 +++
> > tools/bpf/Makefile | 5 ++++-
> > 3 files changed, 24 insertions(+), 5 deletions(-)
> >
>
> [...]
>
> >
> > +prepare-bpfwl: $(bpfwl_target)
> > +ifeq ($(SKIP_BTF_WHITELIST_GENERATION),1)
> > + @echo "warning: Cannot use BTF whitelist checks, please install libelf-dev, libelf-devel or elfutils-libelf-devel" >&2
> > +endif
>
> When we added BTF dedup and generation first time, we also made pahole
> unavailability or any error during deduplication process an error. It
> actually was very confusing to users and they often missed that BTF
> generation didn't happen, but they would notice it only at runtime
> (after a confusing debugging session).
>
> So I wonder if it's better to make this an error instead? Just guard
> whitelist generation on whether CONFIG_DEBUG_INFO_BTF is enabled or
> not?

ok, makes sense.. I'll let it fail if there's CONFIG_DEBUG_INFO_BTF
enabled and we'are missing libelf

>
> > # Generate some files
> > # ---------------------------------------------------------------------------
> >
> > diff --git a/tools/Makefile b/tools/Makefile
> > index bd778812e915..85af6ebbce91 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -67,6 +67,9 @@ cpupower: FORCE
> > cgroup firewire hv guest bootconfig spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware debugging: FORCE
> > $(call descend,$@)
> >
> > +bpf/%: FORCE
> > + $(call descend,$@)
> > +
> > liblockdep: FORCE
> > $(call descend,lib/lockdep)
> >
> > diff --git a/tools/bpf/Makefile b/tools/bpf/Makefile
> > index f897eeeb0b4f..d4ea2b5a2e58 100644
> > --- a/tools/bpf/Makefile
> > +++ b/tools/bpf/Makefile
> > @@ -124,5 +124,8 @@ runqslower_install:
> > runqslower_clean:
> > $(call descend,runqslower,clean)
> >
> > +bpfwl:
> > + $(call descend,bpfwl)
> > +
> > .PHONY: all install clean bpftool bpftool_install bpftool_clean \
> > - runqslower runqslower_install runqslower_clean
> > + runqslower runqslower_install runqslower_clean bpfwl
>
> what about install/clean subcommands? At least clean seems like a good idea?

not sure about install, does not seem necessary for this tool,
but I'll add propagation of clean (it's defined in bpfwl already)

thanks,
jirka