All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform
@ 2020-01-21 15:04 Chris Down
  2020-01-21 19:06 ` Andrii Nakryiko
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Down @ 2020-01-21 15:04 UTC (permalink / raw)
  To: bpf, netdev
  Cc: Stanislav Fomichev, Andrii Nakryiko, John Fastabend,
	linux-kernel, kernel-team

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 <chris@chrisdown.name>
Cc: Stanislav Fomichev <sdf@google.com>
Cc: Andrii Nakryiko <andriin@fb.com>
Cc: John Fastabend <john.fastabend@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: bpf@vger.kernel.org
Cc: kernel-team@fb.com
---
 scripts/link-vmlinux.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index c287ad9b3a67..c8e9f49903a0 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -108,13 +108,15 @@ gen_btf()
 	local bin_arch
 
 	if ! [ -x "$(command -v ${PAHOLE})" ]; then
-		info "BTF" "${1}: pahole (${PAHOLE}) is not available"
+		printf 'BTF: %s: pahole (%s) is not available\n' \
+			"${1}" "${PAHOLE}" >&2
 		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"
+		printf 'BTF: %s: pahole version %s is too old, need at least v1.13\n' \
+			"${1}" "$(${PAHOLE} --version)" >&2
 		return 1
 	fi
 
-- 
2.25.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform
  2020-01-21 15:04 [PATCH] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform Chris Down
@ 2020-01-21 19:06 ` Andrii Nakryiko
  2020-01-21 20:29   ` Chris Down
  0 siblings, 1 reply; 5+ messages in thread
From: Andrii Nakryiko @ 2020-01-21 19:06 UTC (permalink / raw)
  To: Chris Down
  Cc: bpf, Networking, Stanislav Fomichev, Andrii Nakryiko,
	John Fastabend, open list, Kernel Team

On Tue, Jan 21, 2020 at 7:05 AM Chris Down <chris@chrisdown.name> 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 <chris@chrisdown.name>
> Cc: Stanislav Fomichev <sdf@google.com>
> Cc: Andrii Nakryiko <andriin@fb.com>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: linux-kernel@vger.kernel.org
> Cc: netdev@vger.kernel.org
> Cc: bpf@vger.kernel.org
> Cc: kernel-team@fb.com
> ---
>  scripts/link-vmlinux.sh | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index c287ad9b3a67..c8e9f49903a0 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -108,13 +108,15 @@ gen_btf()
>         local bin_arch
>
>         if ! [ -x "$(command -v ${PAHOLE})" ]; then
> -               info "BTF" "${1}: pahole (${PAHOLE}) is not available"
> +               printf 'BTF: %s: pahole (%s) is not available\n' \
> +                       "${1}" "${PAHOLE}" >&2

any reason not to use echo instead of printf? would be more minimal change

>                 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"
> +               printf 'BTF: %s: pahole version %s is too old, need at least v1.13\n' \
> +                       "${1}" "$(${PAHOLE} --version)" >&2
>                 return 1
>         fi
>
> --
> 2.25.0
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform
  2020-01-21 19:06 ` Andrii Nakryiko
@ 2020-01-21 20:29   ` Chris Down
  2020-01-21 21:46     ` Andrii Nakryiko
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Down @ 2020-01-21 20:29 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: bpf, Networking, Stanislav Fomichev, Andrii Nakryiko,
	John Fastabend, open list, Kernel Team

Andrii Nakryiko writes:
>> --- a/scripts/link-vmlinux.sh
>> +++ b/scripts/link-vmlinux.sh
>> @@ -108,13 +108,15 @@ gen_btf()
>>         local bin_arch
>>
>>         if ! [ -x "$(command -v ${PAHOLE})" ]; then
>> -               info "BTF" "${1}: pahole (${PAHOLE}) is not available"
>> +               printf 'BTF: %s: pahole (%s) is not available\n' \
>> +                       "${1}" "${PAHOLE}" >&2
>
>any reason not to use echo instead of printf? would be more minimal change

I generally avoid using echo because it has a bunch of portability gotchas 
which printf mostly doesn't have. If you'd prefer echo, that's fine though, 
just let me know and I can send v2.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform
  2020-01-21 20:29   ` Chris Down
@ 2020-01-21 21:46     ` Andrii Nakryiko
  2020-01-21 23:49       ` Chris Down
  0 siblings, 1 reply; 5+ messages in thread
From: Andrii Nakryiko @ 2020-01-21 21:46 UTC (permalink / raw)
  To: Chris Down
  Cc: bpf, Networking, Stanislav Fomichev, Andrii Nakryiko,
	John Fastabend, open list, Kernel Team

On Tue, Jan 21, 2020 at 12:29 PM Chris Down <chris@chrisdown.name> wrote:
>
> Andrii Nakryiko writes:
> >> --- a/scripts/link-vmlinux.sh
> >> +++ b/scripts/link-vmlinux.sh
> >> @@ -108,13 +108,15 @@ gen_btf()
> >>         local bin_arch
> >>
> >>         if ! [ -x "$(command -v ${PAHOLE})" ]; then
> >> -               info "BTF" "${1}: pahole (${PAHOLE}) is not available"
> >> +               printf 'BTF: %s: pahole (%s) is not available\n' \
> >> +                       "${1}" "${PAHOLE}" >&2
> >
> >any reason not to use echo instead of printf? would be more minimal change
>
> I generally avoid using echo because it has a bunch of portability gotchas
> which printf mostly doesn't have. If you'd prefer echo, that's fine though,
> just let me know and I can send v2.

The rest of the script is using echo for errors, so let's stick to it
for consistency. Thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform
  2020-01-21 21:46     ` Andrii Nakryiko
@ 2020-01-21 23:49       ` Chris Down
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Down @ 2020-01-21 23:49 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: bpf, Networking, Stanislav Fomichev, Andrii Nakryiko,
	John Fastabend, open list, Kernel Team

Andrii Nakryiko writes:
>On Tue, Jan 21, 2020 at 12:29 PM Chris Down <chris@chrisdown.name> wrote:
>>
>> Andrii Nakryiko writes:
>> >> --- a/scripts/link-vmlinux.sh
>> >> +++ b/scripts/link-vmlinux.sh
>> >> @@ -108,13 +108,15 @@ gen_btf()
>> >>         local bin_arch
>> >>
>> >>         if ! [ -x "$(command -v ${PAHOLE})" ]; then
>> >> -               info "BTF" "${1}: pahole (${PAHOLE}) is not available"
>> >> +               printf 'BTF: %s: pahole (%s) is not available\n' \
>> >> +                       "${1}" "${PAHOLE}" >&2
>> >
>> >any reason not to use echo instead of printf? would be more minimal change
>>
>> I generally avoid using echo because it has a bunch of portability gotchas
>> which printf mostly doesn't have. If you'd prefer echo, that's fine though,
>> just let me know and I can send v2.
>
>The rest of the script is using echo for errors, so let's stick to it
>for consistency. Thanks!

Sure thing, I'll send v2. Thanks! :-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-01-21 23:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-21 15:04 [PATCH] bpf: btf: Always output invariant hit in pahole DWARF to BTF transform Chris Down
2020-01-21 19:06 ` Andrii Nakryiko
2020-01-21 20:29   ` Chris Down
2020-01-21 21:46     ` Andrii Nakryiko
2020-01-21 23:49       ` Chris Down

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.