* [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh
@ 2024-09-13 17:37 Masahiro Yamada
2024-09-13 17:37 ` [PATCH v2 2/3] btf: move pahole check in scripts/link-vmlinux.sh to lib/Kconfig.debug Masahiro Yamada
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Masahiro Yamada @ 2024-09-13 17:37 UTC (permalink / raw)
To: Martin KaFai Lau, bpf
Cc: Andrii Nakryiko, linux-kernel, Nathan Chancellor, Masahiro Yamada,
Alan Maguire
CONFIG_DEBUG_INFO_BTF depends on CONFIG_BPF_SYSCALL, which in turn
selects CONFIG_BPF.
When CONFIG_DEBUG_INFO_BTF=y, CONFIG_BPF=y is always met.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
---
(no changes since v1)
scripts/link-vmlinux.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index bd196944e350..cfffc41e20ed 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -288,7 +288,7 @@ strip_debug=
vmlinux_link vmlinux
# fill in BTF IDs
-if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then
+if is_enabled CONFIG_DEBUG_INFO_BTF; then
info BTFIDS vmlinux
${RESOLVE_BTFIDS} vmlinux
fi
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 2/3] btf: move pahole check in scripts/link-vmlinux.sh to lib/Kconfig.debug
2024-09-13 17:37 [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Masahiro Yamada
@ 2024-09-13 17:37 ` Masahiro Yamada
2024-09-13 17:37 ` [PATCH v2 3/3] btf: require pahole 1.21+ for DEBUG_INFO_BTF with default DWARF version Masahiro Yamada
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2024-09-13 17:37 UTC (permalink / raw)
To: Martin KaFai Lau, bpf
Cc: Andrii Nakryiko, linux-kernel, Nathan Chancellor, Masahiro Yamada,
Alan Maguire
When DEBUG_INFO_DWARF5 is selected, pahole 1.21+ is required to enable
DEBUG_INFO_BTF.
When DEBUG_INFO_DWARF4 or DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is selected,
DEBUG_INFO_BTF can be enabled without pahole installed, but a build error
will occur in scripts/link-vmlinux.sh:
LD .tmp_vmlinux1
BTF: .tmp_vmlinux1: pahole (pahole) is not available
Failed to generate BTF for vmlinux
Try to disable CONFIG_DEBUG_INFO_BTF
We did not guard DEBUG_INFO_BTF by PAHOLE_VERSION when previously
discussed [1].
However, commit 613fe1692377 ("kbuild: Add CONFIG_PAHOLE_VERSION")
added CONFIG_PAHOLE_VERSION after all. Now several CONFIG options, as
well as the combination of DEBUG_INFO_BTF and DEBUG_INFO_DWARF5, are
guarded by PAHOLE_VERSION.
The remaining compile-time check in scripts/link-vmlinux.sh now appears
to be an awkward inconsistency.
This commit adopts Nathan's original work.
[1]: https://lore.kernel.org/lkml/20210111180609.713998-1-natechancellor@gmail.com/
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
---
Changes in v2:
- Reword the help message per Alan
lib/Kconfig.debug | 6 ++++--
scripts/link-vmlinux.sh | 12 ------------
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 5e2f30921cb2..bdf822bc1bab 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -379,13 +379,15 @@ config DEBUG_INFO_BTF
depends on !DEBUG_INFO_SPLIT && !DEBUG_INFO_REDUCED
depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST
depends on BPF_SYSCALL
+ depends on PAHOLE_VERSION >= 116
depends on !DEBUG_INFO_DWARF5 || PAHOLE_VERSION >= 121
# pahole uses elfutils, which does not have support for Hexagon relocations
depends on !HEXAGON
help
Generate deduplicated BTF type information from DWARF debug info.
- Turning this on expects presence of pahole tool, which will convert
- DWARF type info into equivalent deduplicated BTF type info.
+ Turning this on requires pahole v1.16 or later (v1.21 or later to
+ support DWARF 5), which will convert DWARF type info into equivalent
+ deduplicated BTF type info.
config PAHOLE_HAS_SPLIT_BTF
def_bool PAHOLE_VERSION >= 119
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index cfffc41e20ed..53bd4b727e21 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -111,20 +111,8 @@ vmlinux_link()
# ${1} - vmlinux image
gen_btf()
{
- local pahole_ver
local btf_data=${1}.btf.o
- if ! [ -x "$(command -v ${PAHOLE})" ]; then
- 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 "116" ]; then
- echo >&2 "BTF: ${1}: pahole version $(${PAHOLE} --version) is too old, need at least v1.16"
- return 1
- fi
-
info BTF "${btf_data}"
LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${PAHOLE_FLAGS} ${1}
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2 3/3] btf: require pahole 1.21+ for DEBUG_INFO_BTF with default DWARF version
2024-09-13 17:37 [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Masahiro Yamada
2024-09-13 17:37 ` [PATCH v2 2/3] btf: move pahole check in scripts/link-vmlinux.sh to lib/Kconfig.debug Masahiro Yamada
@ 2024-09-13 17:37 ` Masahiro Yamada
2024-09-13 22:26 ` [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Andrii Nakryiko
2024-09-14 3:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2024-09-13 17:37 UTC (permalink / raw)
To: Martin KaFai Lau, bpf
Cc: Andrii Nakryiko, linux-kernel, Nathan Chancellor, Masahiro Yamada,
Alan Maguire
As described in commit 42d9b379e3e1 ("lib/Kconfig.debug: Allow BTF +
DWARF5 with pahole 1.21+"), the combination of CONFIG_DEBUG_INFO_BTF
and CONFIG_DEBUG_INFO_DWARF5 requires pahole 1.21+.
GCC 11+ and Clang 14+ default to DWARF 5 when the -g flag is passed.
For the same reason, the combination of CONFIG_DEBUG_INFO_BTF and
CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT is also likely to require
pahole 1.21+ these days. (At least, it is uncertain whether the actual
requirement is pahole 1.16+ or 1.21+.)
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
---
(no changes since v1)
lib/Kconfig.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index bdf822bc1bab..e24c4caaa067 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -380,7 +380,7 @@ config DEBUG_INFO_BTF
depends on !GCC_PLUGIN_RANDSTRUCT || COMPILE_TEST
depends on BPF_SYSCALL
depends on PAHOLE_VERSION >= 116
- depends on !DEBUG_INFO_DWARF5 || PAHOLE_VERSION >= 121
+ depends on DEBUG_INFO_DWARF4 || PAHOLE_VERSION >= 121
# pahole uses elfutils, which does not have support for Hexagon relocations
depends on !HEXAGON
help
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh
2024-09-13 17:37 [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Masahiro Yamada
2024-09-13 17:37 ` [PATCH v2 2/3] btf: move pahole check in scripts/link-vmlinux.sh to lib/Kconfig.debug Masahiro Yamada
2024-09-13 17:37 ` [PATCH v2 3/3] btf: require pahole 1.21+ for DEBUG_INFO_BTF with default DWARF version Masahiro Yamada
@ 2024-09-13 22:26 ` Andrii Nakryiko
2024-09-14 1:51 ` Masahiro Yamada
2024-09-14 3:10 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 7+ messages in thread
From: Andrii Nakryiko @ 2024-09-13 22:26 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Martin KaFai Lau, bpf, Andrii Nakryiko, linux-kernel,
Nathan Chancellor, Alan Maguire
On Fri, Sep 13, 2024 at 10:38 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> CONFIG_DEBUG_INFO_BTF depends on CONFIG_BPF_SYSCALL, which in turn
> selects CONFIG_BPF.
>
> When CONFIG_DEBUG_INFO_BTF=y, CONFIG_BPF=y is always met.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> ---
>
Masahiro,
Are you planning to take this through your tree, or you'd prefer us
routing it through bpf-next?
> (no changes since v1)
>
> scripts/link-vmlinux.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index bd196944e350..cfffc41e20ed 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -288,7 +288,7 @@ strip_debug=
> vmlinux_link vmlinux
>
> # fill in BTF IDs
> -if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then
> +if is_enabled CONFIG_DEBUG_INFO_BTF; then
> info BTFIDS vmlinux
> ${RESOLVE_BTFIDS} vmlinux
> fi
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh
2024-09-13 22:26 ` [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Andrii Nakryiko
@ 2024-09-14 1:51 ` Masahiro Yamada
2024-09-14 3:03 ` Alexei Starovoitov
0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2024-09-14 1:51 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: Martin KaFai Lau, bpf, Andrii Nakryiko, linux-kernel,
Nathan Chancellor, Alan Maguire
On Sat, Sep 14, 2024 at 7:26 AM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Fri, Sep 13, 2024 at 10:38 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > CONFIG_DEBUG_INFO_BTF depends on CONFIG_BPF_SYSCALL, which in turn
> > selects CONFIG_BPF.
> >
> > When CONFIG_DEBUG_INFO_BTF=y, CONFIG_BPF=y is always met.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
> > Acked-by: Andrii Nakryiko <andrii@kernel.org>
> > Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> > ---
> >
>
> Masahiro,
>
> Are you planning to take this through your tree, or you'd prefer us
> routing it through bpf-next?
Hi,
If possible, could you apply it to bpf-next
for the upcoming MW?
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh
2024-09-14 1:51 ` Masahiro Yamada
@ 2024-09-14 3:03 ` Alexei Starovoitov
0 siblings, 0 replies; 7+ messages in thread
From: Alexei Starovoitov @ 2024-09-14 3:03 UTC (permalink / raw)
To: Masahiro Yamada
Cc: Andrii Nakryiko, Martin KaFai Lau, bpf, Andrii Nakryiko, LKML,
Nathan Chancellor, Alan Maguire
On Fri, Sep 13, 2024 at 6:52 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Sat, Sep 14, 2024 at 7:26 AM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Fri, Sep 13, 2024 at 10:38 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > CONFIG_DEBUG_INFO_BTF depends on CONFIG_BPF_SYSCALL, which in turn
> > > selects CONFIG_BPF.
> > >
> > > When CONFIG_DEBUG_INFO_BTF=y, CONFIG_BPF=y is always met.
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
> > > Acked-by: Andrii Nakryiko <andrii@kernel.org>
> > > Reviewed-by: Nathan Chancellor <nathan@kernel.org>
> > > ---
> > >
> >
> > Masahiro,
> >
> > Are you planning to take this through your tree, or you'd prefer us
> > routing it through bpf-next?
>
> Hi,
>
> If possible, could you apply it to bpf-next
> for the upcoming MW?
Sure thing. We'll do.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh
2024-09-13 17:37 [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Masahiro Yamada
` (2 preceding siblings ...)
2024-09-13 22:26 ` [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Andrii Nakryiko
@ 2024-09-14 3:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-14 3:10 UTC (permalink / raw)
To: Masahiro Yamada
Cc: martin.lau, bpf, andrii, linux-kernel, nathan, alan.maguire
Hello:
This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Sat, 14 Sep 2024 02:37:52 +0900 you wrote:
> CONFIG_DEBUG_INFO_BTF depends on CONFIG_BPF_SYSCALL, which in turn
> selects CONFIG_BPF.
>
> When CONFIG_DEBUG_INFO_BTF=y, CONFIG_BPF=y is always met.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> Reviewed-by: Alan Maguire <alan.maguire@oracle.com>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>
> [...]
Here is the summary with links:
- [v2,1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh
https://git.kernel.org/bpf/bpf-next/c/c980dc9c67a9
- [v2,2/3] btf: move pahole check in scripts/link-vmlinux.sh to lib/Kconfig.debug
https://git.kernel.org/bpf/bpf-next/c/42450f7a9086
- [v2,3/3] btf: require pahole 1.21+ for DEBUG_INFO_BTF with default DWARF version
https://git.kernel.org/bpf/bpf-next/c/5277d130947b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-09-14 3:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-13 17:37 [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Masahiro Yamada
2024-09-13 17:37 ` [PATCH v2 2/3] btf: move pahole check in scripts/link-vmlinux.sh to lib/Kconfig.debug Masahiro Yamada
2024-09-13 17:37 ` [PATCH v2 3/3] btf: require pahole 1.21+ for DEBUG_INFO_BTF with default DWARF version Masahiro Yamada
2024-09-13 22:26 ` [PATCH v2 1/3] btf: remove redundant CONFIG_BPF test in scripts/link-vmlinux.sh Andrii Nakryiko
2024-09-14 1:51 ` Masahiro Yamada
2024-09-14 3:03 ` Alexei Starovoitov
2024-09-14 3:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox