From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932169AbdJXJVc (ORCPT ); Tue, 24 Oct 2017 05:21:32 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:52500 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751323AbdJXJV1 (ORCPT ); Tue, 24 Oct 2017 05:21:27 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 24 Oct 2017 02:21:26 -0700 From: Sodagudi Prasad To: Thomas Gleixner 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: References: <664eaf79d594e82c2b3fb736f7c1a50f@codeaurora.org> <1508832388-30929-1-git-send-email-psodagud@codeaurora.org> Message-ID: User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; > > Thanks, > > tglx -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, Linux Foundation Collaborative Project