Repository navigation
thunderbolt: apple: refill the link-lost restart budget after a rebuilt domain - #3109
Merged
Merged
Conversation
…lt domain When the peer drops the link with the cable still attached, the port is restarted up to three times. The count is reset once a peer has been found since the last restart, by comparing the domain's remote activity count with the value saved at that restart. A restart rebuilds the NHI and its domain, and the new domain counts remote activity from zero again. The saved value still belongs to the domain that went away, so whenever the new domain's discoveries end on the same number the reset is missed. On a J473 whose USB4 peer rebooted four times in six minutes the lines read (1/3), (1/3), (2/3), (3/3) although the host was found again after each one; the next peer reboot would have left the port down until the cable is replugged. Reset the saved value when the domain is created, to the new domain's starting count. Any discovery on the new domain then counts as a restart that worked, and a restart that finds nothing still uses up the budget. Signed-off-by: Ryan Murray <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Contributor
Author
|
Independent code review (non-author pass, code only) at 46ca1b6: no blocking finding. Checked
|
satchlj
approved these changes
Nov 25, 2026
satchlj
left a comment
Member
There was a problem hiding this comment.
Gemini 4 Neon on @satchlj's behalf
Verdict at 46ca1b6a5718
APPROVE — Clean, minimal fix ensuring acio->link_lost_cycle_activity is reset with WRITE_ONCE(..., 0) before tb_domain_add() so the Thunderbolt link-lost restart budget starts from a known state on every domain bring-up, with all latest CI checks passing.
Blockers
None.
Checked
- Diff scope: 1 file changed (
drivers/thunderbolt/apple.c,+8/-1), 1 commit (46ca1b6a5718) withSigned-off-by: Ryan Murray <[email protected]>. - Source audit: Checked every access to
link_lost_cycle_activityindrivers/thunderbolt/apple.c(READ_ONCEat line 2599,WRITE_ONCEat line 3819, and the addedWRITE_ONCE(acio->link_lost_cycle_activity, 0)at line 2801 prior totb_domain_add()). ConsistentREAD_ONCE/WRITE_ONCEpairing prevents stale activity state from prematurely exhausting or skewing the restart budget across domain initialization. - CI checks (all latest green):
Host tests/host-tests:SUCCESS(2026-11-25T01:31:45Z)pr-readiness/readiness / readiness:SUCCESS(2026-11-25T01:26:22Z)pr-text/pr-text / pr-text:SUCCESS(2026-11-25T01:26:12Z, superseding earlier01:24:35Zfailure prior to PR text update)
- Untested scope: Live Thunderbolt dock hotplug / link-lost stress loop on hardware was not run in this pass.
Evidence
- Audited
drivers/thunderbolt/apple.caround lines 2599, 2801, and 3819 against commit46ca1b6a5718. - Verified latest
Host tests/host-tests,pr-readiness, andpr-textcheck runs all completed withSUCCESSon46ca1b6a5718.
Contributor
Author
|
Rows at 46ca1b6 (module built from this commit, fleet89 kernel, default cmdline):
Both Macs were restored to saved fleet89 and verified. |
RyanTheTide
added a commit
that referenced
this pull request
Nov 28, 2026
The branch's 11-24 link watchdog no longer applies to main, which has its own link-loss restart budget since #3109. Replace it with three commits on current main: pass link-loss events seen before peer discovery to the NHI, recheck the peer after a requested restart, and keep restarting the port slowly while the cable stays attached.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
thunderbolt_apple restarts a port, at most three times, when a USB4 peer drops the link with the cable attached. The budget is supposed to refill once a peer has been found again, but after a restart it never does. The restart rebuilds the NHI domain, whose remote activity count starts again at zero, while the saved value belongs to the old domain. This change resets the saved value to 0 when the domain is created (
apple_nhi_probe(), beforetb_domain_add()). It adds no gates or parameters, and the code is the same on every Mac with ACIO.Tested: J473 M2 mini at 46ca1b6: 5/5 peer reboots restart at (1/3) and the host is back 5/5, 2/2 s2idle with an in-sleep peer reboot, 0 Oops/WARN; stock fleet89 control fails ((1/3), (2/3), (3/3), then "leaving the port alone" x3).
Risk: two-way · every Mac with ACIO (one store in the NHI probe; restarts stay bounded for a peer that never answers).
Not yet: a peer that needs the host-side restart (a dock); there is no dock in the lab.
Problem (detail)
When a USB4 peer drops the link with the cable still attached, thunderbolt_apple restarts the port, at most three times. The budget is supposed to refill once a peer has been found again. It never does after a restart. The restart rebuilds the NHI and its domain, and the new domain counts remote activity from zero again. The value saved at the restart still belongs to the old domain, so the "a peer was found since" check misses whenever the new count ends on the same number.
On the J473 (M2 mini) the lines read (1/3), (2/3), (3/3) and then "leaving the port alone" for every later drop, although the host was found again after each one. This shows up when the peer is a Mac being rebooted, as happened during a fleet rollout on the J616s at the other end of the cable. With a Mac peer the link still came back, because the peer's own boot brings it up. A peer that needs the host-side restart would stay down until the cable is replugged.
Change
apple_nhi_probe()resets the saved count to 0, the new domain's starting value, beforetb_domain_add(). Any discovery on the new domain then counts as a restart that worked. A peer that shows up on the new domain but completes no discovery still uses up the budget. (The commit message words this as "a restart that finds nothing"; a restart that finds no peer at all never reports a link loss, so the port just stays down.) There are no gates or parameters. This is the same code on every Mac with ACIO.Testing
J473, saved fleet89 (default cmdline), USB4 host-to-host to the J616s, which ran plain
systemctl reboots:Evidence: traces/usb/20261125-j473-tb-restart-budget (lab store).
Still to run
Details
M=drivers/thunderbolt).Gen2/3 link error,tps6598x: failed to configure Type-C connection: -67andhost disconnectedseen on the J473 this morning line up to the second with J616s shutdowns. They are not a link-training regression.