mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH bpf] bpf: Report RCU-tasks quiescent states in do_check()
@ 2026-11-10 12:18 Breno Leitao
  2026-11-10 18:50 ` Paul E. McKenney
  2026-11-13  4:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Breno Leitao @ 2026-11-10 12:18 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, John Fastabend,
	Andrii Nakryiko, Eduard Zingerman, Kumar Kartikeya Dwivedi,
	Martin KaFai Lau, Song Liu, Yonghong Song, Jiri Olsa,
	Emil Tsalapatis, Ihor Solodrai, David S. Miller
  Cc: bpf, linux-kernel, kernel-team, paulmck, Breno Leitao

I am seeing rcu_tasks stalls in the Meta fleet on debug kernels (KASAN,
kmemleak, lockdep), where a task loading a BPF program stays in the
verifier for over 20 minutes:

  INFO: rcu_tasks detected stalls on tasks:
  000000000cc1a43d: .. nvcsw: 4/4 holdout: 1 idle_cpu: -1/91 task:GlobalCPUThread state:R  running task  pid:175256 tgid:169948 ppid:1
  Call Trace:
   __create_object
   __kmalloc_node_track_caller_noprof
   krealloc_node_align_noprof
   copy_array
   bpf_copy_verifier_state
   bpf_split_cur_state
   do_check_common
   do_check_main
   bpf_check
   bpf_prog_load
   __sys_bpf

The main loop in do_check() only calls cond_resched(), which is a no-op
on PREEMPTION kernels. Involuntary preemption is not a Tasks-RCU
quiescent state, so the loading task never reports one and stays a
holdout until bpf_prog_load() returns. Meanwhile every
synchronize_rcu_tasks() caller waits, e.g. ftrace_shutdown() of a
dynamic ftrace_ops.

Upgrade it to cond_resched_tasks_rcu_qs(), which reports a quiescent
state even when cond_resched() does nothing. The need_resched() check
goes away, as cond_resched() does it already.

Fixes: 3c2ce60bdd3d ("bpf: adjust verifier heuristics")
Signed-off-by: Breno Leitao <leitao@debian.org>
---
 kernel/bpf/verifier.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 5e4700fda66b9f..232551fd7cefdd 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -20627,8 +20627,7 @@ static int do_check(struct bpf_verifier_env *env)
 		if (signal_pending(current))
 			return -EAGAIN;
 
-		if (need_resched())
-			cond_resched();
+		cond_resched_tasks_rcu_qs();
 
 		/* reset current history entry on each new instruction */
 		env->cur_hist_ent = NULL;

---
base-commit: 630059a5a632377b9b7b487baccde92b7ae1dd47
change-id: 20261110-bpf-verifier-rcu-tasks-qs-bb523c1febe9

Best regards,
--  
Breno Leitao <leitao@debian.org>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-13  4:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-10 12:18 [PATCH bpf] bpf: Report RCU-tasks quiescent states in do_check() Breno Leitao
2026-11-10 18:50 ` Paul E. McKenney
2026-11-13  4:40 ` 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

all inboxes | Powered by JetHome®