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 5E48FC2D0D1 for ; Mon, 24 Jun 2024 17:02:36 +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:Content-Transfer-Encoding: Content-Type:In-Reply-To:References:Cc:To:From:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qOE56w0ktJJd9akk7x9QFeWDNrCx33c/tpi1K5dettI=; b=CxudR+6nIdyk4qPFTI4VJx7uSq tXDYI/uJ3N8k7jReDfFTwXXCdDykoa7JUJ34pxAifJbON5+3rd8vZMWTeW3IlF6Mw7+ZU4gwlsq8G JFer7gzv8wLsGmhcaC5iz/EnIqkSmXMNDdzpBer6zVWkYHZdNnbsgebEcyfgUWz96zXBcKw7bwZXW 0Br6CNBQXS1dafOpyH558FcGq0RpqTtdbQl0Pd39vQ0EHAPnNaRhwllNQbjS+m+9NCF+JJuhS7fGX 3RumBy3FF75YAYOO1c7Vizgi15OFzZHV8Wos5QDhLYojHosNbWysV8qlAOWBWn6DIBueiRnJNAKiR 2usynv4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLn5A-000000001hC-1xZI; Mon, 24 Jun 2024 17:02:20 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLn54-000000001gP-0rUU for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2024 17:02:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1719248523; x=1719853323; i=wahrenst@gmx.net; bh=qOE56w0ktJJd9akk7x9QFeWDNrCx33c/tpi1K5dettI=; h=X-UI-Sender-Class:Message-ID:Date:MIME-Version:Subject:From:To: Cc:References:In-Reply-To:Content-Type:Content-Transfer-Encoding: cc:content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=aieM7N45SG4j2wJp8qQ0vkUp7ju+mEcESJiSvL/Qi/TFdQWCZAyVQ5gj1LvaICb1 V4I74pF1PXV3jtyn/8Iaccq9h+cnqdL7mDGxXv6RQyt1GAjRXaNQJEI1XHT7l2xJM 8eD2d1Sa3t/5e0EGjPlKfe7BWbp39bc07PdfEpCe7hzvYvG2YtXi4j99driGeE/TU Jf5n3N500hcJ8NdIKC5ydPMePqeVhsQQaoe7VK2vZDlK6e1xTeAugJb/5qTZMZPaa CxS8KHOVCxmRRGg8KLNSjViqgGWoopdIF/w2BUkkFJAFbOXTQeb6pNM7E/p7RByYx gIVFFu9N42OSTe6pkg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.1.127] ([37.4.248.43]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Msq6M-1sb84J1Oh6-014n1e; Mon, 24 Jun 2024 19:02:03 +0200 Message-ID: <3fd0c2fb-4752-45b3-94eb-42352703e1fd@gmx.net> Date: Mon, 24 Jun 2024 19:02:02 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: dwc2: irq 66: nobody cared triggered on resume From: Stefan Wahren To: Lukas Wunner , Minas Harutyunyan Cc: Florian Fainelli , Thomas Gleixner , "linux-usb@vger.kernel.org" , Linux ARM , bcm-kernel-feedback-list@broadcom.com, Ray Jui , Scott Branden , Marc Zyngier References: <2bcf7fac-8e8f-4d7a-a837-08805a0076e3@gmx.net> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:CCpXIav8XGdBBv7GqvLBNq4Tv2xl2XffNnzZ8LT9zWFijYP26Te 8kZCJ/wwv3AYOkr8GHy+xNoWDun2YbmdRxLx7egpWRUoziB3s/SiAK1tEFrARBvHzIghBRP Q5J8E0dtIZ6Xtf3yMI/hGfRqq+079l2Kf6gQ+L8+GA5oTRyW9QACbZxVuT+eQMJESFJ8Cmj pevrLJY4g9kPCNCflJnzw== UI-OutboundReport: notjunk:1;M01:P0:B9irqgBdb8Y=;8TxSaOGZXdglIlDb/kpsT/AN/zZ h8frn1B8kJFeVP///uGFRu54h++I25+16V4aUg+J6z5MqQY1IuPW7HnhAGQk9tTiuCMcKr6Zg ZKeHdK9vFrrZ780NwRmoBzRgT4gxR09Yq9GUf2LH+ItwZ3ZUkL8ac+s5NnRjFrp2jmgfExgp5 sdFtpWknYeYAwvmJO5Cyktv6PL6Q9mNnns1hLBzWmUFcNVzheSuAO7tL9y+jRUY3TWQBBc0uJ zi7zxh5NlgWGyHj4kdWNkeuxNeMmOrLSDriqfapzj3Sf39vpO5pE2h7PQ4vpOL7kPkVC8CseO 4nF2W9HgVlE/pIc+AbSP+eq/UvKCGD44Nf4MhTcDf84Rvlm8hg6DR80SJNLD01XGleoF+gKpJ dzWhnwrsKwU0t3MdFw65G+a4L5kHSdbIHR79tfXEstvzVIwXyfgUiJcrvxVZqXp3a6P4DTWj8 taA2le4zIWuXz0+e1sghGhSguRAOGPT6Prt50zLBf0zeXiSiym8OBG+K6r8NmwmNDCWmRudPv d0LM+ScfuQ2nlaKQ4TaHGZ4VvJ5YwxQQy9owy6iya4IC18GBRXelmEWrBnXHUixKQ2EQsDmlk YM2WLwdieQCevqlz1XGfwL0IN640PDdRBfk53oEs+cdJyKR8CTmfAEH1N37BfMq/OGik39tJQ wZ2TZzM9ia1mjDFJYMDGq7OQQvKKcaJfxxf6SHc34MT8gBNqtNUQ0iV+XEnLy/BOrnO00zFeA EnoYFK2irTvsmEFLBY2x3uwqtcH0EF2YtyHzKUuZKIE4G+yUuSxmtbg4vOTmBu+upDmQqBi9M WMgRFx+MJzlQ8B8mU8DIx85oF/X/WUA9wjRj5XqjuJmFo= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240624_100214_731155_F369EA7A X-CRM114-Status: GOOD ( 19.37 ) 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 Hi, Am 23.06.24 um 15:27 schrieb Stefan Wahren: > Hello Lukas, > > Am 22.06.24 um 20:47 schrieb Lukas Wunner: >> On Sat, Jun 22, 2024 at 02:23:33PM +0200, Stefan Wahren wrote: >>> i currently experiment with suspend to idle on the Raspberry Pi 3 A+. >>> Supend & resume works expected as long as no USB device is connected t= o >>> the board. If i connect a USB hub to the Pi, the resume phase is >>> significantly delayed and the kernel disabled IRQ 66 which belongs >>> to DWC2. >> [...] >>> [ 1131.109996] PM: noirq resume of devices complete after 1.273 msecs >>> [ 1131.111208] PM: early resume of devices complete after 1.051 msecs >>> [ 1131.230277] brcmfmac: brcmf_fw_alloc_request: using >>> brcm/brcmfmac43455-sdio for chip BCM4345/6 >>> [ 1131.458687] irq 66: nobody cared (try booting with the "irqpoll" >>> option) >>> [ 1131.458714] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G W >>> 6.10.0-rc3-g7fd4227d1bd5-dirty #49 >>> [ 1131.458734] Hardware name: BCM2835 >>> [ 1131.458744] Call trace: >> [...] >>> [ 1131.458877] note_interrupt from handle_irq_event+0x88/0x8c >>> [ 1131.458900] handle_irq_event from handle_level_irq+0xb4/0x1ac >>> [ 1131.458923] handle_level_irq from >>> generic_handle_domain_irq+0x24/0x34 >>> [ 1131.458957] generic_handle_domain_irq from >>> bcm2836_chained_handle_irq+0x24/0x28 >>> [ 1131.458992] bcm2836_chained_handle_irq from >>> generic_handle_domain_irq+0x24/0x34 >>> [ 1131.459024] generic_handle_domain_irq from >>> generic_handle_arch_irq+0x34/0x44 >>> [ 1131.459056] generic_handle_arch_irq from __irq_svc+0x88/0xb0 >>> [ 1131.459079] Exception stack(0xc1b01f20 to 0xc1b01f68) >>> [ 1131.459142] __irq_svc from default_idle_call+0x1c/0xb0 >>> [ 1131.459167] default_idle_call from do_idle+0x21c/0x284 >>> [ 1131.459202] do_idle from cpu_startup_entry+0x28/0x2c >>> [ 1131.459239] cpu_startup_entry from kernel_init+0x0/0x12c >>> [ 1131.459271] handlers: >>> [ 1131.459279] [] dwc2_handle_common_intr >>> [ 1131.459308] [<75cd278b>] usb_hcd_irq >>> [ 1131.459329] Disabling IRQ #66 >> [...] >>> An ideas what causing this issue? >> Interrupts are re-enabled after the resume_noirq phase.=C2=A0 Looks lik= e >> the chip signals an interrupt right afterwards but the two hardirq >> handlers do not feel responsible. >> >> The only option might be to add a few printk() in >> dwc2_handle_common_intr(), >> usb_hcd_irq() and dwc2_handle_hcd_intr() (called from usb_hcd_irq()) >> to see why they're all returning IRQ_NONE without clearing the source >> of the interrupt.=C2=A0 The chip just keeps signaling interrupts becaus= e >> the driver doesn't handle them, hence the IRQ storm which the IRQ core >> eventually stops by outright disabling the interrupt. > thanks for your suggestion. Unfortunately placing printk in those busy > interrupt handler is futile, so i switched to debugfs. This issue > would be much easier in case the interrupt wouldn't be shared. But > first let me share some outputs before i start to extend debugfs further= : > > 1. No hub connected to Rpi 3 A+ > > root@raspberrypi:/sys/kernel/debug/usb/3f980000.usb# cat state > DCFG=3D0x00000000, DCTL=3D0x00000000, DSTS=3D0x0007ff02 > DIEPMSK=3D0x00000000, DOEPMASK=3D0x00000000 > GINTMSK=3D0xf3000806, GINTSTS=3D0x04000023 > DAINTMSK=3D0x00000000, DAINT=3D0x00000000 > GNPTXSTS=3D0x00080100, GRXSTSR=3D3f83bbfe > > 2. Hub connected before suspend / irq issue > > DCFG=3D0x00000000, DCTL=3D0x00000000, DSTS=3D0x0007a202 > DIEPMSK=3D0x00000000, DOEPMASK=3D0x00000000 > GINTMSK=3D0xf300080e, GINTSTS=3D0x04000023 > DAINTMSK=3D0x00000000, DAINT=3D0x00000000 > GNPTXSTS=3D0x08080100, GRXSTSR=3D789a460a > > 3. Hub connected after suspend / irq issue > > DCFG=3D0x00000000, DCTL=3D0x00000000, DSTS=3D0x0007ff02 > DIEPMSK=3D0x00000000, DOEPMASK=3D0x00000000 > GINTMSK=3D0xf1000806, GINTSTS=3D0x0500002b > DAINTMSK=3D0x000000ff, DAINT=3D0x00000000 > GNPTXSTS=3D0x29080100, GRXSTSR=3Dbefdf595 > > Based on my limited knowledge and observations the issue seems related > to GINTMSK/GINTSTS and a outstanding GINTSTS_PRTINT. i narrowed this a little bit further. At least i know the reason for the "nobody cared". It's clear that the issue is triggered by GINTSTS_PRTINT. The DWC2 controller is in host mode so dwc2_handle_common_intr() ignores the interrupt and returns IRQ_NONE. But usb_hcd_irq() also cannot handle it because HCD_FLAG_HW_ACCESSIBLE is still clear, so the handler also returns IRQ_NONE :-( Is disabling the IRQ via the upper layers an expected behavior instead of letting the DWC2 controller driver resolve the situation? But back to the root cause. I followed the suspend/resume path, why the HCD_FLAG_HW_ACCESSIBLE is not cleared. Suspend path: The power down is DWC2_POWER_DOWN_PARAM_NONE so the HCD_FLAG_HW_ACCESSIBLE is cleared ( https://elixir.bootlin.com/linux/v6.10-rc3/source/drivers/usb/dwc2/hcd.c#L= 4385 ). Resume path: During resume the HPRT0_CONNSTS flag is set, so the HCD_FLAG_HW_ACCESSIBLE is not set ( https://elixir.bootlin.com/linux/v6.10-rc3/source/drivers/usb/dwc2/hcd.c#L= 4435 ). Is the reason for this behavior the lack of clock gating support on BCM283x or is it a driver bug? How can i figure out clock gating is supported? Regards > > Regards