Re: linux-next: runtime warnings after merge of the bpf-next tree
From: Daniel Xu
Date: Wed Jan 31 2024 - 22:56:10 EST
Hi Stephen,
Thanks for the report.
On Thu, Feb 01, 2024 at 02:23:48PM +1100, Stephen Rothwell wrote:
> Hi all,
>
> After merging the bpf-next tree, today's linux-next build (powerpc
> pseries_le_defconfig) produced these runtime warnings in my qemu boot
I can't quite find that config in-tree. Mind giving me a pointer?
> tests:
>
> ipip: IPv4 and MPLS over IPv4 tunneling driver
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1 at kernel/bpf/btf.c:8131 register_btf_kfunc_id_set+0x68/0x74
> Modules linked in:
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.8.0-rc2-03380-gd0c0d80c1162 #2
> Hardware name: IBM pSeries (emulated by qemu) POWER8 (raw) 0x4d0200 0xf000004 of:SLOF,HEAD pSeries
> NIP: c0000000003bfbfc LR: c00000000209ba3c CTR: c00000000209b9a4
> REGS: c0000000049bf960 TRAP: 0700 Not tainted (6.8.0-rc2-03380-gd0c0d80c1162)
> MSR: 8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE> CR: 24000482 XER: 00000000
> CFAR: c0000000003bfbb0 IRQMASK: 0
> GPR00: c00000000209ba3c c0000000049bfc00 c0000000015c9900 000000000000001b
> GPR04: c0000000012bc980 000000000000019a 000000000000019a 0000000000000133
> GPR08: c000000002969900 0000000000000001 c000000002969900 c000000002969900
> GPR12: c00000000209b9a4 c000000002b60000 c0000000000110cc 0000000000000000
> GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
> GPR20: 0000000000000000 0000000000000000 0000000000000000 c0000000014cd250
> GPR24: c000000002003e6c c000000001582c78 000000000000018b c0000000020c1060
> GPR28: 0000000000000000 0000000000000007 c0000000020c10a8 c000000002968f80
> NIP [c0000000003bfbfc] register_btf_kfunc_id_set+0x68/0x74
> LR [c00000000209ba3c] cubictcp_register+0x98/0xc8
> Call Trace:
> [c0000000049bfc30] [c000000000010d58] do_one_initcall+0x80/0x2f8
> [c0000000049bfd00] [c000000002005aec] kernel_init_freeable+0x32c/0x520
> [c0000000049bfde0] [c0000000000110f8] kernel_init+0x34/0x25c
> [c0000000049bfe50] [c00000000000debc] ret_from_kernel_user_thread+0x14/0x1c
> --- interrupt: 0 at 0x0
> Code: 60420000 3d22ffc6 39290708 7d291a14 89290270 7d290774 79230020 4bfff8c0 60420000 e9240000 7d290074 7929d182 <0b090000> 3860ffea 4e800020 3c4c0121
> ---[ end trace 0000000000000000 ]---
> NET: Registered PF_INET6 protocol family
[...]
>
> Exposed (and maybe caused) by commit
>
> 6e7769e6419f ("bpf: treewide: Annotate BPF kfuncs in BTF")
>
My guess is the config does not enable CONFIG_DEBUG_INFO_BTF which
causes compilation to use the dummy definitions for BTF_KFUNCS_START().
I think there's probably a few ways to fix it. This untested diff should
work if I am guessing correctly. There's probably a cleaner way to do
this. I'll take a closer look in the morning.
diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h
index 0fe4f1cd1918..e24aabfe8ecc 100644
--- a/include/linux/btf_ids.h
+++ b/include/linux/btf_ids.h
@@ -227,7 +227,7 @@ BTF_SET8_END(name)
#define BTF_SET_END(name)
#define BTF_SET8_START(name) static struct btf_id_set8 __maybe_unused name = { 0 };
#define BTF_SET8_END(name)
-#define BTF_KFUNCS_START(name) static struct btf_id_set8 __maybe_unused name = { 0 };
+#define BTF_KFUNCS_START(name) static struct btf_id_set8 __maybe_unused name = { .flags = BTF_SET8_KFUNCS };
#define BTF_KFUNCS_END(name)
#endif /* CONFIG_DEBUG_INFO_BTF */
Thanks,
Daniel