From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757848AbbBFWNR (ORCPT ); Fri, 6 Feb 2015 17:13:17 -0500 Received: from v094114.home.net.pl ([79.96.170.134]:58550 "HELO v094114.home.net.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1757455AbbBFWNO (ORCPT ); Fri, 6 Feb 2015 17:13:14 -0500 From: "Rafael J. Wysocki" To: Peter Zijlstra Cc: Thomas Gleixner , "Li, Aubrey" , "Brown, Len" , Alan Cox , LKML , Linux PM list Subject: Re: [Update] Re: [PATCH v3]PM/Sleep: Timer quiesce in freeze state Date: Fri, 06 Feb 2015 23:36:12 +0100 Message-ID: <1684745.qMDN6HIHc8@vostro.rjw.lan> User-Agent: KMail/4.11.5 (Linux/3.16.0-rc5+; KDE/4.11.5; x86_64; ; ) In-Reply-To: <20150206182922.GN24151@twins.programming.kicks-ass.net> References: <54866625.8010406@linux.intel.com> <20150206161454.GQ21418@twins.programming.kicks-ass.net> <20150206182922.GN24151@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday, February 06, 2015 07:29:22 PM Peter Zijlstra wrote: > On Fri, Feb 06, 2015 at 05:14:54PM +0100, Peter Zijlstra wrote: > > On Fri, Feb 06, 2015 at 02:20:13AM +0100, Rafael J. Wysocki wrote: > > > void freeze_wake(void) > > > { > > > + unsigned long flags; > > > + > > > + spin_lock_irqsave(&suspend_freeze_lock, flags); > > > + if (suspend_freeze_state > FREEZE_STATE_NONE) { > > > + suspend_freeze_state = FREEZE_STATE_WAKE; > > > + wake_up(&suspend_freeze_wait_head); > > > + } > > > + spin_unlock_irqrestore(&suspend_freeze_lock, flags); > > > } > > > > > > > +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); > > > + /* > > > + * 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()); > > > +} > > > > So I'm a wee bit confused; if we use an enter_freeze() state that keeps > > interrupts disabled; who is going to call the freeze_wake() thing? > > Ah, I think I see, so we wake up, keep the interrupt pending, re-enable > the tick and time and everybody, then re-enable interrupts, take the > interrupt and go around the idle loop to find we need a reschedule etc.. Exactly.