PM: make /sys/devices/.../power/state optional
Subsystems (5)
PATCH 1/2 PM: make /sys/devices/.../power/state optional
There seems to be a consensus on linux-pm that the sysfs power/state files are the wrong approach to userspace having control over runtime PM. Not that there's agreement on what such controls _should_ look like, or even that there should be such controls for purposes other than testing...
So here's a patch that just makes it easy to get rid of this misfeature. It'll help flush out any userspace software that really thinks it needs that mechanism; PCMCIA seems to no longer be in that camp, it has it's own sysfs attribute.
- Dave
Add a new PM_SYSFS_DEPRECATED config option to control whether or not the /sys/devices/.../power/state files are provided. This will make it easier to get rid of that mechanism when the time comes, and to verify that userspace tools work right without it.
kernel/power/Kconfig +11 -0
@@ -53,6 +53,17 @@ CAUTION: this option will cause your machine's real-time clock to be set to an invalid time after a resume. +config PM_SYSFS_DEPRECATED + bool "Driver model /sys/devices/.../power/state files (DEPRECATED)" + depends on PM && SYSFS + default n + help + The driver model started out with a sysfs file intended to provide + a userspace hook for device power management. This feature has never + worked very well, except for limited testing purposes, and so it will + be removed. It's not clear that a generic mechanism could really + handle the wide variability of device power states; any replacements + are likely to be bus or driver specific. config SOFTWARE_SUSPEND bool "Software Suspend"
drivers/base/power/sysfs.c +6 -0
@@ -7,6 +7,8 @@#include "power.h" +#ifdef CONFIG_PM_SYSFS_DEPRECATED +/** * state - Control current power state of device *
@@ -67,6 +69,8 @@ static DEVICE_ATTR(state, 0644, state_show, state_store); +#endif /* CONFIG_PM_SYSFS_DEPRECATED */ +/* * wakeup - Report/change current wakeup option for device *
@@ -140,7 +144,9 @@static struct attribute * power_attrs[] = { +#ifdef CONFIG_PM_SYSFS_DEPRECATED &dev_attr_state.attr, +#endif &dev_attr_wakeup.attr,NULL , };
HI!
Quoted 10 lines
There seems to be a consensus on linux-pm that the sysfs power/state files are the wrong approach to userspace having control over runtime PM. Not that there's agreement on what such controls _should_ look like, or even that there should be such controls for purposes other than testing...
So here's a patch that just makes it easy to get rid of this misfeature. It'll help flush out any userspace software that really thinks it needs that mechanism; PCMCIA seems to no longer be in that camp, it has it's own sysfs attribute.
Quoted 6 lines
Add a new
PM_SYSFS_DEPRECATEDconfig option to control whether or not the/sys/devices/.../power/statefiles are provided. This will make it easier to get rid of that mechanism when the time comes, and to verify that userspace tools work right without it.Signed-off-by David Brownell <[email protected]>
Looks good to me, ACK.
(And sorry for long delay).
I guess this should go with it...? OTOH andrew wanted alternative, first, before removing the feature... but it is unclear to me if we want the feature at all on the production system, so...
Documentation/feature-removal-schedule.txt +10 -0
@@ -6,6 +6,16 @@ be removed from this file. --------------------------- +What: /sys/device/.../power/state +When: July 2007 +Files: +Why: Because it takes integers, and different userland applications + expect different numbers to mean different things. + (Pcmcia expect 2 for off, some other code expects 3 for off). +Who: Pavel Machek <[email protected]> + +--------------------------- + What: RAW driver (CONFIG_RAW_DRIVER) When: December 2005 Why: declared obsolete since kernel 2.6.3
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 6 lines · Pavel Machek
Quoted 2 lines
Add a new
PM_SYSFS_DEPRECATEDconfig option to control whether or not the/sys/devices/.../power/statefiles are provided. ...Looks good to me, ACK.
(And sorry for long delay).
Greg still hasn't merged it; so, no prob. :)
I updated patch 2/2 so that it doesn't test for the problematic and incomplete prepare_suspend() method, and to remove prepare_suspend(). (That removal was discussed separately.)
Quoted 3 lines
I guess this should go with it...? OTOH andrew wanted alternative, first, before removing the feature... but it is unclear to me if we want the feature at all on the production system, so...
How about this one instead? The issue is not limited to that sysfs file and its use of PM_EVENT_* codes, that's just the most visible facet of the problem.
- Dave
Documentation/feature-removal-schedule.txt +15 -0
@@ -6,6 +6,21 @@ be removed from this file. --------------------------- +What: /sys/devices/.../power/state + dev->power.power_state + dpm_runtime_{suspend,resume)() +When: July 2007 +Why: Broken design for runtime control over driver power states, confusing + driver-internal runtime power management with: mechanisms to support + system-wide sleep state transitions; event codes that distinguish + different phases of swsusp "sleep" transitions; and userspace policy + inputs. This framework was never widely used, and most attempts to + use it were broken. Drivers should instead be exposing domain-specific + interfaces either to kernel or to userspace, iff they are even needed. +Who: Pavel Machek <[email protected]> + +--------------------------- + What: RAW driver (CONFIG_RAW_DRIVER) When: December 2005 Why: declared obsolete since kernel 2.6.3
Hi!
Quoted 15 lines
Quoted 6 lines
Quoted 2 lines
Add a new
PM_SYSFS_DEPRECATEDconfig option to control whether or not the/sys/devices/.../power/statefiles are provided. ...Looks good to me, ACK.
(And sorry for long delay).
Greg still hasn't merged it; so, no prob. :)
I updated patch 2/2 so that it doesn't test for the problematic and incomplete
prepare_suspend()method, and to removeprepare_suspend(). (That removal was discussed separately.)
Quoted 7 lines
Quoted 3 lines
I guess this should go with it...? OTOH andrew wanted alternative, first, before removing the feature... but it is unclear to me if we want the feature at all on the production system, so...
How about this one instead? The issue is not limited to that sysfs file and its use of PM_EVENT_* codes, that's just the most visible facet of the problem.
Looks good to me.
Quoted 26 lines
Index:
o26/Documentation/feature-removal-schedule.txt
===================================================================Documentation/feature-removal-schedule.txt +15
-0@@ -6,6 +6,21 @@ be removed from this file. --------------------------- +What: /sys/devices/.../power/state + dev->power.power_state + dpm_runtime_{suspend,resume)() +When: July 2007 +Why: Broken design for runtime control over driver power states, confusing + driver-internal runtime power management with: mechanisms to support + system-wide sleep state transitions; event codes that distinguish + different phases of swsusp "sleep" transitions; and userspace policy + inputs. This framework was never widely used, and most attempts to + use it were broken. Drivers should instead be exposing domain-specific + interfaces either to kernel or to userspace, iff they are even needed. +Who: Pavel Machek <[email protected]> + +--------------------------- + What: RAW driver (CONFIG_RAW_DRIVER) When: December 2005 Why: declared obsolete since kernel 2.6.3
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html