Received: by 10.223.164.221 with SMTP id h29csp40480wrb; Fri, 3 Nov 2017 10:08:01 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TBK1ssTusu7bhqkRqggqIY3ozwT9rPLXaASO/76nr6I0A4Pwl6j+kkCGrAa+BvtW6c4zy0 X-Received: by 10.99.144.65 with SMTP id a62mr7991786pge.429.1509728880939; Fri, 03 Nov 2017 10:08:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509728880; cv=none; d=google.com; s=arc-20160816; b=YYrNxK1b+q/43/YDIs+qkWFVOkOKWFW/GUFQ0hxSrC8GjjUeIWbpGsENFCZ3wxxuK0 CbZYryh4pD+8R4LlpPUFNg4lLG9XsADaIiKvn9Sz2Wr6MH/wY50ja/ZWhYEfmcIK4ohi pjbGJdALQ5mDywbrzr/WWI6zGuoMAXZYqRD3cD51kxvOtORjXQDIrVt3qllsg9ThmzKo R+3iAngZtk/QP9RdEQVGLUD5UfSHA7FgKaP23IDxoT6gU5BpLkLwY+K5nRxhBXwpE/TQ 2ozRnxof9gZC2cJSItQc5tyW4eBC1vzxrD6nx766NlU26guUGfVybNbn5Fl30utb0vxU 2QTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=eqtpa2bkx+qctf3NS+A9axbCvdy9FNtV/KCMpCN26xk=; b=tbhOrBVlgXg849ecgx8ZrPQI1QTM60Mpgz5ha+mYWHMdUS+POZ7oEBVvc2Lx53/Aau mK9OJNEgb0aM4/RMx1PTfSVxL+KHcVjAGjICiSFRhkK0JIfZfLNaQSR+Mh6dvZneqYWF pB/UdlhLJ4+xfqYM9KT2r73wGj7uv1DPZZyjuD6xw1NNJXF/DYtLcJw5P83YhTwIJDen fGkIfzVnx2809d1vcg9q8M5K1qRZsAkSY1sGFPqQlro0JhEmA2osciYU02R7CDG4c0s+ j/tfl31BuHx6U5xYf55tOJ0uYjdjCYSCq9ZMHZLi8oRGLqaNJkVY60GkSoHXE5EkeWLr 6yjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si7076979pfk.204.2017.11.03.10.07.47; Fri, 03 Nov 2017 10:08:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mellanox.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756349AbdKCRGd (ORCPT + 93 others); Fri, 3 Nov 2017 13:06:33 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:56564 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932312AbdKCRFT (ORCPT ); Fri, 3 Nov 2017 13:05:19 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from cmetcalf@mellanox.com) with ESMTPS (AES256-SHA encrypted); 3 Nov 2017 19:05:14 +0200 Received: from ld-1.internal.tilera.com (ld-1.internal.tilera.com [10.15.7.41]) by mtbu-labmail01.internal.tilera.com (8.14.4/8.14.4) with ESMTP id vA3H5CXY008361; Fri, 3 Nov 2017 13:05:12 -0400 Received: (from cmetcalf@localhost) by ld-1.internal.tilera.com (8.14.7/8.13.8/Submit) id vA3H5CK8010526; Fri, 3 Nov 2017 13:05:12 -0400 From: Chris Metcalf To: 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 , Daniel Lezcano , Mark Rutland , Marc Zyngier , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Chris Metcalf Subject: [PATCH v16 12/13] arm, tile: turn off timer tick for oneshot_stopped state Date: Fri, 3 Nov 2017 13:04:51 -0400 Message-Id: <1509728692-10460-13-git-send-email-cmetcalf@mellanox.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1509728692-10460-1-git-send-email-cmetcalf@mellanox.com> References: <1509728692-10460-1-git-send-email-cmetcalf@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- arch/tile/kernel/time.c | 1 + drivers/clocksource/arm_arch_timer.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c index f74f10d827fa..afca6fe496c8 100644 --- a/arch/tile/kernel/time.c +++ b/arch/tile/kernel/time.c @@ -163,6 +163,7 @@ static DEFINE_PER_CPU(struct clock_event_device, tile_timer) = { .set_next_event = tile_timer_set_next_event, .set_state_shutdown = tile_timer_shutdown, .set_state_oneshot = tile_timer_shutdown, + .set_state_oneshot_stopped = tile_timer_shutdown, .tick_resume = tile_timer_shutdown, }; diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index fd4b7f684bd0..61ea7f907c56 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -722,6 +722,8 @@ static void __arch_timer_setup(unsigned type, } } + clk->set_state_oneshot_stopped = clk->set_state_shutdown; + clk->set_state_shutdown(clk); clockevents_config_and_register(clk, arch_timer_rate, 0xf, 0x7fffffff); -- 2.1.2 From 1582923605583912172@xxx Thu Nov 02 03:33:07 +0000 2017 X-GM-THRID: 1582873868372186384 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread