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>,
"USB list" <linux-usb@vger.kernel.org>
Subject: MUSB interrupt storm on device removal
Date: Thu, 24 Jan 2019 09:43:57 -0600 [thread overview]
Message-ID: <20190124154357.GF18982@uda0271908> (raw)
On Thu, Jan 24, 2019 at 10:22:26AM -0500, Alan Stern wrote:
> On Thu, 24 Jan 2019, Johan Hovold wrote:
>
> > > At least when -EPROTO errors are caused by device disconnect, we know
> > > that they will eventually go away when the upstream hub reports the
> > > port disconnect event. But until then, an interrupt storm is certainly
> > > possible.
> >
> > Indeed, and this isn't the first time we've had this discussion either I
> > realised.
> >
> > In fact, I've been hit by this myself on BBB and musb when disconnecting
> > a device connected through an external hub.
> >
> > At the time, the immediate causes that were making the completion
> > handler take longer than usual (unaligned copy of a large buffer and a
> > printk respectively) could be fixed. The problem went away, but of
> > course not the underlying issue.
> >
> > Note that the problem I was seeing also went away both when switching to
> > a different single-core SoC using ehci-omap, or when replacing the
> > external hub. IIRC it wasn't the hub workqueue that was starved as a I
> > first had thought, but the hub interrupt was never even received (or
> > processed at least).
> >
> > Unfortunately, I never got around to investigating this further.
>
> I guess now we have some motivation to look into this more closely. :-)
>
> > > > > My point was that unless you fix this at the HCD level, you will need to
> > > > > add complex recovery handling to every USB driver and completion handler
> > > > > (~500 of those). But perhaps that is what it needed.
> > > >
> > > > okay, it probably make sense to handle the case in HCD because the
> > > > number of HCD is much less.
> > >
> > > 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.
> > >
> > > > > 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.
> >
> > I tend to agree with you on that, but adding complex back-off handling
> > of intermittent errors to every USB driver and completion handler will
> > be quite a bit of work. Unless the HCD drivers can assist, we'd at least
> > want have some part of the implementation provided by shared code.
> >
> > Also note that simply starting to bail out on any error now would risk
> > introducing regressions for setups where intermittent errors do occur.
>
> Agreed.
>
> > > Why doesn't the same problem occur with other types of host controller?
> >
> > I think we should get to the bottom of that. BBB is single core which
> > may be part of the reason why it's affected, but it's definitely related
> > to the controller as well.
>
> Perhaps it has something to do with the timing of the completion
> interrupts. I don't know anything about how musb works, though. Some
> low-level timing information would be good to see.
The musb controller driver itself doesn't have a isr BH, so when an ep
interrupt happened, the isr directly processes the urb and called
giveback. I tried to add HCD_BH to the musb hcd .flag, the issue still
happens.
Regards,
-Bin.
next reply other threads:[~2019-01-24 15:43 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 15:43 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: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 20:12 Bin Liu
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=20190124154357.GF18982@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).