2020-01-22 00:02:41

by Chris Down

[permalink] [raw]
Subject: [PATCH v2] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform

When trying to compile with CONFIG_DEBUG_INFO_BTF enabled, I got this
error:

% make -s
Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make[3]: *** [vmlinux] Error 1

Compiling again without -s shows the true error (that pahole is
missing), but since this is fatal, we should show the error
unconditionally on stderr as well, not silence it using the `info`
function. With this patch:

% make -s
BTF: .tmp_vmlinux.btf: pahole (pahole) is not available
Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
make[3]: *** [vmlinux] Error 1

Signed-off-by: Chris Down <[email protected]>
Cc: Stanislav Fomichev <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: John Fastabend <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
scripts/link-vmlinux.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index c287ad9b3a67..bbe9be2bf5ff 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -108,13 +108,13 @@ gen_btf()
local bin_arch

if ! [ -x "$(command -v ${PAHOLE})" ]; then
- info "BTF" "${1}: pahole (${PAHOLE}) is not available"
+ echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available"
return 1
fi

pahole_ver=$(${PAHOLE} --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/')
if [ "${pahole_ver}" -lt "113" ]; then
- info "BTF" "${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.13"
+ echo >&2 "BTF: ${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.13"
return 1
fi

--
2.25.0


2020-01-22 00:07:16

by Andrii Nakryiko

[permalink] [raw]
Subject: Re: [PATCH v2] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform

On Tue, Jan 21, 2020 at 4:01 PM Chris Down <[email protected]> wrote:
>
> When trying to compile with CONFIG_DEBUG_INFO_BTF enabled, I got this
> error:
>
> % make -s
> Failed to generate BTF for vmlinux
> Try to disable CONFIG_DEBUG_INFO_BTF
> make[3]: *** [vmlinux] Error 1
>
> Compiling again without -s shows the true error (that pahole is
> missing), but since this is fatal, we should show the error
> unconditionally on stderr as well, not silence it using the `info`
> function. With this patch:
>
> % make -s
> BTF: .tmp_vmlinux.btf: pahole (pahole) is not available
> Failed to generate BTF for vmlinux
> Try to disable CONFIG_DEBUG_INFO_BTF
> make[3]: *** [vmlinux] Error 1
>
> Signed-off-by: Chris Down <[email protected]>
> Cc: Stanislav Fomichev <[email protected]>
> Cc: Andrii Nakryiko <[email protected]>
> Cc: John Fastabend <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> ---
> scripts/link-vmlinux.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>

Looks great, thanks!

Acked-by: Andrii Nakryiko <[email protected]>

> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index c287ad9b3a67..bbe9be2bf5ff 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -108,13 +108,13 @@ gen_btf()
> local bin_arch
>
> if ! [ -x "$(command -v ${PAHOLE})" ]; then
> - info "BTF" "${1}: pahole (${PAHOLE}) is not available"
> + echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available"
> return 1
> fi
>
> pahole_ver=$(${PAHOLE} --version | sed -E 's/v([0-9]+)\.([0-9]+)/\1\2/')
> if [ "${pahole_ver}" -lt "113" ]; then
> - info "BTF" "${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.13"
> + echo >&2 "BTF: ${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.13"
> return 1
> fi
>
> --
> 2.25.0
>

2020-01-22 17:25:14

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH v2] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform

On 1/22/20 1:01 AM, Chris Down wrote:
> When trying to compile with CONFIG_DEBUG_INFO_BTF enabled, I got this
> error:
>
> % make -s
> Failed to generate BTF for vmlinux
> Try to disable CONFIG_DEBUG_INFO_BTF
> make[3]: *** [vmlinux] Error 1
>
> Compiling again without -s shows the true error (that pahole is
> missing), but since this is fatal, we should show the error
> unconditionally on stderr as well, not silence it using the `info`
> function. With this patch:
>
> % make -s
> BTF: .tmp_vmlinux.btf: pahole (pahole) is not available
> Failed to generate BTF for vmlinux
> Try to disable CONFIG_DEBUG_INFO_BTF
> make[3]: *** [vmlinux] Error 1
>
> Signed-off-by: Chris Down <[email protected]>
> Cc: Stanislav Fomichev <[email protected]>
> Cc: Andrii Nakryiko <[email protected]>
> Cc: John Fastabend <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]
> Cc: [email protected]

Applied, thanks!