From: David Brownell <david-b@pacbell.net>
To: Patrick Mochel <mochel@digitalimplant.org>
Cc: linux-kernel@vger.kernel.org, pavel@ucw.cz,
"" <benh@kernel.crashing.org>
Subject: Re: [RFC] Fix Device Power Management States
Date: Tue, 10 Aug 2004 12:18:25 -0700 [thread overview]
Message-ID: <200408101218.25752.david-b@pacbell.net> (raw)
In-Reply-To: <Pine.LNX.4.50.0408090311310.30307-100000@monsoon.he.net>
Hmm, some of these proposals seem to relate to stuff OTHER than the
device power management states. While I suspect it might be a very
handy thing to add methods to quiesce drivers (drivers have to have
that anyway) the semantics need to be properly nailed down.
On Monday 09 August 2004 3:43 am, Patrick Mochel wrote:
> The 2nd argument to ->pm_save() and ->pm_power() is determined by mapping
> an enumerated system power state to a static array of 'struct pm_state'
> pointers, that is in dev->power.pm_system. The pointers in that array
> point to entries in dev->power.pm_supports, which is an array of all the
> device power states that device supports. Please see include/linux/pm.h in
> the patch below. These arrays should be initialized by the bus, though
> they can be fixed up by the individual drivers, should they have a
> different set of states they support, or given user policy.
This sounds exactly like what I suggested a week or two ago... though
in the context of suspend/resume calls. I don't remember whether I
mentioned the notion of having "new style" suspend calls with those
parameters, and having the glue code smart enough to call "old style"
ones, but I think Pavel mentioned that in this thread. API migration is
a significant issue ... unless this is planning for a temporary 2.7 fork? :)
> The actual value of the 'struct pm_state' instances is driver-specific,
> though again, the bus drivers should provide the set of power states valid
> for that bus. For example:
>
>
> struct pm_state {
> char * name;
> u32 state;
> };
Even the same struct. But the point of the "u32" would be for
bus-specific information, and I'd expected that these would
be used with suspend states specific to busses, devices,
and maybe even drivers. I might even agree that the u32
shouldn't be included (it's certainly error prone).
And as a definitional thing: two states are equal iff they are
the same pointer, NOT if the string names are the same.
So instead of:
> #define decl_state(n, s) \
> struct pm_state pm_state_##n = { \
> .name = __stringify(n), \
> .state = s, \
> }
Defining a macro for something this simple is overkill...
> drivers/pci/ should do:
>
> decl_state(d0, PCI_PM_CAP_PME_D0);
> EXPORT_SYMBOL(pm_state_d0);
>
> ...
While that might actually work OK for PCI, since it's only
got four power states (D3hot != D3cold), a single u32
is NOT enough to provide additional device power state
Instead there could be:
struct mybus_pm_state {
struct pm_state standard
... custom PM state associated with it
};
>
> This provides a meaningful tag to each state that is completely local to
> the bus, but can be handled easily by the core.
The core should only be passing these around, not even looking at
the tags. The "system suspend" logic would know about a handful
of standard states ... architecture, board, bus, and driver-specific
code should be able to map those (along the lines Pavel suggested).
> To handle runtime power management, a set of sysfs files will be created,
> inclding 'current' and 'supports'. The latter will display all the
> possible states the device supports, as specified its ->power.pm_supports
> array, in an attractive string format. 'current' will display the current
> power state, as an ASCII string. Writing to this file will look up the
> state requested in ->pm_supports, and if found, translate that into the
> device-specific power state and suspend the device.
I like that idea. Though I also catch myself wanting to distinguish
two different notions of "current": (a) current policy applied to
the device from external sources, not unlike the cpufreq governor;
(b) current state produced by that policy.
So for example a power-aware driver might have a default governor
that enters and exit low power states based on usage patterns ... but
if some external policy were applied -- maybe like STR -- it would no
longer be OK to exit the low power state automatically. Unless some
wakeup events were enabled, and hmm that's not yet part of the
device PM framework either ... :)
- Dave
next prev parent reply other threads:[~2004-08-10 20:28 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-09 10:43 [RFC] Fix Device Power Management States Patrick Mochel
2004-08-09 11:38 ` Pavel Machek
2004-08-09 16:02 ` Patrick Mochel
2004-08-09 21:29 ` Pavel Machek
2004-08-10 5:03 ` Patrick Mochel
2004-08-10 9:43 ` Nigel Cunningham
2004-08-10 10:20 ` Pavel Machek
2004-08-10 22:33 ` Nigel Cunningham
2004-08-10 13:58 ` Patrick Mochel
2004-08-10 22:29 ` Nigel Cunningham
2004-08-10 22:56 ` Patrick Mochel
2004-08-10 23:09 ` Nigel Cunningham
2004-08-10 23:36 ` suspend2 merge [was Re: [RFC] Fix Device Power Management States] Pavel Machek
2004-08-11 0:04 ` Arkadiusz Miskiewicz
2004-08-11 5:05 ` Nigel Cunningham
2004-08-11 9:13 ` Pavel Machek
2004-08-10 10:13 ` [RFC] Fix Device Power Management States Pavel Machek
2004-08-10 18:36 ` David Brownell
2004-08-10 20:36 ` Pavel Machek
2004-08-10 22:42 ` Patrick Mochel
2004-08-09 22:15 ` Nigel Cunningham
2004-08-10 0:43 ` Benjamin Herrenschmidt
2004-08-10 9:00 ` Russell King
2004-08-10 10:08 ` Pavel Machek
2004-08-10 0:40 ` Benjamin Herrenschmidt
2004-08-10 4:55 ` Patrick Mochel
2004-08-10 6:52 ` Benjamin Herrenschmidt
2004-08-10 10:07 ` Pavel Machek
2004-08-10 14:28 ` Patrick Mochel
2004-08-10 17:56 ` Pavel Machek
2004-08-10 22:41 ` Patrick Mochel
2004-08-10 23:10 ` Pavel Machek
2004-08-10 23:14 ` [patch] Smaller goal first: fix confusion [was Re: [RFC] Fix Device Power Management States] Pavel Machek
2004-08-11 1:02 ` [RFC] Fix Device Power Management States Benjamin Herrenschmidt
2004-08-10 19:41 ` David Brownell
2004-08-10 22:44 ` Patrick Mochel
2004-08-10 10:33 ` Matthew Garrett
2004-08-10 14:36 ` Patrick Mochel
2004-08-10 19:18 ` David Brownell [this message]
2004-08-10 20:50 ` Pavel Machek
2004-08-11 1:47 ` Todd Poynor
2004-08-12 22:03 ` Russell King
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=200408101218.25752.david-b@pacbell.net \
--to=david-b@pacbell.net \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mochel@digitalimplant.org \
--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