From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH 4/6] PM / sleep: Make it possible to quiesce timers during suspend-to-idle Date: Thu, 12 Feb 2015 14:24:47 +0100 Message-ID: <20150212132447.GX23123@twins.programming.kicks-ass.net> References: <8292243.ibkmfVtXac@vostro.rjw.lan> <3761728.YL7DDdWRW2@vostro.rjw.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from bombadil.infradead.org ([198.137.202.9]:43824 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750912AbbBLNY4 (ORCPT ); Thu, 12 Feb 2015 08:24:56 -0500 Content-Disposition: inline In-Reply-To: <3761728.YL7DDdWRW2@vostro.rjw.lan> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: "Rafael J. Wysocki" Cc: Thomas Gleixner , Alan Cox , "Li, Aubrey" , LKML , Linux PM list , ACPI Devel Maling List , Kristen Carlson Accardi , John Stultz , Len Brown On Wed, Feb 11, 2015 at 05:03:44AM +0100, Rafael J. Wysocki wrote: > Index: linux-pm/include/linux/cpuidle.h > =================================================================== > --- linux-pm.orig/include/linux/cpuidle.h > +++ linux-pm/include/linux/cpuidle.h > @@ -50,6 +50,10 @@ struct cpuidle_state { > int index); > > int (*enter_dead) (struct cpuidle_device *dev, int index); Do we want a comment here describing that enter_freeze() must not re-enable interrupts _ever_? To help people who want to enable this on their platform. > + > + void (*enter_freeze) (struct cpuidle_device *dev, > + struct cpuidle_driver *drv, > + int index); > }; > +static void enter_freeze_proper(struct cpuidle_driver *drv, > + struct cpuidle_device *dev, int index) > +{ > + tick_freeze(); > + /* > + * The state used here cannot be a "coupled" one, because the "coupled" > + * cpuidle mechanism enables interrupts and doing that with timekeeping > + * suspended is generally unsafe. > + */ > + drv->states[index].enter_freeze(dev, drv, index); WARN_ON(!irqs_disabled()); To go along with the comment and catch fail? > + /* > + * 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()); > +}