From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752885AbcGSHU7 (ORCPT ); Tue, 19 Jul 2016 03:20:59 -0400 Received: from terminus.zytor.com ([198.137.202.10]:45936 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753016AbcGSHU5 (ORCPT ); Tue, 19 Jul 2016 03:20:57 -0400 Date: Tue, 19 Jul 2016 00:20:11 -0700 From: tip-bot for Richard Cochran Message-ID: Cc: hpa@zytor.com, bigeasy@linutronix.de, tglx@linutronix.de, anna-maria@linutronix.de, rcochran@linutronix.de, linux-kernel@vger.kernel.org, daniel.lezcano@linaro.org, peterz@infradead.org, torvalds@linux-foundation.org, mingo@kernel.org Reply-To: linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, torvalds@linux-foundation.org, daniel.lezcano@linaro.org, hpa@zytor.com, rcochran@linutronix.de, anna-maria@linutronix.de, tglx@linutronix.de, bigeasy@linutronix.de In-Reply-To: <20160713153336.380737946@linutronix.de> References: <20160713153336.380737946@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:smp/hotplug] clocksource/mips-gic: Convert to hotplug state machine Git-Commit-ID: 2dab90932fd08f101a45acc0495ccd77b869da5d 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: 2dab90932fd08f101a45acc0495ccd77b869da5d Gitweb: http://git.kernel.org/tip/2dab90932fd08f101a45acc0495ccd77b869da5d Author: Richard Cochran AuthorDate: Wed, 13 Jul 2016 17:16:44 +0000 Committer: Ingo Molnar CommitDate: Fri, 15 Jul 2016 10:40:26 +0200 clocksource/mips-gic: Convert to hotplug state machine Install the callbacks via the state machine and let the core invoke the callbacks on the already online CPUs. Signed-off-by: Richard Cochran Signed-off-by: Anna-Maria Gleixner Reviewed-by: Sebastian Andrzej Siewior Cc: Daniel Lezcano Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: rt@linutronix.de Link: http://lkml.kernel.org/r/20160713153336.380737946@linutronix.de Signed-off-by: Ingo Molnar --- drivers/clocksource/mips-gic-timer.c | 38 ++++++++++++------------------------ include/linux/cpuhotplug.h | 1 + 2 files changed, 14 insertions(+), 25 deletions(-) diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c index 1572c7a..d91e872 100644 --- a/drivers/clocksource/mips-gic-timer.c +++ b/drivers/clocksource/mips-gic-timer.c @@ -49,10 +49,9 @@ struct irqaction gic_compare_irqaction = { .name = "timer", }; -static void gic_clockevent_cpu_init(struct clock_event_device *cd) +static void gic_clockevent_cpu_init(unsigned int cpu, + struct clock_event_device *cd) { - unsigned int cpu = smp_processor_id(); - cd->name = "MIPS GIC"; cd->features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_C3STOP; @@ -79,19 +78,10 @@ static void gic_update_frequency(void *data) clockevents_update_freq(this_cpu_ptr(&gic_clockevent_device), rate); } -static int gic_cpu_notifier(struct notifier_block *nb, unsigned long action, - void *data) +static int gic_starting_cpu(unsigned int cpu) { - switch (action & ~CPU_TASKS_FROZEN) { - case CPU_STARTING: - gic_clockevent_cpu_init(this_cpu_ptr(&gic_clockevent_device)); - break; - case CPU_DYING: - gic_clockevent_cpu_exit(this_cpu_ptr(&gic_clockevent_device)); - break; - } - - return NOTIFY_OK; + gic_clockevent_cpu_init(cpu, this_cpu_ptr(&gic_clockevent_device)); + return 0; } static int gic_clk_notifier(struct notifier_block *nb, unsigned long action, @@ -105,10 +95,11 @@ static int gic_clk_notifier(struct notifier_block *nb, unsigned long action, return NOTIFY_OK; } - -static struct notifier_block gic_cpu_nb = { - .notifier_call = gic_cpu_notifier, -}; +static int gic_dying_cpu(unsigned int cpu) +{ + gic_clockevent_cpu_exit(this_cpu_ptr(&gic_clockevent_device)); + return 0; +} static struct notifier_block gic_clk_nb = { .notifier_call = gic_clk_notifier, @@ -125,12 +116,9 @@ static int gic_clockevent_init(void) if (ret < 0) return ret; - ret = register_cpu_notifier(&gic_cpu_nb); - if (ret < 0) - pr_warn("GIC: Unable to register CPU notifier\n"); - - gic_clockevent_cpu_init(this_cpu_ptr(&gic_clockevent_device)); - + cpuhp_setup_state(CPUHP_AP_MIPS_GIC_TIMER_STARTING, + "AP_MIPS_GIC_TIMER_STARTING", gic_starting_cpu, + gic_dying_cpu); return 0; } diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index d74d15a..456e3d9 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -40,6 +40,7 @@ enum cpuhp_state { CPUHP_AP_DUMMY_TIMER_STARTING, CPUHP_AP_METAG_TIMER_STARTING, CPUHP_AP_QCOM_TIMER_STARTING, + CPUHP_AP_MIPS_GIC_TIMER_STARTING, CPUHP_AP_KVM_STARTING, CPUHP_AP_NOTIFY_STARTING, CPUHP_AP_ONLINE,