From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Mike Galbraith <efault@gmx.de>
Cc: linux-rt-users <linux-rt-users@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: 5.10-rt: non-repeatable flush_delayed_work()...del_timer_wait_running() ATOMIC_SLEEP splat
Date: Mon, 2 Nov 2020 13:23:25 +0100 [thread overview]
Message-ID: <20201102122325.pre6t4qo7bktrru2@linutronix.de> (raw)
In-Reply-To: <17f055aad6788c17dbeb522f2cac4f8bb94f759b.camel@gmx.de>
On 2020-11-01 06:23:50 [+0100], Mike Galbraith wrote:
> Apparently, timer ain't ever supposed to be running when you get there
> via flush_delayed_work(), but it was.
The first hunk will always trigger the warning and not just if the
slow/wait path is really used. The second part should fix it.
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 7edc9fba34bbd..696bb88d15db2 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1372,6 +1372,13 @@ int del_timer_sync(struct timer_list *timer)
*/
WARN_ON(in_irq() && !(timer->flags & TIMER_IRQSAFE));
+ /*
+ * Can not be used with disabled interrupts on PREEMPT_RT because
+ * del_timer_wait_running() sleeps.
+ */
+ if (IS_ENABLED(CONFIG_PREEMPT_RT))
+ WARN_ON(irqs_disabled());
+
do {
ret = try_to_del_timer_sync(timer);
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index c71da2a59e127..1ca03051a949f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3187,10 +3187,11 @@ EXPORT_SYMBOL_GPL(cancel_work_sync);
*/
bool flush_delayed_work(struct delayed_work *dwork)
{
- local_irq_disable();
- if (del_timer_sync(&dwork->timer))
+ if (del_timer_sync(&dwork->timer)) {
+ local_irq_disable();
__queue_work(dwork->cpu, dwork->wq, &dwork->work);
- local_irq_enable();
+ local_irq_enable();
+ }
return flush_work(&dwork->work);
}
EXPORT_SYMBOL(flush_delayed_work);
Sebastian
next prev parent reply other threads:[~2020-11-02 12:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 19:18 [ANNOUNCE] v5.10-rc1-rt2 Sebastian Andrzej Siewior
2020-11-01 5:23 ` 5.10-rt: non-repeatable flush_delayed_work()...del_timer_wait_running() ATOMIC_SLEEP splat Mike Galbraith
2020-11-02 12:23 ` Sebastian Andrzej Siewior [this message]
2020-11-02 17:06 ` Sebastian Andrzej Siewior
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=20201102122325.pre6t4qo7bktrru2@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=efault@gmx.de \
--cc=linux-rt-users@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox