From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796110250; b=SF9NHLyuPsU9L8Bil2SmRLHsERfeYp6nKd+54U7Z3tETylUr+hTCf712s9bRncR4uS9i TGAjSVLYTBeD/5Cei0fgiBK9Se1k78+qX74/+cCqln8JqxrPnAx7j3xzSQBkw+kXkRPmH DaQX32G69S1PIRv+sJ7M4WbSPnSlgtKIX/SYqNZU8zDI+rnFevdqRvn8EU9GnzOid2JkV xtD5YxEYBiD+JxWlP2Hs31d+zMoVlW7JKCHod6y9u5c5JDvdMFDNl5pK4Ny4Z6oiDEUHb 5HKn8Ej3gKixpOsNRsG0pPE4xbKmQMBgKakdCSipLxdm81eLGhvSr0oOAAY7UtBCy1A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796110250; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=5XygkUa3/5sMz28ccXD1UVWOtmP5lfoiTDvsYj9xjHE=; b=JJIVGqttkf55yOAkAVATcdMq8LIOFSi8rdncRZ/wv/zJbdPL5BH72S82eIsdsWaYWB/C Oy5iRehar1KE9HUd6dxo352Fo0NAHblElWc59oJwIaOIiTAg+5dnkVfqWc8rBjVD090YE TTJZOHRdl8jU375b50k9uWZ8miIPSGUPWjx8/Nb0Q520KkH6pn2s7X30t9Y61j71pUUwm ZjdDFBRx5l84sc8/Dlx9ZLgbk6/A+3K7rSBPCRkDOzHacU1RGdXT1uUP/2rn1ifyIkHWs GenDB3XP928alaVdmTBuDmsZwcJQFXjjwM/Ks9Y7nI1SGmpil8FBIGWKTBMIJERFQCg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bvW+FVut; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 814E8606A695; Tue, 1 Dec 2026 07:30:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bvW+FVut Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0AEA1F00897; Tue, 1 Dec 2026 07:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796110250; bh=5XygkUa3/5sMz28ccXD1UVWOtmP5lfoiTDvsYj9xjHE=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=bvW+FVutZ/gvTqpQ/cCP7+mTUh3SdHwthektC+7BiMKfE9upR28gcvjZZtxYkNieT VIPf6vJRJJXcs6KSTp+QC0oYM0eePur6/YLciWsZ749GKxwDIt69AIhqQc/l9ZWf34 wv0lDn1TbuXam5RlvUNPE0bYTwPCs3Xla/CYhendAVvcwXiu0YitEK+2HtrOvkOoSK 2NnvPGdjTaVArTHEw6V1FUGLVKi07a1aILJTMo5TVb2ckN3vmvMnvjoWKguijzQP/3 laUjB2GjkEePXZoNc8kh9onOmyn2RAYUycnUAWMjaF+DYzPO0g6gg/UTfe8bWdrAWi 02r8d0q2ED7Og== Subject: Re: [PATCH net v9 3/5] net: phy: stop postponing PHY interrupts when phy_suspend() fails From: netdev-bot+sashiko@kernel.org To: iav@iav.lv Cc: andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, tglx@kernel.org, linux-pm@vger.kernel.org, maxime.chevallier@bootlin.com, lukas@wunner.de, rafael.j.wysocki@intel.com, wei.fang@nxp.com, niklas.soderlund@ragnatech.se, paul@pbarker.dev, florian.fainelli@broadcom.com, opendmb@gmail.com, Thangaraj.S@microchip.com, shenwei.wang@nxp.com, Haoning.CHENG@cn.bosch.com, willemb@google.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Date: Tue, 01 Dec 2026 07:30:48 +0000 Message-ID: <179611024824.3146.12326645036576718233@kernel.org> In-Reply-To: <20261130-b4-phylib-mac-pm-irq-v3-v9-3-7b9c3c9ac9f7@iav.lv> References: <20261130-b4-phylib-mac-pm-irq-v3-v9-3-7b9c3c9ac9f7@iav.lv> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-pm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The new failure branch in mdio_bus_phy_suspend() (drivers/net/phy/phy_device.c) undoes only the phylib side of the… -- net: phy: stop postponing PHY interrupts when phy_suspend() fails When phy_suspend() fails in mdio_bus_phy_suspend(), the patch now undoes the interrupt postponing and restarts the state machine. It also sets suspended_by_mdio_bus only once phy_suspend() has succeeded. The error paths of mdio_bus_phy_resume() are left as they were. > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > index f2e2370b4be7c..2d2058c29f300 100644 > --- a/drivers/net/phy/phy_device.c > +++ b/drivers/net/phy/phy_device.c [ ... ] > @@ -385,9 +386,20 @@ static __maybe_unused int mdio_bus_phy_suspend(struct device *dev) > if (!mdio_bus_phy_may_suspend(phydev)) > return 0; > > + ret = phy_suspend(phydev); > + if (ret) { > + /* The PM core skips the resume callback of a device whose > + * suspend callback failed. > + */ > + mdio_bus_phy_resume_irq(phydev); > + if (phy_uses_state_machine(phydev)) > + phy_start_machine(phydev); > + return ret; > + } [Severity: Medium] This branch undoes the phylib side of the suspend. Does it also undo what phydrv->suspend() may have done to the hardware before it failed? phy_suspend() doesn't roll anything back. On error it only skips setting phydev->suspended. Some PHY drivers mask their own interrupt sources first and then do a power-down MDIO write that can fail. For example: drivers/net/phy/marvell-88q2xxx.c:mv88q2xxx_suspend() { ... if (phy_interrupt_is_valid(phydev)) { phydev->interrupts = PHY_INTERRUPT_DISABLED; ret = mv88q2xxx_config_intr(phydev); if (ret) return ret; } return phy_set_bits_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_CTRL1, MDIO_CTRL1_LPOWER); } kszphy_suspend() in micrel.c follows the same pattern through drv->config_intr() and then kszphy_generic_suspend()->genphy_suspend(). So does dp83867_suspend(), through dp83867_config_intr() and then genphy_suspend(). Suppose the final power-down write fails, for example with an MDIO timeout or -EIO. The PHY's interrupt generation is then masked in hardware and phydev->interrupts is still PHY_INTERRUPT_DISABLED. Only the drivers' resume callbacks, such as mv88q2xxx_resume() and kszphy_resume(), turn it back on. This branch calls neither phy_resume() nor phy_init_hw(). phydev->irq is still valid, so phy_polling_mode() returns false. After the restarted state machine runs once, phylib waits for PHY interrupts the hardware no longer generates. Would link up/down changes then be lost until ifdown/ifup or the next successful suspend/resume cycle? Would calling phy_resume() here help? __phy_resume() calls phydrv->resume() whether or not phydev->suspended is set. The other option would be for these drivers' suspend callbacks to undo their interrupt masking on error. > + > phydev->suspended_by_mdio_bus = 1; > > - return phy_suspend(phydev); > + return 0; > } -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-b4-phylib-mac-pm-irq-v3-v9-0-7b9c3c9ac9f7%40iav.lv