From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932708AbdJXKNO (ORCPT ); Tue, 24 Oct 2017 06:13:14 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:51704 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932410AbdJXKNL (ORCPT ); Tue, 24 Oct 2017 06:13:11 -0400 Date: Tue, 24 Oct 2017 12:13:06 +0200 (CEST) From: Thomas Gleixner To: Sodagudi Prasad cc: mingo@kernel.org, viresh.kumar@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Clockevents: Always call clockevents_program_event In-Reply-To: Message-ID: References: <664eaf79d594e82c2b3fb736f7c1a50f@codeaurora.org> <1508832388-30929-1-git-send-email-psodagud@codeaurora.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Oct 2017, Sodagudi Prasad wrote: > On 2017-10-24 01:37, Thomas Gleixner wrote: > > On Tue, 24 Oct 2017, Prasad Sodagudi wrote: > > > > > Currently tick_program_event function is not calling > > > clockevents_program_event when 'expires == KTIME_MAX', > > > it is just updating clockevent state to CLOCK_EVT_STATE_ONESHOT_STOPPED. > > > clockevents_program_event function updates clockevent > > > device next_event by checking clockevent device state, > > > so always call clockevents_program_event() from tick_program_event. > > > > No. This is fundmentally wrong. If the clockevent is in oneshot stopped > > mode then you cannot call clockevents_program_event(). There is even a > > warning in that code which will trigger. > > Yes. There is warning and I overlooked at that part of the code and > thought > it would return from the clockevents_program_event function after next_event > update. > dev->next_event = expires; > > if (clockevent_state_shutdown(dev)) > return 0; > > Thanks tglx for reviewing patch. > > How to clean next next_event from clockevent device in the ONESHOT_STOPPED > state from tick_program_event()? > > Shall I update the next patch set with following condition? Or Any other > suggestions to fix this path? > > diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c > index 4237e07..21104b6 100644 > --- a/kernel/time/clockevents.c > +++ b/kernel/time/clockevents.c > @@ -317,7 +317,8 @@ int clockevents_program_event(struct clock_event_device > *dev, ktime_t expires, > > dev->next_event = expires; > > - if (clockevent_state_shutdown(dev)) > + if (clockevent_state_shutdown(dev) || > + clockevent_state_oneshot_stopped(dev)) > return 0; This needs more thought than that. Thanks, tglx