From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C01C6C5B543 for ; Tue, 10 Jun 2025 10:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nUVTmfdkyIz2sCibo8CQYdH/ADMQuNhoQmpTEzyRL5M=; b=U4bd4dS0ul2XUeUYfiSbrvxmKJ PlLBvrB+7obPoDoLDSnQUZVKnTsuGb5nIZSxRsHFk4eS+xH0GaYp/dhR+2hfUg2nwX3LQx+7Uw+eI ckkIonMRjyr9a0YfaKmg0HsCpFHoM/iE5648RspJ6/FjmvTLqOXFORBQ0Viw6OCCApHX+A/JEVnt1 ulcmLtLj5uMBUQDFDFPgVmSZ40t3Cr3yI4f6mOszkBUvW7TJzzlGRjjeWmLtRIjD+UKA8xzi1z6MF QTlEhmA/4j5t4wB00Q9hIlXT+FdHPPAPszgLw5HfHeQtjcKb0A0ZNNdXuBiMpa+51cH5/Jy783Bxl OlFO0MwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uOwet-00000006Y1G-2yT4; Tue, 10 Jun 2025 10:56:47 +0000 Received: from mail-m16.yeah.net ([220.197.32.19]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uOvct-00000006OxN-3QI8 for linux-arm-kernel@lists.infradead.org; Tue, 10 Jun 2025 09:50:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yeah.net; s=s110527; h=Date:From:To:Subject:Message-ID:MIME-Version: Content-Type; bh=nUVTmfdkyIz2sCibo8CQYdH/ADMQuNhoQmpTEzyRL5M=; b=qNGD5sEGGVHWy8tTwX792dVz/FOchRHUWGIobOMMn684dG2AfKdMafxMgMN6yL oNo1c1YramDqSCyFpDJxlToxQXLxDGO+L2i8mV0ZmdjtY7CK+tZzBpsGerCLqGyR q/PPFm6yl4jVK8fL/eoZl7Kw4TyqKglkseO32kQd4YnY8= Received: from dragon (unknown []) by gzsmtp3 (Coremail) with SMTP id M88vCgD3xx3b_0doxXNVAA--.50837S3; Tue, 10 Jun 2025 17:50:21 +0800 (CST) Date: Tue, 10 Jun 2025 17:50:19 +0800 From: Shawn Guo To: Xu Yang Cc: Peter Chen , Shawn Guo , imx@lists.linux.dev, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: i.MX kernel hangup caused by chipidea USB gadget driver Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CM-TRANSID: M88vCgD3xx3b_0doxXNVAA--.50837S3 X-Coremail-Antispam: 1Uf129KBjvJXoWxAFykZw4DZF1kKFWUtw1xGrg_yoW5WF17pa 1ayFWIka1kGa4rGr47Kw17KFyUXa9YkrWqkryxGw4xXFy3ur95GF17K34Fvr90kryfJanF yF4qgw1DAFyvga7anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07UC1v3UUUUU= X-Originating-IP: [117.82.86.8] X-CM-SenderInfo: pvkd40hjxrjqh1hdxhhqhw/1tbiCwVoZWhH4ayQ7wAAse X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250610_025040_246774_1FA639A2 X-CRM114-Status: GOOD ( 20.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jun 09, 2025 at 07:53:22PM +0800, Xu Yang wrote: > 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? Thanks for the patch, Xu! It does fix the hangup but seems to be less reliable than my/Peter's change (disconnecting gadget), per my testing on a custom i.MX8MM board. With your change, host/PC doesn't disconnect gadget when the board suspends. After a few suspend cycles, Ethernet gadget stops working and the following workqueue lockup is seen. There seems to some be other bugs? [ 223.047990] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: [ 223.054097] rcu: 1-...0: (7 ticks this GP) idle=bb7c/1/0x4000000000000000 softirq=5368/5370 fqs=2431 [ 223.063318] rcu: (detected by 0, t=5252 jiffies, g=4705, q=2400 ncpus=4) [ 223.070105] Task dump for CPU 1: [ 223.073330] task:systemd-network state:R running task stack:0 pid:406 ppid:1 flags:0x00000202 [ 223.083248] Call trace: [ 223.085692] __switch_to+0xc0/0x124 [ 246.747996] BUG: workqueue lockup - pool cpus=1 node=0 flags=0x0 nice=0 stuck for 43s! However, your change seems working fine on i.MX8MM EVK. It's probably due to the fact that host disconnects gadget for some reason when EVK suspends. This is a different behavior from the custom board above. We do not really expect this disconnecting, do we? Shawn > ---8<-------------------- > > diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c > index 8a9b31fd5c89..27a7674ed62c 100644 > --- a/drivers/usb/chipidea/udc.c > +++ b/drivers/usb/chipidea/udc.c > @@ -2367,6 +2367,8 @@ static void udc_id_switch_for_host(struct ci_hdrc *ci) > #ifdef CONFIG_PM_SLEEP > static void udc_suspend(struct ci_hdrc *ci) > { > + ci->driver->suspend(&ci->gadget); > + > /* > * Set OP_ENDPTLISTADDR to be non-zero for > * checking if controller resume from power lost > @@ -2389,6 +2391,8 @@ static void udc_resume(struct ci_hdrc *ci, bool power_lost) > /* Restore value 0 if it was set for power lost check */ > if (hw_read(ci, OP_ENDPTLISTADDR, ~0) == 0xFFFFFFFF) > hw_write(ci, OP_ENDPTLISTADDR, ~0, 0); > + > + ci->driver->resume(&ci->gadget); > } > #endif > > ---->8------------------