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=1796341281; b=X1Z4GnszKEu3BmzmcCqUQUnzW/izsshDvSZ3fwpzrAvMTZE+TwnRE5uDtjg2BDEZ1IH9 7RqdZLG2/OXeI/qaNGZ8SiMgNuGD/Rhf5wPebjxkQ7Y6C4Otdd4pnqpRXrYcTWA/MsAs8 5CQDhjol12G+pv706M1rCCDqXVG+UmuhmuTBS7ezx5ux2z/o17b90lKtx9OfpOhFOq0tx LKLF5Uc2lLhcY38LMTKgOUERH/CDZSY4dQ5MbTXI3AYZwemP9ZzPAe1UYh1wdVvvmSYOr HnhA0DGmx+K7wO+kW0EWTdxphxshvS11epBW3gIIz2X02WMFnNAp5D0enxLjIgOvyGg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796341281; 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=rnYmp5x/rTsPcZyu0cOMIWEbuJtgD+ypy0xa5iof2Bw=; b=ikWBVQiW45P2FnY8z4g1ugFvvGYwLDDxPge47aw1zCic+uLm1ooxms6MoPLlRBBmPh/i oyLnac1NNeA0q73o1RpefaWzI29t3VuozpTrt5oOx7n13+4Ls5wagBle3wuTNN6m+qIzk fN5xjweLopUOPVmaf4JVQPzTo/xoxUIzZ8frlVPyd7j+yJ6O5D0RJYF6PXooWtBln1jY0 8Qrm7BfrujlDC35W4Pk/PyrD1HQ+o/bfgLiVKXrNoO8r5SwDeoTMhObizDPvInMDKHq29 oy4GOxRhxIqGKffXKk/nOSvcg37l+ejVFFrzr8GSNDNPGDn3CSSnaRWXBD/y1uQAukQ== 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=UoYaYErd; 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 501C5606A32F; Thu, 3 Dec 2026 23:41:21 +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=UoYaYErd Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC9E71F00931; Thu, 3 Dec 2026 23:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796341281; bh=rnYmp5x/rTsPcZyu0cOMIWEbuJtgD+ypy0xa5iof2Bw=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=UoYaYErd7sY1gOsbspSgWyxgIiG3xzZ7XH/mV8M3Igs6mpOc7veHPIe5PoFdpoTfD 0c0C1Xs37LjsKkoVUaGEcgrtUKkEYji5igkJG116tR2dPpgKpv8t5UEii9rcRO6Wpb LMaqzr3K+ZakcPzyUUyC/HfP+H+3plI+KHRrRzXMizlQDP4iJXbmgMYmnJEpQfEN/L cnqACRiw6ew5udNMvLZ4Cf43UZjpvQeCuI/+pomfvV/GcZgyUF8U96xwAh2tijGqE+ zxaS/wSNmnvk894jLDBNdL0bP2yDathO+FGe1+gu4LNA+tQxorDGLmvySheNllyC7e 4zQtG3igj+ATA== Subject: Re: [PATCH net v5 09/10] net: au1000: keep the MAC stopped until the PHY link is ready From: netdev-bot+sashiko@kernel.org To: f.fainelli@gmail.com Cc: netdev@vger.kernel.org, horms@kernel.org, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, hkallweit1@gmail.com, linux@armlinux.org.uk, shaojijie@huawei.com, runyu.xiao@seu.edu.cn, mmyangfl@gmail.com, hvr@gnu.org, danny.kukawka@bisect.de, mugunthanvnm@ti.com, sebastian.hesselbarth@gmail.com, linux-kernel@vger.kernel.org, manuel.lauss@gmail.com Date: Thu, 03 Dec 2026 23:41:19 +0000 Message-ID: <179634127950.3146.17178958985267882353@kernel.org> In-Reply-To: <20261202224957.3043478-10-f.fainelli@gmail.com> References: <20261202224957.3043478-10-f.fainelli@gmail.com> X-sashiko-severity: Medium Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: linux-kernel@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 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 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] au1000_resume() (drivers/net/ethernet/amd/au1000_eth.c) calls phy_init_hw() and phy_resume() on the attached PHY before it checks… - [Low] net: au1000: missing discovery and runtime test context in changelog -- net: au1000: keep the MAC stopped until the PHY link is ready This patch keeps au1000 MAC RX/TX disabled until phylib reports link up and stops the MAC on link-down. au1000_open() now resumes the PHY synchronously before MAC initialization. The patch also adds system sleep PM ops that manage PHY power from the MAC driver, and marks every PHY on the MDIO bus as mac_managed_pm. > diff --git a/drivers/net/ethernet/amd/au1000_eth.c b/drivers/net/ethernet/amd/au1000_eth.c > index ec28ed33bf698..5bfafe52020f6 100644 > --- a/drivers/net/ethernet/amd/au1000_eth.c > +++ b/drivers/net/ethernet/amd/au1000_eth.c [ ... ] > +static int au1000_resume(struct device *device) > +{ > + struct net_device *dev = dev_get_drvdata(device); > + struct au1000_private *aup = netdev_priv(dev); > + unsigned long flags; > + int ret = 0; > + > + rtnl_lock(); > + spin_lock_irqsave(&aup->lock, flags); > + aup->old_link = 0; > + aup->old_speed = 0; > + aup->old_duplex = -1; > + spin_unlock_irqrestore(&aup->lock, flags); > + > + if (dev->phydev) { > + ret = phy_init_hw(dev->phydev); > + if (ret) > + goto err_reset; > + ret = phy_resume(dev->phydev); > + if (ret) > + goto err_reset; > + } > + > + if (!netif_running(dev)) { > + /* PHY reinitialization may have enabled the MAC for MDIO. */ > + au1000_reset_mac(dev); > + netif_device_attach(dev); > + goto out; > + } [Severity: Low] The changelog explains the mechanism in detail, but it still doesn't say how these problems were found or which of them were seen on real hardware. On v4 you replied that the open/close/open hang on MTX-1 was hit during hardware testing, and that the other issues were found by code inspection. Jakub asked for that to be recorded in the changelog when the series was reposted: https://lore.kernel.org/r/20261121103844.2c27eba4@kernel.org This patch now bundles several separate changes: - the link-down MAC stop in au1000_adjust_link() - the phy_init_hw()/phy_resume() ordering before au1000_init() in au1000_open() - the new au1000_suspend()/au1000_resume() PM ops - setting mac_managed_pm on every PHY on the bus for the address 31 alias - the failed-resume recovery through au1000_close() >>From your v4 reply, only the reopen hang appears to have been reproduced. A reader of the v5 log can't tell that. Could you add a short paragraph that says which changes fix the reproduced MTX-1 reopen hang and which ones come from inspection or review? Please also say whether the system sleep paths and the alias handling were exercised on MTX-1 at all. That would make it much easier to judge the Fixes: tag and the risk of backporting this to stable. [Severity: Medium] Does this power up the PHY of a down interface again after every system resume? Here is the sequence. First ifup, then ifdown. au1000_close() calls phy_stop(), and phylib suspends the PHY: genphy_suspend() sets BMCR_PDOWN and phydev->suspended becomes 1. On system suspend, au1000_suspend() takes the non-running branch. phy_suspend() returns early there because the PHY is already suspended. On resume, phy_init_hw() and phy_resume() run before netif_running() is checked. On MTX-1 this reaches lan83c183_resume(): drivers/net/phy/smsc.c:lan83c183_resume() { ret = phy_modify_changed(phydev, MII_BMCR, BMCR_PDOWN, 0); ... if (ret) msleep(500); } The !netif_running() branch then only resets the MAC and returns. The PHY stays powered, autonegotiates and shows link to the partner while the host interface is administratively down. phydev->state stays PHY_HALTED with suspended cleared until the next ifup/ifdown or system suspend. On MTX-1, each down interface also adds 500 ms to system resume. Before this patch, phylib's MDIO bus PM handled the PHY. mdio_bus_phy_may_suspend() returns !phydev->suspended, which is false for a PHY that phy_stop() has already powered down. So mdio_bus_phy_resume() took the no_resume path and the close-time power-down survived sleep. That looks like the behaviour introduced by be9dad1f9f26, the commit this patch names in its Fixes: tag. The commit message says: Reinitialize and resume the attached PHY even when the interface is down across sleep, then reset the MAC again to gate the clock enabled by MDIO. It doesn't give a reason. au1000_open() now calls phy_init_hw() and phy_resume() itself, so is the resume needed here at all? It also seems to conflict with au1000_suspend(), which treats a non-running interface as one whose PHY should be suspended. Could the !netif_running() branch call phy_suspend() after the PHY is reinitialized and before au1000_reset_mac()? Two error paths appear to leave a similar gap. In au1000_open(), a phy_init_hw() or phy_resume() failure only resets the MAC, even if phy_init_hw() has already powered the PHY up: err_reset: au1000_reset_mac(dev); free_irq(dev->irq, dev); return retval; In au1000_close(), after a failed system resume the state is already PHY_HALTED, so phy_stop() is skipped: if (dev->phydev && dev->phydev->state != PHY_HALTED) phy_stop(dev->phydev); phy_init_hw() may have reset and powered up the PHY on that failed resume path. In both cases nothing puts the PHY back into power-down. Should these paths also call phy_suspend()? -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202224957.3043478-1-f.fainelli%40gmail.com