net: lan969x: don't disable hardirqs in fdma tx clear
Subsystems (4)
Daniel Machon
maintainerPATCH 1/1 net: lan969x: don't disable hardirqs in fdma tx clear
lan969x_fdma_tx_clear_buf() runs from the NAPI poll and frees the skbs of completed tx DCBs with napi_consume_skb(), under sparx5->tx_lock.
Before this patch, the lock is taken with spin_lock_irqsave(), so the skbs are freed with hardirqs disabled. RX skbs are marked for page_pool recycling, so when such an skb is forwarded back out and its tx completion frees it here, the free path reaches __page_pool_put_page(), which warns via lockdep_assert_no_hardirq().
Take tx_lock with a plain spin_lock(), as the only other tx_lock user, sparx5_port_xmit_impl(), already does. tx_clear_buf() is only called from softirq context, so disabling hardirqs is not needed.
Found with lockdep enabled (CONFIG_PROVE_LOCKING), which the assert depends on. Reproduced on lan969x by redirecting received frames out of another port with tc mirred.
--- drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/net/ethernet/microchip/sparx5/lan969x/lan969x_fdma.c +2 -3
@@ -54,10 +54,9 @@ static void lan969x_fdma_tx_clear_buf(struct sparx5 *sparx5, int weight) {struct fdma *fdma = &sparx5->tx.fdma;struct sparx5_tx_buf *db; -unsigned long flags;int i; -spin_lock_irqsave (&sparx5->tx_lock, flags); +spin_lock (&sparx5->tx_lock);for (i =0 ; i < fdma->n_dcbs; ++i) { db = &sparx5->tx.dbs[i];
@@ -83,7 +82,7 @@ static void lan969x_fdma_tx_clear_buf(struct sparx5 *sparx5, int weight) db->used = false; } -spin_unlock_irqrestore (&sparx5->tx_lock, flags); +spin_unlock (&sparx5->tx_lock); }static void lan969x_fdma_free_pages (struct sparx5_rx *rx)
---
base-commit: 07bd391eb9572e74f073c49acef327611234f9bb
change-id: 20261019-lan969x-fdma-tx-clear-irq-d86877f96431
Best regards,
Signature · 1 line
Daniel Machon <[email protected]>
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Tue, 20 Oct 2026 10:57:27 +0200 you wrote:
lan969x_fdma_tx_clear_buf()runs from the NAPI poll and frees the skbs of completed tx DCBs withnapi_consume_skb(), undersparx5->tx_lock.Before this patch, the lock is taken with
spin_lock_irqsave(), so the skbs are freed with hardirqs disabled. RX skbs are marked forpage_poolrecycling, so when such an skb is forwarded back out and its tx completion frees it here, the free path reaches__page_pool_put_page(), which warns vialockdep_assert_no_hardirq().[...]
Here is the summary with links:
- [net] net: lan969x: don't disable hardirqs in fdma tx clear
https://git.kernel.org/netdev/net/c/9770818b8a92
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html