From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932662AbbGGROi (ORCPT ); Tue, 7 Jul 2015 13:14:38 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36408 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757746AbbGGROZ (ORCPT ); Tue, 7 Jul 2015 13:14:25 -0400 Date: Tue, 7 Jul 2015 10:13:52 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: mingo@kernel.org, Catalin.Marinas@arm.com, Suzuki.Poulose@arm.com, peterz@infradead.org, Lorenzo.Pieralisi@arm.com, tglx@linutronix.de, hpa@zytor.com, sudeep.holla@arm.com, preeti@linux.vnet.ibm.com, rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org Reply-To: Suzuki.Poulose@arm.com, peterz@infradead.org, Catalin.Marinas@arm.com, mingo@kernel.org, linux-kernel@vger.kernel.org, rafael.j.wysocki@intel.com, preeti@linux.vnet.ibm.com, sudeep.holla@arm.com, hpa@zytor.com, Lorenzo.Pieralisi@arm.com, tglx@linutronix.de In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/urgent] tick/broadcast: Move the check for periodic mode inside state handling Git-Commit-ID: e3ac79e087ffe8a1f953ed44a74acf7616cb0b25 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: e3ac79e087ffe8a1f953ed44a74acf7616cb0b25 Gitweb: http://git.kernel.org/tip/e3ac79e087ffe8a1f953ed44a74acf7616cb0b25 Author: Thomas Gleixner AuthorDate: Tue, 7 Jul 2015 16:38:11 +0200 Committer: Thomas Gleixner CommitDate: Tue, 7 Jul 2015 18:46:47 +0200 tick/broadcast: Move the check for periodic mode inside state handling We need to check more than the periodic mode for proper operation in all runtime combinations. To avoid code duplication move the check into the enter state handling. No functional change. [ Split out from a larger combo patch ] Reported-and-tested-by: Sudeep Holla Signed-off-by: Thomas Gleixner Cc: Suzuki Poulose Cc: Lorenzo Pieralisi Cc: Catalin Marinas Cc: Rafael J. Wysocki Cc: Peter Zijlstra Cc: Preeti U Murthy Cc: Ingo Molnar Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1507070929360.3916@nanos --- kernel/time/tick-broadcast.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index fad3f78..83aa92e 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -688,7 +688,6 @@ static void broadcast_shutdown_local(struct clock_event_device *bc, int __tick_broadcast_oneshot_control(enum tick_broadcast_state state) { struct clock_event_device *bc, *dev; - struct tick_device *td; int cpu, ret = 0; ktime_t now; @@ -699,25 +698,20 @@ int __tick_broadcast_oneshot_control(enum tick_broadcast_state state) if (!tick_broadcast_device.evtdev) return -EBUSY; - /* - * Periodic mode does not care about the enter/exit of power - * states - */ - if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) - return 0; - - /* - * We are called with preemtion disabled from the depth of the - * idle code, so we can't be moved away. - */ - td = this_cpu_ptr(&tick_cpu_device); - dev = td->evtdev; + dev = this_cpu_ptr(&tick_cpu_device)->evtdev; raw_spin_lock(&tick_broadcast_lock); bc = tick_broadcast_device.evtdev; cpu = smp_processor_id(); if (state == TICK_BROADCAST_ENTER) { + /* + * If the broadcast device is in periodic mode, we + * return. + */ + if (tick_broadcast_device.mode == TICKDEV_MODE_PERIODIC) + goto out; + if (!cpumask_test_and_set_cpu(cpu, tick_broadcast_oneshot_mask)) { WARN_ON_ONCE(cpumask_test_cpu(cpu, tick_broadcast_pending_mask)); broadcast_shutdown_local(bc, dev);