Commit 80f8b450 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'irq-urgent-2024-05-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull irq fix from Ingo Molnar:
 "Fix suspicious RCU usage in __do_softirq()"

* tag 'irq-urgent-2024-05-05' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  softirq: Fix suspicious RCU usage in __do_softirq()
parents b9158815 1dd1eff1
...@@ -508,7 +508,7 @@ static inline bool lockdep_softirq_start(void) { return false; } ...@@ -508,7 +508,7 @@ static inline bool lockdep_softirq_start(void) { return false; }
static inline void lockdep_softirq_end(bool in_hardirq) { } static inline void lockdep_softirq_end(bool in_hardirq) { }
#endif #endif
asmlinkage __visible void __softirq_entry __do_softirq(void) static void handle_softirqs(bool ksirqd)
{ {
unsigned long end = jiffies + MAX_SOFTIRQ_TIME; unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
unsigned long old_flags = current->flags; unsigned long old_flags = current->flags;
...@@ -563,8 +563,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) ...@@ -563,8 +563,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
pending >>= softirq_bit; pending >>= softirq_bit;
} }
if (!IS_ENABLED(CONFIG_PREEMPT_RT) && if (!IS_ENABLED(CONFIG_PREEMPT_RT) && ksirqd)
__this_cpu_read(ksoftirqd) == current)
rcu_softirq_qs(); rcu_softirq_qs();
local_irq_disable(); local_irq_disable();
...@@ -584,6 +583,11 @@ asmlinkage __visible void __softirq_entry __do_softirq(void) ...@@ -584,6 +583,11 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
current_restore_flags(old_flags, PF_MEMALLOC); current_restore_flags(old_flags, PF_MEMALLOC);
} }
asmlinkage __visible void __softirq_entry __do_softirq(void)
{
handle_softirqs(false);
}
/** /**
* irq_enter_rcu - Enter an interrupt context with RCU watching * irq_enter_rcu - Enter an interrupt context with RCU watching
*/ */
...@@ -921,7 +925,7 @@ static void run_ksoftirqd(unsigned int cpu) ...@@ -921,7 +925,7 @@ static void run_ksoftirqd(unsigned int cpu)
* We can safely run softirq on inline stack, as we are not deep * We can safely run softirq on inline stack, as we are not deep
* in the task stack here. * in the task stack here.
*/ */
__do_softirq(); handle_softirqs(true);
ksoftirqd_run_end(); ksoftirqd_run_end();
cond_resched(); cond_resched();
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment