On Thu, 2024-06-20 at 10:17 +0100, Alan Maguire wrote: [...] Hi Alan, I still get the error message in the dmesg: [ 10.489223] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:337 [ 10.489454] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 184, name: test_progs [ 10.489589] preempt_count: 200, expected: 0 [ 10.489659] RCU nest depth: 1, expected: 0 [ 10.489733] 1 lock held by test_progs/184: [ 10.489811] #0: ffffffff83198a60 (rcu_read_lock){....}-{1:2}, at: bpf_test_timer_enter+0x1d/0xb0 [ 10.490040] Preemption disabled at: [ 10.490060] [<ffffffff81a0ee6a>] bpf_test_run+0x16a/0x300 [ 10.490197] CPU: 1 PID: 184 Comm: test_progs Tainted: G OE 6.10.0-rc2-00766-gb812ab0e1306-dirty #39 [ 10.490356] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.15.0-1 04/01/2014 [ 10.490475] Call Trace: [ 10.490515] <TASK> [ 10.490557] dump_stack_lvl+0x83/0xa0 [ 10.490618] __might_resched+0x199/0x2b0 [ 10.490695] kmalloc_trace_noprof+0x273/0x320 [ 10.490756] ? srso_alias_return_thunk+0x5/0xfbef5 [ 10.490836] ? bpf_test_run+0xc0/0x300 [ 10.490836] ? bpf_testmod_ctx_create+0x23/0x50 [bpf_testmod] [ 10.490836] bpf_testmod_ctx_create+0x23/0x50 [bpf_testmod] [ 10.490836] bpf_prog_d1347efc07047347_kfunc_call_ctx+0x2c/0xae [ 10.490836] bpf_test_run+0x198/0x300 [ 10.490836] ? srso_alias_return_thunk+0x5/0xfbef5 [ 10.490836] ? lockdep_init_map_type+0x4b/0x250 [ 10.490836] bpf_prog_test_run_skb+0x381/0x7f0 [ 10.490836] __sys_bpf+0xc4f/0x2e00 [ 10.490836] ? srso_alias_return_thunk+0x5/0xfbef5 [ 10.490836] ? reacquire_held_locks+0xcf/0x1f0 [ 10.490836] __x64_sys_bpf+0x1e/0x30 [ 10.490836] do_syscall_64+0x68/0x140 [ 10.490836] entry_SYSCALL_64_after_hwframe+0x76/0x7e The following fix helps: --- a/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c +++ b/tools/testing/selftests/bpf/bpf_testmod/bpf_testmod.c @@ -164,7 +164,7 @@ bpf_testmod_ctx_create(int *err) { struct bpf_testmod_ctx *ctx; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL | GFP_ATOMIC); + ctx = kzalloc(sizeof(*ctx), GFP_ATOMIC); if (!ctx) { *err = -ENOMEM; return NULL; Thanks, Eduard [...]