Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756977AbcDGQ6m (ORCPT ); Thu, 7 Apr 2016 12:58:42 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:38187 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756741AbcDGQ6k (ORCPT ); Thu, 7 Apr 2016 12:58:40 -0400 Date: Thu, 7 Apr 2016 17:58:35 +0100 From: Daniel Lezcano To: Chris Metcalf Cc: Gilad Ben Yossef , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andrew Morton , Rik van Riel , Tejun Heo , Frederic Weisbecker , Thomas Gleixner , "Paul E. McKenney" , Christoph Lameter , Viresh Kumar , Catalin Marinas , Will Deacon , Andy Lutomirski , linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 09/13] arm, tile: turn off timer tick for oneshot_stopped state Message-ID: <20160407165835.GD9188@linaro.org> References: <1459877922-15512-1-git-send-email-cmetcalf@mellanox.com> <1459877922-15512-10-git-send-email-cmetcalf@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1459877922-15512-10-git-send-email-cmetcalf@mellanox.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1616 Lines: 31 On Tue, Apr 05, 2016 at 01:38:38PM -0400, Chris Metcalf wrote: > When the schedule tick is disabled in tick_nohz_stop_sched_tick(), > we call hrtimer_cancel(), which eventually calls down into > __remove_hrtimer() and thus into hrtimer_force_reprogram(). > That function's call to tick_program_event() detects that > we are trying to set the expiration to KTIME_MAX and calls > clockevents_switch_state() to set the state to ONESHOT_STOPPED, > and returns. See commit 8fff52fd5093 ("clockevents: Introduce > CLOCK_EVT_STATE_ONESHOT_STOPPED state") for more background. > > However, by default the internal __clockevents_switch_state() code > doesn't have a "set_state_oneshot_stopped" function pointer for > the arm_arch_timer or tile clock_event_device structures, so that > code returns -ENOSYS, and we end up not setting the state, and more > importantly, we don't actually turn off the hardware timer. > As a result, the timer tick we were waiting for before is still > queued, and fires shortly afterwards, only to discover there was > nothing for it to do, at which point it quiesces. > > The fix is to provide that function pointer field, and like the > other function pointers, have it just turn off the timer interrupt. > Any call to set a new timer interval will properly re-enable it. > > This fix avoids a small performance hiccup for regular applications, > but for TASK_ISOLATION code, it fixes a potentially serious > kernel timer interruption to the time-sensitive application. > > Signed-off-by: Chris Metcalf > --- Acked-by: Daniel Lezcano