* [PATCH bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined
@ 2024-06-23 13:52 Alan Maguire
2024-06-23 14:35 ` Alexei Starovoitov
2024-06-23 20:00 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Alan Maguire @ 2024-06-23 13:52 UTC (permalink / raw)
To: andrii, eddyz87, ast
Cc: acme, daniel, jolsa, martin.lau, song, yonghong.song,
john.fastabend, kpsingh, sdf, haoluo, mcgrof, masahiroy, nathan,
mykolal, thinker.li, bentiss, tanggeliang, bpf, Alan Maguire,
kernel test robot
Kernel test robot reports that kernel build fails with
resilient split BTF changes.
Examining the associated config and code we see that
btf_relocate_id() is defined under CONFIG_DEBUG_INFO_BTF_MODULES.
Moving it outside the #ifdef solves the issue.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202406221742.d2srFLVI-lkp@intel.com/
Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
---
kernel/bpf/btf.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 8e12cb80ba73..4ff11779699e 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -6185,8 +6185,6 @@ struct btf *btf_parse_vmlinux(void)
return btf;
}
-#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
-
/* If .BTF_ids section was created with distilled base BTF, both base and
* split BTF ids will need to be mapped to actual base/split ids for
* BTF now that it has been relocated.
@@ -6198,6 +6196,8 @@ static __u32 btf_relocate_id(const struct btf *btf, __u32 id)
return btf->base_id_map[id];
}
+#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
+
static struct btf *btf_parse_module(const char *module_name, const void *data,
unsigned int data_size, void *base_data,
unsigned int base_data_size)
--
2.31.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined
2024-06-23 13:52 [PATCH bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined Alan Maguire
@ 2024-06-23 14:35 ` Alexei Starovoitov
2024-06-23 19:04 ` Alan Maguire
2024-06-23 20:00 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2024-06-23 14:35 UTC (permalink / raw)
To: Alan Maguire
Cc: Andrii Nakryiko, Eddy Z, Alexei Starovoitov,
Arnaldo Carvalho de Melo, Daniel Borkmann, Jiri Olsa,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Luis R. Rodriguez,
Masahiro Yamada, Nathan Chancellor, Mykola Lysenko, Kui-Feng Lee,
Benjamin Tissoires, Geliang Tang, bpf, kernel test robot
On Sun, Jun 23, 2024 at 6:52 AM Alan Maguire <alan.maguire@oracle.com> wrote:
>
> Kernel test robot reports that kernel build fails with
> resilient split BTF changes.
>
> Examining the associated config and code we see that
> btf_relocate_id() is defined under CONFIG_DEBUG_INFO_BTF_MODULES.
> Moving it outside the #ifdef solves the issue.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202406221742.d2srFLVI-lkp@intel.com/
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
> ---
> kernel/bpf/btf.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
> index 8e12cb80ba73..4ff11779699e 100644
> --- a/kernel/bpf/btf.c
> +++ b/kernel/bpf/btf.c
> @@ -6185,8 +6185,6 @@ struct btf *btf_parse_vmlinux(void)
> return btf;
> }
>
> -#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
> -
> /* If .BTF_ids section was created with distilled base BTF, both base and
> * split BTF ids will need to be mapped to actual base/split ids for
> * BTF now that it has been relocated.
> @@ -6198,6 +6196,8 @@ static __u32 btf_relocate_id(const struct btf *btf, __u32 id)
> return btf->base_id_map[id];
> }
>
> +#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
> +
It doesn't fix it all. The 32 build is still failing:
../kernel/bpf/btf.c: In function ‘btf_populate_kfunc_set’:
-../kernel/bpf/btf.c:8251:36: error: implicit declaration of function
‘btf_relocate_id’; did you mean ‘btf_relocate’?
[-Wimplicit-function-declaration]
- 8251 | set->pairs[i].id = btf_relocate_id(btf,
set->pairs[i].id);
- | ^~~~~~~~~~~~~~~
- | btf_relocate
-
See build_32, build_clang, build_allmod failures in CI:
https://patchwork.kernel.org/project/netdevbpf/patch/20240623135224.27981-1-alan.maguire@oracle.com/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined
2024-06-23 14:35 ` Alexei Starovoitov
@ 2024-06-23 19:04 ` Alan Maguire
2024-06-23 19:53 ` Alexei Starovoitov
0 siblings, 1 reply; 5+ messages in thread
From: Alan Maguire @ 2024-06-23 19:04 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Andrii Nakryiko, Eddy Z, Alexei Starovoitov,
Arnaldo Carvalho de Melo, Daniel Borkmann, Jiri Olsa,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Luis R. Rodriguez,
Masahiro Yamada, Nathan Chancellor, Mykola Lysenko, Kui-Feng Lee,
Benjamin Tissoires, Geliang Tang, bpf, kernel test robot
On 23/06/2024 15:35, Alexei Starovoitov wrote:
> On Sun, Jun 23, 2024 at 6:52 AM Alan Maguire <alan.maguire@oracle.com> wrote:
>>
>> Kernel test robot reports that kernel build fails with
>> resilient split BTF changes.
>>
>> Examining the associated config and code we see that
>> btf_relocate_id() is defined under CONFIG_DEBUG_INFO_BTF_MODULES.
>> Moving it outside the #ifdef solves the issue.
>>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202406221742.d2srFLVI-lkp@intel.com/
>> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>
>> ---
>> kernel/bpf/btf.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
>> index 8e12cb80ba73..4ff11779699e 100644
>> --- a/kernel/bpf/btf.c
>> +++ b/kernel/bpf/btf.c
>> @@ -6185,8 +6185,6 @@ struct btf *btf_parse_vmlinux(void)
>> return btf;
>> }
>>
>> -#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
>> -
>> /* If .BTF_ids section was created with distilled base BTF, both base and
>> * split BTF ids will need to be mapped to actual base/split ids for
>> * BTF now that it has been relocated.
>> @@ -6198,6 +6196,8 @@ static __u32 btf_relocate_id(const struct btf *btf, __u32 id)
>> return btf->base_id_map[id];
>> }
>>
>> +#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
>> +
>
> It doesn't fix it all. The 32 build is still failing:
>
> ../kernel/bpf/btf.c: In function ‘btf_populate_kfunc_set’:
> -../kernel/bpf/btf.c:8251:36: error: implicit declaration of function
> ‘btf_relocate_id’; did you mean ‘btf_relocate’?
> [-Wimplicit-function-declaration]
> - 8251 | set->pairs[i].id = btf_relocate_id(btf,
> set->pairs[i].id);
> - | ^~~~~~~~~~~~~~~
> - | btf_relocate
> -
>
> See build_32, build_clang, build_allmod failures in CI:
> https://patchwork.kernel.org/project/netdevbpf/patch/20240623135224.27981-1-alan.maguire@oracle.com/
I've been trying to reproduce this with no success I'm afraid. I may be
misreading but it appears that the diff from baseline to new build is
actually telling us the btf_relocate_id() issues went away
https://netdev.bots.linux.dev/static/nipa/864622/13708618/build_clang/stderr
shows (note the "-" in the diffs preceding the btf_relocate_id()
complaints):
New errors added
--- /tmp/tmp.tLVKGCnz0N 2024-06-23 07:09:50.097720906 -0700
+++ /tmp/tmp.5jUDaRbbAY 2024-06-23 07:10:36.751715396 -0700
@@ -9,24 +9,846 @@
-../kernel/bpf/btf.c:8251:22: error: call to undeclared function
'btf_relocate_id'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
- 8251 | set->pairs[i].id = btf_relocate_id(btf,
set->pairs[i].id);
- | ^
-../kernel/bpf/btf.c:8251:22: note: did you mean 'btf_relocate'?
-../include/linux/btf.h:556:5: note: 'btf_relocate' declared here
- 556 | int btf_relocate(struct btf *btf, const struct btf *base_btf,
__u32 **map_ids);
- | ^
-../kernel/bpf/btf.c:8376:37: error: call to undeclared function
'btf_relocate_id'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
- 8376 | ret = btf_check_kfunc_protos(btf,
btf_relocate_id(btf, kset->set->pairs[i].id),
- | ^
-../kernel/bpf/btf.c:8440:17: error: call to undeclared function
'btf_relocate_id'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
- 8440 | dtor_btf_id = btf_relocate_id(btf,
dtors[i].kfunc_btf_id);
- | ^
-../kernel/bpf/btf.c:8529:26: error: call to undeclared function
'btf_relocate_id'; ISO C99 and later do not support implicit function
declarations [-Wimplicit-function-declaration]
- 8529 | tab->dtors[i].btf_id = btf_relocate_id(btf,
tab->dtors[i].btf_id);
- | ^
-4 errors generated.
-make[5]: *** [../kernel/bpf/Makefile:60: kernel/bpf/btf.o] Error 1
-make[4]: *** [../scripts/Makefile.build:485: kernel/bpf] Error 2
-make[3]: *** [../scripts/Makefile.build:485: kernel] Error 2
-make[3]: *** Waiting for unfinished jobs....
-make[2]: *** [/home/nipa/bpf-next/wt-0/Makefile:1934: .] Error 2
-make[1]: *** [/home/nipa/bpf-next/wt-0/Makefile:240: __sub-make] Error 2
-make: *** [Makefile:240: __sub-make] Error 2
+WARNING: modpost: missing MODULE_DESCRIPTION() in vmlinux.o
+WARNING: modpost: missing MODULE_DESCRIPTION() in
arch/x86/kernel/cpu/mce/mce-inject.o
+WARNING: modpost: missing MODULE_DESCRIPTION() in
arch/x86/mm/testmmiotrace.o
+WARNING: modpost: missing MODULE_DESCRIPTION() in
arch/x86/crypto/crc32-pclmul.o
+WARNING: modpost: missing MODULE_DESCRIPTION() in
arch/x86/crypto/curve25519-x86_64.o
...
...and looking at
https://github.com/linux-netdev/nipa/blob/main/tests/patch/build_32bit/build_32bit.sh
...that appears to be a diff between old and new build logs. The new
issues all appear to be missing module license complaints in an
allmodconfig build.
I did find another issue in tools/lib/bpf/btf_relocate.c when compiling
with clang that I'll send a patch for, and there's an existing issue in
btf.c that generates a warning:
tools/testing/selftests/kvm/settings: warning: ignored by one of the
.gitignore files
../kernel/bpf/btf.c: In function ‘btf_seq_show’:
../kernel/bpf/btf.c:7544:29: warning: function ‘btf_seq_show’ might be a
candidate for ‘gnu_printf’ format attribute [-Wsuggest-attribute=format]
7544 | seq_vprintf((struct seq_file *)show->target, fmt, args);
| ^~~~~~~~
../kernel/bpf/btf.c: In function ‘btf_snprintf_show’:
../kernel/bpf/btf.c:7581:9: warning: function ‘btf_snprintf_show’ might
be a candidate for ‘gnu_printf’ format attribute
[-Wsuggest-attribute=format]
7581 | len = vsnprintf(show->target, ssnprintf->len_left, fmt,
args);
| ^~~
...but I can't see how this fix is still causing failures in finding
btf_relocate_id(). There may be something I'm missing here of course.
Thanks!
Alan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined
2024-06-23 19:04 ` Alan Maguire
@ 2024-06-23 19:53 ` Alexei Starovoitov
0 siblings, 0 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2024-06-23 19:53 UTC (permalink / raw)
To: Alan Maguire
Cc: Andrii Nakryiko, Eddy Z, Alexei Starovoitov,
Arnaldo Carvalho de Melo, Daniel Borkmann, Jiri Olsa,
Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
KP Singh, Stanislav Fomichev, Hao Luo, Luis R. Rodriguez,
Masahiro Yamada, Nathan Chancellor, Mykola Lysenko, Kui-Feng Lee,
Benjamin Tissoires, Geliang Tang, bpf, kernel test robot
On Sun, Jun 23, 2024 at 12:04 PM Alan Maguire <alan.maguire@oracle.com> wrote:
> I've been trying to reproduce this with no success I'm afraid. I may be
> misreading but it appears that the diff from baseline to new build is
> actually telling us the btf_relocate_id() issues went away
>
> https://netdev.bots.linux.dev/static/nipa/864622/13708618/build_clang/stderr
>
> shows (note the "-" in the diffs preceding the btf_relocate_id()
> complaints):
Ahh. Makes sense. Applied.
> I did find another issue in tools/lib/bpf/btf_relocate.c when compiling
> with clang that I'll send a patch for, and there's an existing issue in
> btf.c that generates a warning:
Thanks!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined
2024-06-23 13:52 [PATCH bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined Alan Maguire
2024-06-23 14:35 ` Alexei Starovoitov
@ 2024-06-23 20:00 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-06-23 20:00 UTC (permalink / raw)
To: Alan Maguire
Cc: andrii, eddyz87, ast, acme, daniel, jolsa, martin.lau, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, mcgrof,
masahiroy, nathan, mykolal, thinker.li, bentiss, tanggeliang, bpf,
lkp
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Sun, 23 Jun 2024 14:52:24 +0100 you wrote:
> Kernel test robot reports that kernel build fails with
> resilient split BTF changes.
>
> Examining the associated config and code we see that
> btf_relocate_id() is defined under CONFIG_DEBUG_INFO_BTF_MODULES.
> Moving it outside the #ifdef solves the issue.
>
> [...]
Here is the summary with links:
- [bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined
https://git.kernel.org/bpf/bpf-next/c/5a532459aa91
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] 5+ messages in thread
end of thread, other threads:[~2024-06-23 20:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-23 13:52 [PATCH bpf-next] bpf: fix build when CONFIG_DEBUG_INFO_BTF[_MODULES] is undefined Alan Maguire
2024-06-23 14:35 ` Alexei Starovoitov
2024-06-23 19:04 ` Alan Maguire
2024-06-23 19:53 ` Alexei Starovoitov
2024-06-23 20:00 ` 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