[linux-pm] Implementing the new PM model

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm trying to get my mind around what's needed for drivers (USB drivers in 
particular) to implement the new PM model.  Several aspects are still 
unclear.

First, a couple of questions.  Is it guaranteed that the FREEZE events 
are only sent by the PM core, always to every device in the tree, and only 
for system-wide state changes?  There doesn't seem to be any reason to use 
it for partial-tree selective suspends.

Would it be a good idea to store in dev->power a flag indicating whether
or not the device is currently frozen?  Unlike the power_state, being
frozen has a reasonably well-defined meaning for every device.

How should the USB system handle these things?  FREEZE means:

	A. Make sure the device is idle, not doing anything non-trivial;

	B. Make sure the device is not doing DMA or issuing IRQs;

	C. Be prepared to resume from some weird state, not necessarily
	   the same one the device was left in;

	D. No change in power level is needed.

USB device drivers would want to do A.  B is vacuous because USB devices
(real ones, not virtual root hubs) cannot do DMA or issue IRQs.  C is
pretty much meaningless because if the state changes in any way it will
show up as a disconnect event.  As for D... see below.  Unanswered is
whether or not the driver should cancel all its outstanding URBs and
refuse to issue any more.

Now what about a USB HCD?  In order to avoid doing DMA the controller must
not be executing its schedule.  For UHCI at least that means the
controller must be stopped, not even sending out SOF packets.  This will
cause a bus-wide suspend (what the USB specification refers to as a
"global suspend").

So whenever the HCD gets a FREEZE message, the entire bus will unavoidably
go into a low-power suspend state.  Should USB devices behave the same
way, suspending whenever they get a FREEZE?  It doesn't seem necessary.  
On the other hand, there's a question about when to enable remote wakeup.  
I don't see anything wrong with leaving it enabled even when the device
isn't suspended -- but that's not how the code works now.  At what point
during STR or STD (or even STANDBY) should remote wakeup be enabled?  
(Note that this isn't an issue if we leave it enabled all the time.)

Still unanswered is whether URBs should remain queued during FREEZE.  
Obviously they won't get sent since the bus is suspended, but I don't see
anything wrong with allowing them to sit in the schedule.  If usbcore
implements FREEZE by explicitly suspending devices then of course there
won't be any outstanding URBs.

This is related to the question of whether FREEZE is ever sent to a 
partial subtree.  What should happen if some USB devices get a FREEZE but 
their parent HCD doesn't?

Alan Stern



[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux