2022-07-15 02:47:52 +00:00
|
|
|
From d5af37ae22f0364be9ded773d737dd6e5b207b10 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Ioana Ciornei <ioana.ciornei@nxp.com>
|
|
|
|
Date: Thu, 21 Nov 2019 21:15:25 +0200
|
|
|
|
Subject: [PATCH 3/4] dpaa2-eth: do not hold rtnl_lock on phylink_create() or
|
|
|
|
_destroy()
|
|
|
|
|
|
|
|
The rtnl_lock should not be held when calling phylink_create() or
|
|
|
|
phylink_destroy() since it leads to the deadlock listed below:
|
|
|
|
|
|
|
|
[ 18.656576] rtnl_lock+0x18/0x20
|
|
|
|
[ 18.659798] sfp_bus_add_upstream+0x28/0x90
|
|
|
|
[ 18.663974] phylink_create+0x2cc/0x828
|
|
|
|
[ 18.667803] dpaa2_mac_connect+0x14c/0x2a8
|
|
|
|
[ 18.671890] dpaa2_eth_connect_mac+0x94/0xd8
|
|
|
|
|
|
|
|
Fix this by moving the _lock() and _unlock() calls just outside of
|
|
|
|
phylink_of_phy_connect() and phylink_disconnect_phy().
|
|
|
|
|
|
|
|
Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink")
|
|
|
|
Reported-by: Russell King <linux@armlinux.org.uk>
|
|
|
|
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
|
|
|
|
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
|
|
|
|
---
|
|
|
|
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ----
|
|
|
|
drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c | 4 ++++
|
|
|
|
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
|
|
|
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
|
kernel: bump 5.15 to 5.15.145
Changelog: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.15.145
No patches needed a rebase.
23.05 backport:
Rebased patch mediatek/100-dts-update-mt7622-rfb1.patch due to
changes introduced in commit e37aa926447f ("arm64: dts: mediatek:
mt7622: fix memory node warning check") in version v5.15.143 and we
jumped over from v5.15.139 directly to v5.15.145.
Build system: x86_64
Build-tested: ramips/tplink_archer-a6-v3
Run-tested: ramips/tplink_archer-a6-v3
23.05 backport:
Stijn:
Compile-tested: ath79/generic, ipq40xx/generic, mvebu/cortexa72, ramips/mt{7621,7620,76x8}, realtek/rtl{838x,930x}, 86/64.
Run-tested: cortexa72 (RB5009UG+S+IN), mt7621 (EAP615-Wall v1), rtl838x (GS1900-10HP, GS1900-8HP, GS108T v3).
Petr:
Compile-tested: ipq807x, mvebu/cortexa9
Run-tested: turris-omnia, prpl-haze
Tested-by: Stijn Segers <foss@volatilesystems.org> [23.05 testing]
Signed-off-by: John Audia <therealgraysky@proton.me>
Signed-off-by: Petr Štetiar <ynezz@true.cz> [23.05 refresh]
(cherry picked from commit 8de4cc77a6d5c25e48566d0203f159287ac7f3fe)
2023-12-23 11:52:06 +00:00
|
|
|
@@ -4215,12 +4215,10 @@ static irqreturn_t dpni_irq0_handler_thr
|
2022-07-15 02:47:52 +00:00
|
|
|
dpaa2_eth_set_mac_addr(netdev_priv(net_dev));
|
|
|
|
dpaa2_eth_update_tx_fqids(priv);
|
|
|
|
|
|
|
|
- rtnl_lock();
|
|
|
|
if (dpaa2_eth_has_mac(priv))
|
|
|
|
dpaa2_eth_disconnect_mac(priv);
|
|
|
|
else
|
|
|
|
dpaa2_eth_connect_mac(priv);
|
|
|
|
- rtnl_unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
@@ -4516,9 +4514,7 @@ static int dpaa2_eth_remove(struct fsl_m
|
|
|
|
#endif
|
|
|
|
|
|
|
|
unregister_netdev(net_dev);
|
|
|
|
- rtnl_lock();
|
|
|
|
dpaa2_eth_disconnect_mac(priv);
|
|
|
|
- rtnl_unlock();
|
|
|
|
|
|
|
|
dpaa2_eth_dl_port_del(priv);
|
|
|
|
dpaa2_eth_dl_traps_unregister(priv);
|
|
|
|
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
|
|
|
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-mac.c
|
2023-07-21 01:38:30 +00:00
|
|
|
@@ -357,7 +357,9 @@ int dpaa2_mac_connect(struct dpaa2_mac *
|
2022-07-15 02:47:52 +00:00
|
|
|
if (mac->pcs)
|
|
|
|
phylink_set_pcs(mac->phylink, &mac->pcs->pcs);
|
|
|
|
|
|
|
|
+ rtnl_lock();
|
|
|
|
err = phylink_fwnode_phy_connect(mac->phylink, dpmac_node, 0);
|
|
|
|
+ rtnl_unlock();
|
|
|
|
if (err) {
|
|
|
|
netdev_err(net_dev, "phylink_fwnode_phy_connect() = %d\n", err);
|
|
|
|
goto err_phylink_destroy;
|
2023-07-21 01:38:30 +00:00
|
|
|
@@ -378,7 +380,9 @@ void dpaa2_mac_disconnect(struct dpaa2_m
|
2022-07-15 02:47:52 +00:00
|
|
|
if (!mac->phylink)
|
|
|
|
return;
|
|
|
|
|
|
|
|
+ rtnl_lock();
|
|
|
|
phylink_disconnect_phy(mac->phylink);
|
|
|
|
+ rtnl_unlock();
|
|
|
|
phylink_destroy(mac->phylink);
|
|
|
|
dpaa2_pcs_destroy(mac);
|
|
|
|
}
|