From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753410AbcGSH2L (ORCPT ); Tue, 19 Jul 2016 03:28:11 -0400 Received: from terminus.zytor.com ([198.137.202.10]:46368 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752464AbcGSH2I (ORCPT ); Tue, 19 Jul 2016 03:28:08 -0400 Date: Tue, 19 Jul 2016 00:27:29 -0700 From: tip-bot for Richard Cochran Message-ID: Cc: john.stultz@linaro.org, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, hpa@zytor.com, anna-maria@linutronix.de, bigeasy@linutronix.de, peterz@infradead.org, tglx@linutronix.de, oleg@redhat.com, linux@rasmusvillemoes.dk, mingo@kernel.org, rcochran@linutronix.de Reply-To: rcochran@linutronix.de, mingo@kernel.org, anna-maria@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, john.stultz@linaro.org, oleg@redhat.com, linux@rasmusvillemoes.dk, bigeasy@linutronix.de, tglx@linutronix.de, peterz@infradead.org In-Reply-To: <20160713153337.566790058@linutronix.de> References: <20160713153337.566790058@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] timers/core: Convert to hotplug state machine Git-Commit-ID: 24f73b99716a9cd8cbb345c41ced6b3b5ed94006 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 24f73b99716a9cd8cbb345c41ced6b3b5ed94006 Gitweb: http://git.kernel.org/tip/24f73b99716a9cd8cbb345c41ced6b3b5ed94006 Author: Richard Cochran AuthorDate: Wed, 13 Jul 2016 17:16:59 +0000 Committer: Ingo Molnar CommitDate: Fri, 15 Jul 2016 10:41:42 +0200 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 Signed-off-by: Anna-Maria Gleixner Reviewed-by: Sebastian Andrzej Siewior Cc: John Stultz Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Rasmus Villemoes Cc: Thomas Gleixner Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153337.566790058@linutronix.de Signed-off-by: Ingo Molnar --- include/linux/cpuhotplug.h | 1 + include/linux/timer.h | 6 ++++++ kernel/cpu.c | 5 +++++ kernel/time/timer.c | 25 ++----------------------- 4 files changed, 14 insertions(+), 23 deletions(-) diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 04ecc55..15d46d2 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -16,6 +16,7 @@ enum cpuhp_state { CPUHP_X86_APB_DEAD, CPUHP_WORKQUEUE_PREP, CPUHP_HRTIMERS_PREPARE, + CPUHP_TIMERS_DEAD, CPUHP_NOTIFY_PREPARE, CPUHP_BRINGUP_CPU, CPUHP_AP_IDLE_DEAD, diff --git a/include/linux/timer.h b/include/linux/timer.h index 4419506..51d601f 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -273,4 +273,10 @@ unsigned long __round_jiffies_up_relative(unsigned long j, int cpu); unsigned long round_jiffies_up(unsigned long j); unsigned long round_jiffies_up_relative(unsigned long j); +#ifdef CONFIG_HOTPLUG_CPU +int timers_dead_cpu(unsigned int cpu); +#else +#define timers_dead_cpu NULL +#endif + #endif diff --git a/kernel/cpu.c b/kernel/cpu.c index 85500e7..e1017d9 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1195,6 +1195,11 @@ static struct cpuhp_step cpuhp_bp_states[] = { .startup = hrtimers_prepare_cpu, .teardown = hrtimers_dead_cpu, }, + [CPUHP_TIMERS_DEAD] = { + .name = "timers dead", + .startup = NULL, + .teardown = timers_dead_cpu, + }, /* * Preparatory and dead notifiers. Will be replaced once the notifiers * are converted to states. diff --git a/kernel/time/timer.c b/kernel/time/timer.c index cb9ab40..555670a 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 } } -static void migrate_timers(int cpu) +int timers_dead_cpu(unsigned int cpu) { struct timer_base *old_base; struct timer_base *new_base; @@ -1831,29 +1831,9 @@ static void migrate_timers(int cpu) spin_unlock_irq(&new_base->lock); put_cpu_ptr(&timer_bases); } + return 0; } -static int timer_cpu_notify(struct notifier_block *self, - unsigned long action, void *hcpu) -{ - switch (action) { - case CPU_DEAD: - case CPU_DEAD_FROZEN: - migrate_timers((long)hcpu); - break; - default: - break; - } - - return NOTIFY_OK; -} - -static inline void timer_register_cpu_notifier(void) -{ - cpu_notifier(timer_cpu_notify, 0); -} -#else -static inline void timer_register_cpu_notifier(void) { } #endif /* CONFIG_HOTPLUG_CPU */ static void __init init_timer_cpu(int cpu) @@ -1881,7 +1861,6 @@ void __init init_timers(void) { init_timer_cpus(); init_timer_stats(); - timer_register_cpu_notifier(); open_softirq(TIMER_SOFTIRQ, run_timer_softirq); }