rcu: Warn on for_each_leaf_node_cpu_mask() from non-leaf
authorPaul E. McKenney <paulmck@kernel.org>
Sun, 15 Dec 2019 19:38:57 +0000 (11:38 -0800)
committerPaul E. McKenney <paulmck@kernel.org>
Thu, 20 Feb 2020 23:58:21 +0000 (15:58 -0800)
commit82dd8419e225958f01708cda8a3fc6c3c5356228
treed11b6e4bf1cbcbeaf29bc916762b2fdbaf24c3f1
parent9f01eb5d4936f12d57da84cdfbc2a3623e23a7eb
rcu: Warn on for_each_leaf_node_cpu_mask() from non-leaf

The for_each_leaf_node_cpu_mask() and for_each_leaf_node_possible_cpu()
macros must be invoked only on leaf rcu_node structures.  Failing to
abide by this restriction can result in infinite loops on systems with
more than 64 CPUs (or for more than 32 CPUs on 32-bit systems).  This
commit therefore adds WARN_ON_ONCE() calls to make misuse of these two
macros easier to debug.

Reported-by: Qian Cai <cai@lca.pw>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/rcu.h