Re: linux-next: boot warning from the bpf-next tree

From: Biju Das
Date: Wed Sep 13 2023 - 06:42:55 EST


Hi,

On 9/13/2023 12:59 PM, Stephen Rothwell wrote:
> Hi all,
>
> On Wed, 13 Sep 2023 13:34:36 +1000 Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>> Today's linux-next boot tests (powerpc pseries_le_defconfig) produced
>> this warning:
>>
>> ------------[ cut here ]------------
>> bpf_mem_cache[0]: unexpected object size 16, expect 96
>> WARNING: CPU: 0 PID: 1 at kernel/bpf/memalloc.c:500 bpf_mem_alloc_init+0x410/0x440
>> Modules linked in:
>> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.0-rc1-04964-g2e08ed1d459f #1
>> Hardware name: IBM pSeries (emulated by qemu) POWER8 (raw) 0x4d0200 0xf000004 of:SLOF,HEAD pSeries
>> NIP: c0000000003c0890 LR: c0000000003c088c CTR: 0000000000000000
>> REGS: c000000004783890 TRAP: 0700 Not tainted (6.6.0-rc1-04964-g2e08ed1d459f)
>> MSR: 8000000002029033 <SF,VEC,EE,ME,IR,DR,RI,LE> CR: 24000280 XER: 00000000
>> CFAR: c00000000014cfa0 IRQMASK: 0
>> GPR00: c0000000003c088c c000000004783b30 c000000001578c00 0000000000000036
>> GPR04: 0000000000000000 c000000002667e18 0000000000000001 0000000000000000
>> GPR08: c000000002667ce0 0000000000000001 0000000000000000 0000000044000280
>> GPR12: 0000000000000000 c000000002b00000 c000000000011188 0000000000000060
>> GPR16: c0000000011f9a30 c000000002920f68 c0000000021fac40 c0000000021fac40
>> GPR20: c000000002a3ed88 c000000002921560 c0000000014867f0 c00000000291ccd8
>> GPR24: 0000000000000000 0000000000000000 0000000000000000 0000000000000010
>> GPR28: c0000000011f9a30 0000000000000000 000000000000000b c00000007fc9ac40
>> NIP [c0000000003c0890] bpf_mem_alloc_init+0x410/0x440
>> LR [c0000000003c088c] bpf_mem_alloc_init+0x40c/0x440
>> Call Trace:
>> [c000000004783b30] [c0000000003c088c] bpf_mem_alloc_init+0x40c/0x440 (unreliable)
>> [c000000004783c20] [c00000000203d0c0] bpf_global_ma_init+0x5c/0x9c
>> [c000000004783c50] [c000000000010bc0] do_one_initcall+0x80/0x300
>> [c000000004783d20] [c000000002004978] kernel_init_freeable+0x30c/0x3b4
>> [c000000004783df0] [c0000000000111b0] kernel_init+0x30/0x1a0
>> [c000000004783e50] [c00000000000debc] ret_from_kernel_user_thread+0x14/0x1c
>> --- interrupt: 0 at 0x0
>> NIP: 0000000000000000 LR: 0000000000000000 CTR: 0000000000000000
>> REGS: c000000004783e80 TRAP: 0000 Not tainted (6.6.0-rc1-04964-g2e08ed1d459f)
>> MSR: 0000000000000000 <> CR: 00000000 XER: 00000000
>> CFAR: 0000000000000000 IRQMASK: 0
>> GPR00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> GPR04: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> GPR08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> GPR12: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> GPR24: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> GPR28: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
>> NIP [0000000000000000] 0x0
>> LR [0000000000000000] 0x0
>> --- interrupt: 0
>> Code: 3b000000 4bfffcbc 78650020 3c62ffe7 39200001 3d420130 7cc607b4 7ba40020 386382f0 992a1e24 4bd8c631 60000000 <0fe00000> 4bffff40 ea410080 3860fff4
>> ---[ end trace 0000000000000000 ]---
>>
>> Presumably related to commit
>>
>> 41a5db8d8161 ("bpf: Add support for non-fix-size percpu mem allocation")
>>
>> (or other commist in that series) from the bpf-next tree.
> Actually it looks like it is some interaction between that commit a
> commits in the bpf tree.

Yes. The warning is due to the checking added in commit c93047255202
("bpf: Ensure unit_size is matched with slab cache object size").
Considering that bpf-next has not merged the patch-set yet, should I
post a patch to bpf tree to fix it ? A fix patch is attached which can
fix the warning in my local setup.

>
>

This issue is seen on Renesas RZ/G2L SMARC EVK platform[1] as well. Can you please post proper patch to fix this issue instead of attachment?

[1]
[ 0.283075] ------------[ cut here ]------------
[ 0.283090] bpf_mem_cache[0]: unexpected object size 16, expect 96
[ 0.283126] WARNING: CPU: 0 PID: 1 at kernel/bpf/memalloc.c:500 bpf_mem_alloc_init+0x324/0x338
[ 0.283163] Modules linked in:
[ 0.283180] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.6.0-rc1-next-20230913-00003-g5734f56be91e-dirty #1044
[ 0.283201] Hardware name: Renesas SMARC EVK based on r9a07g044l2 (DT)
[ 0.283214] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[ 0.283230] pc : bpf_mem_alloc_init+0x324/0x338
[ 0.283245] lr : bpf_mem_alloc_init+0x324/0x338
[ 0.283259] sp : ffff80008286bd00
[ 0.283268] x29: ffff80008286bd00 x28: 0000000000000000 x27: ffff800082399a60
[ 0.283290] x26: ffff00007bde74b0 x25: 0000000000000000 x24: ffff80008239d8b8
[ 0.283311] x23: ffff800082399ca0 x22: 0000000000000000 x21: 0000000000000000
[ 0.283332] x20: 0000000000000000 x19: 0000000000000010 x18: 0000000000000030
[ 0.283352] x17: 0005000800000000 x16: 0004000800000001 x15: 07200765077a0769
[ 0.283373] x14: ffff8000823b0de0 x13: 000000000000028b x12: 00000000000000d9
[ 0.283394] x11: 0720072007200720 x10: ffff800082408de0 x9 : 00000000fffff000
[ 0.283415] x8 : ffff8000823b0de0 x7 : ffff800082408de0 x6 : 0000000000000000
[ 0.283435] x5 : 000000000000bff4 x4 : 0000000000000000 x3 : 0000000000000000
[ 0.283455] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff00000ac90000
[ 0.283476] Call trace:
[ 0.283485] bpf_mem_alloc_init+0x324/0x338
[ 0.283500] bpf_global_ma_init+0x44/0x6c
[ 0.283516] do_one_initcall+0x6c/0x1b0
[ 0.283531] kernel_init_freeable+0x1c4/0x28c
[ 0.283546] kernel_init+0x24/0x1e0
[ 0.283564] ret_from_fork+0x10/0x20
[ 0.283577] ---[ end trace 0000000000000000 ]---

Cheers,
Biju