[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEgEF6YKYccequVw@dragon>
Date: Tue, 10 Jun 2025 18:08:23 +0800
From: Shawn Guo <shawnguo2@...h.net>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Xu Yang <xu.yang_2@....com>, Peter Chen <peter.chen@...nel.org>,
Shawn Guo <shawnguo@...nel.org>, imx@...ts.linux.dev,
linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org
Subject: Re: i.MX kernel hangup caused by chipidea USB gadget driver
Hi Alan,
On Mon, Jun 09, 2025 at 09:54:45AM -0400, Alan Stern wrote:
> On Mon, Jun 09, 2025 at 07:53:22PM +0800, Xu Yang wrote:
> > Hi Shawn,
> >
> > Thanks for your reports!
> >
> > On Mon, Jun 09, 2025 at 01:31:06PM +0800, Shawn Guo wrote:
> > > Hi Xu, Peter,
> > >
> > > I'm seeing a kernel hangup on imx8mm-evk board. It happens when:
> > >
> > > - USB gadget is enabled as Ethernet
> > > - There is data transfer over USB Ethernet
> > > - Device is going in/out suspend
>
> > During the scp process, the usb host won't put usb device to suspend state.
> > In current design, then the ether driver doesn't know the system has
> > suspended after echo mem. The root cause is that ether driver is still tring
> > to queue usb request after usb controller has suspended where usb clock is off,
> > then the system hang.
> >
> > With the above changes, I think the ether driver will fail to eth_start_xmit()
> > at an ealier stage, so the issue can't be triggered.
> >
> > I think the ether driver needs call gether_suspend() accordingly, to do this,
> > the controller driver need explicitly call suspend() function when it's going
> > to be suspended. Could you check whether below patch fix the issue?
>
> The situation is more complicated than this.
>
> In general, a USB gadget cannot allow itself to be suspended while the
> USB bus it is connected to remains active. Not unless it can be set to
> wake up when a USB packet arrives, and even that probably won't work
> because the wakeup sequence would take too long and the USB transfer
> would time out on the host.
>
> The best way to fix this problem is for the gadget to disconnect itself
> from the USB bus whenever it goes into suspend, and to reconnect when it
> resumes.
Thank you so much for the insight! It matches my testing pretty well.
The disconnect/reconnect gadget in udc suspend/resume is more reliable
than suspend/resume gadget.
Shawn
Powered by blists - more mailing lists