From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933382AbbBIPoT (ORCPT ); Mon, 9 Feb 2015 10:44:19 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:39477 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932684AbbBIPoR (ORCPT ); Mon, 9 Feb 2015 10:44:17 -0500 Date: Mon, 9 Feb 2015 16:44:08 +0100 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: Thomas Gleixner , "Li, Aubrey" , "Brown, Len" , Alan Cox , LKML , Linux PM list Subject: Re: [Update 2x] Re: [PATCH v3]PM/Sleep: Timer quiesce in freeze state Message-ID: <20150209154408.GV5029@twins.programming.kicks-ass.net> References: <54866625.8010406@linux.intel.com> <16564156.c5NBzjJuA3@vostro.rjw.lan> <2439333.L8nfGI3YZp@vostro.rjw.lan> <8924978.aOrU4231JI@vostro.rjw.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8924978.aOrU4231JI@vostro.rjw.lan> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 09, 2015 at 03:54:22AM +0100, Rafael J. Wysocki wrote: > Complete patch with that modification is appended. In the next few days I'm > going to split it into smaller parts and send along with cpuidle driver > patches implementing ->enter_freeze. > > Please let me know what you think. > @@ -104,6 +105,21 @@ static void cpuidle_idle_call(void) > rcu_idle_enter(); > > /* > + * Suspend-to-idle ("freeze") is a system state in which all user space > + * has been frozen, all I/O devices have been suspended and the only > + * activity happens here and in iterrupts (if any). In that case bypass > + * the cpuidle governor and go stratight for the deepest idle state > + * available. Possibly also suspend the local tick and the entire > + * timekeeping to prevent timer interrupts from kicking us out of idle > + * until a proper wakeup interrupt happens. > + */ > + if (idle_should_freeze()) { > + cpuidle_enter_freeze(); > + local_irq_enable(); > + goto exit_idle; > + } > + > + /* > * Ask the cpuidle framework to choose a convenient idle state. > * Fall back to the default arch idle method on errors. > */ I was hoping to not have to put that into the regular idle path; say maybe share a single special branch with the play-dead call. People seem to start complaining about the total amount of time it takes to just 'run' the idle path. Now I don't think we can do that, because we need the arch_cpu_idle_enter() nonsense for the one but not the other; also all this really only makes sense in the cpuidle context, so nothing to be done about that. In any case, you could make that: static inline bool idle_should_freeze(void) { return unlikely(suspend_freeze_state == FREEZE_STATE_ENTER); } which should help a bit I suppose. > +static void enter_freeze_proper(struct cpuidle_driver *drv, > + struct cpuidle_device *dev, int index) > +{ > + tick_freeze(); > + drv->states[index].enter_freeze(dev, drv, index); This is slightly different from cpuidle_enter() in that it does not consider the coupled states nonsense, is that on purpose? And if so, does that want a comment? > + /* > + * timekeeping_resume() that will be called by tick_unfreeze() for the > + * last CPU executing it calls functions containing RCU read-side > + * critical sections, so tell RCU about that. > + */ > + RCU_NONIDLE(tick_unfreeze()); > +} But over all it looks fine to me.