From: Curtis McBurney <cmcburney@telcobridges.com>
To: netdev@vger.kernel.org
Cc: Curtis McBurney <cmcburney@telcobridges.com>,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, andrew+netdev@lunn.ch,
willemb@google.com, toke@redhat.com, daniel@iogearbox.net,
almasrymina@google.com, linux-kernel@vger.kernel.org
Subject: [PATCH net v3 0/2] net: keep txq->trans_start on repeated netif_tx_stop_queue()
Date: Thu, 26 Nov 2026 11:01:12 -0500 [thread overview]
Message-ID: <20261126160117.652865-1-cmcburney@telcobridges.com> (raw)
Since commit 95ecba62e2fd ("net: fix races in
netdev_tx_sent_queue()/dev_watchdog()"), every netif_tx_stop_queue()
call writes txq->trans_start, also on a queue that is already stopped.
Drivers whose Tx hang check stops the queue again on each run (e1000,
e1000e, igb, igc) keep moving trans_start forward, dev_watchdog() never
times out, and the hung adapter is never reset.
Patch 1 makes netif_tx_stop_queue() return early when the driver has
already stopped the queue, so it writes neither trans_start nor the
bit. Patch 2 adds KUnit tests for the four cases; one of them fails
without patch 1.
The issue was observed on a system in real use. I reproduced it and
tested the fix on an AlmaLinux 10 kernel (6.12.0-211.74.2.el10_2) with
e1000 on a VMware-emulated 82545EM, using a test-only module parameter
that forces the e1000 hang check to fire. Patch 1 has the details. The
KUnit tests ran on UML on the net tree.
I wrote the first version of the fix. Claude Code (Anthropic) reviewed
it, wrote v2 of the fix, the KUnit tests, the e1000 reproducer and the
changelogs.
Changes in v3:
- Rebased on net. Patch 2 did not apply after commit e8c39bfac24d
("net: add a KUnit test for the alloc_skb_with_frags() tail split")
added tests at the same place in net_test.c. The tests now come
before the netmem section. No code change.
Changes in v2:
- Patch 1: return early when DRV_XOFF is already set instead of only
skipping the trans_start write. In v1, a wake between test_bit() and
set_bit() let set_bit() stop the queue again with the trans_start of
the earlier stop, which could cause a spurious timeout (Sashiko AI
review). The early return issues smp_mb() to keep the full barrier
that callers get after set_bit().
- Patch 1: rewrite the comment and the changelog paragraph on the race,
which claimed a bound that v1 did not have.
- Patch 2: state in the changelog that the tests do not cover a wake
racing with a stop.
- Rebased on net.
- Not carried: Xia Yan's Reviewed-by on v1, since patch 1 changed.
v2: https://lore.kernel.org/netdev/20261119141633.3118789-1-cmcburney@telcobridges.com/
v1: https://lore.kernel.org/netdev/20261116143716.367451-1-cmcburney@telcobridges.com/
Curtis McBurney (2):
net: keep txq->trans_start on repeated netif_tx_stop_queue()
net: net_test: add tests for netif_tx_stop_queue() trans_start
include/linux/netdevice.h | 14 +++++
net/core/net_test.c | 112 ++++++++++++++++++++++++++++++++++++++
2 files changed, 126 insertions(+)
base-commit: e1055cbfd6eb578417f3ce983cf44462e8465267
--
2.52.0
next reply other threads:[~2026-11-26 16:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 16:01 Curtis McBurney [this message]
2026-11-26 16:01 ` [PATCH net v3 1/2] " Curtis McBurney
2026-11-26 16:01 ` [PATCH net v3 2/2] net: net_test: add tests for netif_tx_stop_queue() trans_start Curtis McBurney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261126160117.652865-1-cmcburney@telcobridges.com \
--to=cmcburney@telcobridges.com \
--cc=almasrymina@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=toke@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®