From: Thomas Gleixner <tglx@linutronix.de>
To: Z qiang <qiang.zhang1211@gmail.com>, paulmck@kernel.org
Cc: syzbot <syzbot+dce04ed6d1438ad69656@syzkaller.appspotmail.com>,
linux-kernel@vger.kernel.org, peterz@infradead.org,
syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [kernel?] WARNING: suspicious RCU usage in __do_softirq
Date: Mon, 22 Apr 2024 23:15:28 +0200 [thread overview]
Message-ID: <87o7a1umj3.ffs@tglx> (raw)
In-Reply-To: <CALm+0cXGBPWxiNOkAoQG4hdnKCeVVR-APbfBPk9OGeU2RW+bKA@mail.gmail.com>
On Fri, Apr 19 2024 at 13:50, Z qiang wrote:
>> On Thu, Apr 18, 2024 at 05:49:38PM +0800, Z qiang wrote:
> static __init int spawn_ksoftirqd(void)
> {
> + int cpu;
> +
> + for_each_possible_cpu(cpu)
> + per_cpu(ksoftirqd_work, cpu) = false;
First of all that initialization is pointless, but why making all of
this complex as hell?
Thanks,
tglx
---
diff --git a/kernel/softirq.c b/kernel/softirq.c
index b315b21fb28c..e991d735be0d 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -508,7 +508,7 @@ static inline bool lockdep_softirq_start(void) { return false; }
static inline void lockdep_softirq_end(bool in_hardirq) { }
#endif
-asmlinkage __visible void __softirq_entry __do_softirq(void)
+static void handle_softirqs(bool kirqd)
{
unsigned long end = jiffies + MAX_SOFTIRQ_TIME;
unsigned long old_flags = current->flags;
@@ -563,8 +563,7 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
pending >>= softirq_bit;
}
- if (!IS_ENABLED(CONFIG_PREEMPT_RT) &&
- __this_cpu_read(ksoftirqd) == current)
+ if (!IS_ENABLED(CONFIG_PREEMPT_RT) && kirqd)
rcu_softirq_qs();
local_irq_disable();
@@ -584,6 +583,11 @@ asmlinkage __visible void __softirq_entry __do_softirq(void)
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
*/
@@ -921,7 +925,7 @@ static void run_ksoftirqd(unsigned int cpu)
* We can safely run softirq on inline stack, as we are not deep
* in the task stack here.
*/
- __do_softirq();
+ handle_softirqs(true);
ksoftirqd_run_end();
cond_resched();
return;
next prev parent reply other threads:[~2024-04-22 21:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 18:05 [syzbot] [kernel?] WARNING: suspicious RCU usage in __do_softirq syzbot
2024-04-16 7:05 ` syzbot
2024-04-16 8:10 ` Z qiang
2024-04-16 8:44 ` Z qiang
2024-04-17 1:13 ` Paul E. McKenney
2024-04-17 2:25 ` Z qiang
2024-04-17 22:39 ` Paul E. McKenney
2024-04-18 9:49 ` Z qiang
2024-04-18 22:49 ` Paul E. McKenney
2024-04-19 5:50 ` Z qiang
2024-04-19 6:11 ` Z qiang
2024-04-19 7:12 ` Paul E. McKenney
2024-04-19 7:29 ` Z qiang
2024-04-22 21:15 ` Thomas Gleixner [this message]
2024-04-23 2:20 ` Z qiang
2024-04-23 22:28 ` Paul E. McKenney
2024-04-26 2:09 ` Z qiang
2024-04-26 17:23 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87o7a1umj3.ffs@tglx \
--to=tglx@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=qiang.zhang1211@gmail.com \
--cc=syzbot+dce04ed6d1438ad69656@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.