Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

rcu: Eliminate BUG_ON() for kernel/rcu/tree.c

The tree.c file has a number of calls to BUG_ON(), which panics the
kernel, which is not a good strategy for devices (like embedded) that
don't have a way to capture console output. This commit therefore
converts these BUG_ON() calls to WARN_ON_ONCE() and WARN_ONCE().

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>

+3 -2
+3 -2
kernel/rcu/tree.c
··· 2826 2826 * Very early boot, before rcu_init(). Initialize if needed 2827 2827 * and then drop through to queue the callback. 2828 2828 */ 2829 - BUG_ON(cpu != -1); 2829 + WARN_ON_ONCE(cpu != -1); 2830 2830 WARN_ON_ONCE(!rcu_is_watching()); 2831 2831 if (rcu_segcblist_empty(&rdp->cblist)) 2832 2832 rcu_segcblist_init(&rdp->cblist); ··· 3485 3485 3486 3486 rcu_scheduler_fully_active = 1; 3487 3487 t = kthread_create(rcu_gp_kthread, NULL, "%s", rcu_state.name); 3488 - BUG_ON(IS_ERR(t)); 3488 + if (WARN_ONCE(IS_ERR(t), "%s: Could not start grace-period kthread, OOM is now expected behavior\n", __func__)) 3489 + return 0; 3489 3490 rnp = rcu_get_root(); 3490 3491 raw_spin_lock_irqsave_rcu_node(rnp, flags); 3491 3492 rcu_state.gp_kthread = t;