Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032857AbdDTX1y (ORCPT ); Thu, 20 Apr 2017 19:27:54 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33879 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S948046AbdDTX1u (ORCPT ); Thu, 20 Apr 2017 19:27:50 -0400 Date: Fri, 21 Apr 2017 01:27:47 +0200 From: Frederic Weisbecker To: Thomas Gleixner Cc: Ingo Molnar , LKML , Peter Zijlstra , Rik van Riel , James Hartsock , stable@vger.kernel.org, Tim Wright , Pavel Machek Subject: Re: [PATCH 2/2] tick: Make sure tick timer is active when bypassing reprogramming Message-ID: <20170420232746.GF25160@lerouge> References: <1492702230-28462-1-git-send-email-fweisbec@gmail.com> <1492702230-28462-3-git-send-email-fweisbec@gmail.com> <20170420182900.GE25160@lerouge> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1399 Lines: 48 On Thu, Apr 20, 2017 at 09:40:12PM +0200, Thomas Gleixner wrote: > On Thu, 20 Apr 2017, Frederic Weisbecker wrote: > > On Thu, Apr 20, 2017 at 07:56:22PM +0200, Thomas Gleixner wrote: > > > > /* Skip reprogram of event if its not changed */ > > > > - if (ts->tick_stopped && (expires == ts->next_tick)) > > > > + if (ts->tick_stopped && (expires == ts->next_tick)) { > > > > + WARN_ON_ONCE(dev->next_event > ts->next_tick); > > > > > > What about handling it proper ? dev->next_event might be KTIME_MAX, > > > i.e. no more event for the next 500+ years. > > > > I thought I handled this case, what I'm I missing? > > if (ts->tick_stopped && (expires == ts->next_tick)) { > WARN_ON_ONCE(dev->next_event > ts->next_tick); > goto out; > } > > IOW, the WARN_ON yells in dmesg, but despite seing the wreckage it just > leaves it and goes out doing nothing. > > Why can't you just do > > if (ts->tick_stopped && (expires == ts->next_tick)) { > if (dev->next_event > ts->next_tick)) { > WARN_ONCE(); > do_something_sensible(); > } > goto out; > } > > Hmm? Ah ok, right! So something like this: if (ts->tick_stopped && (expires == ts->next_tick)) { if (likely(dev->next_event <= ts->next_tick)) goto out; WARN_ON_ONCE(1); } So that we fall down to clock reprogramming if the sanity check fails. I'm resending the patches. Thanks.