Re: [PATCH net-next v6 4/5] net: sched: add timeout count to NETDEV WATCHDOG message
From: Jesper Dangaard Brouer
Date: Fri Jun 12 2026 - 05:40:57 EST
On 04/06/2026 10.30, Paolo Abeni wrote:
On 5/27/26 3:54 PM, hawk@xxxxxxxxxx wrote:
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 237ee1cd0136..2aebab985c00 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -533,13 +533,12 @@ static void dev_watchdog(struct timer_list *t)
netif_running(dev) &&
netif_carrier_ok(dev)) {
unsigned int timedout_ms = 0;
+ struct netdev_queue *txq;
unsigned int i;
unsigned long trans_start;
unsigned long oldest_start = jiffies;
for (i = 0; i < dev->num_tx_queues; i++) {
- struct netdev_queue *txq;
-
txq = netdev_get_tx_queue(dev, i);
if (!netif_xmit_stopped(txq))
continue;
@@ -561,9 +560,10 @@ static void dev_watchdog(struct timer_list *t)
if (unlikely(timedout_ms)) {
trace_net_dev_xmit_timeout(dev, i);
- netdev_crit(dev, "NETDEV WATCHDOG: CPU: %d: transmit queue %u timed out %u ms\n",
+ netdev_crit(dev, "NETDEV WATCHDOG: CPU: %d: transmit queue %u timed out %u ms (n:%ld)\n",
raw_smp_processor_id(),
- i, timedout_ms);
+ i, timedout_ms,
+ atomic_long_read(&txq->trans_timeout));
It looks like txq could be uninitialized here if num_tx_queues is 0. I'm
unsure if some weird/buggy device driver could actually hit that case,
but grep '->num_tx_queues = 0;' has more than 0 hits in the current tree
and I would err on the safe side.
Addressed in [V7], by reading out trans_timeout value when it is
accessed/incremented anyhow. Thus, avoiding the need to deref txq.
[V7] https://lore.kernel.org/all/20260612083530.1650245-5-hawk@xxxxxxxxxx/
--Jesper