gmac_clean_txq() updates ir_stats_syncp with hard interrupts enabled, while the MIB and RX overrun interrupt paths update the same seqcount. Initializing its lockdep key exposes the incompatible IRQ contexts on 32-bit debug kernels. The writer sections also lack mutual exclusion. Take the existing IRQ-safe irq_lock around the TX completion statistics update, matching the other ir_stats_syncp writers. Acquire it before opening the seqcount writer section so PREEMPT_RT does not acquire a potentially sleeping spinlock with preemption disabled. The TX fragment counter also uses tx_stats_syncp from both start_xmit() and process-context teardown. Use IRQ-safe writer helpers around that increment so a statistics reader cannot interrupt the writer and spin on an odd sequence. Keep this protection local to the counter update rather than covering the entire TX cleanup. Found during Sashiko review and confirmed by tracing the IRQ, transmit and stop paths. Cross-built gemini.o for ARM with W=1. No hardware lockdep or PREEMPT_RT runtime testing was performed for this change. Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini gigabit ethernet") Signed-off-by: Linus Walleij --- drivers/net/ethernet/cortina/gemini.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cortina/gemini.c b/drivers/net/ethernet/cortina/gemini.c index 5a87d88607cd..cc26ff16a0a3 100644 --- a/drivers/net/ethernet/cortina/gemini.c +++ b/drivers/net/ethernet/cortina/gemini.c @@ -671,6 +671,7 @@ static void gmac_clean_txq(struct net_device *netdev, struct gmac_txq *txq, union gmac_txdesc_1 word1; unsigned int hwchksum = 0; unsigned long bytes = 0; + unsigned long flags; struct gmac_txdesc *txd; unsigned short nfrags; unsigned int errs = 0; @@ -716,18 +717,21 @@ static void gmac_clean_txq(struct net_device *netdev, struct gmac_txq *txq, if (nfrags >= TX_MAX_FRAGS) nfrags = TX_MAX_FRAGS - 1; - u64_stats_update_begin(&port->tx_stats_syncp); + flags = u64_stats_update_begin_irqsave(&port->tx_stats_syncp); port->tx_frag_stats[nfrags]++; - u64_stats_update_end(&port->tx_stats_syncp); + u64_stats_update_end_irqrestore(&port->tx_stats_syncp, + flags); } } + spin_lock_irqsave(&geth->irq_lock, flags); u64_stats_update_begin(&port->ir_stats_syncp); port->stats.tx_errors += errs; port->stats.tx_packets += pkts; port->stats.tx_bytes += bytes; port->tx_hw_csummed += hwchksum; u64_stats_update_end(&port->ir_stats_syncp); + spin_unlock_irqrestore(&geth->irq_lock, flags); txq->cptr = c; } -- 2.56.0