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
Subject: Re: [PATCH net v9 3/5] net: phy: stop postponing PHY interrupts when phy_suspend() fails
Date: Tue, 01 Dec 2026 07:30:48 +0000 [thread overview]
Message-ID: <179611024824.3146.12326645036576718233@kernel.org> (raw)
In-Reply-To: <20261130-b4-phylib-mac-pm-irq-v3-v9-3-7b9c3c9ac9f7@iav.lv>
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
next prev parent reply other threads:[~2026-12-01 7:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 7:04 [PATCH net v9 0/5] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov via B4 Relay
2026-11-30 7:04 ` [PATCH net v9 1/5] net: phy: move irq_suspended and irq_rerun out of the bitfield Igor Velkov via B4 Relay
2026-11-30 7:04 ` [PATCH net v9 2/5] net: phy: fix three paths that unbalance a postponed PHY interrupt line Igor Velkov via B4 Relay
2026-12-01 7:30 ` netdev-bot+sashiko
2026-11-30 7:04 ` [PATCH net v9 3/5] net: phy: stop postponing PHY interrupts when phy_suspend() fails Igor Velkov via B4 Relay
2026-12-01 7:30 ` netdev-bot+sashiko [this message]
2026-11-30 7:04 ` [PATCH net v9 4/5] net: phy: run a postponed PHY interrupt handler directly on resume Igor Velkov via B4 Relay
2026-11-30 7:04 ` [PATCH net v9 5/5] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov via B4 Relay
2026-12-01 7:30 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179611024824.3146.12326645036576718233@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=Haoning.CHENG@cn.bosch.com \
--cc=Thangaraj.S@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=hkallweit1@gmail.com \
--cc=iav@iav.lv \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=lukas@wunner.de \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=paul@pbarker.dev \
--cc=rafael.j.wysocki@intel.com \
--cc=shenwei.wang@nxp.com \
--cc=tglx@kernel.org \
--cc=wei.fang@nxp.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox