diff mbox series

[bpf-next] bpf: Generate BTF_KIND_FLOAT when linking vmlinux

Message ID 20210331014356.256212-1-iii@linux.ibm.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series [bpf-next] bpf: Generate BTF_KIND_FLOAT when linking vmlinux | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 10 maintainers not CCed: netdev@vger.kernel.org linux-kbuild@vger.kernel.org yhs@fb.com kpsingh@kernel.org masahiroy@kernel.org andrii@kernel.org kafai@fb.com john.fastabend@gmail.com songliubraving@fb.com michal.lkml@markovi.net
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 1 this patch: 1
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 1 this patch: 1
netdev/header_inline success Link

Commit Message

Ilya Leoshkevich March 31, 2021, 1:43 a.m. UTC
pahole v1.21 will support the --btf_gen_floats flag, which makes it
generate the information about the floating-point types.

Adjust link-vmlinux.sh to pass this flag to pahole in case it's
supported. Whether or not this flag is supported is determined by
probing, which is chosen over version check for two reasons:

1) at this moment --btf_gen_floats exists only in master, which
   identifies itself as v1.20.
2) distros may backport features, making the version check too
   conservative.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 scripts/link-vmlinux.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Andrii Nakryiko March 31, 2021, 6:28 a.m. UTC | #1
On Tue, Mar 30, 2021 at 6:44 PM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
>
> pahole v1.21 will support the --btf_gen_floats flag, which makes it
> generate the information about the floating-point types.
>
> Adjust link-vmlinux.sh to pass this flag to pahole in case it's
> supported. Whether or not this flag is supported is determined by
> probing, which is chosen over version check for two reasons:
>
> 1) at this moment --btf_gen_floats exists only in master, which
>    identifies itself as v1.20.
> 2) distros may backport features, making the version check too
>    conservative.
>

Does anyone really cherry-pick and backport pahole patches, though? So
far we've been using strictly version checks for pahole (1.13, then
1.16, then 1.19 for modules), that keeps everything simpler and more
reliable, IMO. I'd stick with 1.21 check and just check with Arnaldo
when he's planning to release a new version.

> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  scripts/link-vmlinux.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 3b261b0f74f0..f4c763d2661d 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -227,8 +227,13 @@ gen_btf()
>
>         vmlinux_link ${1}
>
> +       local paholeopt=-J
> +       if ${PAHOLE} --btf_gen_floats --help >/dev/null 2>&1; then
> +               paholeopt="${paholeopt} --btf_gen_floats"
> +       fi
> +
>         info "BTF" ${2}
> -       LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
> +       LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} ${paholeopt} ${1}

we know that -J is always specified, so I'd leave it intact, and just
have "extra pahole options", potentially empty.

>
>         # Create ${2} which contains just .BTF section but no symbols. Add
>         # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
> --
> 2.29.2
>
Arnaldo Carvalho de Melo March 31, 2021, 1:14 p.m. UTC | #2
Em Tue, Mar 30, 2021 at 11:28:36PM -0700, Andrii Nakryiko escreveu:
> On Tue, Mar 30, 2021 at 6:44 PM Ilya Leoshkevich <iii@linux.ibm.com> wrote:
> >
> > pahole v1.21 will support the --btf_gen_floats flag, which makes it
> > generate the information about the floating-point types.
> >
> > Adjust link-vmlinux.sh to pass this flag to pahole in case it's
> > supported. Whether or not this flag is supported is determined by
> > probing, which is chosen over version check for two reasons:
> >
> > 1) at this moment --btf_gen_floats exists only in master, which
> >    identifies itself as v1.20.
> > 2) distros may backport features, making the version check too
> >    conservative.
> >
> 
> Does anyone really cherry-pick and backport pahole patches, though? So
> far we've been using strictly version checks for pahole (1.13, then
> 1.16, then 1.19 for modules), that keeps everything simpler and more
> reliable, IMO. I'd stick with 1.21 check and just check with Arnaldo
> when he's planning to release a new version.

The plan is to get 1.21 out of the door when we finish the LTO work, which should be soon.

- Arnaldo
 
> > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > ---
> >  scripts/link-vmlinux.sh | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> > index 3b261b0f74f0..f4c763d2661d 100755
> > --- a/scripts/link-vmlinux.sh
> > +++ b/scripts/link-vmlinux.sh
> > @@ -227,8 +227,13 @@ gen_btf()
> >
> >         vmlinux_link ${1}
> >
> > +       local paholeopt=-J
> > +       if ${PAHOLE} --btf_gen_floats --help >/dev/null 2>&1; then
> > +               paholeopt="${paholeopt} --btf_gen_floats"
> > +       fi
> > +
> >         info "BTF" ${2}
> > -       LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
> > +       LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} ${paholeopt} ${1}
> 
> we know that -J is always specified, so I'd leave it intact, and just
> have "extra pahole options", potentially empty.
> 
> >
> >         # Create ${2} which contains just .BTF section but no symbols. Add
> >         # SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all
> > --
> > 2.29.2
> >
diff mbox series

Patch

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index 3b261b0f74f0..f4c763d2661d 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -227,8 +227,13 @@  gen_btf()
 
 	vmlinux_link ${1}
 
+	local paholeopt=-J
+	if ${PAHOLE} --btf_gen_floats --help >/dev/null 2>&1; then
+		paholeopt="${paholeopt} --btf_gen_floats"
+	fi
+
 	info "BTF" ${2}
-	LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} -J ${1}
+	LLVM_OBJCOPY=${OBJCOPY} ${PAHOLE} ${paholeopt} ${1}
 
 	# Create ${2} which contains just .BTF section but no symbols. Add
 	# SHF_ALLOC because .BTF will be part of the vmlinux image. --strip-all