rcu-tasks: Permit use of debug-objects with RCU Tasks flavors
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 28 Jul 2023 20:33:02 +0000 (13:33 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Mon, 31 Jul 2023 23:06:57 +0000 (16:06 -0700)
commitcb88f7f51bc6f351a529ff61d0a706c6eae1417a
treeacf02d0aa154ec893de34a238b961e5d6f6bb917
parent84dd7f19e72656fac5faf67f1b1809e57e9788cc
rcu-tasks: Permit use of debug-objects with RCU Tasks flavors

Currently, cblist_init_generic() holds a raw spinlock when invoking
INIT_WORK().  This fails in kernels built with CONFIG_DEBUG_OBJECTS=y
due to memory allocation being forbidden while holding a raw spinlock.
But the only reason for holding the raw spinlock is to synchronize
with early boot calls to call_rcu_tasks(), call_rcu_tasks_rude, and,
last but not least, call_rcu_tasks_trace().  These calls also invoke
cblist_init_generic() in order to support early boot queueing of
callbacks.

Except that there are no early boot calls to either of these three
functions, and the BPF guys confirm that they have no plans to add any
such calls.

This commit therefore removes the synchronization and adds a
WARN_ON_ONCE() to catch the case of now-prohibited early boot RCU Tasks
callback queueing.

If early boot queueing is needed, an "initialized" flag may be added to
the rcu_tasks structure.  Then queueing a callback before this flag is set
would initialize the callback list (if needed) and queue the callback.
The decision as to where to queue the callback given the possibility of
non-zero boot CPUs is left as an exercise for the reader.

Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tasks.h