Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750966AbdGMEyu (ORCPT ); Thu, 13 Jul 2017 00:54:50 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:46191 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750773AbdGMEys (ORCPT ); Thu, 13 Jul 2017 00:54:48 -0400 Date: Thu, 13 Jul 2017 06:54:35 +0200 (CEST) From: Thomas Gleixner To: "dbasehore ." cc: LKML , Ingo Molnar , Rajneesh Bhardwaj , x86@kernel.org, Platform Driver , "Rafael J . Wysocki" , Len Brown , Linux-pm mailing list , Peter Zijlstra Subject: Re: [PATCH v5 2/5] tick: Add freeze timer events In-Reply-To: Message-ID: References: <20170708000303.21863-1-dbasehore@chromium.org> <20170708000303.21863-2-dbasehore@chromium.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2180 Lines: 62 Derek, On Wed, 12 Jul 2017, dbasehore . wrote: > On Wed, Jul 12, 2017 at 2:25 PM, Thomas Gleixner wrote: > > On Fri, 7 Jul 2017, Derek Basehore wrote: > >> +/* > >> + * Clockevent device may run during freeze > >> + */ > >> +# define CLOCK_EVT_FEAT_FREEZE_NONSTOP 0x000100 > > > > Is that really restricted to freezing? > > I'm not going to make the call on what firmware may do when it enters > suspend. Even if it's not supposed to do anything, it still might. The feature is a description of the hardware capability not of the way how it's used by software. > >> + if (!clockevent_state_shutdown(dev)) { > > > > What puts the device in shutdown mode when the machine is in freeze state? > > tick_freeze does through timekeeping_suspend or tick_suspend_local > depending on whether it's the last CPU to freeze or not. Ok. I completely forgot about the inner workings of freeze. So this check for shutdown actually wants to have a printk, because that's a state which is wrong. The nonavailability of oneshot mode is just factual information that this is not possible and does not justify dmesg spam. > >> + clockevents_tick_resume(dev); > > > > That looks wrong as well. What did call suspend on that device? > > > > I'm not aware that freeze will actually call suspend on anything down deep > > in the core code. Can you please explain this magic here? > > tick_freeze in tick-common.c calls the tick suspend code. Fair enough. > > All of this lacks an explanation how any of this is safe vs. the normal > > operation of clock event devices and the tick device code. > > > > This lacks documentation of calling conventions and checks which make sure > > they are obeyed. > > If I get rid of passing in the cpu id, the only thing left to check > seems to be making sure that tick_clear_freeze_event is called on the > same CPU as tick_set_freeze_event. Yes, you want to store that information somewhere. > Am I missing something? I'll add Documentation. Please make that whole thing depend on a Kconfig option. There is no point having the code and the exports there for everyone while it has only a single user. Thanks, tglx