Currently, the per-cpu rcu_data structure's->defer_qs_iw is initialized by
IRQ_WORK_INIT_HARD(), this means the rcu_preempt_deferred_qs_handler()
always be executed in the hardirq context of irq-disabled.
This commit therefore remove local_irq_save/restore() operations in
rcu_preempt_deferred_qs_handler() and add lockdep_assert_irqs_disabled()
check, if someone mistakenly invokes this function in hardirq enabled
context will splat.

Signed-off-by: Zqiang <qiang.zh...@linux.dev>
---
 kernel/rcu/tree_plugin.h | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h
index fc14adf15cbb..57e2ae51c0b2 100644
--- a/kernel/rcu/tree_plugin.h
+++ b/kernel/rcu/tree_plugin.h
@@ -626,11 +626,10 @@ notrace void rcu_preempt_deferred_qs(struct task_struct 
*t)
  */
 static void rcu_preempt_deferred_qs_handler(struct irq_work *iwp)
 {
-       unsigned long flags;
        struct rcu_data *rdp;
 
+       lockdep_assert_irqs_disabled();
        rdp = container_of(iwp, struct rcu_data, defer_qs_iw);
-       local_irq_save(flags);
 
        /*
         * If the IRQ work handler happens to run in the middle of RCU read-side
@@ -647,8 +646,6 @@ static void rcu_preempt_deferred_qs_handler(struct irq_work 
*iwp)
         */
        if (rcu_preempt_depth() > 0)
                WRITE_ONCE(rdp->defer_qs_iw_pending, DEFER_QS_IDLE);
-
-       local_irq_restore(flags);
 }
 
 /*
-- 
2.48.1


Reply via email to