diff mbox series

[SRU,JAMMY] (upstream) scripts/pahole-flags.sh: Add --skip_encoding_btf_enum64 for pahole versions >= 124

Message ID 20240126152328.73258-1-mitchell.augustin@canonical.com
State New
Headers show
Series [SRU,JAMMY] (upstream) scripts/pahole-flags.sh: Add --skip_encoding_btf_enum64 for pahole versions >= 124 | expand

Commit Message

Mitchell Augustin Jan. 26, 2024, 3:23 p.m. UTC
From: Mitchell Augustin <mitchell.augustin@canonical.com>

BugLink: https://bugs.launchpad.net/bugs/2051376

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.

(cherry picked from commit b775fbf532dc01ae53a6fc56168fd30cb4b0c658)

Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>
---
 scripts/pahole-flags.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Stefan Bader Jan. 26, 2024, 3:59 p.m. UTC | #1
On 26.01.24 16:23, mitchell.augustin@canonical.com wrote:
> From: Mitchell Augustin <mitchell.augustin@canonical.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2051376
> 
> 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.
> 
> (cherry picked from commit b775fbf532dc01ae53a6fc56168fd30cb4b0c658)

This is not true. This SHA1 is not found in upstream (Linus kernel 
tree). And it looks like it would not be upstreamable either since with 
6.7-rc1 the script got converted into a makefile snippet. So this would 
have to be a SAUCE patch for Jammy 5.15. However it likely also requires 
to think about HWE kernels. 6.5 and upcoming Noble. And not sure just 
checking for a specific pahole version is right. Might be a range to be 
more generic.

> 
> Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>
> ---
>   scripts/pahole-flags.sh | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/pahole-flags.sh b/scripts/pahole-flags.sh
> index ac8b23787427..d38fa6d84d62 100755
> --- a/scripts/pahole-flags.sh
> +++ b/scripts/pahole-flags.sh
> @@ -4,7 +4,7 @@
>   extra_paholeopt=
>   
>   if ! [ -x "$(command -v ${PAHOLE})" ]; then
> -	return
> +	exit 0
>   fi
>   
>   pahole_ver=$($(dirname $0)/pahole-version.sh ${PAHOLE})
> @@ -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}
Stefan Bader Jan. 29, 2024, 10:20 a.m. UTC | #2
On 26.01.24 16:23, mitchell.augustin@canonical.com wrote:
> From: Mitchell Augustin <mitchell.augustin@canonical.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2051376
> 
> 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.
> 
> (cherry picked from commit b775fbf532dc01ae53a6fc56168fd30cb4b0c658)
> 
> Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>

Rejected for the following reasons:
There is a follow-up submission of this on the mailing list. I added 
additional reasoning and explanations there.

-Stefan
> ---
>   scripts/pahole-flags.sh | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/pahole-flags.sh b/scripts/pahole-flags.sh
> index ac8b23787427..d38fa6d84d62 100755
> --- a/scripts/pahole-flags.sh
> +++ b/scripts/pahole-flags.sh
> @@ -4,7 +4,7 @@
>   extra_paholeopt=
>   
>   if ! [ -x "$(command -v ${PAHOLE})" ]; then
> -	return
> +	exit 0
>   fi
>   
>   pahole_ver=$($(dirname $0)/pahole-version.sh ${PAHOLE})
> @@ -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}
diff mbox series

Patch

diff --git a/scripts/pahole-flags.sh b/scripts/pahole-flags.sh
index ac8b23787427..d38fa6d84d62 100755
--- a/scripts/pahole-flags.sh
+++ b/scripts/pahole-flags.sh
@@ -4,7 +4,7 @@ 
 extra_paholeopt=
 
 if ! [ -x "$(command -v ${PAHOLE})" ]; then
-	return
+	exit 0
 fi
 
 pahole_ver=$($(dirname $0)/pahole-version.sh ${PAHOLE})
@@ -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}