ksummit.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: NeilBrown <neilb@suse.com>
Cc: Pavel Machek <pavel@ucw.cz>,
	ksummit-discuss@lists.linuxfoundation.org,
	kyungmin.park@samsung.com, John Stultz <john.stultz@linaro.org>,
	Bjorn Andersson <Bjorn.Andersson@sonymobile.com>
Subject: Re: [Ksummit-discuss] [CORE TOPIC] Mainline kernel on a cellphone
Date: Thu, 30 Jul 2015 02:57:17 +0200	[thread overview]
Message-ID: <2904825.6WZJacWC6y@vostro.rjw.lan> (raw)
In-Reply-To: <20150730095903.5cb431a4@noble>

On Thursday, July 30, 2015 09:59:03 AM NeilBrown wrote:
> On Thu, 30 Jul 2015 01:23:21 +0200 "Rafael J. Wysocki"
> <rjw@rjwysocki.net> wrote:
> 
> > On Wednesday, July 29, 2015 02:51:22 AM Rafael J. Wysocki wrote:
> > > On Wednesday, July 29, 2015 08:03:50 AM NeilBrown wrote:
> > > > On Sat, 25 Jul 2015 00:26:03 +0200 "Rafael J. Wysocki"
> > > > <rjw@rjwysocki.net> wrote:
> > > > 
> > > > > On Thursday, July 23, 2015 11:00:49 PM Tony Lindgren wrote:
> > > > > > * NeilBrown <neilb@suse.com> [150723 21:37]:
> > > > > > > On Thu, 23 Jul 2015 22:34:29 +0200 Pavel Machek <pavel@ucw.cz> wrote:
> > > > > > > > 
> > > > > > > > and the big one... for Android people (not me):
> > > > > > > > 
> > > > > > > > 6) do we need to use s2ram (and then pretend phone is not suspended)
> > > > > > > > to save power on cellphones? If so, do we need new interface for
> > > > > > > > applications to signal "I'd really like to run"?
> > > > > > > > 
> > > > > > > 
> > > > > > > For the first half of this question, the answer is:
> > > > > > >  Probably not.  runtime-pm should be able to put all devices to sleep,
> > > > > > >   and cgroup freezer should be able to freeze untrusted processes.
> > > > > > 
> > > > > > Yes s2ram is just an additional tool. PM runtime alone can
> > > > > > already provide a reasonable battery life for a phone as long as
> > > > > > it's properly implemented and the hardware supports it. With
> > > > > > reasonable battery life in this case I mean over 10 days in idle
> > > > > > mode with system running and timers working.
> > > > > > 
> > > > > > >  But I suspect runtime-pm doesn't provide as much power saving as
> > > > > > >  system suspend, and using the cgroup freezer means lots of changes to
> > > > > > >  userspace.
> > > > > > >  So lots of work would be needed to meet this goal, if it is a
> > > > > > >  worthwhile goal.
> > > > > > 
> > > > > > And with s2ram the difference is that then the system is not running
> > > > > > and timers don't work so it really needs to be optional.
> > > > > 
> > > > > Right.
> > > > > 
> > > > > Even with suspend-to-idle we can get less energy usage with respect to
> > > > > runtime idle (device runtime PM plus cpuidle) just because timer events
> > > > > are disabled then.
> > > > > 
> > > > 
> > > > Is this just the timer interrupt which keeps the clock up to date, or
> > > > are there other timer events which keep ticking?
> > > 
> > > The other events mostly.
> > > 
> > > > Would it be possible for the wall-clock timer to stop if the system
> > > > has been idle for a while, and for the RTC to be used to recover the
> > > > correct time when activity restarts?
> > > 
> > > We use that mechanism in suspend-to-idle, but it requires the timekeeping
> > > to be frozen.  I don't think it would be possible to do that for runtime
> > > idle without races, though.
> > 
> > Moreover, the "if the system has been idle for a while" condition is not really
> > in line with how runtime idle works.  Namely, it works by predicting how much
> > time the given CPU will be idle (on the basis of when the next timer event
> > for it is scheduled among other things) and selecting an idle state for it
> > to go to in accordance with that.  So we know upfront how much time the CPU
> > will be idle (at least roughly) and we rely on timer events to wake up CPUs
> > from idle states.
> > 
> > In the suspend-to-idle case we only need to care about events from devices
> > explicitly enabled to wake up the system from sleep and that's why we can safely
> > suspend the timekeeping then.
> > 
> 
> Thanks ... this actually helps me understand the point of
> suspend-to-idle which didn't really make a lot of sense to me before
> (though it entirely possible that I'm still missing some bits).
> 
> A while ago (years?) there was a debate about whether it was really
> sensible/necessary to use system suspend to save power.  This was in
> the context of Android and suspend-blocker/wake-locks.  One school of
> thought was that with sufficient runtime-PM and appropriate controls of
> user-space processes, system-wide suspend was not necessary.
> 
> You seem to be saying that timer-interrupts are the deal-breaker.

Yes, they are.

> The only way to stop timer interrupts indefinitely is using some sort of
> system-wide suspend, whether suspend-to-RAM or suspend-to-idle.

Right.

> While it may be possible to achieve significant power savings without
> using system-wide suspend, there is a limit and system-wide suspend
> will always allow better savings.
> 
> Would that be correct?  If so: it is nice to have a clear answer -
> thanks.

Yes, that's correct.

Essentially, what happens is that runtime PM allows us to reach the state
in which the system draws as little power as in suspend-to-idle, but it
simply doesn't allow the system to stay in that state long enough in one
go due to timer interrupts (and possibly other types of interrupt noice
that is suppressed by suspending all devices).

Since energy is the power drawn in a given state times the time spent in that
state (on the average), that's why the system in suspend-to-idle uses less
energy than it would with runtime idle during the same period (modulo the
energy spent on suspending and resuming devices etc, of course).

Thanks,
Rafael

  reply	other threads:[~2015-07-30  0:30 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 10:57 Pavel Machek
2015-07-23 11:21 ` Linus Walleij
2015-07-23 12:14   ` Pavel Machek
2015-07-23 12:42     ` Steven Rostedt
2015-07-23 15:40       ` Mark Brown
2015-07-28 22:09         ` Tim Bird
2015-07-28 23:07           ` Bjorn Andersson
2015-07-31 16:18             ` Rob Herring
2015-07-31 16:56               ` Bjorn Andersson
2015-08-11  9:34                 ` Johannes Berg
2015-07-31 17:25               ` Tim Bird
2015-08-03 15:29                 ` John W. Linville
2015-08-03  7:42               ` Linus Walleij
2015-08-03 21:34                 ` Rob Herring
2015-08-03 22:36                   ` Marcel Holtmann
2015-08-05  8:40                     ` Linus Walleij
2015-08-05  8:46                       ` Linus Walleij
2015-08-05  9:11                         ` Samuel Ortiz
2015-08-05 11:54                         ` Pavel Machek
2015-08-05  9:09                       ` Samuel Ortiz
2015-08-05 17:19                       ` Marcel Holtmann
2015-08-05 16:02                     ` Rob Herring
2015-08-05 17:00                       ` Marcel Holtmann
2015-08-07 12:40                         ` Linus Walleij
2015-07-29  0:45           ` Krzysztof Kozlowski
2015-07-29  6:12             ` Laurent Pinchart
2015-07-29  7:40             ` Pavel Machek
2015-08-25 18:59               ` Tim Bird
2015-08-26  1:22                 ` Krzysztof Kozlowski
2015-08-26  4:25                   ` Sudip Mukherjee
2015-08-26  4:52                     ` Krzysztof Kozlowski
2015-08-26  5:30                       ` Laurent Pinchart
2015-08-26  5:33                         ` Krzysztof Kozlowski
2015-08-26  6:15                           ` Josh Triplett
2015-08-26  7:23                             ` Heiko Stuebner
2015-08-26  8:05                               ` Krzysztof Kozlowski
2015-08-28  8:20                                 ` Nicolas Ferre
2015-08-26 11:33                   ` Mark Brown
2015-08-26 12:56                   ` Jason Cooper
2015-08-26 13:35                     ` Geert Uytterhoeven
2015-08-26 13:58                     ` Sudip Mukherjee
2015-08-26 14:51                       ` Jason Cooper
2015-08-26 17:13                         ` Sudip Mukherjee
2015-08-26 20:09                           ` Greg Kroah-Hartman
2015-08-28  7:44                             ` Pavel Machek
2015-08-28  8:42                               ` Heiko Stuebner
2015-08-29 15:47                                 ` Sudip Mukherjee
2015-07-29  8:18             ` Heiko Stübner
2015-07-29  0:56           ` Rafael J. Wysocki
2015-07-29  6:43           ` Daniel Vetter
2015-07-29 17:42             ` Tim Bird
2015-07-29  7:14           ` Bintian
2015-07-29 18:07             ` Tim Bird
2015-07-31  1:50               ` Bintian
2015-07-23 20:29       ` Pavel Machek
2015-07-23 20:34         ` Pavel Machek
2015-07-24  4:34           ` NeilBrown
2015-07-24  6:00             ` Tony Lindgren
2015-07-24 22:26               ` Rafael J. Wysocki
2015-07-28 22:03                 ` NeilBrown
2015-07-29  0:51                   ` Rafael J. Wysocki
2015-07-29 23:23                     ` Rafael J. Wysocki
2015-07-29 23:59                       ` NeilBrown
2015-07-30  0:57                         ` Rafael J. Wysocki [this message]
2015-07-31 17:55                           ` Mark Brown
2015-08-01  0:08                             ` Rafael J. Wysocki
2015-07-23 21:00         ` josh
2015-07-23 21:29           ` Pavel Machek
2015-07-29 13:32         ` Mark Brown
2015-07-31 12:22           ` Pavel Machek
2015-07-31 17:52             ` Mark Brown
2015-07-31 22:03               ` Pavel Machek
2015-08-01 10:55                 ` Mark Brown
2015-08-01 19:03                   ` Pavel Machek
2015-08-04 17:17                     ` Mark Brown
2015-08-03  5:33                 ` Tony Lindgren
2015-07-23 13:23     ` Krzysztof Kozlowski
2015-07-23 21:56       ` Pavel Machek
2015-07-24  1:37         ` Krzysztof Kozlowski
2015-07-24  4:40       ` Kyungmin Park
2015-07-23 14:48 ` Shuah Khan
2015-07-23 15:08 ` Heiko Stübner
2015-08-04 19:39 ` Pavel Machek
2015-08-05  7:05   ` Bintian

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=2904825.6WZJacWC6y@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=Bjorn.Andersson@sonymobile.com \
    --cc=john.stultz@linaro.org \
    --cc=ksummit-discuss@lists.linuxfoundation.org \
    --cc=kyungmin.park@samsung.com \
    --cc=neilb@suse.com \
    --cc=pavel@ucw.cz \
    /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