Explain why we need to disable softirqs while processing callbacks in
an offline fashion. The subtle reason doesn't want to be forgotten.

Reported-by: Boqun Feng <[email protected]>
Reported-by: Paul E. McKenney <[email protected]>
Cc: Josh Triplett <[email protected]>
Cc: Lai Jiangshan <[email protected]>
Cc: Joel Fernandes <[email protected]>
Cc: Neeraj Upadhyay <[email protected]>
Cc: Boqun Feng <[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
---
 kernel/rcu/tree_plugin.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index a44f80d7661b..dcfae03eb9e9 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -2235,6 +2235,12 @@ static void nocb_cb_wait(struct rcu_data *rdp)
        local_irq_save(flags);
        rcu_momentary_dyntick_idle();
        local_irq_restore(flags);
+       /*
+        * While transitioning to/from NOCB mode, a CPU might execute the same
+        * callback concurrently if it requeues itself and the softirq 
interrupts
+        * the offloaded callback processing. Make sure we disable BH to prevent
+        * from that.
+        */
        local_bh_disable();
        rcu_do_batch(rdp);
        local_bh_enable();
-- 
2.25.1

Reply via email to