Disabling Devices
One potentially important aspect of power management is the ability for the user to disable a device that he or she does not intend to use. Our current model does not allow for this. Calling PMSG_SUSPEND won't cut it, because it might enable wake events and is expecting the system to sleep. It seems we need to implement something specifically for this case. Also, there is the posibility of resource rebalancing, which requires yet another slightly different behavior.
Consider if a user wanted to disable a pci bus... If the bus was just suspended, it would be straightforward, put all the children to sleep and then turn off the bus. However, in the case of disabling it (as in "do not use me") all of the child devices would actually need to be unregistered.
Furthermore, take an ethernet controller as an example. When suspending, just run the driver specific logic. When disabling, you actually want to unregister from the net class interface.
Unbinding the driver may not be the solution, because the driver may be retaining configuration state information lost during the power-down.
"Disabling" is just one possible user preference. Selective-suspending a device is another. For example, if a user was using an ethernet interface on a laptop, the wireless interface should probably reduce power consumption. The kernel may be able to take care of this automatically via idle timers etc.
I'm interested in any opinions. Should we try to support something like this? How might we go about it?
As another issue, how should we handle surprise removal between suspend and resume? It seems like we would need to tell the resume method about this.
Thanks,
Adam
Hi!
Quoted 8 lines
One potentially important aspect of power management is the ability for the user to disable a device that he or she does not intend to use. Our current model does not allow for this. Calling
PMSG_SUSPENDwon't cut it, because it might enable wake events and is expecting the system to sleep. It seems we need to implement something specifically for this case. Also, there is the posibility of resource rebalancing, which requires yet another slightly different behavior.
Quoted 4 lines
Consider if a user wanted to disable a pci bus... If the bus was just suspended, it would be straightforward, put all the children to sleep and then turn off the bus. However, in the case of disabling it (as in "do not use me") all of the child devices would actually need to be unregistered.
I think you should talk to hotplug people from high-end machines. "Disable PCI bus" seems very similar to "hey, I want to unplug that PCI bus". And they have to the ethernet case for hot-pluggable PCI cards, too.
Pavel
Signature · 1 line
Boycott Kodak -- for their patent abuse against Java.
Quoted 8 lines · Adam Belay
One potentially important aspect of power management is the ability for the user to disable a device that he or she does not intend to use. Our current model does not allow for this. Calling
PMSG_SUSPENDwon't cut it, because it might enable wake events and is expecting the system to sleep. It seems we need to implement something specifically for this case. Also, there is the posibility of resource rebalancing, which requires yet another slightly different behavior.
Quoted 8 lines
Consider if a user wanted to disable a pci bus... If the bus was just suspended, it would be straightforward, put all the children to sleep and then turn off the bus. However, in the case of disabling it (as in "do not use me") all of the child devices would actually need to be unregistered.
Furthermore, take an ethernet controller as an example. When suspending, just run the driver specific logic. When disabling, you actually want to unregister from the net class interface.
You're taking this too far. "Disable", as in "do not use me", really requires nothing more than that the device be suspended (with remote wakeup turned off) and that the driver respond to requests with an error.
What you describe is more like "do your best to pretend this device doesn't exist at all"! I don't see any need to unregister anything, unload drivers, or take other special action.
Quoted 2 lines
As another issue, how should we handle surprise removal between suspend and resume? It seems like we would need to tell the resume method about this.
I don't know how it should be handled in other subsystems. With USB, we detect the removal at or close to the time when we attempt to resume the device. Of course USB is peculiar, in that the drivers don't bind directly to the devices (they bind to interfaces within the devices). Hence by the time the drivers' ->resume gets called, there's a good chance we already know the device is gone.
But even if we didn't know, it wouldn't matter much. The driver would encounter a rash of errors as it tried to communicate with the missing device, and they would end abruptly when we learned that the device had been disconnected.
In any case, isn't it up to the bus to detect new devices and removals? Why should removal during suspend be treated any differently from removal at any other time when the device is not in use?
Alan Stern
Quoted 19 lines · Alan Stern
Quoted 8 lines · Adam Belay
One potentially important aspect of power management is the ability for the user to disable a device that he or she does not intend to use. Our current model does not allow for this. Calling
PMSG_SUSPENDwon't cut it, because it might enable wake events and is expecting the system to sleep. It seems we need to implement something specifically for this case. Also, there is the posibility of resource rebalancing, which requires yet another slightly different behavior.Quoted 8 lines
Consider if a user wanted to disable a pci bus... If the bus was just suspended, it would be straightforward, put all the children to sleep and then turn off the bus. However, in the case of disabling it (as in "do not use me") all of the child devices would actually need to be unregistered.
Furthermore, take an ethernet controller as an example. When suspending, just run the driver specific logic. When disabling, you actually want to unregister from the net class interface.
Quoted 7 lines
You're taking this too far. "Disable", as in "do not use me", really requires nothing more than that the device be suspended (with remote wakeup turned off) and that the driver respond to requests with an error.
What you describe is more like "do your best to pretend this device doesn't exist at all"! I don't see any need to unregister anything, unload drivers, or take other special action.
Really this is an implementation detail. The point I was trying to make is that we don't currently have a way of even suspending devices without wakeup. However, "pretend this device doesn't exist" seems logical to me, it frees memory and removes clutter.
Quoted 12 lines
Quoted 4 lines
As another issue, how should we handle surprise removal between suspend and resume? It seems like we would need to tell the resume method about this.
I don't know how it should be handled in other subsystems. With USB, we detect the removal at or close to the time when we attempt to resume the device. Of course USB is peculiar, in that the drivers don't bind directly to the devices (they bind to interfaces within the devices). Hence by the time the drivers' ->resume gets called, there's a good chance we already know the device is gone.
Quoted 4 lines
But even if we didn't know, it wouldn't matter much. The driver would encounter a rash of errors as it tried to communicate with the missing device, and they would end abruptly when we learned that the device had been disconnected.
Most drivers aren't this smart, and not every bus will be happy with drivers tearing through the remains of previously removed hardware.
Quoted 4 lines
In any case, isn't it up to the bus to detect new devices and removals? Why should removal during suspend be treated any differently from removal at any other time when the device is not in use?
It's a very different situation. Take PCI as an example... If the device has been removed while suspended, the goal changes from "restore this device" to "free up this saved state information and unregister stuff".
Notice how surprise removal is connected and related with manual device disabling. We need to have unregistration infustructure anyway, why not handle device disabling completely?
Also, there is no way to ensure that a removal will not occur during a reduced power state (dynamic power management) that wasn't invoked by suspend. So, in short, hotplug drivers will need to be really robust. I think the PM subsystem should try to be helpful here when it can.
Finally, we need to have device resume routines rescan for child devices.
Adam
Hi!
Quoted 10 lines
Quoted 10 lines
Quoted 2 lines
As another issue, how should we handle surprise removal between suspend and resume? It seems like we would need to tell the resume method about this.
I don't know how it should be handled in other subsystems. With USB, we detect the removal at or close to the time when we attempt to resume the device. Of course USB is peculiar, in that the drivers don't bind directly to the devices (they bind to interfaces within the devices). Hence by the time the drivers' ->resume gets called, there's a good chance we already know the device is gone.
Quoted 8 lines
Quoted 4 lines
But even if we didn't know, it wouldn't matter much. The driver would encounter a rash of errors as it tried to communicate with the missing device, and they would end abruptly when we learned that the device had been disconnected.
Most drivers aren't this smart, and not every bus will be happy with drivers tearing through the remains of previously removed hardware.
...so fix the drivers. If the device fails, they should handle it. And bus should handle it, too...
Pavel
Signature · 1 line
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms
Quoted 3 lines · Adam Belay
One potentially important aspect of power management is the ability for the user to disable a device that he or she does not intend to use.
I tend to agree with Alan on this: this doesn't seem like something that should need separate attention.
Though maybe I'm not clear on what you mean by "disable". How would that differ from having inactive drivers be in low power modes?
- Dave