net: sched: Print msecs when transmit queue time out
authorYajun Deng <yajun.deng@linux.dev>
Fri, 21 Apr 2023 08:26:06 +0000 (16:26 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 23 Apr 2023 13:18:05 +0000 (14:18 +0100)
commit2f0f9465ad9fa9c93f30009184c10da0f504f313
tree9b89ff45b393c5d1874d58d2dd054ca23d7a3a73
parent00266b365d2b5a7ab4c9fa300784607d5770f8bc
net: sched: Print msecs when transmit queue time out

The kernel will print several warnings in a short period of time
when it stalls. Like this:

First warning:
[ 7100.097547] ------------[ cut here ]------------
[ 7100.097550] NETDEV WATCHDOG: eno2 (xxx): transmit queue 8 timed out
[ 7100.097571] WARNING: CPU: 8 PID: 0 at net/sched/sch_generic.c:467
                       dev_watchdog+0x260/0x270
...

Second warning:
[ 7147.756952] rcu: INFO: rcu_preempt self-detected stall on CPU
[ 7147.756958] rcu:   24-....: (59999 ticks this GP) idle=546/1/0x400000000000000
                      softirq=367      3137/3673146 fqs=13844
[ 7147.756960]        (t=60001 jiffies g=4322709 q=133381)
[ 7147.756962] NMI backtrace for cpu 24
...

We calculate that the transmit queue start stall should occur before
7095s according to watchdog_timeo, the rcu start stall at 7087s.
These two times are close together, it is difficult to confirm which
happened first.

To let users know the exact time the stall started, print msecs when
the transmit queue time out.

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_generic.c