From: Mike Galbraith <efault@gmx.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
linux-rt-users <linux-rt-users@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: v4.11.12-rt10 - hotplug lockdep splat
Date: Sun, 03 Sep 2017 04:48:10 +0200 [thread overview]
Message-ID: <1504406890.3054.3.camel@gmx.de> (raw)
In-Reply-To: <20170831161834.t7ymwsnpbko6und5@linutronix.de>
On Thu, 2017-08-31 at 18:18 +0200, Sebastian Andrzej Siewior wrote:
> On 2017-08-23 11:53:44 [+0200], Mike Galbraith wrote:
> > virt box reminded me this morning to report this gripe.
>
> if you can reproduce it, then this should make it go away:
Missed a spot. With this on top, lockdep went silent.
kernel/hrtimer/hotplug: don't wake ktimersoftd while holding the hrtimer base lock
kernel/hrtimer: don't wakeup a process while holding the hrtimer base lock
missed a path, namely hrtimers_dead_cpu() -> migrate_hrtimer_list(). Defer
raising softirq until after base lock has been released there as well.
Signed-off-by: Mike Galbraith <efault@gmx.de>
---
kernel/time/hrtimer.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1779,7 +1779,7 @@ int hrtimers_prepare_cpu(unsigned int cp
#ifdef CONFIG_HOTPLUG_CPU
-static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
+static int migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
struct hrtimer_clock_base *new_base)
{
struct hrtimer *timer;
@@ -1809,15 +1809,19 @@ static void migrate_hrtimer_list(struct
}
#ifdef CONFIG_PREEMPT_RT_BASE
list_splice_tail(&old_base->expired, &new_base->expired);
- if (!list_empty(&new_base->expired))
- raise_softirq_irqoff(HRTIMER_SOFTIRQ);
+ /*
+ * Tell the caller to raise HRTIMER_SOFTIRQ. We can't safely
+ * acquire ktimersoftd->pi_lock while the base lock is held.
+ */
+ return !list_empty(&new_base->expired);
#endif
+ return 0;
}
int hrtimers_dead_cpu(unsigned int scpu)
{
struct hrtimer_cpu_base *old_base, *new_base;
- int i;
+ int i, raise = 0;
BUG_ON(cpu_online(scpu));
tick_cancel_sched_timer(scpu);
@@ -1833,13 +1837,16 @@ int hrtimers_dead_cpu(unsigned int scpu)
raw_spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
- migrate_hrtimer_list(&old_base->clock_base[i],
- &new_base->clock_base[i]);
+ raise |= migrate_hrtimer_list(&old_base->clock_base[i],
+ &new_base->clock_base[i]);
}
raw_spin_unlock(&old_base->lock);
raw_spin_unlock(&new_base->lock);
+ if (raise)
+ raise_softirq_irqoff(HRTIMER_SOFTIRQ);
+
/* Check, if we got expired work to do */
__hrtimer_peek_ahead_timers();
local_irq_enable();
next prev parent reply other threads:[~2017-09-03 2:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-18 12:09 [ANNOUNCE] v4.11.12-rt10 Sebastian Andrzej Siewior
2017-08-23 9:53 ` v4.11.12-rt10 - hotplug lockdep splat Mike Galbraith
2017-08-31 16:18 ` Sebastian Andrzej Siewior
2017-09-02 7:00 ` Mike Galbraith
2017-09-03 2:48 ` Mike Galbraith [this message]
2017-09-04 14:58 ` Sebastian Andrzej Siewior
2017-08-23 9:57 ` [patch-rt] drivers/zram: fix zcomp_stream_get() smp_processor_id() use in preemptible code Mike Galbraith
2017-08-31 15:48 ` Sebastian Andrzej Siewior
2017-08-31 19:11 ` Thomas Gleixner
2017-08-31 19:26 ` Sebastian Andrzej Siewior
2017-08-31 19:32 ` Thomas Gleixner
2017-09-01 7:40 ` Sebastian Andrzej Siewior
2017-09-01 7:47 ` 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=1504406890.3054.3.camel@gmx.de \
--to=efault@gmx.de \
--cc=bigeasy@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--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