Hotplug for device power state changes
Subsystems (4)
PATCH 1/1 Hotplug for device power state changes
A patch to call a hotplug device-power agent when the power state of a device is modified at runtime (that is, individually via sysfs or by a driver call, not as part of a system suspend/resume). Allows a power management application to be informed of changes in device power needs. This can be useful on platforms with dependencies between system clock/voltage settings and operation of certain devices (such as PXA27x), or, for example, on a cell phone where voiceband or network devices going inactive signals an opportunity to lower platform power levels to conserve battery life.
Implemented via new class device-power, with which all devices register. I'm interested in comments on this approach and in alternate suggestions. Perhaps device-power should be an "opt-in" class, since power state changes won't be a concern for most devices/platforms/applications.
drivers/base/power/runtime.c +4 -1
@@ -33,6 +33,7 @@down (&dpm_sem);runtime_resume (dev);up (&dpm_sem); +dpm_notify (dev); }
@@ -53,8 +54,10 @@if (dev->power.power_state)runtime_resume (dev); -if (!(error =suspend_device (dev,state))) +if (!(error =suspend_device (dev,state))) { dev->power.power_state = state; +dpm_notify (dev); + } Done:up (&dpm_sem);return error;
drivers/base/power/sysfs.c +70 -0
88 lines not on this page · raw message
drivers/base/power/power.h +1 -0
@@ -54,6 +54,7 @@extern int dpm_sysfs_add (struct device *);extern void dpm_sysfs_remove (struct device *); +extern void dpm_notify (struct device *);/* * resume.c
drivers/base/init.c +2 -0
@@ -14,6 +14,7 @@extern int buses_init (void );extern int classes_init (void );extern int firmware_init (void ); +extern int dpm_init (void );extern int platform_bus_init (void );extern int system_bus_init (void );extern int cpu_dev_init (void );
@@ -31,6 +32,7 @@devices_init ();buses_init ();classes_init (); +dpm_init ();firmware_init ();/* These are also core pieces, but must come after the
include/linux/pm.h +2 -0
@@ -227,6 +227,7 @@*/ struct device ; +struct class_device ;struct dev_pm_info {#ifdef CONFIG_PM
@@ -234,6 +235,7 @@u8 * saved_state;atomic_t pm_users;struct device * pm_parent; +struct class_device * class_dev;struct list_head entry;#endif };
Signature · 2 lines
Todd Poynor MontaVista Software
Quoted 9 lines · Todd Poynor
A patch to call a hotplug device-power agent when the power state of a device is modified at runtime (that is, individually via sysfs or by a driver call, not as part of a system suspend/resume). Allows a power management application to be informed of changes in device power needs. This can be useful on platforms with dependencies between system clock/voltage settings and operation of certain devices (such as PXA27x), or, for example, on a cell phone where voiceband or network devices going inactive signals an opportunity to lower platform power levels to conserve battery life.
Note that we should run this synchronously with userspace - ie, wait for the userspace hotplug script to finish executing before moving on to the next device. Why?
Think of the case where we're suspending the complete system. If you go round and asynchonously try to run userspace scripts, chances are you'll have the CPU asleep before _any_ of the scripts have run, which means (eg) your DHCP client couldn't tell the server that its released its allocation.
Also, should we be telling userspace about suspend before we actually suspend the device?
Signature · 15 lines
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id�66&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-develQuoted 9 lines · Russell King
Note that we should run this synchronously with userspace - ie, wait for the userspace hotplug script to finish executing before moving on to the next device. Why?
Think of the case where we're suspending the complete system. If you go round and asynchonously try to run userspace scripts, chances are you'll have the CPU asleep before _any_ of the scripts have run, which means (eg) your DHCP client couldn't tell the server that its released its allocation.
I figured system suspend/resume would need to be a separate event and isn't covered by this patch, which is for "runtime" individual device suspend/resume only. Also, the flood of notifications of all devices suspending/resuming might not be useful -- the single system suspend/resume event could imply these device events, although perhaps in some cases something would want to know exactly which devices were operable at system suspend time. I can also send a patch for system suspend/resume hotplug if there's interest.
Now that you mention it, device power hotplug should be synchronous, to make sure the power management application has reacted to the changed state prior to the device going into actual service (in the case of a resume).
Quoted 2 lines
Also, should we be telling userspace about suspend before we actually suspend the device?
I suppose that, depending on the reason notification is needed, "just before" or "just after" might be the right answer. Now that you bring this up, it was originally my intention to notify of suspend "just after" (so power mgr can change power state, knowing that the associated device no longer has any requirements), and notify of resume "just before" (so power mgr can adjust power state to match requirements about to be put into service). I'd be interested in hearing about other usage scenarios that might need a different notification order. Thanks,
Signature · 13 lines
Todd Poynor MontaVista Software ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines
I figured system suspend/resume would need to be a separate event and isn't covered by this patch, which is for "runtime" individual device suspend/resume only. Also, the flood of notifications of all devices suspending/resuming might not be useful -- the single system suspend/resume event could imply these device events, although perhaps in some cases something would want to know exactly which devices were operable at system suspend time. I can also send a patch for system suspend/resume hotplug if there's interest.
Quoted 4 lines
Now that you mention it, device power hotplug should be synchronous, to make sure the power management application has reacted to the changed state prior to the device going into actual service (in the case of a resume).
This is dangerous.
If the device you are suspending is on the VM path in any way, beeing synchronous with a userland call can deadlock you solid.
This is even more true for system suspend where we are suspending all devices including the main swap/storage.
There are various cases where I would have loved to get userland more involved in the suspend/resume process for various reasons, but in the end, I always got bitten by that problem. Userland cannot be relied upon unless the process is made completely resident as soon as we start the suspend dance.
More to this: If you use the "common" code in kernel/power, which I don't (yet) use on pmac for suspend-to-ram, you'll also stop all userland processes before notifying drivers (and suspend-to-disk expects that).
Ben.
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id�66&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 4 lines · Benjamin Herrenschmidt
This is dangerous.
If the device you are suspending is on the VM path in any way, beeing synchronous with a userland call can deadlock you solid.
And not being synchronous means that there's no point in calling userland, because userland won't run before the machine has suspended, so there's no point in calling it in the first place. Also consider the case where you suspend, and asynchronously queue up all these suspend scripts to run. Then you resume and queue up the resume scripts to run. What order do the suspend and resume scripts ultimately end up being run?
What if the scripts have side effects like releasing and re-acquiring your DHCP allocation - what would be the effect of the suspend script completing after the resume script?
What about the case where suspend/resume scripts bring up/tear down any communication protocol?
Maybe we should have a two-pass approach, where the first pass synchronously tells userspace about the suspend, and the second pass does the actual suspend. Then for resume the opposite.
Signature · 15 lines
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 PCMCIA - http://pcmcia.arm.linux.org.uk/
2.6 Serial core
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g.
Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id�66&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-develQuoted 7 lines · Russell King
And not being synchronous means that there's no point in calling userland, because userland won't run before the machine has suspended, so there's no point in calling it in the first place. Also consider the case where you suspend, and asynchronously queue up all these suspend scripts to run. Then you resume and queue up the resume scripts to run. What order do the suspend and resume scripts ultimately end up being run?
...
Quoted 3 lines
Maybe we should have a two-pass approach, where the first pass synchronously tells userspace about the suspend, and the second pass does the actual suspend. Then for resume the opposite.
I would argue that a system suspend/resume event does not need to also inform of the individual device suspend/resume events, since these can be implied. But if we were to include individual device suspend/resume hotplug events as part of system suspend/resume then I would agree with a two-phase model, since notification at the time of actual hardware suspend does not work once something critical to userspace notification is shutdown.
So I'm planning to resubmit patches with the following:
* Individual device resume events signalled before, not after, the resume, so that userspace can react to any new requirements before the device is placed into service.
* Individual device suspend and resume events converted to synchronous events (that wait for hotplug processing to complete before continuing).
* Changes to kobject to allow kobject hotplug to optionally be synchronous if desired. I'd assume this is a new hotplug_ops field.
* Synchronous hotplug events for system suspend and resume (without individual device notifications). These events can probably be generated by the kobject hotplug methods by the existing power subsys (once the above enhancement is in place).
Any comments on this course of action welcomed.
Signature · 14 lines
Todd Poynor MontaVista Software ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 3 lines · Todd Poynor
* Changes to kobject to allow kobject hotplug to optionally be synchronous if desired. I'd assume this is a new
hotplug_opsfield.
Ick.
Quoted 4 lines
* Synchronous hotplug events for system suspend and resume (without individual device notifications). These events can probably be generated by the kobject hotplug methods by the existing power subsys (once the above enhancement is in place).
But why? Do you really need this? Have you actually tested a system to see if it is needed?
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id�66&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 7 lines · Greg KH
Quoted 2 lines · Todd Poynor
* Changes to kobject to allow kobject hotplug to optionally be synchronous if desired. I'd assume this is a new
hotplug_opsfield.Ick.
Is the objection to using kobject for synchronous hotplug events, or to using a hotplug_ops flag to indicate which kind is needed? Would the addition of a kobject_hotplug_sync function be better? Or a handshake-like interface as with firmware downloads?
Quoted 8 lines
Quoted 4 lines
* Synchronous hotplug events for system suspend and resume (without individual device notifications). These events can probably be generated by the kobject hotplug methods by the existing power subsys (once the above enhancement is in place).
But why? Do you really need this? Have you actually tested a system to see if it is needed?
This is something that was requested of me by others who build Linux into consumer electronics devices. Perhaps some of the interested parties may speak up here to add more insight. Among the intended uses that I'm aware of are: saving application state to stable storage (for example, to be prepared in case the battery dies during an extended "suspended" period, and such gadgets often do not have a device suitable for a complete system suspend-to-disk), terminating applications that reside in memory banks to be powered off during the suspend (this also relies on other enhancements to allocate memory accordingly), and dropping network connections in order to conserve resources on servers that support mobile devices. It sounds like the folks that deal with ACPI power management have found use for such a mechanism in the server/desktop world as well.
Thanks,
Signature · 14 lines
Todd Poynor MontaVista Software ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 7 lines · Todd Poynor
Quoted 6 lines · Greg KH
Quoted 2 lines · Todd Poynor
* Changes to kobject to allow kobject hotplug to optionally be synchronous if desired. I'd assume this is a new
hotplug_opsfield.
Quoted 6 lines
Quoted 1 line
Ick.
Is the objection to using kobject for synchronous hotplug events, or to using a
hotplug_opsflag to indicate which kind is needed? Would the addition of akobject_hotplug_syncfunction be better? Or a handshake-like interface as with firmware downloads?
To add an option to the kobject_hotplug() function for a sync call is one thing. To make the option for the main kobject add and remove call to be sync is a horribly misguided thought (the reason why is left as an exercise for the reader...like go read the udev code for many reasons why...)
I don't have an objection to add such a new paramater (or even a new function call like you suggested), just don't go messing with the main kobject hotplug call without thinking everything through :)
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
* Synchronous hotplug events for system suspend and resume (without individual device notifications). These events can probably be generated by the kobject hotplug methods by the existing power subsys (once the above enhancement is in place).
Quoted 6 lines
Quoted 2 lines
But why? Do you really need this? Have you actually tested a system to see if it is needed?
This is something that was requested of me by others who build Linux into consumer electronics devices. Perhaps some of the interested parties may speak up here to add more insight.
Please encourage them to speak up. I hear _nothing_ from any embedded developers, and I am really interested in how the driver model and hotplug works (or doesn't) for them. Without that feedback, we are in the dark as to what their needs/hates are.
thanks,
greg k-h
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id149&alloc_id�66&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 3 lines · Greg KH
I don't have an objection to add such a new paramater (or even a new function call like you suggested), just don't go messing with the main kobject hotplug call without thinking everything through :)
OK, will do.
Quoted 9 lines
Quoted 3 lines
This is something that was requested of me by others who build Linux into consumer electronics devices. Perhaps some of the interested parties may speak up here to add more insight.
Please encourage them to speak up. I hear _nothing_ from any embedded developers, and I am really interested in how the driver model and hotplug works (or doesn't) for them. Without that feedback, we are in the dark as to what their needs/hates are.
Thanks, I have passed the call to get involved on to a group of Linux consumer electronics developers (the Consumer Electronics Linux Forum; Tim Bird will hold a BoF at OLS introducing this group). I am involved at an infrastructure level and have helped steer various general requirements toward use of LDM (which we've been using even in 2.4 for some time) and hotplug (which is new to us for these purposes and they might not yet have much experience with this), and can also serve as a conduit for feedback. I appreciate your interest in the needs of embedded developers and hope that we can contribute some useful suggestions and features.
Signature · 14 lines
Todd Poynor MontaVista Software ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Hi.
Sorry for getting in on this conversion a little late; I've only just noticed it.
The usual way in which userspace notification of suspending/resuming is handled at the moment is via scripts which are run prior to suspending and after resuming. As has been noted, the first thing the kernel side implementations does is freeze userspace, keeping things static until post resume. This seems to me to be a good, simple model. DHCP releases can be handled from user space, prior to echo 4 > /proc/acpi/sleep (or alternatives) and the whole difficulty regarding interactions between userspace and kernelspace just goes away.
Note too that the actual invocation of a suspend can still be in response to kernel events. An ACPI event can be sent to the userspace ACPI daemon, which does userspace preparations and then invokes the kernel suspend mechanism. After resume, it can also do userspace reinitialisation.
Given this model, I would suggest that hotplug should silently drop any events that happen while suspending, and queue events that occur while resuming until the kernelspace part of resuming is complete and userspace can run as normal. It shouldn't rely upon device suspend/resume notifications because they can and do happen while we're still in the process of suspending and resuming. The means to detect whether we're suspending or resuming or running normally could be implemented as a simple function that could test the status of the different suspend implementations.
Is that at all helpful?
Regards,
Nigel
Signature · 18 lines
Nigel Cunningham C/- Westminster Presbyterian Church Belconnen 61 Templeton Street, Cook, ACT 2614, Australia. +61 (2) 6251 7727 (wk) At just the right time, while we were still powerless, Christ died for the ungodly. (Romans 5:6) ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 9 lines · Nigel Cunningham
Given this model, I would suggest that hotplug should silently drop any events that happen while suspending, and queue events that occur while resuming until the kernelspace part of resuming is complete and userspace can run as normal. It shouldn't rely upon device suspend/resume notifications because they can and do happen while we're still in the process of suspending and resuming. The means to detect whether we're suspending or resuming or running normally could be implemented as a simple function that could test the status of the different suspend implementations.
If needed, there's already a "system_running" flag used to ignore the underlying usermode helper execution if requested prior to the system being ready for such an event at boot time, and perhaps this could be co-opted or extended for use at suspend/resume time. Sounds like the correct behavior is to leave the exec requests queued until userspace is resumed (and I'd assume that device power state notifications are not needed, but perhaps hotplug events and/or modprobes of drivers for hotpluggable devices and associated features may be generated at resume time). Thanks,
Signature · 14 lines
Todd Poynor MontaVista Software ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 6 lines · Benjamin Herrenschmidt
Quoted 4 lines
Now that you mention it, device power hotplug should be synchronous, to make sure the power management application has reacted to the changed state prior to the device going into actual service (in the case of a resume).
Quoted 7 lines
This is dangerous.
If the device you are suspending is on the VM path in any way, beeing synchronous with a userland call can deadlock you solid.
This is even more true for system suspend where we are suspending all devices including the main swap/storage.
Well, this feature is intended to allow power management of appropriate devices; using sysfs or a driver call to individually suspend a device required for proper system operation would be a danger, hotplug notification or no. And the individual device notifications provided by the patch under discussion are not for use during a system-wide suspend/resume sequence. I would imagine system suspend/resume would be separate events that probably would not notify of the individual device suspends/resumes performed as a consequence. At any rate, yes, this would occur outside of the code path that freezes processes and such.
Signature · 14 lines
Todd Poynor MontaVista Software ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 10 lines
A patch to call a hotplug device-power agent when the power state of a device is modified at runtime (that is, individually via sysfs or by a driver call, not as part of a system suspend/resume). Allows a power management application to be informed of changes in device power needs. This can be useful on platforms with dependencies between system clock/voltage settings and operation of certain devices (such as PXA27x), or, for example, on a cell phone where voiceband or network devices going inactive signals an opportunity to lower platform power levels to conserve battery life.
Why? If the device is powered down at runtime via sysfs, then the app that did that already exists in userspace, like the ones you're trying to notify via /sbin/hotplug. It would be much simpler for the first app to generate e.g. a d-bus message to notify other apps, rather than creating this conduit through the kernel.
Besides, if one process has a device open, then the driver should refuse any requests to power it down.
And, for the case where a communication device loses signal, you should treat it similarly to a network device, which notifies userspace of a lost link, which then has the option of powering down the device and notifying other processes.
Pat
Quoted 11 lines · Patrick Mochel
Quoted 9 lines
A patch to call a hotplug device-power agent when the power state of a device is modified at runtime (that is, individually via sysfs or by a driver call, not as part of a system suspend/resume). Allows a power management application to be informed of changes in device power needs. This can be useful on platforms with dependencies between system clock/voltage settings and operation of certain devices (such as PXA27x), or, for example, on a cell phone where voiceband or network devices going inactive signals an opportunity to lower platform power levels to conserve battery life.
Quoted 5 lines
Why? If the device is powered down at runtime via sysfs, then the app that did that already exists in userspace, like the ones you're trying to notify via
/sbin/hotplug. It would be much simpler for the first app to generate e.g. a d-bus message to notify other apps, rather than creating this conduit through the kernel.
The ability to do this was originally requested in the context of a driver managing the power state of its devices (according to some unspecified logic); agreed that state changes requested via sysfs are a less compelling usage scenario. Small battery-powered gadgets often implement drivers that are more actively involved in managing power state than the desktop/notebook/server norm, invoking LDM suspend routines when an opportunity to power down arises. But it is also common in wall-plug-wired systems to have a few power state transitions that result from things under kernel control, such as blanking a display device after a timer expires.
In many cases, the opportunity to move to a lower-power state may be triggered by userspace activity and would make a good candidate for a purely userspace notification method. However, a kernel-to-userspace notification method is suggested for this to cover potential cases where a device power state change might not be directly caused by, or may be a non-obvious side effect of, an application action. Display blanking is an example; other devices that can enter a low-power state due to inactivity or due to changes in power state of other upstream or downstream devices could also use this. If anyone reading this has concrete examples that they would like to have considered then please do speak up.
It may be the case that most useful scenarios for userspace actions in response to device power state changes could be handled through a suitable implementation of D-BUS messages between applications, and I'd certainly support use of that model wherever possible. Returning errors through the system call interface for an operation on a device file descriptor, as I believe you've suggested, may also help cover most useful cases. I will continue to encourage the developers who have asked me for driver power state notifiers to chime in here with more details on their needs.
Quoted 2 lines
Besides, if one process has a device open, then the driver should refuse any requests to power it down.
I'd suggest some latitude in driver handling of low-power device states wrt open file descriptors, such as for display blanking. But yes, this is usually true (at least in the non-system-suspend case).
Signature · 14 lines
Todd Poynor MontaVista Software ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id�66&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 11 lines
The ability to do this was originally requested in the context of a driver managing the power state of its devices (according to some unspecified logic); agreed that state changes requested via sysfs are a less compelling usage scenario. Small battery-powered gadgets often implement drivers that are more actively involved in managing power state than the desktop/notebook/server norm, invoking LDM suspend routines when an opportunity to power down arises. But it is also common in wall-plug-wired systems to have a few power state transitions that result from things under kernel control, such as blanking a display device after a timer expires.
It seems like it would best be done at the class level, rather than the core driver level, if you wanted to do it all. For things like communication devices going out of range, you would probably want to easily support multiple drivers of the same type, so you might as well abstract it to the class. And, I don't see a reason for it to be synchronous, since any apps trying to communicate over it will soon realize it's not available; and any policy in userspace shouldn't by definition be that critical to the health of the system.
Display blanking is based on user input inactivity, and already works on most systems.
Pat
Quoted 21 lines · Patrick Mochel
Quoted 10 lines
The ability to do this was originally requested in the context of a driver managing the power state of its devices (according to some unspecified logic); agreed that state changes requested via sysfs are a less compelling usage scenario. Small battery-powered gadgets often implement drivers that are more actively involved in managing power state than the desktop/notebook/server norm, invoking LDM suspend routines when an opportunity to power down arises. But it is also common in wall-plug-wired systems to have a few power state transitions that result from things under kernel control, such as blanking a display device after a timer expires.
It seems like it would best be done at the class level, rather than the core driver level, if you wanted to do it all. For things like communication devices going out of range, you would probably want to easily support multiple drivers of the same type, so you might as well abstract it to the class. And, I don't see a reason for it to be synchronous, since any apps trying to communicate over it will soon realize it's not available; and any policy in userspace shouldn't by definition be that critical to the health of the system.
Quoted 2 lines
Display blanking is based on user input inactivity, and already works on most systems.
Although there are a number of ways this information could be used, the specific use I intended is for system power management purposes. I wouldn't suggest implementing features such as screen blanking (which was brought up as an example of a device power state transition that occurs according to kernel logic and not at the request of an app) or notifying network applications of downed links using this mechanism.
Let me throw out an example to help discuss the model best suits that situation. An XScale PXA27x "Bulverde", a smartphone platform, has a low-power mode that helps conserve battery power during periods of reduced activity while leaving the CPU running at a low clock rate (and often idling) to handle any events that occur during that time. In that mode, certain devices must be powered off (apparently critical input clocks are turned off and the device may get wedged and cease to function). Among these devices are the LCD controller and serial devices such as IrDA and Bluetooth. If a system power management mechanism such as cpufreq is employed to place the system into low-power mode during idle periods, some coordination between device state and entering/exiting low-power state is needed.
Various interactions to accomplish this coordination are possible. For the patch under discussion it is suggested that an appropriate mechanism by which the power management control app may be informed of changes in device state would be for the LCD and serial drivers to notify the app about changes in the state of their devices at exactly the time the state transition is to occur (and that hotplug is an appropriate method to use for this). The notification might be used by the power management app to take the system out of low-power mode prior to powering up the device, or to note that low-power mode may be entered now that all conflicting devices are off. So in this case an app not using the device for I/O purposes could still benefit from information about its state.
A similar request was made by another smartphone development team to handle a dual-core CPU + DSP ARM OMAP system, where changes in DSP or network activity (i.e., a call or other communication is starting or stopping) are to trigger changes in system power state. In this case, the affected devices might not be all-the-way powered off, but in an intermediate lower-power state.
Now it may be the case that application-level state could be used to manage these interactions; I have very limited knowledge of what happens above the kernel (and the device usage models) in the example systems I'm discussing. Placing the ability to notify of power state changes into the drivers would seem to be the model that offers the most flexibility, which is probably why it was originally requested and why I thought it might be appropriate. If there continue to be strong reservations regarding the suitability of kernel-to-userspace device power state notifiers then I'll encourage the developers to either add their voices directly to the debate or to explore solutions using existing kernel interfaces and/or pure userspace methods.
Signature · 14 lines
Todd Poynor MontaVista Software ------------------------------------------------------- This SF.Net email is sponsored by Sleepycat Software Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to deliver higher performing products faster, at low TCO. http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Hi!
Quoted 9 lines
Let me throw out an example to help discuss the model best suits that situation.
An XScale PXA27x "Bulverde", a smartphone platform, has a low-power mode that
helps conserve battery power during periods of reduced activity while leaving
the CPU running at a low clock rate (and often idling) to handle any events that occur during that time. In that mode, certain devices must be powered off
...
Quoted 8 lines
A similar request was made by another smartphone development team to handle a
dual-core CPU + DSP ARM OMAP system, where changes in DSP or network activity
(i.e., a call or other communication is starting or stopping) are to trigger changes in system power state. In this case, the affected devices might not be
all-the-way powered off, but in an intermediate lower-power state.
Hey, I want linux smartphone ;-).
In case of that dual-core CPU, does linux really run on both CPUs? Do we get sources for GSM network stack, too?
Is there some preliminary docs about such beasts available somewhere? Dual CPU design for phone certainly looks interesting...
Pavel
Signature · 12 lines
When do you have heart between your knees? ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 1 line · Pavel Machek
In case of that dual-core CPU, does linux really run on both CPUs?
No, only one of them. One is usually an ARM core which runs Linux while the other is a DSP.
Quoted 1 line
Do we get sources for GSM network stack, too?
Since they run on the DSP then probably not.
Quoted 2 lines
Is there some preliminary docs about such beasts available somewhere? Dual CPU design for phone certainly looks interesting...
Try Google with "site:www.ti.com OMAP".
Nicolas
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Hi!
Quoted 4 lines
Quoted 1 line
In case of that dual-core CPU, does linux really run on both CPUs?
No, only one of them. One is usually an ARM core which runs Linux while the other is a DSP.
Ahha, I originaly thought that it is 2 arms, each of them with DSP capabilities (MMX-like). Thanks.
Quoted 3 lines
Quoted 1 line
Do we get sources for GSM network stack, too?
Since they run on the DSP then probably not.
Ok, even without DSP sources it should be possible to create usefull NetMonitor, but we'll probably not be able to turn phones into two-way radios... Good.
Pavel
Signature · 13 lines
Horseback riding is like software... ...vgf orggre jura vgf serr. ------------------------------------------------------- This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months! http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net [email protected] https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Quoted 1 line · Pavel Machek
Hey, I want linux smartphone ;-).
Me too ;)
Quoted 2 lines
In case of that dual-core CPU, does linux really run on both CPUs? Do we get sources for GSM network stack, too?
As Nicolas mentioned, the voiceband/RF stuff is probably on the DSP in such systems and typically runs in a custom environment, perhaps with libraries supplied by the silicon vendor. I am not myself familiar with a Linux-based phone software offering that includes open source GSM modem drivers or GSM/GPRS network stacks and such.
Quoted 1 line
Is there some preliminary docs about such beasts available somewhere?
Nicolas mentioned sites for the popular TI OMAP platform (ARM925/6T), another is Renesas SH-Mobile. I'm not aware of writeups regarding Linux support for CPU+DSP designs, if that's of interest; in my capacity I mostly treat the DSP as an unmanaged black box device. But in the context of power management there are a few unavoidable interactions, for example, phone software developers get cranky when Linux decides to power down some or all of the system while the DSP was busy doing something important and there's a common clock or power domain.
Todd
-------------------------------------------------------
This SF.Net email is sponsored by: SourceForge.net Broadband Sign-up now for SourceForge Broadband and get the fastest 6.0/768 connection for only $19.95/mo for the first 3 months!
http://ads.osdn.com/?ad_id%62&alloc_ida84&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel