diff mbox series

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

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

Commit Message

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

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

UpstreamStatus: Merged with 5.15.148

This patch will not go upstream since 6.7-rc1 converts this script into a makefile snippet, and since this patch is already present
in upstream 5.15.148 and the master branch for Noble.

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 in 5.15.148 tree)

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. 29, 2024, 10:19 a.m. UTC | #1
On 26.01.24 19:54, mitchell.augustin@canonical.com wrote:
> From: Mitchell Augustin <mitchell.augustin@canonical.com>
> 
> BugLink: https://bugs.launchpad.net/bugs/2051376
> 
> UpstreamStatus: Merged with 5.15.148
> 
> This patch will not go upstream since 6.7-rc1 converts this script into a makefile snippet, and since this patch is already present
> in upstream 5.15.148 and the master branch for Noble.
> 
> 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 in 5.15.148 tree)
> 
> Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>
> ---

Rejected for the following reasons:
Ok, so this patch is taken from the upstream stable repository. In which 
case the proper provenance (including commit message) needs to be 
preserved. That is if there is a need for speed. Eventually all 
linux-5.15.y will be picked into Jammy, we just lag a bit behind 
(currently we have 5.15.143 committed).
So what the patch should look like is:

 From b775fbf532dc01ae53a6fc56168fd30cb4b0c658 Mon Sep 17 00:00:00 2001
From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Date: Sun, 4 Sep 2022 15:19:01 +0200
Subject: [PATCH] kbuild: Add skip_encoding_btf_enum64 option to pahole

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.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

(cherry picked from commit b775fbf532dc01ae53a6fc56168fd30cb4b0c658 
linux-5.15.y)
Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>
---
  scripts/pahole-flags.sh | 4 ++++
  1 file changed, 4 insertions(+)

...

The second question I had in previous replies was whether we also need 
to do something for HWE kernels. Jammy (5.15) fails to compile when 
pahole >= 1.24 is available. This must be a configuration other than 
what we use by default for the distro, otherwise we should have seen 
this. But we also have HWE kernels (now 6.5, at some point 6.8). I 
currently do not see something adjusted in the 6.5 kernel. That might 
mean in Mantic there is a pahole version which does not have the 
problem. Or it is the kernel Makefiles which got adjusted, so this is no 
longer necessary.

-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}
Stefan Bader Jan. 29, 2024, 10:24 a.m. UTC | #2
On 29.01.24 11:19, Stefan Bader wrote:
> On 26.01.24 19:54, mitchell.augustin@canonical.com wrote:
>> From: Mitchell Augustin <mitchell.augustin@canonical.com>
>>
>> BugLink: https://bugs.launchpad.net/bugs/2051376
>>
>> UpstreamStatus: Merged with 5.15.148
>>
>> This patch will not go upstream since 6.7-rc1 converts this script 
>> into a makefile snippet, and since this patch is already present
>> in upstream 5.15.148 and the master branch for Noble.
>>
>> 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 in 
>> 5.15.148 tree)
>>
>> Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>
>> ---
> 
> Rejected for the following reasons:
> Ok, so this patch is taken from the upstream stable repository. In which 
> case the proper provenance (including commit message) needs to be 
> preserved. That is if there is a need for speed. Eventually all 
> linux-5.15.y will be picked into Jammy, we just lag a bit behind 
> (currently we have 5.15.143 committed).
> So what the patch should look like is:
> 
>  From b775fbf532dc01ae53a6fc56168fd30cb4b0c658 Mon Sep 17 00:00:00 2001
> From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> Date: Sun, 4 Sep 2022 15:19:01 +0200
> Subject: [PATCH] kbuild: Add skip_encoding_btf_enum64 option to pahole
> 
> 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.
> 
> 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.

I think this ^ in the upstream stable commit message answered the 
question I asked below. So it is the kernel build environment that 
matters. And only the old kernel version requires adjustment when being 
compiled with a pahole version 1.24 or later.

