[PATCH net] net: spacemit: Hold RTNL lock in emac_resume() and emac_suspend()
Troy Mitchell
troy.mitchell at linux.spacemit.com
Fri Nov 6 06:26:19 PST 2026
On Fri, 6 Nov 2026 15:44:50 +0500, Ali Tariq wrote:
> For the deadlock, I think the correct function to call is
> rtnl_trylock() inside the emac_tx_timeout_task(), which would return
> if the lock is already held and will hold the lock if it is not.
>
> What are your thoughts on this? Does a v2 changing rtnl_lock() to
> rtnl_trylock() inside emac_tx_timeout_task() make sense?
rtnl_trylock() there is fine, it fixes the suspend case.
Looking at it, I found an existing bug though: once the work holds RTNL
it deadlocks on itself, on every TX timeout:
emac_tx_timeout_task()
dev_close()
emac_stop()
emac_down()
cancel_work_sync(&priv->tx_timeout_task) <- waits for itself
rtnl_trylock() does not help with that. Please fix it in a separate
patch ahead of this one, e.g. by resetting in place instead of going
through dev_close()/dev_open(). Feel free to add:
Reported-by: Troy Mitchell <troy.mitchell at linux.spacemit.com>
--
Troy Mitchell
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20261106/a74574af/attachment.sig>
More information about the linux-riscv
mailing list