From: Len Brown <lenb@kernel.org>
To: linux-pm@lists.linux-foundation.org
Cc: linux-pm <linux-pm@lists.osdl.org>
Subject: Re: [RFC] dynamic device power management proposal
Date: Thu, 22 Mar 2007 00:42:20 -0400 [thread overview]
Message-ID: <200703220042.20471.lenb@kernel.org> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0703191135360.14222-100000@iolanthe.rowland.org>
On Monday 19 March 2007 11:44, Alan Stern wrote:
> On Mon, 19 Mar 2007, Shaohua Li wrote:
>
> > Runtime device power management or dynamic device power management
> > (dpm).
> >
> > Why dpm:
> > 1. put an idle device into low power state to save power
> > 2. speed up S3/S4. In resume time, we could resume devices only as
> > the devices are used. In suspend time, we could skip suspended
> > devices. (suspend/resume a device equals to change device state)
Today on system suspend we suspend all devices.
Today on system resume, we resume all devices.
In the future we need to recognize that upon system suspend,
some devices are already suspended.
We need to remember that, so upon resume we can restove
them to their suspended state, rather than blindly resuming everything.
> > Basically we need device driver support, a kernel framework and a policy
> > (determine when to change a deviceâs power state).
>
> A lot of development along these lines has already been going on in the
> USB subsystem. It isn't complete yet, but a lot of the ideas you raise
> have already been implemented.
Of course we should avoid the acronym "DPM",
as that already means something else:-)
> > I think we need answer below questions:
> > 1. How to present deviceâs power info/control interface to policy.
> > Unlike ACPI Dx state, a deviceâs power state might depend on several
> > parameters, like voltage/clock. We must change several parameters in the
> > meantime to switch deviceâs power state.
> > 2. How to handle devices dependences. For example, for a PCI endpoint
> > and a pci bridge above the pci endpoint, we should suspend pci endpoint
> > device first and then suspend pci bridge and vice versa in resume. On
> > the other hand, two devices might not have such relationship. Two
> > devices might havenât any bus relationship. Eg, in embedded system, a
> > clock might drive several devices under different buses.
The embedded devices which have a lot of complicated
platform specific dependencies. These devices effectively get
a custom distribution -- custom kernel, and custom management application.
I think we'd create a big mess if we try to figure out these dependencies
at boot time with generic kernel code that runs on everything.
Instead I think we should focus on exporting the appropriate APIs
so that a management application with platform specific knowledge can
efficiently get the kernel/drivers to implement its policies.
I think that for laptops/desktops/servers with industry standard
components we _do_ need the generic kernel to figure out the dependencies
at boot time.
> > 3. How to detect if a device is idle.
>
> These issues are where you are liable to run into trouble. There are
> extremely dependent on the type of platform, bus, and device. USB is
> particularly simple in this respect.
>
> > 4. where should policy be, kernel/userspace. Userspace policy is
> > flexible, but userspace policy has some limitations like being swapped
> > out. The limitations donât impact suspend device, but resume device
> > should be quick, eg suspended device should be resumed quickly soon
> > after new service request is coming.
> >
> > My proposal:
> > 1. deviceâs power parameters. If a deviceâs power state depends on
> > several parameters, we can map different parameters combining
> > to a single index, which looks like ACPI Dx state. In this way,
> > dpm framework and policy have a generic interface to get/set
> > deviceâs state. Each state exports some info, including this
> > stateâs power consumption/latency. Device driver can export
> > extra info to policy, dpm framework doesnât handle the extra
> > info, but policy can.
I don't think it is realistic for devices to export power numbers to user-space.
Sure, it would be great, I just don't think it is realistic.
Latencies? maybe.
In general, no API has a chance until somebody actually tries it out
and programs to it.
> > 2. The device dependence varies from different systems especially
> > for embedded system. The idea is dpm framework handles device
> > dependence (like, resume a deviceâs parent before resume the
> > device itself), and policy inputs the dependence data to dpm
> > framework. As device dependence exists, device driver shouldnât
> > directly resume a device. Instead, let dpm framework resumes the
> > device and handle dependence in the meantime. To input
> > dependence data, policy should know deviceâs unique name and dpm
> > framework can get corresponding dpm device from the name.
> > Different buses have different device naming methods. To assign
> > a unified name to each device, I just give each device an id
> > regardless which bus the device is on.
I'm skeptical about an additional framework in the kernel to track
dependencies, as I don't think we should even try to track embedded system
dependencies in the kernel. For laptop/desktop/server, perhaps we can
focus on making the existing device tree be 90% of what we need and
augment it with the missing 10%, like the relationship between
PCI devices and the devices that control hotplug on the slots
that they're plugged into...
> > 3. detect if a device is idle. The idea is each device has a busy
> > timestamp. Every time the driver wants to handle the device,
> > driver will update the timestamp. Policy can poll the timestamp
> > to determine if the device is idle.
>
> That's not how the USB implementation works. Although a timestamp like
> the one you describe is going to be added.
I sort of like this idea -- it seems that it is low overhead.
Of course it requires every device driver to be changed.
Instead we could maybe hook the generic driver entry points
and do this in the framework -- dunno if that is viable.
> > 4. policy position. The idea is policy resides on userspace. Dpm
> > framework exports deviceâs busy timestamp, state info,
> > dependence setting to userspace. According to the info, policy
> > suspends a device in specific time. Resuming a device is
> > directly done by dpm framework in kernel.
>
> In USB, we export the idle-time delay value (device is autosuspended
> when it has been idle longer than this) and an administrative power-level
> atttribute: on, auto, or suspend. When set to "on" the device will not
> autosuspend; when set to "auto" the device will autosuspend and autoresume
> according to the delay setting; when set to "suspend" the device will be
> suspended and will not autoresume.
>
> (This is cutting-edge stuff, not all present even in the development
> trees. But we're getting there.)
>
> The API design is documented, so far as it exists, by the kerneldoc in
> drivers/usb/core/driver.c.
This is the "intelligent device driver" model -- the driver actually has a clue
and can do the work internally. Probably we need some combination of this
plus the simple timeout/user-policy-manager for dumber drivers if we are to
cover the whole system.
-Len
next prev parent reply other threads:[~2007-03-22 4:42 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-19 9:08 [RFC] dynamic device power management proposal Shaohua Li
2007-03-19 15:44 ` Alan Stern
2007-03-20 1:06 ` Shaohua Li
2007-03-20 14:58 ` Alan Stern
2007-03-21 1:43 ` Shaohua Li
2007-03-21 14:44 ` Alan Stern
2007-03-22 4:42 ` Len Brown [this message]
2007-03-22 11:56 ` Jim Gettys
2007-03-22 19:28 ` David Brownell
2007-03-22 13:20 ` Pavel Machek
2007-03-22 13:44 ` Oliver Neukum
2007-03-22 13:56 ` Pavel Machek
2007-03-22 14:18 ` Oliver Neukum
2007-03-22 14:22 ` Pavel Machek
2007-03-22 14:26 ` Oliver Neukum
2007-03-22 14:35 ` Pavel Machek
2007-03-22 19:41 ` David Brownell
2007-03-22 19:58 ` David Brownell
2007-03-20 18:30 ` Pavel Machek
2007-03-21 1:34 ` Shaohua Li
2007-03-21 15:21 ` Amit Kucheria
2007-03-21 21:49 ` Dmitry Krivoschekov
2007-03-21 22:54 ` Pavel Machek
2007-03-21 21:39 ` Pavel Machek
2007-03-22 3:09 ` Shaohua Li
2007-03-22 13:13 ` Pavel Machek
2007-03-22 19:20 ` David Brownell
2007-03-22 20:32 ` Alan Stern
2007-03-22 20:02 ` David Brownell
2007-03-22 22:10 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2007-03-21 20:19 Scott E. Preece
2007-03-21 21:45 ` Pavel Machek
2007-03-26 13:53 ` Amit Kucheria
2007-03-22 13:39 Scott E. Preece
2007-03-22 13:48 ` Oliver Neukum
2007-03-22 14:01 ` Pavel Machek
2007-03-22 14:45 ` Alan Stern
2007-03-22 18:53 ` David Brownell
2007-03-22 19:05 Scott E. Preece
2007-03-27 12:05 ` Pavel Machek
2007-03-27 12:19 ` Oliver Neukum
2007-03-22 19:18 Scott E. Preece
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=200703220042.20471.lenb@kernel.org \
--to=lenb@kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=linux-pm@lists.osdl.org \
/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