From: Wayen Yan <win847@gmail.com>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Vladimir Oltean <olteanv@gmail.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, netdev@vger.kernel.org,
mfd@lists.linux.dev, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v20 04/10] mfd: an8855: Add support for Airoha AN8855 Switch
Date: Tue, 18 Aug 2026 09:19:25 +0800 [thread overview]
Message-ID: <178701596581.1096543.14003915779643840966@gmail.com> (raw)
In-Reply-To: <20260817082034.20326-6-ansuelsmth@gmail.com>
Hi Christian,
I noticed a possible MDIO bus locking issue in
an8855_core_probe().
The helper an8855_mii_set_page() is declared as:
static int an8855_mii_set_page(struct an8855_core_priv *priv,
u8 addr, u8 page)
__must_hold(&priv->bus->mdio_lock)
and uses __mdiobus_write(). The latter requires the caller to hold
bus->mdio_lock and checks this with lockdep_assert_held_once().
The other callers of an8855_mii_set_page() correctly hold the MDIO bus
lock, for example:
mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED);
ret = an8855_mii_set_page(priv, addr, page);
...
mutex_unlock(&bus->mdio_lock);
However, an8855_core_probe() calls the same helper directly:
ret = an8855_mii_set_page(priv, priv->switch_addr,
AN8855_PHY_PAGE_STANDARD);
The MDIO device probe path does not hold bus->mdio_lock around the
driver's probe callback. Therefore this call can trigger the lockdep
assertion, and the MDIO page-select write is not protected by the MDIO
bus lock against concurrent accesses to the same bus.
Could this be changed to take the bus lock around the call, for example:
mutex_lock(&priv->bus->mdio_lock);
ret = an8855_mii_set_page(priv, priv->switch_addr,
AN8855_PHY_PAGE_STANDARD);
mutex_unlock(&priv->bus->mdio_lock);
if (ret)
return ret;
Alternatively, if there is a reason why the probe path is serialized by
another mechanism, it would be useful to document that assumption and
annotate the call accordingly.
I don't think changing an8855_mii_set_page() to use mdiobus_write() would
be appropriate, since the helper is also called by paths that already
hold mdio_lock; that could result in recursive locking. Keeping the
helper as an unlocked MDIO primitive with an explicit locking contract
seems reasonable, but the probe caller appears to need the missing lock.
This is a discussion and fix suggestion rather than a request to redesign
the series. Please let me know if I am missing an existing serialization
guarantee in the MDIO device probe path.
Thanks,
Wayen
next prev parent reply other threads:[~2026-08-18 1:19 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 8:20 [PATCH net-next v20 00/10] net: dsa: Add Airoha AN8855 support Christian Marangi
2026-08-17 8:20 ` [PATCH net-next v20 01/10] dt-bindings: net: dsa: Document support for Airoha AN8855 DSA Switch Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 8:20 ` [PATCH net-next v20 02/10] dt-bindings: net: Document support for AN8855 Switch Internal PHY Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 8:20 ` [PATCH net-next v20 03/10] dt-bindings: mfd: Document support for Airoha AN8855 Switch SoC Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 8:20 ` [PATCH net-next v20 04/10] mfd: an8855: Add support for Airoha AN8855 Switch MFD Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 8:20 ` [PATCH net-next v20 04/10] mfd: an8855: Add support for Airoha AN8855 Switch Christian Marangi
2026-08-18 1:19 ` Wayen Yan [this message]
2026-08-17 8:20 ` [PATCH net-next v20 05/10] net: phy: Add Airoha AN8855 Internal Switch Gigabit PHY Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 8:20 ` [PATCH net-next v20 06/10] net: dsa: tag_mtk: add Airoha variant usage of this TAG Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 8:20 ` [PATCH net-next v20 07/10] MAINTAINERS: add myself as maintainer for Airoha AN8855 Switch Christian Marangi
2026-08-17 8:20 ` [PATCH net-next v20 08/10] net: dsa: mt7530: move MDIO bus locking into regmap Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 8:20 ` [PATCH net-next v20 09/10] net: dsa: mt7530: generalize and move common function to lib module Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 8:20 ` [PATCH net-next v20 10/10] net: dsa: Add Airoha AN8855 5-Port Gigabit DSA Switch driver Christian Marangi
2026-08-18 9:03 ` sashiko-bot
2026-08-17 15:38 ` [PATCH net-next v20 00/10] net: dsa: Add Airoha AN8855 support Jakub Kicinski
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=178701596581.1096543.14003915779643840966@gmail.com \
--to=win847@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=angelogioacchino.delregno@collabora.com \
--cc=ansuelsmth@gmail.com \
--cc=conor@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lee@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mfd@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).