[PATCH RT 09/13] kernel/hrtimer: migrate deferred timer on CPU down
From: Steven Rostedt
Date: Wed Jan 17 2018 - 10:18:15 EST
3.18.91-rt98-rc1 stable review patch.
If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
hrtimers, which were deferred to the softirq context, and expire between
softirq shutdown and hrtimer migration are dangling around. If the CPU
goes back up the list head will be initialized and this corrupts the
timer's list. It will remain unnoticed until a hrtimer_cancel().
This moves those timers so they will expire.
Cc: stable-rt@xxxxxxxxxxxxxxx
Reported-by: Mike Galbraith <efault@xxxxxx>
Tested-by: Mike Galbraith <efault@xxxxxx>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
kernel/time/hrtimer.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 2c1597d2bd6d..2e869c707628 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1959,6 +1959,11 @@ static void migrate_hrtimer_list(struct hrtimer_clock_base *old_base,
/* Clear the migration state bit */
timer->state &= ~HRTIMER_STATE_MIGRATE;
}
+#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);
+#endif
}
static void migrate_hrtimers(int scpu)
--
2.13.2