From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751508AbdJXHXS (ORCPT ); Tue, 24 Oct 2017 03:23:18 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:50890 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750868AbdJXHXR (ORCPT ); Tue, 24 Oct 2017 03:23:17 -0400 Date: Tue, 24 Oct 2017 09:23:08 +0200 (CEST) From: Thomas Gleixner To: Sodagudi Prasad cc: viresh.kumar@linaro.org, fweisbec@gmail.com, mingo@kernel.org, linux-kernel@vger.kernel.org Subject: =?ISO-8859-7?Q?Re=3A_clock_event_device=A2s_next=5Fevent?= In-Reply-To: <7c5ccef0fe45286324f5bf80eb3635c3@codeaurora.org> Message-ID: References: <7c5ccef0fe45286324f5bf80eb3635c3@codeaurora.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="8323329-339643557-1508829792=:2369" 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 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-339643557-1508829792=:2369 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT On Mon, 23 Oct 2017, Sodagudi Prasad wrote: > Hi Viresh and Thomas, > > In the functions tick_nohz_stop_sched_tick(), when expires = KTIME_MAX we are > canceling the tick_sched_timer timer but we are not updating the clock event > device’s next_event to KTIME_MAX. > Due to that broadcast device’s next_event is not programmed properly and > resulting unnecessary wakeups for this cpu. > > /* > * If the expiration time == KTIME_MAX, then we simply stop > * the tick timer. > */ > if (unlikely(expires == KTIME_MAX)) { > if (ts->nohz_mode == NOHZ_MODE_HIGHRES) > hrtimer_cancel(&ts->sched_timer); > goto out; > } Right, because this code does not have access to the broadcast device at all. It doesn't even know and care about it. > After digging further, I see that following call flow is updating > tick_cpu_device state to shutdown state but clock event device next_event is > not updated to KTIME_MAX. > hrtimer_cancel -> __remove_hrtimer -> hrtimer_force_reprogram -> > tick_program_event. > > int tick_program_event(ktime_t expires, int force) > { > struct clock_event_device *dev = > __this_cpu_read(tick_cpu_device.evtdev); > > if (unlikely(expires == KTIME_MAX)) { > /* > * We don't need the clock event device any more, stop it. > */ > clockevents_switch_state(dev, > CLOCK_EVT_STATE_ONESHOT_STOPPED); > return 0; > } > In the above tick_program_event() function clock event device’s next_event is > not getting updated as clockevents_program_event() function not called after > state update. If the device is shutdown, then next_event does not matter. But yes, for consistency reasons we could set it to KTIME_MAX. Thanks, tglx --8323329-339643557-1508829792=:2369--