Re: Hibernation with LPM, was: Re: xhci: LPM issues using Western Digital harddrive

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

 



On Tue, Oct 16, 2012 at 02:42:20PM -0400, Alan Stern wrote:
> On Tue, 16 Oct 2012, Sarah Sharp wrote:
> 
> > > Okay.  But that still leaves a question: Is it reasonable to call
> > > xhci-hcd's bus_suspend method without first putting all the devices on
> > > the bus into U3?  If it is then generic_suspend() can avoid calling
> > > usb_port_suspend() for the FREEZE and PRETHAW events, even on a USB-3
> > > bus.
> > 
> > I think we really do need to place all the devices into suspend during
> > the FREEZE or PRETHAW.  The xHCI specification says that before a host
> > can be suspended, the driver shall "Stop all USB activity by issuing
> > Stop Endpoint Commands for each endpoint in the Running state."  I
> > assume that's because the endpoint rings need to be stopped, or the host
> > may attempt to do DMA to get the next TRB for a periodic endpoint.
> > 
> > Currently, the xHCI driver kind of hacks around this.  If bus_suspend is
> > called and one of the rootports is not in U3, then it issues a Stop
> > Endpoint command with the 'suspend' bit set, and places the root port
> > link into U3.  But that only stops the endpoints on devices attached to
> > the roothub, not ones that are deeper in the tree.  So the xHCI host
> > could, for example, go fetch a TRB from a periodic endpoint of a device
> > on the second hub tier, in the middle of the hibernate operation.
> > 
> > Since the xHCI spec really wants us to suspend all devices, I would
> > rather the hibernate actually do that for both USB 2.0 and USB 3.0
> > devices.
> 
> Well, we're talking about two different things.  Stopping the endpoints
> comes under the heading of "quiescing", whereas putting a link into U3
> comes under the heading of "going to low power".  FREEZE and PRETHAW
> require the host controller (and all the USB devices) to be quiescent,
> but they do not require anything to be in a low-power state.

Ok.  Is there an overview of the PM core's state machine?  I'm not
familiar with it, so I'm not sure, for instance, if we get any callbacks
other than FREEZE and PRETHAW when the system hibernates.  I tried
looking in Documentation, but there didn't seem to be an overview.

> It seems reasonable that we could have separate callbacks for these two
> different things.  FREEZE and PRETHAW could invoke the callback that 
> stops a device's endpoints and skip the callback that puts the device 
> into U3.

That sounds reasonable.  The only downside to adding a callback is that
I'd like to backport these patches, and I'm not sure if people will
object to adding new APIs to fix bugs in stable kernels.

Where would disabling LPM come in?  You mentioned that FREEZE and
PRETHAW don't mean "go to low power", but I think you also mentioned
that we don't get any other PM events for hibernate?  So would that mean
that we would have to disable LPM in the FREEZE or PRETHAW stages?

Sarah Sharp
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux