Skip to content

Commit 09efeee

Browse files
committed
rcu: Move callback-list warning to irq-disable region
After adopting callbacks from a newly offlined CPU, the adopting CPU checks to make sure that its callback list's count is zero only if the list has no callbacks and vice versa. Unfortunately, it does so after enabling interrupts, which means that false positives are possible due to interrupt handlers invoking call_rcu(). Although these false positives are improbable, rcutorture did make it happen once. This commit therefore moves this check to an irq-disabled region of code, thus suppressing the false positive. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
1 parent aed4e04 commit 09efeee

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/rcu/tree.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3869,14 +3869,14 @@ static void rcu_migrate_callbacks(int cpu, struct rcu_state *rsp)
38693869
rcu_advance_cbs(rsp, rnp_root, rdp); /* Leverage recent GPs. */
38703870
rcu_advance_cbs(rsp, rnp_root, my_rdp); /* Assign GP to pending CBs. */
38713871
rcu_segcblist_merge(&my_rdp->cblist, &rdp->cblist);
3872+
WARN_ON_ONCE(rcu_segcblist_empty(&my_rdp->cblist) !=
3873+
!rcu_segcblist_n_cbs(&my_rdp->cblist));
38723874
raw_spin_unlock_irqrestore_rcu_node(rnp_root, flags);
38733875
WARN_ONCE(rcu_segcblist_n_cbs(&rdp->cblist) != 0 ||
38743876
!rcu_segcblist_empty(&rdp->cblist),
38753877
"rcu_cleanup_dead_cpu: Callbacks on offline CPU %d: qlen=%lu, 1stCB=%p\n",
38763878
cpu, rcu_segcblist_n_cbs(&rdp->cblist),
38773879
rcu_segcblist_first_cb(&rdp->cblist));
3878-
WARN_ON_ONCE(rcu_segcblist_empty(&my_rdp->cblist) !=
3879-
!rcu_segcblist_n_cbs(&my_rdp->cblist));
38803880
}
38813881

38823882
/*

0 commit comments

Comments
 (0)