rcu/nocb: Add a warning for non-GP kthread running GP code
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 5 Aug 2020 17:35:16 +0000 (10:35 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 25 Aug 2020 01:37:54 +0000 (18:37 -0700)
This commit increases RCU's ability to defend itself by emitting a warning
if one of the nocb CB kthreads invokes the GP kthread's wait function.
This warning augments a similar check that is carried out at the end
of rcutorture testing and when RCU CPU stall warnings are emitted.
The problem with those checks is that the miscreants have long since
departed and disposed of any and all evidence.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
kernel/rcu/tree_plugin.h

index 4d63ee3de7a9a92f0cd0910aa02f956337bf6790..cb1e8c8befb983f38c2815366e4f4fdc6442c1e2 100644 (file)
@@ -1926,6 +1926,7 @@ static void nocb_gp_wait(struct rcu_data *my_rdp)
         * nearest grace period (if any) to wait for next.  The CB kthreads
         * and the global grace-period kthread are awakened if needed.
         */
+       WARN_ON_ONCE(my_rdp->nocb_gp_rdp != my_rdp);
        for (rdp = my_rdp; rdp; rdp = rdp->nocb_next_cb_rdp) {
                trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("Check"));
                rcu_nocb_lock_irqsave(rdp, flags);