hi, new version of pahole (1.24) is causing compilation fail for 5.15 stable kernel, discussed in here [1][2]. Sending fix for that plus one dependency patch.
Note for patch 1: there was one extra line change in scripts/pahole-flags.sh file in its linux tree merge commit:
fc02cb2b37fe Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
not sure how/if to track that, I squashed the change in.
thanks, jirka
[1] https://lore.kernel.org/bpf/20220825163538.vajnsv3xcpbhl47v@altlinux.org/ [2] https://lore.kernel.org/bpf/YwQRKkmWqsf%2FDu6A@kernel.org/ --- Jiri Olsa (1): kbuild: Unify options for BTF generation for vmlinux and modules
Martin Rodriguez Reboredo (1): kbuild: Add skip_encoding_btf_enum64 option to pahole
Makefile | 3 +++ scripts/Makefile.modfinal | 2 +- scripts/link-vmlinux.sh | 11 +---------- scripts/pahole-flags.sh | 24 ++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 11 deletions(-) create mode 100755 scripts/pahole-flags.sh
From: Jiri Olsa jolsa@redhat.com
commit e27f05147bff21408c1b8410ad8e90cd286e7952 upstream.
Using new PAHOLE_FLAGS variable to pass extra arguments to pahole for both vmlinux and modules BTF data generation.
Adding new scripts/pahole-flags.sh script that detect and prints pahole options.
[ fixed issues found by kernel test robot ]
Signed-off-by: Jiri Olsa jolsa@kernel.org Signed-off-by: Andrii Nakryiko andrii@kernel.org Acked-by: Andrii Nakryiko andrii@kernel.org Link: https://lore.kernel.org/bpf/20211029125729.70002-1-jolsa@kernel.org --- Makefile | 3 +++ scripts/Makefile.modfinal | 2 +- scripts/link-vmlinux.sh | 11 +---------- scripts/pahole-flags.sh | 20 ++++++++++++++++++++ 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100755 scripts/pahole-flags.sh
diff --git a/Makefile b/Makefile index 0802acf352d2..6aa52276e969 100644 --- a/Makefile +++ b/Makefile @@ -480,6 +480,8 @@ LZ4 = lz4c XZ = xz ZSTD = zstd
+PAHOLE_FLAGS = $(shell PAHOLE=$(PAHOLE) $(srctree)/scripts/pahole-flags.sh) + CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void -Wno-unknown-attribute $(CF) NOSTDINC_FLAGS := @@ -534,6 +536,7 @@ export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE export KBUILD_AFLAGS AFLAGS_KERNEL AFLAGS_MODULE export KBUILD_AFLAGS_MODULE KBUILD_CFLAGS_MODULE KBUILD_LDFLAGS_MODULE export KBUILD_AFLAGS_KERNEL KBUILD_CFLAGS_KERNEL +export PAHOLE_FLAGS
# Files to ignore in find ... statements
diff --git a/scripts/Makefile.modfinal b/scripts/Makefile.modfinal index ff805777431c..ce9661d968a3 100644 --- a/scripts/Makefile.modfinal +++ b/scripts/Makefile.modfinal @@ -40,7 +40,7 @@ quiet_cmd_ld_ko_o = LD [M] $@ quiet_cmd_btf_ko = BTF [M] $@ cmd_btf_ko = \ if [ -f vmlinux ]; then \ - LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J --btf_base vmlinux $@; \ + LLVM_OBJCOPY="$(OBJCOPY)" $(PAHOLE) -J $(PAHOLE_FLAGS) --btf_base vmlinux $@; \ else \ printf "Skipping BTF generation for %s due to unavailability of vmlinux\n" $@ 1>&2; \ fi; diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 3819a461465d..57ef6accbb40 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -211,7 +211,6 @@ vmlinux_link() gen_btf() { local pahole_ver - local extra_paholeopt=
if ! [ -x "$(command -v ${PAHOLE})" ]; then echo >&2 "BTF: ${1}: pahole (${PAHOLE}) is not available" @@ -226,16 +225,8 @@ gen_btf()
vmlinux_link ${1}
- if [ "${pahole_ver}" -ge "118" ] && [ "${pahole_ver}" -le "121" ]; then - # pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars - extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_vars" - fi - if [ "${pahole_ver}" -ge "121" ]; then - extra_paholeopt="${extra_paholeopt} --btf_gen_floats" - fi - info "BTF" ${2} - LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${extra_paholeopt} ${1} + LLVM_OBJCOPY="${OBJCOPY}" ${PAHOLE} -J ${PAHOLE_FLAGS} ${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 diff --git a/scripts/pahole-flags.sh b/scripts/pahole-flags.sh new file mode 100755 index 000000000000..e6093adf4c06 --- /dev/null +++ b/scripts/pahole-flags.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +extra_paholeopt= + +if ! [ -x "$(command -v ${PAHOLE})" ]; then + exit 0 +fi + +pahole_ver=$(${PAHOLE} --version | sed -E 's/v([0-9]+).([0-9]+)/\1\2/') + +if [ "${pahole_ver}" -ge "118" ] && [ "${pahole_ver}" -le "121" ]; then + # pahole 1.18 through 1.21 can't handle zero-sized per-CPU vars + extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_vars" +fi +if [ "${pahole_ver}" -ge "121" ]; then + extra_paholeopt="${extra_paholeopt} --btf_gen_floats" +fi + +echo ${extra_paholeopt}
From: Martin Rodriguez Reboredo yakoyoku@gmail.com
New pahole (version 1.24) generates by default new BTF_KIND_ENUM64 BTF tag, which is not supported by stable kernel.
As a result the kernel with CONFIG_DEBUG_INFO_BTF option will fail to compile with following error:
BTFIDS vmlinux FAILED: load BTF from vmlinux: Invalid argument
New pahole provides --skip_encoding_btf_enum64 option to skip BTF_KIND_ENUM64 generation and produce BTF supported by stable kernel.
Adding this option to scripts/pahole-flags.sh.
This change does not have equivalent commit in linus tree, because linus tree has support for BTF_KIND_ENUM64 tag, so it does not need to be disabled.
Signed-off-by: Martin Rodriguez Reboredo yakoyoku@gmail.com Signed-off-by: Jiri Olsa jolsa@kernel.org --- scripts/pahole-flags.sh | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/scripts/pahole-flags.sh b/scripts/pahole-flags.sh index e6093adf4c06..7acee326aa6c 100755 --- a/scripts/pahole-flags.sh +++ b/scripts/pahole-flags.sh @@ -17,4 +17,8 @@ if [ "${pahole_ver}" -ge "121" ]; then extra_paholeopt="${extra_paholeopt} --btf_gen_floats" fi
+if [ "${pahole_ver}" -ge "124" ]; then + extra_paholeopt="${extra_paholeopt} --skip_encoding_btf_enum64" +fi + echo ${extra_paholeopt}
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
Rule: 'Cc: stable@vger.kernel.org' or 'commit <sha1> upstream.' Subject: [PATCH stable 5.15 2/2] kbuild: Add skip_encoding_btf_enum64 option to pahole Link: https://lore.kernel.org/stable/20220904131901.13025-3-jolsa%40kernel.org
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
On Sun, Sep 04, 2022 at 09:20:48PM +0800, kernel test robot wrote:
Hi,
Thanks for your patch.
FYI: kernel test robot notices the stable kernel rule is not satisfied.
Rule: 'Cc: stable@vger.kernel.org' or 'commit <sha1> upstream.' Subject: [PATCH stable 5.15 2/2] kbuild: Add skip_encoding_btf_enum64 option to pahole Link: https://lore.kernel.org/stable/20220904131901.13025-3-jolsa%40kernel.org
The check is based on https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
Nice catch, but this one is ok :)
On Sun, Sep 04, 2022 at 03:18:59PM +0200, Jiri Olsa wrote:
hi, new version of pahole (1.24) is causing compilation fail for 5.15 stable kernel, discussed in here [1][2]. Sending fix for that plus one dependency patch.
Note for patch 1: there was one extra line change in scripts/pahole-flags.sh file in its linux tree merge commit:
fc02cb2b37fe Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
not sure how/if to track that, I squashed the change in.
Squashing is fine, thanks.
And do we also need this for kernels older than 5.15? Like 5.10 and 5.4?
thanks,
greg k-h
On Sun, Sep 04, 2022 at 04:10:09PM +0200, Greg KH wrote:
On Sun, Sep 04, 2022 at 03:18:59PM +0200, Jiri Olsa wrote:
hi, new version of pahole (1.24) is causing compilation fail for 5.15 stable kernel, discussed in here [1][2]. Sending fix for that plus one dependency patch.
Note for patch 1: there was one extra line change in scripts/pahole-flags.sh file in its linux tree merge commit:
fc02cb2b37fe Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
not sure how/if to track that, I squashed the change in.
Squashing is fine, thanks.
And do we also need this for kernels older than 5.15? Like 5.10 and 5.4?
yes, 5.10 needs similar patchset, but this for 5.15 won't apply there, so I'll send it separately
5.4 passes compilation, but I don't think it will boot properly, still need to check on that
in any case, more patches are coming ;-)
jirka
On Mon, Sep 05, 2022 at 09:04:10AM +0200, Jiri Olsa wrote:
On Sun, Sep 04, 2022 at 04:10:09PM +0200, Greg KH wrote:
On Sun, Sep 04, 2022 at 03:18:59PM +0200, Jiri Olsa wrote:
hi, new version of pahole (1.24) is causing compilation fail for 5.15 stable kernel, discussed in here [1][2]. Sending fix for that plus one dependency patch.
Note for patch 1: there was one extra line change in scripts/pahole-flags.sh file in its linux tree merge commit:
fc02cb2b37fe Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
not sure how/if to track that, I squashed the change in.
Squashing is fine, thanks.
And do we also need this for kernels older than 5.15? Like 5.10 and 5.4?
yes, 5.10 needs similar patchset, but this for 5.15 won't apply there, so I'll send it separately
5.4 passes compilation, but I don't think it will boot properly, still need to check on that
in any case, more patches are coming ;-)
Ok, these two are now queued up, feel free to send the rest when you have them ready.
thanks,
greg k-h
On Tue, Sep 06, 2022 at 02:03:30PM +0200, Greg KH wrote:
On Mon, Sep 05, 2022 at 09:04:10AM +0200, Jiri Olsa wrote:
On Sun, Sep 04, 2022 at 04:10:09PM +0200, Greg KH wrote:
On Sun, Sep 04, 2022 at 03:18:59PM +0200, Jiri Olsa wrote:
hi, new version of pahole (1.24) is causing compilation fail for 5.15 stable kernel, discussed in here [1][2]. Sending fix for that plus one dependency patch.
Note for patch 1: there was one extra line change in scripts/pahole-flags.sh file in its linux tree merge commit:
fc02cb2b37fe Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
not sure how/if to track that, I squashed the change in.
Squashing is fine, thanks.
And do we also need this for kernels older than 5.15? Like 5.10 and 5.4?
yes, 5.10 needs similar patchset, but this for 5.15 won't apply there, so I'll send it separately
5.4 passes compilation, but I don't think it will boot properly, still need to check on that
in any case, more patches are coming ;-)
Ok, these two are now queued up, feel free to send the rest when you have them ready.
hi, as for 5.10 changes, I have them ready, pushed in here: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git pahole_fix_5_10
but it looks like CONFIG_DEBUG_INFO_BTF is not being used in 5.10, because I had to backport other similar option, that would break the build even earlier (--skip_encoding_btf_vars), or people use just old pahole ;-)
I suggest we wait with this change until somebody actually wants this fixed, AFAICS there's no report of broken 5.10 build yet
thanks, jirka
On Mon, Sep 19, 2022 at 12:14:40AM +0200, Jiri Olsa wrote:
On Tue, Sep 06, 2022 at 02:03:30PM +0200, Greg KH wrote:
On Mon, Sep 05, 2022 at 09:04:10AM +0200, Jiri Olsa wrote:
On Sun, Sep 04, 2022 at 04:10:09PM +0200, Greg KH wrote:
On Sun, Sep 04, 2022 at 03:18:59PM +0200, Jiri Olsa wrote:
hi, new version of pahole (1.24) is causing compilation fail for 5.15 stable kernel, discussed in here [1][2]. Sending fix for that plus one dependency patch.
Note for patch 1: there was one extra line change in scripts/pahole-flags.sh file in its linux tree merge commit:
fc02cb2b37fe Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
not sure how/if to track that, I squashed the change in.
Squashing is fine, thanks.
And do we also need this for kernels older than 5.15? Like 5.10 and 5.4?
yes, 5.10 needs similar patchset, but this for 5.15 won't apply there, so I'll send it separately
5.4 passes compilation, but I don't think it will boot properly, still need to check on that
in any case, more patches are coming ;-)
Ok, these two are now queued up, feel free to send the rest when you have them ready.
hi, as for 5.10 changes, I have them ready, pushed in here: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git pahole_fix_5_10
but it looks like CONFIG_DEBUG_INFO_BTF is not being used in 5.10, because I had to backport other similar option, that would break the build even earlier (--skip_encoding_btf_vars), or people use just old pahole ;-)
I suggest we wait with this change until somebody actually wants this fixed, AFAICS there's no report of broken 5.10 build yet
Consider this your first report :)
My build containers include the latest pahole, as I have noticed more issues with older pahole in newer kernels than newer pahole in older kernels, as least until now. I have tripped over this issue on both 5.19 and 5.10, as the stable-only commit b775fbf532dc ("kbuild: Add skip_encoding_btf_enum64 option to pahole") was only applied to 5.15, even though it is needed in all kernels prior to 6.0.
Please consider explicitly sending the 5.10 series to stable and requesting b775fbf532dc to be applied to 5.19.
Cheers, Nathan
On Mon, Oct 17, 2022 at 11:02:39AM -0700, Nathan Chancellor wrote:
On Mon, Sep 19, 2022 at 12:14:40AM +0200, Jiri Olsa wrote:
On Tue, Sep 06, 2022 at 02:03:30PM +0200, Greg KH wrote:
On Mon, Sep 05, 2022 at 09:04:10AM +0200, Jiri Olsa wrote:
On Sun, Sep 04, 2022 at 04:10:09PM +0200, Greg KH wrote:
On Sun, Sep 04, 2022 at 03:18:59PM +0200, Jiri Olsa wrote:
hi, new version of pahole (1.24) is causing compilation fail for 5.15 stable kernel, discussed in here [1][2]. Sending fix for that plus one dependency patch.
Note for patch 1: there was one extra line change in scripts/pahole-flags.sh file in its linux tree merge commit:
fc02cb2b37fe Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next
not sure how/if to track that, I squashed the change in.
Squashing is fine, thanks.
And do we also need this for kernels older than 5.15? Like 5.10 and 5.4?
yes, 5.10 needs similar patchset, but this for 5.15 won't apply there, so I'll send it separately
5.4 passes compilation, but I don't think it will boot properly, still need to check on that
in any case, more patches are coming ;-)
Ok, these two are now queued up, feel free to send the rest when you have them ready.
hi, as for 5.10 changes, I have them ready, pushed in here: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git pahole_fix_5_10
but it looks like CONFIG_DEBUG_INFO_BTF is not being used in 5.10, because I had to backport other similar option, that would break the build even earlier (--skip_encoding_btf_vars), or people use just old pahole ;-)
I suggest we wait with this change until somebody actually wants this fixed, AFAICS there's no report of broken 5.10 build yet
Consider this your first report :)
va bene ;-)
My build containers include the latest pahole, as I have noticed more issues with older pahole in newer kernels than newer pahole in older kernels, as least until now. I have tripped over this issue on both 5.19 and 5.10, as the stable-only commit b775fbf532dc ("kbuild: Add skip_encoding_btf_enum64 option to pahole") was only applied to 5.15, even though it is needed in all kernels prior to 6.0.
Please consider explicitly sending the 5.10 series to stable and
sure I'll rebase and post it
requesting b775fbf532dc to be applied to 5.19.
hm, it was already posted for 5.19: https://lore.kernel.org/bpf/20220916171234.841556-1-yakoyoku@gmail.com/
Greg, is there something missing for it to be taken?
thanks, jirka
On Mon, Oct 17, 2022 at 11:27:07PM +0200, Jiri Olsa wrote:
On Mon, Oct 17, 2022 at 11:02:39AM -0700, Nathan Chancellor wrote:
On Mon, Sep 19, 2022 at 12:14:40AM +0200, Jiri Olsa wrote:
On Tue, Sep 06, 2022 at 02:03:30PM +0200, Greg KH wrote:
On Mon, Sep 05, 2022 at 09:04:10AM +0200, Jiri Olsa wrote:
On Sun, Sep 04, 2022 at 04:10:09PM +0200, Greg KH wrote:
On Sun, Sep 04, 2022 at 03:18:59PM +0200, Jiri Olsa wrote: > hi, > new version of pahole (1.24) is causing compilation fail for 5.15 > stable kernel, discussed in here [1][2]. Sending fix for that plus > one dependency patch. > > Note for patch 1: > there was one extra line change in scripts/pahole-flags.sh file in > its linux tree merge commit: > > fc02cb2b37fe Merge tag 'net-next-for-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next > > not sure how/if to track that, I squashed the change in.
Squashing is fine, thanks.
And do we also need this for kernels older than 5.15? Like 5.10 and 5.4?
yes, 5.10 needs similar patchset, but this for 5.15 won't apply there, so I'll send it separately
5.4 passes compilation, but I don't think it will boot properly, still need to check on that
in any case, more patches are coming ;-)
Ok, these two are now queued up, feel free to send the rest when you have them ready.
hi, as for 5.10 changes, I have them ready, pushed in here: git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git pahole_fix_5_10
but it looks like CONFIG_DEBUG_INFO_BTF is not being used in 5.10, because I had to backport other similar option, that would break the build even earlier (--skip_encoding_btf_vars), or people use just old pahole ;-)
I suggest we wait with this change until somebody actually wants this fixed, AFAICS there's no report of broken 5.10 build yet
Consider this your first report :)
va bene ;-)
My build containers include the latest pahole, as I have noticed more issues with older pahole in newer kernels than newer pahole in older kernels, as least until now. I have tripped over this issue on both 5.19 and 5.10, as the stable-only commit b775fbf532dc ("kbuild: Add skip_encoding_btf_enum64 option to pahole") was only applied to 5.15, even though it is needed in all kernels prior to 6.0.
Please consider explicitly sending the 5.10 series to stable and
sure I'll rebase and post it
requesting b775fbf532dc to be applied to 5.19.
hm, it was already posted for 5.19: https://lore.kernel.org/bpf/20220916171234.841556-1-yakoyoku@gmail.com/
Greg, is there something missing for it to be taken?
Ick, sorry, this got lost. Now queued up.
greg k-h
linux-stable-mirror@lists.linaro.org