Skip to contentSkip to conversation

net: fec: remove .ndo_poll_controller to avoid deadlocks

PATCH In review Feng Liu 2 participants 4 messages May 13, 2025 Stable branch

lore
Share & tools
lore

Feng Liu

author
#0 lore raw

PATCH 1/1 net: fec: remove .ndo_poll_controller to avoid deadlocks

From: Wei Fang <[email protected]>

[ Upstream commit c2e0c58b25a0a0c37ec643255558c5af4450c9f5 ]

There is a deadlock issue found in sungem driver, please refer to the commit ac0a230f719b ("eth: sungem: remove .ndo_poll_controller to avoid deadlocks"). The root cause of the issue is that netpoll is in atomic context and disable_irq() is called by .ndo_poll_controller interface of sungem driver, however, disable_irq() might sleep. After analyzing the implementation of fec_poll_controller(), the fec driver should have the same issue. Due to the fec driver uses NAPI for TX completions, the .ndo_poll_controller is unnecessary to be implemented in the fec driver, so fec_poll_controller() can be safely removed.

Fixes 7f5c6addcdc0 ("net/fec: add poll controller function for fec nic")
[Minor context change fixed]

---
Verified the build test.

---
 drivers/net/ethernet/freescale/fec_main.c | 26 -----------------------
 1 file changed, 26 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +0 -26
index 8e30e999456d..01579719f4ce 100644
@@ -3255,29 +3255,6 @@ fec_set_mac_address(struct net_device *ndev, void *p)
 	return 0;
 }
 
-#ifdef CONFIG_NET_POLL_CONTROLLER
-/**
- * fec_poll_controller - FEC Poll controller function
- * @dev: The FEC network adapter
- *
- * Polled functionality used by netconsole and others in non interrupt mode
- *
- */
-static void fec_poll_controller(struct net_device *dev)
-{
-	int i;
-	struct fec_enet_private *fep = netdev_priv(dev);
-
-	for (i = 0; i < FEC_IRQ_NUM; i++) {
-		if (fep->irq[i] > 0) {
-			disable_irq(fep->irq[i]);
-			fec_enet_interrupt(fep->irq[i], dev);
-			enable_irq(fep->irq[i]);
-		}
-	}
-}
-#endif
-
 static inline void fec_enet_set_netdev_features(struct net_device *netdev,
 	netdev_features_t features)
 {
@@ -3351,9 +3328,6 @@ static const struct net_device_ops fec_netdev_ops = {
 	.ndo_tx_timeout		= fec_timeout,
 	.ndo_set_mac_address	= fec_set_mac_address,
 	.ndo_do_ioctl		= fec_enet_ioctl,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= fec_poll_controller,
-#endif
 	.ndo_set_features	= fec_set_features,
 };
 
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/1 net: fec: remove .ndo_poll_controller to avoid deadlocks

From: Wei Fang <[email protected]>

[ Upstream commit c2e0c58b25a0a0c37ec643255558c5af4450c9f5 ]

There is a deadlock issue found in sungem driver, please refer to the commit ac0a230f719b ("eth: sungem: remove .ndo_poll_controller to avoid deadlocks"). The root cause of the issue is that netpoll is in atomic context and disable_irq() is called by .ndo_poll_controller interface of sungem driver, however, disable_irq() might sleep. After analyzing the implementation of fec_poll_controller(), the fec driver should have the same issue. Due to the fec driver uses NAPI for TX completions, the .ndo_poll_controller is unnecessary to be implemented in the fec driver, so fec_poll_controller() can be safely removed.

Fixes 7f5c6addcdc0 ("net/fec: add poll controller function for fec nic")
[Minor context change fixed]

---
Verified the build test.

---
 drivers/net/ethernet/freescale/fec_main.c | 26 -----------------------
 1 file changed, 26 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +0 -26
index 7b5585bc21d8..7a74a765784a 100644
@@ -3432,29 +3432,6 @@ fec_set_mac_address(struct net_device *ndev, void *p)
 	return 0;
 }
 
-#ifdef CONFIG_NET_POLL_CONTROLLER
-/**
- * fec_poll_controller - FEC Poll controller function
- * @dev: The FEC network adapter
- *
- * Polled functionality used by netconsole and others in non interrupt mode
- *
- */
-static void fec_poll_controller(struct net_device *dev)
-{
-	int i;
-	struct fec_enet_private *fep = netdev_priv(dev);
-
-	for (i = 0; i < FEC_IRQ_NUM; i++) {
-		if (fep->irq[i] > 0) {
-			disable_irq(fep->irq[i]);
-			fec_enet_interrupt(fep->irq[i], dev);
-			enable_irq(fep->irq[i]);
-		}
-	}
-}
-#endif
-
 static inline void fec_enet_set_netdev_features(struct net_device *netdev,
 	netdev_features_t features)
 {
@@ -3528,9 +3505,6 @@ static const struct net_device_ops fec_netdev_ops = {
 	.ndo_tx_timeout		= fec_timeout,
 	.ndo_set_mac_address	= fec_set_mac_address,
 	.ndo_eth_ioctl		= fec_enet_ioctl,
-#ifdef CONFIG_NET_POLL_CONTROLLER
-	.ndo_poll_controller	= fec_poll_controller,
-#endif
 	.ndo_set_features	= fec_set_features,
 };
 
Signature · 1 line
2.34.1
maintainer
#2 lore raw

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: c2e0c58b25a0a0c37ec643255558c5af4450c9f5

WARNING: Author mismatch between patch and upstream commit:
Backport author: Feng Liu<[email protected]> Commit author: Wei Fang<[email protected]>

Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: d38625f71950)
6.1.y | Present (different SHA1: e2348d8c61d0)