> 
> Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> (cherry picked from commit b775fbf532dc01ae53a6fc56168fd30cb4b0c658 
> linux-5.15.y)
> Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>
> ---
>   scripts/pahole-flags.sh | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> ...
> 
> The second question I had in previous replies was whether we also need 
> to do something for HWE kernels. Jammy (5.15) fails to compile when 
> pahole >= 1.24 is available. This must be a configuration other than 
> what we use by default for the distro, otherwise we should have seen 
> this. But we also have HWE kernels (now 6.5, at some point 6.8). I 
> currently do not see something adjusted in the 6.5 kernel. That might 
> mean in Mantic there is a pahole version which does not have the 
> problem. Or it is the kernel Makefiles which got adjusted, so this is no 
> longer necessary.
> 
> -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}
> 
>
Stefan Bader Jan. 29, 2024, 10:30 a.m. UTC | #3
On 29.01.24 11:24, Stefan Bader wrote:
> On 29.01.24 11:19, Stefan Bader wrote:
>> On 26.01.24 19:54, mitchell.augustin@canonical.com wrote:
>>> From: Mitchell Augustin <mitchell.augustin@canonical.com>
>>>
>>> BugLink: https://bugs.launchpad.net/bugs/2051376
>>>
>>> UpstreamStatus: Merged with 5.15.148
>>>
>>> This patch will not go upstream since 6.7-rc1 converts this script 
>>> into a makefile snippet, and since this patch is already present
>>> in upstream 5.15.148 and the master branch for Noble.
>>>
>>> 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 
>>> in 5.15.148 tree)
>>>
>>> Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>
>>> ---
>>
>> Rejected for the following reasons:
>> Ok, so this patch is taken from the upstream stable repository. In 
>> which case the proper provenance (including commit message) needs to 
>> be preserved. That is if there is a need for speed. Eventually all 
>> linux-5.15.y will be picked into Jammy, we just lag a bit behind 
>> (currently we have 5.15.143 committed).
>> So what the patch should look like is:
>>
>>  From b775fbf532dc01ae53a6fc56168fd30cb4b0c658 Mon Sep 17 00:00:00 2001
>> From: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
>> Date: Sun, 4 Sep 2022 15:19:01 +0200
>> Subject: [PATCH] kbuild: Add skip_encoding_btf_enum64 option to pahole

Oh and I forgot to properly change the subject here:

Subject: [SRU Jammy][PATCH] kbuild: Add skip_encoding_btf_enum64 option 
to pahole

The "UBUNTU: SAUCE" was incorrect advice believing it is not cherry 
picked from a upstream source. Since it is 5.15.248 it is not required. 
Just that upstream means Linus primary tree and upstream stable is a 
different repository. So SHA1 references do not match. And in this case 
this was a change _only_ for linux-5.15.y.
>>
>> 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.
>>
>> 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.
> 
> I think this ^ in the upstream stable commit message answered the 
> question I asked below. So it is the kernel build environment that 
> matters. And only the old kernel version requires adjustment when being 
> compiled with a pahole version 1.24 or later.
> 
>>
>> Signed-off-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
>> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>>
>> (cherry picked from commit b775fbf532dc01ae53a6fc56168fd30cb4b0c658 
>> linux-5.15.y)
>> Signed-off-by: Mitchell Augustin <mitchell.augustin@canonical.com>
>> ---
>>   scripts/pahole-flags.sh | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> ...
>>
>> The second question I had in previous replies was whether we also need 
>> to do something for HWE kernels. Jammy (5.15) fails to compile when 
>> pahole >= 1.24 is available. This must be a configuration other than 
>> what we use by default for the distro, otherwise we should have seen 
>> this. But we also have HWE kernels (now 6.5, at some point 6.8). I 
>> currently do not see something adjusted in the 6.5 kernel. That might 
>> mean in Mantic there is a pahole version which does not have the 
>> problem. Or it is the kernel Makefiles which got adjusted, so this is 
>> no longer necessary.
>>
>> -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}