[PATCH 0/2] thunderbolt: fix wedge under sustained tbnet load on AM4 and AM5

Benjamin Berman
2026-04-28T01:55:24Z

Greetings Thunderbolt maintainers,

These patches for drivers were tested by me, Benjamin Berman, a
software developer, but they were authored by a coding agent that
had access to and ran the patches against real hardware.

The purpose of these patches was to fix Thunderbolt networking between
Thunderbolt 3 and Thunderbolt 4 (USB4) hosts on AM4 and AM5. I observed
these issues when using nccl across a Thunderbolt daisy chain: the
connection would drop abruptly, and performance was poorer than
expected. In any instance, I had to also update the NVM by exotic
methods on the TB3 controllers for AM4; AM5 generally ships the
Thunderbolt controller NVM in its UEFI patches.

Please advise on next steps for how to improve the patches. I can also
make my testing environment available, since it has a bunch of random
but useful Thunderbolt hardware.

Below is the generatively-authored explanation of the patch, and the
patch itself:

---

Two changes.

1. drivers/thunderbolt/nhi.c — tb_ring_poll_complete() gates the
unmask on @start_poll rather than @running. Under load on NHIs
with several rings in NAPI poll, a race with __ring_interrupt()'s
unconditional mask leaves the ring masked: MSI-X stops, NAPI is
not rescheduled, carrier stays up, no driver event fires. On NHIs
without QUIRK_AUTO_CLEAR_INT, stale REG_RING_NOTIFY_BASE state
blocks MSI-X re-arm. The patch gates on @running, adds a posted-
write barrier, and clears the ring's pending bit before re-enable.

2. drivers/net/thunderbolt/main.c — TBNET_RING_SIZE=256 and the
netif_napi_add() weight of 64 produce ~1 % rx_missed_errors on a
TB4 transit under sustained tbnet bulk traffic. The patch raises
ring size to 2048 and the NAPI weight to 256.

Hardware tested:
ASRock X570 Phantom Gaming-ITX/TB3 (AM4), Intel JHL7540 2C TB3
controller, NVM 50.0
ASUS ROG STRIX X670E-I GAMING WIFI (AM5), Maple Ridge 4C TB4
controller, NVM 43.83
Monoprice USB4 Gen 3 40 Gb/s passive cables
Linux 6.17.0-22-generic (Ubuntu HWE)

Workload: NCCL 2.28.9 all-reduce over tb-lo, NCCL_ALGO=Tree,
NCCL_PROTO=Simple, three ranks. Pre-patch the connection wedges
under 1 GB transferred. Post-patch a 192 GB run (3000 iterations
of a 64 MiB all-reduce) completes with mask/unmask counters
balanced and rx_missed_errors under 0.005 %.

Built clean against linux.git commit 3b3bea6d4b9c.

Benjamin Berman (2):
thunderbolt: drop start_poll guard in tb_ring_poll_complete()
net: thunderbolt: enlarge RX/TX ring and set NAPI weight for sustained
load

drivers/net/thunderbolt/main.c | 4 ++--
drivers/thunderbolt/nhi.c | 22 +++++++++++++++++++---
2 files changed, 21 insertions(+), 5 deletions(-)

base-commit: 3b3bea6d4b9c162f9e555905d96b8c1da67ecd5b
--
2.43.0