mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	"Li, Aubrey" <aubrey.li@linux.intel.com>,
	"Brown, Len" <len.brown@intel.com>,
	Alan Cox <alan@linux.intel.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PM list <linux-pm@vger.kernel.org>
Subject: Re: [Update 2x] Re: [PATCH v3]PM/Sleep: Timer quiesce in freeze state
Date: Tue, 10 Feb 2015 00:57:43 +0100	[thread overview]
Message-ID: <1642165.PhpflFaKUn@vostro.rjw.lan> (raw)
In-Reply-To: <20150209154408.GV5029@twins.programming.kicks-ass.net>

On Monday, February 09, 2015 04:44:08 PM Peter Zijlstra wrote:
> 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.

Well, this check really only replaces one in cpuidle_select() and another
one in cpuidle_reflect() and they both are called from the idle path, so
that's a net gain rather. :-)

> 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.

Agreed.

> 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.

Won't hurt at least.

> > +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?

Yes, it is on purpose and the reason why is because the coupled thing re-enables
interrupts (unconditionally).  [And it contains a comment about that which does
not make sense to me now that I read it.]

I can add a comment about that, though.

> > +       /*
> > +        * 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.

Cool, thanks!


      reply	other threads:[~2015-02-09 23:34 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-09  3:01 Li, Aubrey
2015-01-14  0:24 ` Li, Aubrey
2015-01-19 15:24   ` Rafael J. Wysocki
2015-01-22 10:15     ` Thomas Gleixner
2015-01-26  8:44       ` Li, Aubrey
2015-01-26  9:40         ` Thomas Gleixner
2015-01-26 14:21           ` Rafael J. Wysocki
2015-01-26 14:15             ` Thomas Gleixner
2015-01-26 14:45               ` Rafael J. Wysocki
2015-01-27  7:12                 ` Li, Aubrey
2015-01-26 14:41           ` Rafael J. Wysocki
2015-01-26 14:24             ` Thomas Gleixner
2015-01-26 14:50               ` Rafael J. Wysocki
2015-01-26 14:34                 ` Thomas Gleixner
2015-01-26 15:04                   ` Rafael J. Wysocki
2015-01-27  8:03             ` Li, Aubrey
2015-01-27 15:10               ` Rafael J. Wysocki
2015-01-28  0:17                 ` Li, Aubrey
2015-01-29 22:20           ` Rafael J. Wysocki
2015-02-06  1:20             ` [Update] " Rafael J. Wysocki
2015-02-06 16:14               ` Peter Zijlstra
2015-02-06 18:29                 ` Peter Zijlstra
2015-02-06 22:36                   ` Rafael J. Wysocki
2015-02-09  9:49                     ` Peter Zijlstra
2015-02-09 14:50                       ` Rafael J. Wysocki
2015-02-09  2:54               ` [Update 2x] " Rafael J. Wysocki
2015-02-09 15:20                 ` Peter Zijlstra
2015-02-09 15:44                 ` Peter Zijlstra
2015-02-09 23:57                   ` Rafael J. Wysocki [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1642165.PhpflFaKUn@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=alan@linux.intel.com \
    --cc=aubrey.li@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®