Repository navigation
drm/apple: dcp: give each Type-C reconnect request its whole budget - #2364
RyanTheTide wants to merge 1 commit into
Conversation
dcp_typec_reconnect_work() connects the DPTX link of an attached Type-C display and, on failure, re-arms itself up to DPTX_RECONNECT_RETRIES (5) times, 1 s apart, before it reports "Type-C DPTX reconnect failed after N retries". The attempt counter, typec_reconnect_tries, was reset only by some of the paths that queue the work (an attach, a DPMS power-on, a port announced by a native external processor, a Thunderbolt tunnel, the bounded display retry), and not by others (component bind enabling the work with a cable already routed, an ext26 layout stop, a failed connect of an attached display). The work also counted without the hpd_mutex those resets are made under. A request from a path that does not reset after an earlier request had used up its attempts gets one attempt instead of five. That is what a J700 log shows after s2idle: a reconnect ladder ends with "after 5 retries: -110" before suspend, the first reconnect after the wake makes one attempt and gives up with "after 6 retries: -110". Reset the counter where every request is made, in dcp_queue_typec_reconnect_locked(), and have the work count its failures under hpd_mutex. The work still re-arms itself directly with mod_delayed_work(), so its own retries keep counting against the request that started them; nothing reachable from the work queues a new request, so the ladder stays bounded. The resets the callers did right before queueing are dropped. The message now counts what it counts: "failed after N attempts". Nothing changes for a request whose path already reset the counter, which covers all first connects. Sessionless (H17P) work now takes hpd_mutex once on failure, as the session path of the same work already does, so no new lock order is introduced. Fixes: ef24bbb ("drm: apple: recover Type-C displays across link interruptions") Signed-off-by: Ryan Murray <[email protected]>
|
Looks good; approve once the Neo s2idle reconnect row has run on this head. I checked that every request still goes through
HW row: the combined-kernel boots had no external display, so the reconnect work never ran. Neo (J700) on this head with the dock that showed the failure, on a kernel that has the #1723 wake fix: boot with the USB-C DP monitor up, then 3 s2idle cycles. Pass:
Then one J616s USB-C DP plug x3 and DPMS off/on x3 as a no-regression row: DP-1 up each time, 0 "reconnect failed" lines. Both rows: 0 AVC, 0 failed units, no new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
RyanTheTide
left a comment
There was a problem hiding this comment.
The lock serializes writes to the retry count, but the current worker can still charge an attempt to the next request. If a new event queues an immediate reconnect while the worker is inside dcp_dptx_connect*(), enqueue resets the counter and requests zero delay. If the older call then fails, its completion increments the new counter and changes that queued work to the retry delay. The attachment/session can legitimately be the same across both requests.
I compiled the exact enqueue and worker bodies with a host stub that queues one new request inside the connect call. Both same-session and sessionless interleavings replaced the new request's immediate work and consumed an attempt. The two ordinary-retry controls passed.
A request generation under hpd_mutex lets the older worker leave the counter and schedule alone when a new request arrived. With this change the projected test passed 4/4, including the ordinary retries. Please also check the direct cancellation/reset in the synchronous power-on path when deciding where to invalidate an in-flight worker.
Problem
dcp_typec_reconnect_work()(drivers/gpu/drm/apple/dcp.c, added in ef24bbb "drm: apple: recover Type-C displays across link interruptions" by DjDeveloperr) connects the DPTX link of an attached Type-C display and, when that fails, re-arms itself up toDPTX_RECONNECT_RETRIES(5) times, 1 s apart, then logs "Type-C DPTX reconnect failed after N retries".The attempt counter
typec_reconnect_trieswas reset by some of the paths that queue the work (attach, DPMS power-on, a port announced by a native external processor, a Thunderbolt tunnel, the bounded display retry) but not by others (component bind with a cable already routed, an ext26 layout stop, a failed connect of an attached display). The work also counted without thehpd_mutexthe resets are made under. A request from a non-resetting path, after an earlier ladder had used its attempts, got one attempt instead of five.A J700 (MacBook Neo) log shows this after s2idle: a ladder ends with "after 5 retries: -110" before suspend, and the first reconnect after the wake makes a single attempt and stops with "after 6 retries: -110".
Change
dcp_queue_typec_reconnect_locked(), which every request goes through, resets the counter. The work keeps re-arming itself directly withmod_delayed_work(), so its retries count against the request that started them. Nothing reachable from the work queues a new request, so the ladder stays bounded.hpd_mutex.The retry ladder itself stays: it runs only after a reported connect failure (link-configuration timeout, link fault, service not published), each attempt's failure is logged by the connect path, and running out is a
dev_err.Testing
drivers/gpu/drm/apple/dcp.owith W=1 on the release config: 0 warnings.tools/testing/selftests/drivers/gpu/apple-dcphost suite: 88/88 ok.Still to run
Hardware rows
dmesg | grep -c "Type-C DPTX reconnect failed"= 0 with the monitor up. Then 3 s2idle cycles with the dock that showed the failure: any "reconnect failed" line must read "after 5 attempts" (never 6 or more), and before it there must be 5 "timed out waiting for port 0 link configuration" lines for that ladder. Expected A/B: DP-1 back after wake at least as often as on the base kernel; the 0/3 wakes of the earlier k36 row were the separate drm/apple: park the DCPEXT crossbar output for s2idle too #1723 wake bug, so compare on a kernel that has that fix.Every SoC: the counter and the work are shared by all Type-C outputs; a request that previously got its budget gets the same one, and only requests that previously inherited a used-up count change behaviour (they get the documented five attempts, or one on T8132 and the T6020 tunnel flow, as before).
Hardware rows (combined test kernel, 2026-11-20)
This change was booted in a combined test kernel: integration/aurora 0abc2f3 plus the open gate-sweep drafts plus this and the related drafts (7.3.0-aurora-hk2/pwr1/hk3). It ran once on each lab Mac (M1 Pro J316s, M2 J413, J616s, Neo J700) and was compared against the production kernel on the same Mac, using the same silent row script:
M1 Pro, M2 and J616s matched production on every row, apart from the new counters and lines the drafts add. The Neo row found the old-DTB display regression that #2358's follow-up commit fixes.
This PR: No external display on the lab Macs during these boots: "reconnect failed" count 0 on all four; the plug-cycle rows are still to run.