]> git.ipfire.org Git - thirdparty/linux.git/commit
net: enetc: fix the deadlock of enetc_mdio_lock
authorJianpeng Chang <jianpeng.chang.cn@windriver.com>
Wed, 15 Oct 2025 02:14:27 +0000 (10:14 +0800)
committerJakub Kicinski <kuba@kernel.org>
Fri, 17 Oct 2025 23:12:44 +0000 (16:12 -0700)
commit50bd33f6b3922a6b760aa30d409cae891cec8fb5
treeac91d757fb26c0059e6538fbe89b62de7e0c6f0f
parent7f864458e9a6d2000b726d14b3d3a706ac92a3b0
net: enetc: fix the deadlock of enetc_mdio_lock

After applying the workaround for err050089, the LS1028A platform
experiences RCU stalls on RT kernel. This issue is caused by the
recursive acquisition of the read lock enetc_mdio_lock. Here list some
of the call stacks identified under the enetc_poll path that may lead to
a deadlock:

enetc_poll
  -> enetc_lock_mdio
  -> enetc_clean_rx_ring OR napi_complete_done
     -> napi_gro_receive
        -> enetc_start_xmit
           -> enetc_lock_mdio
           -> enetc_map_tx_buffs
           -> enetc_unlock_mdio
  -> enetc_unlock_mdio

After enetc_poll acquires the read lock, a higher-priority writer attempts
to acquire the lock, causing preemption. The writer detects that a
read lock is already held and is scheduled out. However, readers under
enetc_poll cannot acquire the read lock again because a writer is already
waiting, leading to a thread hang.

Currently, the deadlock is avoided by adjusting enetc_lock_mdio to prevent
recursive lock acquisition.

Fixes: 6d36ecdbc441 ("net: enetc: take the MDIO lock only once per NAPI poll cycle")
Signed-off-by: Jianpeng Chang <jianpeng.chang.cn@windriver.com>
Acked-by: Wei Fang <wei.fang@nxp.com>
Link: https://patch.msgid.link/20251015021427.180757-1-jianpeng.chang.cn@windriver.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/freescale/enetc/enetc.c