Re: [RFC 9/9] UAS: Free streams during USB disconnect.

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

 



On Fri, Dec 02, 2011 at 04:43:24PM -0500, Alan Stern wrote:
> On Fri, 2 Dec 2011, Sarah Sharp wrote:
> 
> > When a USB device is disconnected (or a driver is unbound from a
> > device), the USB core will automatically cancel any URBs, and possibly
> > clean up any host controller state associated with the device.  This may
> > include setting the alternate interface setting back to alt setting 0.
> > 
> > Unfortunately, the xHCI needs any bulk stream rings to be freed before
> > the next alt setting is installed, and the USB core has no idea which
> > endpoints has stream rings allocated.  Instead, the UAS driver needs to
> > set the soft_unbind flag, which tells the USB core that it will cancel
> > any pending URBs and clean up any extra state (including the stream
> > rings).
> 
> That's right.
> 
> > Make the UAS disconnect method go through the same process as the
> > pre_reset method to quiesce all command submission, wait for all URBs to
> > be killed, and free the stream rings.
> 
> Not the same method at all.  You have to call scsi_remove_host() first,
> so that the SCSI layer can clean up after itself.

Ok, gotcha.

> Once that's done,
> it's okay to go through the pre_reset procedue.  (If the SCSI layer
> behaves properly, it shouldn't have any active commands after
> scsi_remove_host() returns, anyway, so pre_reset won't have anything 
> to do.)

There still might be commands waiting in the UAS workqueue.  Unless the
SCSI layer will call the abort handler for all pending commands when
scsi_remove_host() is called?

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