Re: [PATCH net] net: spacemit: Hold RTNL lock in emac_resume() and emac_suspend()
From: Troy Mitchell
Date: Fri Nov 06 2026 - 09:32:43 EST
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@xxxxxxxxxxxxxxxxxx>
--
Troy Mitchell
Attachment:
signature.asc
Description: PGP signature