From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932570AbbGGRN2 (ORCPT ); Tue, 7 Jul 2015 13:13:28 -0400 Received: from terminus.zytor.com ([198.137.202.10]:36367 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932555AbbGGRNV (ORCPT ); Tue, 7 Jul 2015 13:13:21 -0400 Date: Tue, 7 Jul 2015 10:12:34 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: Suzuki.Poulose@arm.com, preeti@linux.vnet.ibm.com, hpa@zytor.com, tglx@linutronix.de, sudeep.holla@arm.com, peterz@infradead.org, Catalin.Marinas@arm.com, mingo@kernel.org, Lorenzo.Pieralisi@arm.com, rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org Reply-To: mingo@kernel.org, Catalin.Marinas@arm.com, Lorenzo.Pieralisi@arm.com, rafael.j.wysocki@intel.com, linux-kernel@vger.kernel.org, Suzuki.Poulose@arm.com, hpa@zytor.com, preeti@linux.vnet.ibm.com, tglx@linutronix.de, sudeep.holla@arm.com, peterz@infradead.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/urgent] tick/broadcast: Prevent hrtimer recursion Git-Commit-ID: 8eb231261fdd20768db23863d00ef277de4b0543 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: 8eb231261fdd20768db23863d00ef277de4b0543 Gitweb: http://git.kernel.org/tip/8eb231261fdd20768db23863d00ef277de4b0543 Author: Thomas Gleixner AuthorDate: Tue, 7 Jul 2015 14:11:00 +0200 Committer: Thomas Gleixner CommitDate: Tue, 7 Jul 2015 18:46:47 +0200 tick/broadcast: Prevent hrtimer recursion The hrtimer based broadcast vehicle can cause a hrtimer recursion which went unnoticed until we changed the hrtimer expiry code to keep track of the currently running timer. local_timer_interrupt() local_handler() hrtimer_interrupt() expire_hrtimers() broadcast_hrtimer() send_ipis() local_handler() hrtimer_interrupt() .... Solution is simple: Prevent the local handler call from the broadcast code when the broadcast 'device' is hrtimer based. [ Split out from a larger combo patch ] 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 | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index d39f32c..a762040 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -265,8 +265,22 @@ static bool tick_do_broadcast(struct cpumask *mask) * Check, if the current cpu is in the mask */ if (cpumask_test_cpu(cpu, mask)) { + struct clock_event_device *bc = tick_broadcast_device.evtdev; + cpumask_clear_cpu(cpu, mask); - local = true; + /* + * We only run the local handler, if the broadcast + * device is not hrtimer based. Otherwise we run into + * a hrtimer recursion. + * + * local timer_interrupt() + * local_handler() + * expire_hrtimers() + * bc_handler() + * local_handler() + * expire_hrtimers() + */ + local = !(bc->features & CLOCK_EVT_FEAT_HRTIMER); } if (!cpumask_empty(mask)) {