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, netdev@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v8 1/5] net: phy: move irq_suspended and irq_rerun out of the bitfield
Date: Tue, 24 Nov 2026 01:11:36 +0000 [thread overview]
Message-ID: <179548269686.3135.9876460710453451136@kernel.org> (raw)
In-Reply-To: <20261123-b4-phylib-mac-pm-irq-v3-v8-1-e9f706e79614@iav.lv>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The patch adds this comment above the two new bools in struct
phy_device (include/linux/phy.h): "Not bitfields: phy_interrupt() and…
--
net: phy: move irq_suspended and irq_rerun out of the bitfield
This commit turns irq_suspended and irq_rerun in struct phy_device from
1-bit bitfields into separate bools. phy_interrupt() and the PM callbacks
write them without phydev->lock, so a read-modify-write on the shared
bitfield word could lose a concurrent irq_rerun update. The call sites in
phy.c and phy_device.c are updated to use true/false.
[ ... ]
> diff --git a/include/linux/phy.h b/include/linux/phy.h
> index 21afc2082b174..59c75296d5355 100644
> --- a/include/linux/phy.h
> +++ b/include/linux/phy.h
> @@ -726,8 +726,11 @@ struct phy_device {
>
> /* Interrupts are enabled */
> unsigned interrupts:1;
> - unsigned irq_suspended:1;
> - unsigned irq_rerun:1;
> + /* Not bitfields: phy_interrupt() and the PM callbacks write them
> + * without phydev->lock
> + */
[Severity: Low]
This isn't a bug, but could this comment mislead readers about the
bitfields that remain?
The reason it gives, written by the PM callbacks without phydev->lock,
also applies to interrupts:1 on the line just above it. PHY driver suspend
callbacks run from phy_suspend()->phydrv->suspend(), and phy_suspend()
does not take phydev->lock. For example, in dp83867_suspend():
drivers/net/phy/dp83867.c:dp83867_suspend() {
...
if (phy_interrupt_is_valid(phydev)) {
phydev->interrupts = PHY_INTERRUPT_DISABLED;
dp83867_config_intr(phydev);
}
...
}
marvell-88q2xxx.c and micrel.c do the same thing in their suspend paths.
phy_suspend() also sets phydev->suspended = true without the lock, and
suspended:1 is in the same bitfield word.
Both fields still share that word with link:1 and autoneg_complete:1,
which the state machine writes under phydev->lock. From this comment, a
reader could conclude that the remaining bitfields in the word are only
written under phydev->lock.
Would it be clearer to word the comment so it doesn't imply that rule?
It could, for example, just describe the irq_rerun race that this patch
fixes.
> + bool irq_suspended;
> + bool irq_rerun;
>
> unsigned default_timestamp:1;
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261123-b4-phylib-mac-pm-irq-v3-v8-0-e9f706e79614%40iav.lv
next prev parent reply other threads:[~2026-11-24 1:11 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 0:46 [PATCH net v8 0/5] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov via B4 Relay
2026-11-23 0:46 ` [PATCH net v8 1/5] net: phy: move irq_suspended and irq_rerun out of the bitfield Igor Velkov via B4 Relay
2026-11-24 1:11 ` netdev-bot+sashiko [this message]
2026-11-23 0:46 ` [PATCH net v8 2/5] net: phy: fix three paths that unbalance a postponed PHY interrupt line Igor Velkov via B4 Relay
2026-11-24 1:11 ` netdev-bot+sashiko
2026-11-23 0:46 ` [PATCH net v8 3/5] net: phy: stop postponing PHY interrupts when phy_suspend() fails Igor Velkov via B4 Relay
2026-11-23 0:46 ` [PATCH net v8 4/5] net: phy: run a postponed PHY interrupt handler directly on resume Igor Velkov via B4 Relay
2026-11-24 1:11 ` netdev-bot+sashiko
2026-11-23 0:46 ` [PATCH net v8 5/5] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov via B4 Relay
2026-11-24 1:11 ` 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=179548269686.3135.9876460710453451136@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 \
/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