Repository navigation
Conversation
A DP tunnel the display side refused a pipeline waits for one: its DP IN request stays live, and the DP IN work retries it every two seconds. Each retry admits an attempt to hand the request to a display, and DCP may call Activate on that binding before the attempt returns. The tunnel is reported as waiting for a display throughout (dp_tunnel_awaits_display()), so that its DPRX deadline is renewed while the attempt makes its way to the display driver, however long that takes. That report cannot tell a connection manager that wants to re-link the tunnel whether a display is being woken through it now, and a check made under the DP IN lock is stale once the lock is dropped: a retry can be admitted before the tunnel is torn down. Add two hooks for that, beside dp_tunnel_awaits_display(), which stays as it is: - dp_tunnel_retirable(): the tunnel of a given generation waits for a pipeline and no attempt to hand it to a display is admitted (apple_dpin_retirable()), so no display reads its DPRX. Only a hint, for when to decide a held re-link again. - dp_tunnel_retire_waiting(): for a re-link of that tunnel, retire its request under the DP IN lock that admits attempts, as dp_tunnel_changed() does when a tunnel goes, unless an attempt is admitted already. A retired request admits no further attempt, so a retry due for it starts none. The connection manager uses them in the next change. They are registered on every host whose DP IN policy retries for a display pipeline (apple_dpin_m1, _m3, _m4 and _m5), and only the shared-rate path calls them (apple_dpin_m4: T8132 and T6040/T6041). KUnit: apple_dpin_m4_retire_waiting. Signed-off-by: Erik Bourget <[email protected]>
…e DPRX Under TB_HOST_DP_SHARED_RATE both DP IN streams of an Apple ATC PHY run at one link rate, so a host DP tunnel up at HBR3 is torn down and set up again at HBR2 when a second one is wanted. A dock that reports its displays one at a time (a CalDigit TS5 with two monitors) gets the first tunnel at HBR3 and, a moment later, the second display has it re-linked. By then the first tunnel's DP IN adapter has been handed to the display side, and the display's firmware is waking it from its Activate call. The re-link replaces that tunnel, and with it the DP IN request the display was handed, under the call: the Activate is refused (-ESTALE), the firmware trains a link that never comes, and on a replug its later calls time out and the dock's displays stay dark. Hold such a re-link (TB_DP_RELINK_HOLD) while the tunnel's DPRX read is under way (tb_dp_tunnel_release_display()). Only a host that still waits for a display pipeline for the tunnel, with no attempt to hand it to a display admitted, lets it go now: it retires the tunnel's display handoff atomically against such an attempt (dp_tunnel_retire_waiting()), and the re-link is made at once, as before. On HOLD, pairing leaves the host DP IN adapters alone, as it does while a system sleep is in progress. The re-link of a tunnel left alone to a higher rate is held the same way. A held re-link is decided again (tb_dp_relink_unhold()) once no display reads the tunnel's DPRX: - its DPRX read is done, timed out or given up (tb_dp_tunnel_active()); - the DPRX work finds the host waiting for a display pipeline for it with no attempt to hand it to a display admitted (the new await_callback, which asks dp_tunnel_retirable(), on each such pass). While a pipeline retry attempt runs, the DPRX deadline is renewed as before, and nothing is decided again until the attempt ends. The display then sees a plain unplug and plug at the shared rate. Whether a re-link is still wanted is decided from the tunnels and the adapters, not from the hold (tb_dp_relink_wanted()): to HBR2 while a host DP tunnel is up above HBR2 and another host pair is free, to the higher rate while the tunnel left alone is marked and its debounce is over. It survives a pass that defers the re-link for system sleep instead of holding it, and a pass still queued for thaw. When the tunnel's DPRX read times out while its re-link is wanted, the tunnel is kept, listed, instead of torn down with its DP IN adapter dropped, and the re-link is made the way it is for any tunnel: by pairing (tb_dp_host_relink() on the same pair at HBR2 first, then the other display) and by the re-link work (the re-link up at the higher rate, with its immediate fallback to HBR2 and its debounce bookkeeping). A tunnel re-linked up that did not come up is kept the same way, for its HBR2 fallback. The wanted re-link comes first: when another display arrives while that tunnel reads its DPRX at HBR3, the re-link down it waited for keeps it on its own pair, where the fallback would have paired both displays afresh, possibly on swapped DP IN adapters. Until pairing or the re-link work, on the ordered domain queue, releases it (tb_dp_relink_kept()), the DPRX work may still hold the tunnel and its paths, so every pass holds its re-link, also an inline one such as tb_complete()'s. Released, a kept tunnel whose re-link is not wanted any more (the other display went, or another came) is handled as any DPRX timeout (tb_dp_tunnel_inactive()): set up at HBR2 again once, now on its own pair (tb_dp_host_relink()), after a re-link up; torn down with its DP IN dropped otherwise. A kept tunnel is an ordinary listed tunnel: an unplug, a router removal or a suspend that releases DP takes it down. No re-link runs during a system sleep transition, and that is now kept in one place, tb_dp_relink_enter(): every DP tunnel the re-link machinery tears down or sets up goes through it and is torn down or set up only while it holds the system sleep admission. That covers the re-link down, the re-link up, a kept tunnel's HBR2 fallback or teardown, and the pairing pass that sets up what one of those made room for (the other display's tunnel after a re-link down), or tore down and could not set up again (dp_relink_pairing). That pass is entered in tb_dp_host_rate_limit() and holds the admission through its last setup in tb_tunnel_dp(). During a transition nothing is torn down or set up: the work stays recorded (deferred pairing, the kept tunnel with its adapters, the re-link up mark, the pending pass) and the re-link work does it from the domain queue once the transition is over, armed again at thaw, resume and complete. The HBR2 cap left by an HBR2 fallback that could not set its tunnel up again is kept until a pass that may pair is admitted, so the display is set up at HBR2 then, not at the rate that just failed. Pairing outside the re-link machinery is as before. These pairing requests are recorded before the hotplug check, so a re-link decided again while hotplug is stopped for system sleep (tb_freeze_noirq()) is replayed at thaw, resume or complete. A stopping domain records nothing. The KUnit tests cover the decision and, through the connection manager with the real DPRX work and callback: a second display arriving while the first one reads its DPRX, after which the display side refuses the first a pipeline; a pipeline retry admitted when the second display arrives, kept while it runs and decided again once it is refused; and a DPRX read ending while hotplug is frozen or the domain stops. Signed-off-by: Erik Bourget <[email protected]>
A display's Activate on a DP IN binding that is no longer the live one is refused with -ESTALE, and the display side logs only that number. Log why at info level, with the binding's generation and the requested and admitted ones: its tunnel was retired (it went, with no new one), replaced (a new tunnel's request took the adapter), or has no admitted attempt (none yet, or its attempt failed). A Deactivate after the tunnel went is routine, on every unplug: debug only. Signed-off-by: Erik Bourget <[email protected]>
Compile the connection manager's pairing, re-link and DPRX completion code (tb.c), the DPRX work (tunnel.c) and the Apple glue's DP IN request, binding and display hooks (apple.c, apple-dpin-state.c, apple-dpin-request.h) from the tree against host mocks: an ordered domain queue, the freezable queue, a clock, tunnels whose paths hold their HopIDs until their last reference goes, and a display side that admits, fails or completes its attempts where each case puts them. The real DPRX work and callback bring the held pair up. Thirty-eight cases replay a two-display dock: a cold plug, an unplug and a replug; the display side refusing the first display a pipeline after the hold; a pipeline retry admitted when the second display comes, then handed the display or refused again; a waiting request retired before its retry, with the retry run while pairing tears the tunnel down; a completion while hotplug is frozen, then thaw, or while the domain stops; and the re-link of a lone tunnel to a higher rate, held until its DPRX read is done or its display waits for a pipeline. With each host policy that retries for a display pipeline (apple_dpin_m1, _m3, _m4 and _m5), a retry that takes longer than the DPRX deadline to reach the display keeps its tunnel, not active, until DPRX completes. The rest time the held tunnel's DPRX read out. To HBR2: with the second display still there or gone; after a pass that deferred the re-link for system sleep (nothing is torn down or set up again until the PM gate reopens, and the tunnel is dropped then if the second display went meanwhile); with the pairing pass queued for thaw; with an inline pairing pass, as tb_complete() makes, in the window before the DPRX work drops the tunnel; and with the first display on the second DP IN after a failed setup (the displays keep their DP IN adapters). Up, at HBR2: re-linked on the same pair at HBR3, then counted for the debounce of the next re-link down; at HBR2 at once if HBR3 cannot be set up; at HBR2 once more if HBR3 does not come up; nothing set up while the PM gate is closed; the same inline pass; and a router that replaces the dock at the same route before thaw, paired as a new display. Down from HBR3 again: the second display comes back while the tunnel re-linked up reads its DPRX, and that read times out; the re-link down is made on the same pair first, the displays keep their DP IN adapters, and with the PM gate closed no tunnel is set up until it reopens; if the second display goes again before thaw, the tunnel is set up at HBR2 again, on its own pair. The PM gate mock counts its readers and can close the moment the last one leaves, as the PM notifier does. With it closed at each path into tb_dp_relink_enter(), nothing is set up until it reopens, and then the work is done: the re-link down; the re-link up, with the gate closing after the re-link work's own check; the HBR2 fallback of a lone tunnel re-linked up, and of one whose re-link down the second display waited for until it went again, hotplug on or frozen until thaw (the sink then lights at HBR2); a kept tunnel's teardown; and the pairing pass after that teardown, after a failed re-link, or after a re-link down that made room for the second display (whose tunnel is set up only once the gate reopens). When the HBR2 fallback of a tunnel re-linked up cannot set it up again, the pass that pairs its display again, with the gate open or once it reopens, sets it up at HBR2. Twenty-nine negative controls each put one piece back as it was, or take a fix out; each must fail the replay. Among them, one takes the gate out of tb_dp_relink_enter() and one per path goes around it. Run with the host tests. Signed-off-by: Erik Bourget <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
The current J713 boot kept the TS5 disconnected, so it does not exercise the path this change modifies. The disconnected boot and replay cases check different things. Please post an exact-head cold-plug and replug row with both displays and an observed HBR3 to HBR2 transition, followed by suspend and resume with the dock attached. Include the first and second tunnel outcomes and check that both displays recover. The new work is shared with T6040/T6041, so include one affected peer. Existing hosted KUnit jobs are still queued or have earlier failures. Keep held for those gates.
|
Hosted CI at Re-verified locally at
The J713 (
Still open under
|
|
Merge-train note at |
Dismissed under the 12-01 merge bar: this review's blockers were not shown failures (CI/rows/rebase/design or re-run asks). Follow-ups, not blocking: No code affirmation; follow-ups: J713 cold-plug/replug HBR3->HBR2 row with suspend, queued KUnit (peer not required)
|
Re-verified
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Reviewed the DPRX handoff, tunnel cancellation, HBR2 fallback and suspend admission paths. The docked J616s and J316s or J414c rows are still needed, including physical hotplug and the shared-rate re-link during EDID/DPRX reads.
|
We carry this PR in our J713 (M4 Air, T8132) and J313 (M1 Air, T8103) daily kernels. On Running smoothly on our J713 daily kernel (paired with #3273 for dual-display dock bring-up) and on our J313 daily kernel. |
What: On hosts whose two DP IN streams share one link rate (
TB_HOST_DP_SHARED_RATE), a dock that reports its displays one at a time (a CalDigit TS5 with two monitors) had its first tunnel re-linked from HBR3 to HBR2 under the display's Activate. DCP's Activate was refused (-ESTALE) and the displays stayed dark after a replug. The re-link now waits until no display reads the tunnel's DPRX. A tunnel whose DPRX read times out is kept and re-linked on its own DP IN. No tunnel the re-link sets up or tears down, the second display's included, is made during a system sleep transition. A refused call on a stale DP IN binding now logs why.Tested: J713 (M4 Air, T8132, firmware 27.2) docked on a CalDigit TS5 (
boltctlauthorized,40 Gb/s, 2 lanes) with two 3840x2160 monitors onDP-1andDP-3, at head3b32d06f7ae5in a trial kernel built frommain9867e173efb8plus the J713 external-display PRs #2673 (fd3dc16c121b) and #3273 (7f21093a0d31, stacked on #2673) and this head (#2673 is open and conflicts with currentmain, and #3273 stacks on #2673, so they were merged onto themain#2673 branched from), default command line, one-shot GRUB boot with the slot's Stage 2 and device tree. Cold boot docked:eDP-12560x1664@60 andDP-1andDP-33840x2160@60 up,0failed units,0AppArmor denials,0Oops/BUG/WARNING/SError/DART faults. The first display's tunnel came up at 8100 Mb/s per lane and was held (another DP tunnel is wanted: re-linking once its display has read its DPRX), then re-linked to 5400 Mb/s per lane (HBR2) with the two displays routed to their own DP INs (dpin0,dpin1) and no refused-call line. 3 DPMS off/on cycles brought all three outputs off and back at the same modes each time. 3s2idlesuspend/resume cycles (rtcwake -m freeze -s 5) with the TS5 stillauthorizedbrought all three back at the same modes each time, with no thunderbolt or DP tunnel error line. The kernelerrlines at boot match a docked boot of the J713's default kernel (a daily that carries these PRs; 0 new). J313 (M1 Air, T8103, non-shared-rate Apple USB4 hostapple_dpin_m1) at head3b32d06f7ae5in a composite trial kernel (origin/main429e7e15f122+#3335,#3506,#3508,#3269,#3359,#3289;12/12drivers/thunderbolt/*.o/.textbyte-identical vs single-PR merge on429e7e15f122, default command line, docked CalDigit TS5 +DP-23840x2160@120): TS5authorizedat boot,0thunderbolt/tunnel/usb4 error lines,5external DPMS off/on cycles clean (each external DPMS cycle logs oneDCPDP2XService admission failed: -19line + IOMFB syslog noise, not yet compared with the default kernel),1xdeep S2R (rtcwake -d rtc1 -m mem -s 30, ext display DPMS off first:success=1),0failed units,0AVC denials,5err+lines matching default boot. KUnit (120: 119 pass, 1 skip) and the added 38-case re-link replay (with its 29 negative controls) pass at the head; the full host suite ran695/696, matchingmain's694/695baseline plus the added replay with only the same pre-existingapple-dcpfailure (15 not ok) (Evidence). The pre-review form of this fix, in a J713 M4 Air test kernel on 27.2 firmware, brought up both monitors of a CalDigit TS5 and brought them back after an unplug and replug.Risk: two-way door · M4 (T8132: J713/J715 Air, J604 14" Pro, J773g mini) and M4 Pro/Max (T6040/T6041), the hosts with
TB_HOST_DP_SHARED_RATE; the refused-call log line on every Apple host with DP IN display handoff.Not yet: the J713 dock rows that need someone at the Mac: unplug and replug of the dock or of one monitor (the HBR3-to-HBR2 re-link above happened on the cold boot with the dock attached, not on a replug), and the same on 26.6.2 firmware on
mainplus this PR; the dock rows onmainitself (the J713 display PRs are open and not yet merged: #2673 currently conflicts withmain, while #3273 is mergeable against its stacked basej713-dcpext/air-dcpext-272); J313s2idleand physical dock/monitor replug (remote test, no physical replug possible); a dock row on an M4 Pro/Max (J616s, T6040/T6041) and a second Apple USB4 host (J316s or J414c) as requested in review (J616s, J316s, and J414c are not available in this lab).Details
The problem. A dock that reports its displays one at a time gets its first DP tunnel at HBR3. The second display then has that tunnel re-linked at HBR2 while DCP is still waking its DP IN. The re-link replaces the DP IN request DCP was handed, so DCP's Activate is refused (-ESTALE) and the link never comes up. After a dock replug, the dock's displays stay dark.
The change, in short.
tb_dp_relink_enter(), which admits it only while no system sleep transition is in progress and holds that admission through its last setup. The last setup includes the other display's tunnel that a re-link down made room for. During a transition nothing is torn down or set up; the work stays recorded and is done once the transition is over. That includes the HBR2 cap a failed HBR2 fallback leaves, so the display is then set up at HBR2, not at the rate that just failed.Commits
thunderbolt: apple: let a DP re-link retire a tunnel awaiting a pipelineapple_dpin_retirable(): the request waits for a display pipeline (apple_dpin_awaits_display()) and no attempt to hand it to a display is admitted (none in flight, none handed). A request that is no longer the current one has nothing left to hand.dp_tunnel_awaits_display()is unchanged. It still reports a tunnel as waiting while a pipeline retry attempt runs, so the DPRX deadline is renewed until the attempt reaches the display driver.dp_tunnel_retirable(): the read-onlyapple_dpin_retirable()for the tunnel of a given generation. It is a hint for when to decide a held re-link again.dp_tunnel_retire_waiting(): retires the request of the tunnel with the given generation unless an attempt is admitted. It runs under the DP IN lock that admits attempts. A retired request admits no further attempt, so a retry due for it starts none.thunderbolt: hold a shared-rate DP re-link while its display reads the DPRXtb_dp_tunnel_release_display(): a tunnel whose DPRX read is not under way may be torn down. While the read is under way, the tunnel is let go only when the host still waits for a display pipeline for it. Its handoff is then retired throughdp_tunnel_retire_waiting(), and the tunnel is torn down without being announced down again.tb_dp_relink_settle()turns aTB_DP_RELINK_NOWinto the newTB_DP_RELINK_HOLDwhen the tunnel is not released.tb_dp_host_rate_limit()) leaves the host DP IN adapters alone on HOLD, as it already does for WAIT during system sleep, and logs the hold once.tb_dp_host_relink_up()) is held the same way.tb_dp_relink_unhold()wakes a held re-link:tb_dp_tunnel_active(), when the tunnel's DPRX read is done, timed out or given up;await_callback, on a pass that finds the host waiting for a display pipeline with no handoff attempt admitted (tb_dp_tunnel_retirable()).While a pipeline retry attempt runs, the DPRX work renews the deadline as before and wakes nothing.
Pending transition.
tb_dp_relink_wanted()decides whether a re-link is still wanted from the CM's own state, as pairing and the re-link work decide it, not from the hold flags:tb_dp_relink_down());host_relinkmark with its debounce over (tb_dp_relink_up()).It therefore survives a pass that defers the re-link for system sleep (
TB_DP_RELINK_WAIT) instead of holding it, and a pass queued for thaw.DPRX timeout of such a tunnel. The tunnel is kept, listed (
host_relink_kept), instead of torn down with its DP IN dropped. A tunnel re-linked up (host_relinked_up) that did not come up is kept the same way, for its HBR2 fallback. No separate recovery path or saved state is used. Instead, the existing entry points make the re-link:tb_dp_host_relink(): the same pair first, then the other display, with the same backoff bookkeeping.tb_dp_host_relink_up(): an immediate HBR2 fallback on the same pair if HBR3 cannot be set up,dp_relinked_atfor the debounce, andhost_relinked_upfor the DPRX-timeout fallback.Precedence. A wanted re-link is checked before the HBR2 fallback of a tunnel re-linked up that did not come up. Suppose a second display arrives while that tunnel reads its DPRX at HBR3, and the read times out. The tunnel is kept and re-linked down on its own pair, and the other display is paired after it. Otherwise the fallback would drop the tunnel and pair both displays afresh, possibly on swapped DP IN adapters.
Release. Until it is released, the DPRX work may still hold the kept tunnel and its HopIDs. Every pass holds its re-link until then (
tb_dp_relink_settle_tunnel()), including an inline pass such astb_complete()'s. Release comes fromtb_dp_relink_kept(), called from the pairing work and the re-link work. Both run on the ordered domain queue, behind the DPRX work.Re-link no longer wanted. Suppose the other display went, or another came. A released kept tunnel is then handled as a DPRX timeout (
tb_dp_tunnel_inactive()): after a re-link up, set up at HBR2 again, once, between the same adapters (tb_dp_host_relink(); if that fails, pairing tries again at HBR2 at most); otherwise torn down with its DP IN dropped.System sleep admission: one way in.
tb_dp_relink_enter()/tb_dp_relink_exit()wraptb_dp_relink_admit(): true only while no system sleep transition is in progress, and the admission (a read hold on the PM gate) is kept until exit, so no transition starts in between. Every tunnel the re-link machinery tears down or sets up is torn down or set up only inside it;tb_dp_host_relink()refuses (WARN_ON) to run outside it. When the gate is closed, nothing is torn down or set up, the work stays recorded where it is, and the re-link work, armed there, waits for the transition to end and does it from the domain queue; thaw, resume and complete arm it again (tb_dp_relink_replay()). The rule and the paths are written at the function.The pass after a re-link. A re-link down marks the pairing that follows it as part of it (
dp_relink_pairing), whether it set the tunnel up again or not, as a failed re-link or a kept tunnel's teardown already did. That pass is entered intb_dp_host_rate_limit(), which hands the admission totb_tunnel_dp()(relinking) to hold through its last setup: the other display's tunnel after a re-link down, or the tunnel that could not be set up again. The admission is released between the re-link and that pass, so a transition can start there. The pass then sets nothing up and stays marked for the re-link work. The HBR2 cap (dp_host_hold_shared) is used only by a pass that goes on to pair, so a cap left by a failed HBR2 fallback still applies when the pass runs after the transition.tb_dp_host_rate_limit()→tb_dp_host_relink())dp_relink_deferred,dp_tunnel_pending, the HBR2 captb_dp_host_relink_up()→tb_dp_host_relink())host_relinkmarktb_dp_relink_kept())tb_dp_relink_kept()→tb_dp_tunnel_inactive())tb_dp_host_rate_limit()→tb_tunnel_dp(),dp_relink_pairing)tb_dp_host_rate_limit(), held throughtb_tunnel_dp()'s last setup; closed → host DP IN adapters waitdp_relink_pairing, the HBR2 cap (dp_host_hold_shared)tb_dp_tunnel_active())main; sets nothing uptb_dp_relink_unhold(), the await callback,tb_dp_relink_pair_again(),tb_dp_relink_replay()tb_dp_resource_unavailable(),tb_dp_host_tunnel_gone())mainmain, which does not gate it during a transitionA kept tunnel is an ordinary listed tunnel. An unplug, a router removal or a suspend that releases DP takes it down, so no stale endpoint identity is left.
Pairing requests from the hold, wakeup and timeout paths are recorded before the hotplug check, so thaw, resume or complete replays them. A stopping domain records nothing.
The
tb_tunnel_dp()debug line for a waiting host DP IN now sayswaiting for a DP tunnel re-link, because it covers both cases.thunderbolt: apple: say why a call on a stale DP IN binding was refused: a refused Activate logs at info level whether the binding's tunnel was retired, replaced or has no admitted attempt. The line carries the binding's generation and the requested and admitted ones. A refused Deactivate after the tunnel went happens on every unplug, so it is logged at debug level.tools/asahi: replay a shared-rate DP re-link over a display's Activate: a host replay that compiles these from the tree:Its PM gate mock counts readers and can close the moment the last one leaves, as the PM notifier does. It replays 38 dock cases through the real DPRX work and callback, with 29 negative controls. It is registered with
run-host-tests.py.Hosts affected.
TB_HOST_DP_SHARED_RATEis set only inapple_dpin_m4, which T8132 and T6040/T6041 use.tb_dp_relink_settle(),tb_dp_tunnel_release_display(),tb_dp_relink_wanted(),tb_dp_relink_enter(),dp_relink_pairingand kept tunnels (tb_dp_relink_kept()finds none). No hold is ever set, sotb_dp_relink_unhold()and the await callback do nothing.dp_tunnel_retirable()anddp_tunnel_retire_waiting()are registered withdp_tunnel_awaits_display()on every host whose policy retries for a pipeline, but only the shared-rate paths call them.dp_tunnel_awaits_display()and the DPRX deadline are unchanged on every host.tb_dp_host_rate_limit()returns 0 at once without the policy, withrelinkingclear, anddp_host_hold_sharedis set only under it.tb_dp_tunnel_inactive()ismain's DPRX-timeout handling moved into a helper. On a host without the shared-rate policy only its teardown branch is reached, as onmain. Its HBR2 fallback branch (host_relinked_up, set only under the policy) now runs from the kept tunnel, on the same pair, once admitted.Related. The display side of the same dock replug, on a firmware-27.2 T8132 dcpext, is a separate drm/apple PR, #3273 (stacked on #2673). Neither PR needs the other to build or to pass its tests. Both are needed for a two-monitor dock to light reliably across a replug on the M4 Air with 27.2 firmware.
Evidence
Base
mainb45f9e7. Head3b32d06f7ae5: 6709dd3, 0df2a3f, 2e8eb2d, 3b32d06.KUnit, qemu arm64 (
kunit.py run --arch=arm64 --make_options LLVM=1withUSB4_KUNIT_TEST,USB4_APPLE_SOCandUSB4_APPLE_DPIN_KUNIT_TEST), at the head: 120 tests: 119 passed, 1 skipped (apple_g17_rx_util_min_test, which needsCONFIG_UCLAMP_TASK).thunderboltincludes the newtb_test_dp_shared_rate_settle,_dprx_hold,_hold_pipeline_wait,_hold_retry_admitted,_hold_handoffand_hold_frozen;apple-dpin-lifecycleincludes the newapple_dpin_m4_retire_waiting. The tests that calltb_dp_host_rate_limit()also check that it leaves no admission held.KUnit negative controls, rerun at the head, one fix taken out at a time; each fails its test:
tb_test_dp_shared_rate_hold_pipeline_wait(and_hold_retry_admitted) fail.tb_test_dp_shared_rate_hold_retry_admittedfails.tb_test_dp_shared_rate_hold_frozenfails.apple_dpin_retirable()ignoring an admitted attempt:apple_dpin_m4_retire_waitingfails.tools/asahi/tb-dp-relink-hold-tests.py: 38/38 cases, with the defaultcc(GCC) and withCC=clang. Each of the 29 negative controls fails at least one case with a CHECK (exit 77), with the same cases under both compilers:pipeline-wait,relink-up-pipeline-wait,retire-before-retry,retry-in-flight-refusedpipeline-wait,relink-up-pipeline-wait,retry-in-flight-refusedretry-in-flight-handed,retry-in-flight-refusedretry-stalled-m1,-m3,-m4(tunnel and DP IN gone),-m5(active before DPRX)retry-in-flight-handed,retry-in-flight-refusedretire-before-retry,retry-in-flight-handed,retry-in-flight-refusedreplug-under-relink-up,-sleep-gatefrozen-then-thaw,queued-timeout,relink-up-replaced,replug-under-relink-up-gone,teardown-pairing-gatestoppingsleep-gate-timeoutandqueued-timeoutrelink-up-*timeout casescomplete-in-windowcomplete-in-windowfallback-sleep-gate,fallback-retryandteardown-pairing-gatefallback-sleep-gate,fallback-retry,-gate,relink-up-timeout-fallback, the threereplug-under-relink-up-gone*casesfallback-sleep-gate,fallback-retry,-gate, the threereplug-under-relink-up-gone*casessleep-gate-timeout,sleep-gate-timeout-second-gone,replug-under-relink-up-sleep-gate,replug-under-relink-up-gone-sleep-gate,-thaw-gate,fallback-sleep-gate,teardown-pairing-gate,retry-pass-gate,relink-up-gate-race,relink-down-pairing-gate,fallback-retry-gatesleep-gate-timeout,sleep-gate-timeout-second-gone,replug-under-relink-up-sleep-gate,replug-under-relink-up-gone-sleep-gaterelink-up-gate-racefallback-sleep-gate,replug-under-relink-up-gone-sleep-gate,-thaw-gate,sleep-gate-timeout-second-goneretry-pass-gate,teardown-pairing-gate,relink-down-pairing-gate,fallback-retry-gatetb_dp_host_relink())fallback-retry-gate(a failed re-link down is also marked by the re-link down itself)teardown-pairing-gaterelink-down-pairing-gatefallback-retry-gateSystem sleep admission, each path with the PM gate closed (none sets up a tunnel generation until the gate reopens; then the work is done):
relink-down-pairing-gate: the first display up at HBR3, its DPRX read done; the second display comes and the re-link down succeeds on the same pair; the gate closes the moment that re-link releases the admission. Only the first display's replacement is set up. The second display's tunnel waits for the gate to reopen, and then both run at HBR2, each on its DP IN.fallback-retry-gate: a tunnel re-linked up to HBR3 times out alone; its HBR2 fallback on the same pair fails setup once; the gate closes the moment the fallback releases the admission. The pass that pairs the display again sets nothing up until the gate reopens, and then sets it up at HBR2 (5400 Mb/s per lane, limit 5400), with the cap and the pass mark cleared, and the display brings it to ACTIVE.fallback-retryis the same with the gate open: HBR2 at once.replug-under-relink-up-gone-sleep-gate: a tunnel re-linked up to HBR3, the second display back while it reads its DPRX, the gate closed, the read timed out, then the second display unplugged with hotplug on.-thaw-gate: the same with the timeout while hotplug is frozen and thaw before the gate reopens. Once the gate reopens the tunnel is set up at HBR2 on its own pair and its display brings it to ACTIVE.fallback-sleep-gate: a lone tunnel re-linked up to HBR3 times out with the gate closed (the HBR2 fallback as onmain, now only once admitted, on the same pair).sleep-gate-timeout-second-gone: a kept tunnel's teardown waits for the gate; then its display is paired on the other DP IN.teardown-pairing-gate,retry-pass-gate: the gate closes the moment a kept tunnel's teardown, or a re-link whose setup failed, releases the admission; the pass that pairs again sets nothing up until it reopens.relink-up-gate-race: the gate closes after the re-link work's own gate check, before the re-link up.sleep-gate-timeout,relink-up-sleep-gate,replug-under-relink-up-sleep-gate.The replay at the head against the
drivers/thunderbolt/tree of the previous head39f4983dfceb(production build, no mutations): 36/38.relink-down-pairing-gatefails because the second display's tunnel was set up while the gate was closed: the next generation was 4, against 3 for the first display's replacement alone.fallback-retry-gatefails because, after the gate reopened, the display was set up at the HBR3 rate that had just failed.fallback-retry(gate open) passes on both.Earlier rounds' cases, all still in the replay, each failed its behavioural check against the revision it fixed:
replug-under-relink-up-gone-sleep-gateand-thaw-gate(a new tunnel generation while the gate is closed),fallback-sleep-gateandsleep-gate-timeout-second-gone(torn down with the gate closed),teardown-pairing-gateandretry-pass-gate(a tunnel set up with the gate closed),replug-under-relink-up-gone(the fallback not on the same pair);sleep-gate-timeoutandrelink-up-sleep-gate(a tunnel set up again with the PM gate closed);complete-in-windowandrelink-up-complete-in-window(an inline pass sets up a tunnel while the old paths still hold the HopIDs);relink-up-setup-fails(no HBR2 fallback on the same pair);relink-up-timeout(the debounce not doubled);timeout-keeps-pair(the displays swap DP IN adapters);relink-up-replaced(a replacement router inherits the re-link up);replug-under-relink-up(DP IN 5 → DP OUT 14, DP IN 6 → DP OUT 13) and-sleep-gate(new generations before the gate reopens).tools/asahi/run-host-tests.py, full suite, both run on the same day: 695/696 at the head, against 694/695 onmainb45f9e7. The extra run is the new replay. The one failure isapple-dcpon both, with the same 15 tests not ok.tb-dp-repair-tests(which compilestb_dp_tunnel_active()andtb_dp_tunnel_inactive()) passes, and its mutants are caught.checkpatch.pl --strict, per commit: 0 errors, 0 warnings, 0 checks on the three thunderbolt commits. The replay commit gets only the usual new-file MAINTAINERS warning.git diff --checkclean. Each commit builds on its own (drivers/thunderbolt/at commit 2 alone withW=1, and the full J713 kernel at the head), with no compiler warnings.Hardware, J713 (M4 Air, T8132, firmware 27.2), docked on a CalDigit TS5 with
DP-1andDP-3monitors: trial kernel frommain9867e173efb8+ drm/apple, soc: apple: external displays on the M4 MacBook Air (J713) over USB-C on macOS 27.2 #2673fd3dc16c121b+ drm/apple: drive a two-display dock from the firmware-27.2 T8132 dcpexts #32737f21093a0d31+ thunderbolt: hold a shared-rate DP re-link while its display reads the DPRX #32693b32d06f7ae5(clean build with Clang/LLVM, the running kernel's configuration withCONFIG_DRM_ASAHI=m,thunderboltandthunderbolt_appleloaded, the trial kernel's own device trees not installed, so the slot's Stage 2 device tree was used),sha256of theImageb26a02a66bdb, default command line, one-shot GRUB entry (next_entrycleared by the boot, the default kernel and default Stage 2sha256the same before and after).boltctl: TS5authorized,40 Gb/s = 2 lanes * 20 Gb/srx and tx.DP-1,DP-3,eDP-1connectedandenabled. Hyprland:eDP-12560x1664@60 (scale 2),DP-13840x2160@60,DP-33840x2160@60.dmesg:apple-dcp 286e00000.dcp: display routed to Thunderbolt DP tunnel dpin0;thunderbolt-apple-nhi 401f00000.nhi: 0:5 <-> 1:11 (DP): another DP tunnel is wanted: re-linking once its display has read its DPRX; then... re-linking at up to 5400 Mb/s per lane (was 8100); then bothapple-dcp 286e00000.dcpandapple-dcp 48ae00000.dcpdisplay routed to Thunderbolt DP tunneldpin0anddpin1. Nostale,refusedor-ESTALEline, and no thunderbolt or DP error line, for the whole boot, including the 3s2idlecycles.hyprctlDPMS action off, 6 s, on, 10 s): each timeeDP-1,DP-1andDP-3dpms Offandenableddisabled, thendpms Onandenabledat the same modes, withboltctlauthorizedthroughout. Eachonre-ranset_digital_out_modefor the two external DCPs anddcp_hotplug() connected:1 valid_mode:1with no error.s2idlecycles (rtcwake -d /dev/rtc1 -m freeze -s 5;PM: suspend entry (s2idle)andPM: suspend exiteach time, about 2 s asleep):dcp_poweroff()anddcp_dptx_disconnect()on both external DCPs at suspend,dcp_poweron(),set_digital_out_mode3840x2160anddcp_hotplug() connected:1 valid_mode:1at resume, all three outputsconnected,enabledat the same modes,boltctlauthorizedevery time. No DP link rate change was logged across the suspends (the tunnel stayed at 5400 Mb/s per lane).echo offthenecho detecttocard1-DP-3/statusandcard1-DP-1/status) only flipped the sysfs status: nodmesgactivity and Hyprland did not change, so it is not counted as a re-link exercise.systemctl --failedempty,0AppArmor denials,0Oops/BUG/SError/WARNING/DART-fault/GPU-fault/call-trace lines,0thunderbolt or DP tunnelerrlines. The kernelerrlines areapple-dcp 30ae00000.dcpfailed to extract init props: -2andunsupported DFB layout 2560x1664, twoapple-pmgr-pwrstate ... PS 0x3a0reset lines,DCPDP2XService admission failed: -19(two at boot, plus two after each DPMS on and eachs2idleresume), theof_irq_parse_pcilines for the dock's bridge and Ethernet, theapple_sepmatching line, anddwc3-apple 402280000.usb: PM: device_prepare(): genpd_prepare returns -11at each suspend entry; all of these are also logged by the J713's default kernel docked (0 new).90de523e9ed9(mainfcb124279183plus the unchanged heads of ASoC: apple: enable J716c (16-inch M5 Max) AOP audio, v2-only speakers, jack and mic array #3085, pwm: apple: runtime suspend on zero duty cycle #3219, thunderbolt: hold a shared-rate DP re-link while its display reads the DPRX #3269, drm/apple: pause and settle presentation during firmware-27 paired stop #3305, arm64: dts: apple: t6050: allow idle ps_isp_sys domain to power off #3329 and serial: apple-dockchannel: stop idle console drain timer, back off RX, and add sleep PM #3335), default command line +panic=10, with the TS5 disconnected: clean boot,0failed units,0AppArmor denials,thunderbolt/thunderbolt_appleloaded with no error; all 6 kernelerrlines and the J713 deep-sleep reset reproduce on plainmainfcb124279183. The PR merges into currentmainwith no conflicts.Re-verified at
3b32d06f7ae5(2026-12-01):git merge-tree --write-treeagainstmaina171afd2123fis clean (0 conflicts); KUnitdrivers/thunderbolt/.kunitconfig.apple-dpin(arm64,LLVM=1): 120 tests (119 passed, 1 skipped);tools/asahi/tb-dp-relink-hold-tests.py(ccandCC=clang): 38/38 cases and 29/29 negative controls;tools/asahi/tb-dp-repair-tests.py --mutations: 16/16 cases and 16/16 mutants;tb-cio-sleep-tests.py,tb-dock-pm-tests.py,tunnel-route-tests.py,tbnet-refill-tests.py, andt8132-usb4-policy-tests.pypass; full arm64LLVM=1linux-j313kernel/modules/dtb build passes.Hardware, J313 (M1 Air, T8103, non-shared-rate Apple USB4 host
apple_dpin_m1) at3b32d06f7ae5in a composite trial kernel (origin/main429e7e15f122+#3335,#3506,#3508,#32693b32d06f7ae5,#3359,#3289;12/12drivers/thunderbolt/*.o/.textbyte-identical vs single-PR merge on429e7e15f122, GRUB one-shot, default command line, docked CalDigit TS5 +DP-23840x2160@120, AC 100%):authorizedat boot,0thunderbolt/tunnel/usb4 error lines,0failed units,0AVC denials,5err+lines matching default boot.DP-2DPMS off/on x5: clean (0thunderbolt/tunnel/usb4 errors; each external DPMS cycle logs oneDCPDP2XService admission failed: -19line + IOMFB syslog noise, not yet compared with the default kernel).rtcwake -d rtc1 -m mem -s 30, external display DPMS off first): PASS (success=1, wakeNUB.SPMI0Sw3IRQ).s2idleand physical replug were not run.