From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3AACF606A339 for ; Tue, 1 Dec 2026 07:31:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=RUE1g1Qc; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bvW+FVut 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:MIME-Version: Content-Transfer-Encoding:Content-Type:References:In-Reply-To:Message-ID:Date :Cc:To:From:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=5XygkUa3/5sMz28ccXD1UVWOtmP5lfoiTDvsYj9xjHE=; b=RUE1g1Qc8TiS2lnqzk/hHTX+yK cfm3ZpE37wsTBb0uN9QXS0skXLWKjZzFMGpNfmWIwmEkxalI7RavdldbSAzy9AtjaQ9hFw4YfZvti lxA7ypHEo2zapZeZJUFPHhKBKyinx1CF9FfjzzwSvqDpuqRTn5ZqjXfGbVsyxF30YJ/HEafeZFSM+ BLno/hfTLS1SNFh9km4kiKcehwn0Ge/KwhCz3B0DXtFbsioQCxAb5vqEIyOM6wslL7t1cTaE3+9MU R+9euBmszaKgI6O9YDFVHy3qcpiDWzKFSvvssScjElkC7m8UWdJ9JeZppCYUQn3NkBF4yJZxHjzMj Kt4dra5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYIKN-00000006uPz-4Bmv; Tue, 01 Dec 2026 07:31:04 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYIKA-00000006uLB-2XKt; Tue, 01 Dec 2026 07:30:50 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 4D32543528; Tue, 1 Dec 2026 07:30:50 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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