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

Andrii Nakryiko
2020-05-14T22:39:10Z

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?

> # 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?

> --
> 2.25.4
>