diff options
author | Mike Galbraith <efault@gmx.de> | 2017-09-03 04:48:10 +0200 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2018-01-17 10:08:36 -0500 |
commit | 3d85392071893c5c27e5827b1af39e431bda99e3 (patch) | |
tree | c7d6e34c6ba86cec73baae2ff17f92607eaea0a8 | |
parent | 7dc2ca25b642ab8047372730919e18ce50f7a90c (diff) | |
download | linux-rt-3d85392071893c5c27e5827b1af39e431bda99e3.tar.gz |
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>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-rw-r--r-- | kernel/time/hrtimer.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 2e869c707628..1e7c0c9b0e77 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1928,7 +1928,7 @@ static void init_hrtimers_cpu(int cpu) #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; @@ -1961,15 +1961,19 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base, } #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; } static void migrate_hrtimers(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); @@ -1985,13 +1989,16 @@ static void migrate_hrtimers(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(); |