Re: [PATCH] USB: xhci - also free streams when resetting devices

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

 



On Wed, 13 Apr 2011, Dmitry Torokhov wrote:

> On Wed, Apr 13, 2011 at 10:43:37AM -0400, Alan Stern wrote:
> > On Tue, 12 Apr 2011, Dmitry Torokhov wrote:
> > 
> > > Currently, when resetting a device, xHCI driver disables all but one
> > > endpoints and frees their rings, but leaves alone any streams that
> > > might have been allocated. Later, when users try to free allocated
> > > streams, we oops in xhci_setup_no_streams_ep_input_ctx() because
> > > ep->ring is NULL.
> > > 
> > > Let's free not only rings but also stream data as well, so that
> > > calling free_streams() on a device that was reset will be safe.
> > 
> > What happens when the driver that allocated the streams initially wants
> > to use them after the reset?  Is this driver supposed to be responsible
> > for re-allocating the streams in its post_reset method?
> 
> Yes, I think so. It needs to re-initialize/set up the device anyway.
> 
> FWIW the driver that I had issue with (the only one that uses streams at
> the moment - UAS) did not want to use them after reset. It was just
> trying to unbind from the device in otrderly fashion and was blowing up
> spectacularly.
> 
> > 
> > Wouldn't it make more sense to keep the streams around or 
> 
> That could be an option if we were keeping the original rings around as
> well. My reasoning that if we blow away rings we should blow away
> streams too so that we are consistent.
> 
> > automatically re-allocate them?
> 
> And if we fail? Or can't allocate as much as there was before? We'd have
> to notify the driver somehow. Too messy IMO.

Yes, that seems reasonable.  Can you add a line to the kerneldoc for 
usb_alloc_streams() explaining that they will need to be reallocated 
following device resets?

Alan Stern

--
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