diff options
author | Richard Cochran <rcochran@linutronix.de> | 2016-07-13 13:16:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-07-15 04:41:42 -0400 |
commit | 24f73b99716a9cd8cbb345c41ced6b3b5ed94006 (patch) | |
tree | 382df7b88299425d8f3af5b050b7ba26273ea0c5 /kernel/time/timer.c | |
parent | 27590dc17b34aedc4f3e14bd107ee59b9db9b0a6 (diff) |
timers/core: Convert to hotplug state machine
When tearing down, call timers_dead_cpu() before notify_dead().
There is a hidden dependency between:
- timers
- block multiqueue
- rcutree
If timers_dead_cpu() comes later than blk_mq_queue_reinit_notify()
that latter function causes a RCU stall.
Signed-off-by: Richard Cochran <rcochran@linutronix.de>
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160713153337.566790058@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/time/timer.c')
-rw-r--r-- | kernel/time/timer.c | 25 |
1 files changed, 2 insertions, 23 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index cb9ab401e2d9..555670a5143c 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c | |||
@@ -1804,7 +1804,7 @@ static void migrate_timer_list(struct timer_base *new_base, struct hlist_head *h | |||
1804 | } | 1804 | } |
1805 | } | 1805 | } |
1806 | 1806 | ||
1807 | static void migrate_timers(int cpu) | 1807 | int timers_dead_cpu(unsigned int cpu) |
1808 | { | 1808 | { |
1809 | struct timer_base *old_base; | 1809 | struct timer_base *old_base; |
1810 | struct timer_base *new_base; | 1810 | struct timer_base *new_base; |
@@ -1831,29 +1831,9 @@ static void migrate_timers(int cpu) | |||
1831 | spin_unlock_irq(&new_base->lock); | 1831 | spin_unlock_irq(&new_base->lock); |
1832 | put_cpu_ptr(&timer_bases); | 1832 | put_cpu_ptr(&timer_bases); |
1833 | } | 1833 | } |
1834 | return 0; | ||
1834 | } | 1835 | } |
1835 | 1836 | ||
1836 | static int timer_cpu_notify(struct notifier_block *self, | ||
1837 | unsigned long action, void *hcpu) | ||
1838 | { | ||
1839 | switch (action) { | ||
1840 | case CPU_DEAD: | ||
1841 | case CPU_DEAD_FROZEN: | ||
1842 | migrate_timers((long)hcpu); | ||
1843 | break; | ||
1844 | default: | ||
1845 | break; | ||
1846 | } | ||
1847 | |||
1848 | return NOTIFY_OK; | ||
1849 | } | ||
1850 | |||
1851 | static inline void timer_register_cpu_notifier(void) | ||
1852 | { | ||
1853 | cpu_notifier(timer_cpu_notify, 0); | ||
1854 | } | ||
1855 | #else | ||
1856 | static inline void timer_register_cpu_notifier(void) { } | ||
1857 | #endif /* CONFIG_HOTPLUG_CPU */ | 1837 | #endif /* CONFIG_HOTPLUG_CPU */ |
1858 | 1838 | ||
1859 | static void __init init_timer_cpu(int cpu) | 1839 | static void __init init_timer_cpu(int cpu) |
@@ -1881,7 +1861,6 @@ void __init init_timers(void) | |||
1881 | { | 1861 | { |
1882 | init_timer_cpus(); | 1862 | init_timer_cpus(); |
1883 | init_timer_stats(); | 1863 | init_timer_stats(); |
1884 | timer_register_cpu_notifier(); | ||
1885 | open_softirq(TIMER_SOFTIRQ, run_timer_softirq); | 1864 | open_softirq(TIMER_SOFTIRQ, run_timer_softirq); |
1886 | } | 1865 | } |
1887 | 1866 | ||