All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: "Bin Liu" <b-liu@ti.com>, "Måns Rullgård" <mans@mansr.com>,
	linux-usb@vger.kernel.org, johan@kernel.org
Subject: MUSB interrupt storm on device removal
Date: Wed, 23 Jan 2019 07:52:12 +0100	[thread overview]
Message-ID: <20190123065212.GA27080@kroah.com> (raw)

On Tue, Jan 22, 2019 at 02:52:44PM -0600, Bin Liu wrote:
> Hi Johan,
> 
> On Tue, Jan 22, 2019 at 02:16:30PM -0600, Bin Liu wrote:
> > On Tue, Jan 22, 2019 at 05:19:39PM +0000, Måns Rullgård wrote:
> > > Bin Liu <b-liu@ti.com> writes:
> > > 
> > > > On Mon, Jan 21, 2019 at 09:20:52PM +0000, Måns Rullgård wrote:
> > > >> Bin Liu <b-liu@ti.com> writes:
> > > >> 
> > > >> > On Fri, Jan 18, 2019 at 08:15:02PM +0000, Måns Rullgård wrote:
> > > >> >> Bin Liu <b-liu@ti.com> writes:
> > > >> >> 
> > > >> >> > On Mon, Dec 17, 2018 at 09:36:17PM +0000, Måns Rullgård wrote:
> > > >> >> >> Bin Liu <b-liu@ti.com> writes:
> > > >> >> >> 
> > > >> >> >> > On Mon, Dec 17, 2018 at 07:16:08PM +0000, Måns Rullgård wrote:
> > > >> >> >> >> Bin Liu <b-liu@ti.com> writes:
> > > >> >> >> >> 
> > > >> >> >> >> > Hi,
> > > >> >> >> >> >
> > > >> >> >> >> > On Mon, Dec 17, 2018 at 03:13:12PM +0000, Måns Rullgård wrote:
> > > >> >> >> >> >> I have a strange problem with the musb driver in host mode on AM3358
> > > >> >> >> >> >> (beaglebone) hardware.  If I connect a multi-port serial adapter and
> > > >> >
> > > >> > Is this on beaglebone or beagleboneblack?
> > > >> 
> > > >> We've seen it with Beaglebone Enhanced [1] and BeagleCore [2] based
> > > >> devices.  Both are based on the AM3358 and mostly compatible with the
> > > >> Beaglebone Black.
> > > >> 
> > > >> [1] https://elinux.org/SanCloud_BeagleBoneEnhanced
> > > >> [2] http://beaglecore.com/products/bcm1str.html
> > > >
> > > > Okay, now I see you have a hub on the board. I just reproduced the
> > > > console lockup after added a hub in my setup. I will find some time to
> > > > debug this.
> > > >
> > > > FYI, there was a similar issue in a few years ago, which was that the
> > > > hub routine never got called during the storm then the device disconnect
> > > > event never got populated from the hub driver. I am wondering if this is
> > > > the same issue pops up again...
> > > 
> > > Now that you mentioned the hub, I tried connecting the serial adapter to
> > > the OTG port (in host mode) on the Beaglebone Enhanced (it's not
> > > normally used in this product).  When connected directly, the disconnect
> > > indeed works properly.  With a hub in between, it breaks.
> > 
> > Please use the following hack as a workaround for now. I will think more
> > about it.
> > 
> > Regards,
> > -Bin.
> > 
> > --------8<----------
> > diff git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c
> > index b59ce9ad14ce..3719f6d9b26c 100644
> > --- a/drivers/usb/musb/musb_host.c
> > +++ b/drivers/usb/musb/musb_host.c
> > @@ -1811,7 +1811,7 @@ void musb_host_rx(struct musb *musb, u8 epnum)
> >         } else if (rx_csr & MUSB_RXCSR_H_ERROR) {
> >                 musb_dbg(musb, "end %d RX proto error", epnum);
> >  
> > -               status = -EPROTO;
> > +               status = -EPIPE;
> >                 musb_writeb(epio, MUSB_RXINTERVAL, 0);
> >  
> >                 rx_csr &= ~MUSB_RXCSR_H_ERROR;
> 
> When a usb serial device is detached, the musb controller driver returns
> -EPROTO in urb giveback, then usb_serial_generic_read_bulk_callback()
> re-submit the urb, this circle causes interrupt storm, and the hub
> driver workqueue never got a chance to run to populate the device
> disconnect event, the whole console locks up. Do you think
> usb_serial_generic_read_bulk_callback() should handle -EPROTO as well?

Why is musb returning that error?  According to the documentation we
have about this type of thing
(Documentation/driver-api/usb/error-codes.rst), that should only happen
if one of the following just occured:
	- bitstuff error
	- no response packet received within the prescribed bus
	  turn-around time
	- unknown USB error

That's not what any other host controller returns when a device is
removed, so either you are going to have to fix all USB drives for this
issue, or you need to fix the musb driver to not send this error for
when a device is removed (hint, do the latter...)

-EPROTO is supposed to be sent when there is a real hardware error in
the system, not when a normal operation happens.

thanks,

greg k-h

             reply	other threads:[~2019-01-23  6:52 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-23  6:52 Greg KH [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 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-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=20190123065212.GA27080@kroah.com \
    --to=greg@kroah.com \
    --cc=b-liu@ti.com \
    --cc=johan@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mans@mansr.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.