From: Bin Liu <b-liu@ti.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Johan Hovold" <johan@kernel.org>, "Greg KH" <greg@kroah.com>,
"Måns Rullgård" <mans@mansr.com>,
linux-usb@vger.kernel.org
Subject: MUSB interrupt storm on device removal
Date: Wed, 23 Jan 2019 14:12:38 -0600 [thread overview]
Message-ID: <20190123201238.GD18982@uda0271908> (raw)
On Wed, Jan 23, 2019 at 12:42:36PM -0500, Alan Stern wrote:
> On Wed, 23 Jan 2019, Bin Liu wrote:
>
> > > One possibility is to giveback URBs with certain errors (such as
> > > -EPROTO) only at a frame boundary, or at 1-ms intervals. This feels
> > > like a very artificial solution, though.
> >
> > My plan is to add an error counter in musb driver endpoint struct, if
> > -EPROTO has happened consequentially for a certain times, for example 3,
> > giveback URBs with -EPIPE instead -EPROTO. This is the simplest solution
> > I can think of, though I hate expending struct unnecessarily, this is
> > one of the cases.
>
> But -EPIPE is documented to mean that the device replied with a STALL.
> You would be violating the documentation.
(sigh...)
> > > > > I do see now that of all USB drivers we have two drivers that handles
> > > > > -EPROTO by resubmitting after a delay, while a handful explicitly deals
> > > > > with -EPROTO by simply stopping to resubmit (some probably bail out on
> > > > > all errors, but the majority appear to resubmit on -EPROTO).
> > >
> > > Any driver which immediately retries an URB after getting -EPROTO or
> > > -EILSEQ or -ETIME, and has no mechanism for backing off or limiting the
> > > retries, is buggy. As far as I can see, that's all there is to it.
> >
> > Agreed, but given that majority appear to resubmit on -EPROTO as Johan
> > said, I think better to handle it in HCD.
>
> Do all those other drivers handle -EPIPE correctly? A logical way to
> respond to -EPIPE is to issue a Clear-Halt request; what will happen
> when that also fails?
>
> I think it makes more sense to continue using -EPROTO but slow down the
> exchange of packets so that there is no interrupt storm.
the musb driver doesn't use SOF interrupts, so SOF interrupt is
disabled. Another way to add delay for -EPROTO would be moving such URBs
into a new linked list and using a timer to reschedule the list. The
musb driver already has enough mess, I really don't want to add this
logic if there is other simpler option...
>
> > > > Thanks for the info.
> > > > I will handle this case in musb driver.
> > >
> > > Why doesn't the same problem occur with other types of host controller?
> >
> > Not sure, I am on musb for most of the times. Maybe other HCD doesn't
> > giveback URBs with -EPROTO in such error case.
>
> ehci-hcd also uses -EPROTO.
Is it possible to test the use case on ehci?
- connect a multi-ports usb serial device to a hub;
- open multiple ports with cat command;
- remove the usb serial device from the hub;
- console lockup happens?
> > musb controller has a register bit telling the controller has tried the
> > transaction 3 times but didn't receive any response, then the musb
> > driver just giveback this URB with -EPROTO.
>
> Same with EHCI.
Regards,
-Bin.
next reply other threads:[~2019-01-23 20:12 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-23 20:12 Bin Liu [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-03-07 16:16 MUSB interrupt storm on device removal Bin Liu
2019-03-05 11:30 Måns Rullgård
2019-01-25 15:43 Bin Liu
2019-01-24 16:31 Måns Rullgård
2019-01-24 15:54 Bin Liu
2019-01-24 15:49 Alan Stern
2019-01-24 15:43 Bin Liu
2019-01-24 15:40 Bin Liu
2019-01-24 15:22 Alan Stern
2019-01-24 12:56 Måns Rullgård
2019-01-24 9:25 Johan Hovold
2019-01-24 9:22 Johan Hovold
2019-01-24 8:11 Greg Kroah-Hartman
2019-01-23 20:50 Måns Rullgård
2019-01-23 20:44 Alan Stern
2019-01-23 17:42 Alan Stern
2019-01-23 16:53 Bin Liu
2019-01-23 16:05 Alan Stern
2019-01-23 15:21 Bin Liu
2019-01-23 14:55 Johan Hovold
2019-01-23 14:09 Bin Liu
2019-01-23 8:55 Johan Hovold
2019-01-23 6:52 Greg KH
2019-01-22 20:52 Bin Liu
2019-01-22 20:16 Bin Liu
2019-01-22 17:19 Måns Rullgård
2019-01-22 14:57 Bin Liu
2019-01-21 21:20 Måns Rullgård
2019-01-21 16:31 Bin Liu
2019-01-18 20:15 Måns Rullgård
2019-01-10 3:07 Bin Liu
2019-01-09 13:19 Måns Rullgård
2018-12-17 21:36 Måns Rullgård
2018-12-17 20:56 Bin Liu
2018-12-17 19:16 Måns Rullgård
2018-12-17 18:44 Bin Liu
2018-12-17 15:13 Måns Rullgård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190123201238.GD18982@uda0271908 \
--to=b-liu@ti.com \
--cc=greg@kroah.com \
--cc=johan@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mans@mansr.com \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).