Skip to content

net: spacemit: Fix TX timeout work deadlock and RTNL in PM callbacks

Ali Tariq linux-riscv lkml netdev spacemit 1 version Applied

Status from this message: This series was applied to netdev/net.git (main)

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest2 patches 4 repliesApplied 2/2

Changes in v2 from the cover letter

- New patch 1 to fix the TX timeout work deadlock (reported by Troy, approach suggested by Vivian)
- Patch 2: take RTNL before the netif_running() checks
- Patch 2: drop Breno's Reviewed-by, since the patch changed

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2net: spacemit: Fix TX timeout work deadlocking on itselfdrivers/net/ethernet/spacemit/k1_emac.c+6 -21 replyApplied
2/2net: spacemit: Hold RTNL lock in emac_resume() and emac_suspend()drivers/net/ethernet/spacemit/k1_emac.c+10 -11 replyApplied

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchMuhammad BilalVivian Wang
SeriesR-b R-b
1/2R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH net v2 0/2] net: spacemit: Fix TX timeout work deadlock and RTNL in PM callbacks

This series fixes two locking problems in the SpacemiT K1 Ethernet driver.

Patch 1 fixes the TX timeout work, which ends up waiting for itself through cancel_work_sync() in emac_down(), so every TX timeout leaves RTNL held forever.

Patch 2 takes RTNL in emac_suspend() and emac_resume(), which fixes the "suspicious RCU usage" warning from phy_disconnect() on suspend. It depends on patch 1: suspend disables the TX timeout work before taking RTNL, so it never waits for the work while holding the lock.

Tested on Orange Pi RV2 (SpacemiT K1) with a lockdep kernel: 12 suspend/resume cycles without the warning. The board loses its network after about a dozen cycles with or without this series; that is a separate issue.

Changes in v2:
- New patch 1 to fix the TX timeout work deadlock (reported by Troy, approach suggested by Vivian)
- Patch 2: take RTNL before the netif_running() checks
- Patch 2: drop Breno's Reviewed-by, since the patch changed

v1: https://lore.kernel.org/netdev/[email protected]/

Ali Tariq (2):
net: spacemit: Fix TX timeout work deadlocking on itself
net: spacemit: Hold RTNL lock in emac_resume() and emac_suspend()

 drivers/net/ethernet/spacemit/k1_emac.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1