Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1045204AbdDWLnZ (ORCPT ); Sun, 23 Apr 2017 07:43:25 -0400 Received: from terminus.zytor.com ([65.50.211.136]:36337 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1045097AbdDWLnP (ORCPT ); Sun, 23 Apr 2017 07:43:15 -0400 Date: Sun, 23 Apr 2017 04:37:34 -0700 From: tip-bot for Frederic Weisbecker Message-ID: Cc: hartsjc@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@kernel.org, pavel@ucw.cz, fweisbec@gmail.com, tglx@linutronix.de, riel@redhat.com, tim@binbash.co.uk Reply-To: hpa@zytor.com, peterz@infradead.org, linux-kernel@vger.kernel.org, hartsjc@redhat.com, pavel@ucw.cz, mingo@kernel.org, riel@redhat.com, tglx@linutronix.de, fweisbec@gmail.com, tim@binbash.co.uk In-Reply-To: <1492783255-5051-3-git-send-email-fweisbec@gmail.com> References: <1492783255-5051-3-git-send-email-fweisbec@gmail.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/urgent] tick: Make sure tick timer is active when bypassing reprogramming Git-Commit-ID: 22aa2ad45fd8a6ef56eb60038fc0ac7059c0a986 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 Content-Length: 1907 Lines: 50 Commit-ID: 22aa2ad45fd8a6ef56eb60038fc0ac7059c0a986 Gitweb: http://git.kernel.org/tip/22aa2ad45fd8a6ef56eb60038fc0ac7059c0a986 Author: Frederic Weisbecker AuthorDate: Fri, 21 Apr 2017 16:00:55 +0200 Committer: Thomas Gleixner CommitDate: Sun, 23 Apr 2017 13:33:18 +0200 tick: Make sure tick timer is active when bypassing reprogramming So far we have run into too much troubles with the optimization path that skips reprogramming the clock on IRQ exit when the expiration deadline hasn't changed. If by accident the cached deadline happens to be out of sync with the hardware deadline, the buggy result and its cause are hard to investigate. So lets detect and warn about the issue early. Signed-off-by: Frederic Weisbecker Acked-by: Rik van Riel Cc: James Hartsock Cc: Peter Zijlstra Cc: stable@vger.kernel.org Cc: Tim Wright Cc: Pavel Machek Link: http://lkml.kernel.org/r/1492783255-5051-3-git-send-email-fweisbec@gmail.com Signed-off-by: Thomas Gleixner --- kernel/time/tick-sched.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 502b320..be7ca4d 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -783,8 +783,13 @@ static ktime_t tick_nohz_stop_sched_tick(struct tick_sched *ts, tick = expires; /* Skip reprogram of event if its not changed */ - if (ts->tick_stopped && (expires == ts->next_tick)) - goto out; + if (ts->tick_stopped && (expires == ts->next_tick)) { + /* Sanity check: make sure clockevent is actually programmed */ + if (likely(dev->next_event <= ts->next_tick)) + goto out; + + WARN_ON_ONCE(1); + } /* * nohz_stop_sched_tick can be called several times before