Note: The patch differs from the upstream commit:
---
1: c2e0c58b25a0a ! 1: a32e7777c7358 net: fec: remove .ndo_poll_controller to avoid deadlocks
@@ Metadata
## Commit message ##
net: fec: remove .ndo_poll_controller to avoid deadlocks

+ [ Upstream commit c2e0c58b25a0a0c37ec643255558c5af4450c9f5 ]
+
There is a deadlock issue found in sungem driver, please refer to the commit ac0a230f719b ("eth: sungem: remove .ndo_poll_controller to avoid deadlocks"). The root cause of the issue is that netpoll is in atomic
@@ Commit message

+ [Minor context change fixed]
+ Signed-off-by: Feng Liu <[email protected]>
+ Signed-off-by: He Zhe <[email protected]>

## drivers/net/ethernet/freescale/fec_main.c ##
@@ drivers/net/ethernet/freescale/fec_main.c: fec_set_mac_address(struct net_device *ndev, void *p)
@@ drivers/net/ethernet/freescale/fec_main.c: fec_set_mac_address(struct net_device
@@ drivers/net/ethernet/freescale/fec_main.c: static const struct net_device_ops fec_netdev_ops = {
.ndo_tx_timeout = fec_timeout,
.ndo_set_mac_address = fec_set_mac_address,
- .ndo_eth_ioctl = phy_do_ioctl_running,
+ .ndo_eth_ioctl = fec_enet_ioctl,
-#ifdef CONFIG_NET_POLL_CONTROLLER
- .ndo_poll_controller = fec_poll_controller,
-#endif
.ndo_set_features = fec_set_features,
- .ndo_bpf = fec_enet_bpf,
- .ndo_xdp_xmit = fec_enet_xdp_xmit,
+ };
+
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.15.y       |  Success    |  Success   |
maintainer
#3 lore raw
In reply to Feng Liu

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected. No action required from the submitter.

The upstream commit SHA1 provided is correct: c2e0c58b25a0a0c37ec643255558c5af4450c9f5

WARNING: Author mismatch between patch and upstream commit:
Backport author: Feng Liu<[email protected]> Commit author: Wei Fang<[email protected]>

Status in newer kernel trees:
6.14.y | Present (exact SHA1)
6.12.y | Present (exact SHA1)
6.6.y | Present (different SHA1: d38625f71950) 6.1.y | Present (different SHA1: e2348d8c61d0) 5.15.y | Not found

Note: The patch differs from the upstream commit:
---
1: c2e0c58b25a0a ! 1: 4c81ce68d2ac2 net: fec: remove .ndo_poll_controller to avoid deadlocks
@@ Metadata
## Commit message ##
net: fec: remove .ndo_poll_controller to avoid deadlocks

+ [ Upstream commit c2e0c58b25a0a0c37ec643255558c5af4450c9f5 ]
+
There is a deadlock issue found in sungem driver, please refer to the commit ac0a230f719b ("eth: sungem: remove .ndo_poll_controller to avoid deadlocks"). The root cause of the issue is that netpoll is in atomic
@@ Commit message

+ [Minor context change fixed]
+ Signed-off-by: Feng Liu <[email protected]>
+ Signed-off-by: He Zhe <[email protected]>

## drivers/net/ethernet/freescale/fec_main.c ##
@@ drivers/net/ethernet/freescale/fec_main.c: fec_set_mac_address(struct net_device *ndev, void *p)
@@ drivers/net/ethernet/freescale/fec_main.c: fec_set_mac_address(struct net_device
@@ drivers/net/ethernet/freescale/fec_main.c: static const struct net_device_ops fec_netdev_ops = {
.ndo_tx_timeout = fec_timeout,
.ndo_set_mac_address = fec_set_mac_address,
- .ndo_eth_ioctl = phy_do_ioctl_running,
+ .ndo_do_ioctl = fec_enet_ioctl,
-#ifdef CONFIG_NET_POLL_CONTROLLER
- .ndo_poll_controller = fec_poll_controller,
-#endif
.ndo_set_features = fec_set_features,
- .ndo_bpf = fec_enet_bpf,
- .ndo_xdp_xmit = fec_enet_xdp_xmit,
+ };
+
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-5.10.y       |  Success    |  Success   |