Repository navigation
drm/apple: stop the J613 DCPLink when a call is abandoned - #2386
RyanTheTide wants to merge 1 commit into
Conversation
dcp_v26_link_call() was copied from the T6030 14.7 DCPLink client before two fixes landed there, and the 26.6 copy kept the old exits. When a call times out, fails its reply check, or a callback handler fails, it returns with the link still running and calls[nested].active still set. dcp_v26_call() then marks the session failed and nothing pumps the link again, but dcp_v26_link_receive() keeps accepting the late reply and every later callback and queues a kmalloc'd copy of each, up to the 32-event limit. The same happens when a queued notification fails while draining before an outer call, and when a nested call finds no callback to answer. link_fail() woke the waiters but left the queued copies on a list nothing would dequeue again. Port Chris Kearney's 14.7 fixes, commit d203ba4 ("drm/apple: stop the T6030 DCPLink when a call is abandoned") and commit 90139dc ("drm/apple: stop the T6030 DCPLink when a call fails before submit"): stop the link on every return that gives up on a call, clear the abandoned call's active flag so the receive path drops whatever arrives for it, and free the queued events in link_fail() under the lock. An event a caller has already dequeued is no longer on the list. The callers already treat any failed call as the end of the session (dcp_v26_call() latches v26->failed, "recovery requires a reboot"), so nothing that worked before stops working. The firmware buffers and the RPC memory are still kept until reboot. This code runs only with the J613 (apple,t8122-dcp) 25G83 DCP firmware. The -EBUSY retry before submit is unchanged: it re-drains a callback that arrived between the drain and the submit, bounded by the call deadline. Fixes: aa504d6 ("drm: apple: add the J613 v26 display backend and guarded coldplug") Signed-off-by: Ryan Murray <[email protected]>
|
No blockers. Checked the port against the 14.7 client on integration/aurora: every exit of dcp_v26_link_call() after a submit (timeout, -EIO from link_next_event(), bad reply, failed callback, wrong completion id) now goes through
HW row: J613 (or J615) on the 25G83 firmware: boot with 0 "DCP link stopped" lines and the panel up. Then force one call timeout (DCP crash trigger): exactly one "DCP link stopped" line, and kmemleak shows no dcp_v26_event allocations. Plus 0 AVC, 0 failed units and 0 new kernel errors. Assisted-by: LLM (Claude:Opus 5.5) |
|
Folded into #2460, which carries this PR's commits unchanged; review continues there. |
Problem
drivers/gpu/drm/apple/iomfb_v26_6_link.c(the J613 /apple,t8122-dcp25G83 DCPLink client, added in aa504d6) is a copy of the T6030 14.7 clientiomfb_v14_7_link.c. Two fixes landed in the 14.7 copy and never reached the 26.6 one: d203ba4 ("drm/apple: stop the T6030 DCPLink when a call is abandoned") and 90139dc ("drm/apple: stop the T6030 DCPLink when a call fails before submit"), both by Chris Kearney.In the 26.6 copy,
dcp_v26_link_call()still returns with the link running andcalls[nested].activeset when a call times out, fails its reply check or has a callback handler fail. It does the same when a queued notification fails while draining before an outer call, and when a nested call finds no callback to answer.dcp_v26_call()then latches the session as failed and nothing pumps the link again, butdcp_v26_link_receive()keeps accepting the late reply and later callbacks and queues a kmalloc'd copy of each until the 32-event limit.link_fail()then wakes the waiters and leaves those copies on a list nothing dequeues.Change
Port the two 14.7 fixes. Every return that gives up on a call now stops the link and clears the abandoned call's active flag, so the receive path drops anything that arrives for it.
link_fail()frees the queued events under the lock. The-EBUSYretry before submit stays as it is. It handles a callback that arrives between the drain and the submit: it drains that callback and resubmits, bounded by the call deadline. That is the protocol's own ordering, not a retry that hides a failure.Safe for every SoC it reaches: the file is built for the J613 backend only (
iomfb_v26_6.o), and the only caller already treats any failed call as the end of the session (dcp_v26_call()setsv26->failed, "recovery requires a reboot"). Only the queueing of messages nobody will read changes.Testing
make W=1ofdrivers/gpu/drm/apple/iomfb_v26_6_link.oand a full build ofdrivers/gpu/drm/apple/(arm64, LLVM, release config, all three hack/drm-misc-retry branches applied): no warnings.checkpatch.pl --strict: clean apart from commit-id lookups that need a tree.Still to run
None of the four test Macs (J700, J616s, J316s, J413) uses this file, so there is no hardware row there. On a J613, if one is available: boot, then check that
dmesg | grep -c "DCP link stopped"is 0 and the panel comes up as before. Then force a call timeout (for example by crashing the DCP with its debugfs crash trigger) and check that the message appears once and kmemleak shows nodcp_v26_eventallocations.Remaining difference between the two link clients
After this change the 14.7 and 26.6 clients still differ on purpose: 14.7 answers callbacks in the order they were handled (41e7226, needed for external processors whose callbacks come from separate firmware threads) and has an admission veto. 26.6 serves a panel with strictly nested callbacks and keeps arrival timestamps for page-flip events. Merging both into one shared core is possible but is a bigger refactor than this fix. Both idle workers (
dcp_v14_idle(),dcp_v26_idle()) also set the session failed on a notification error without stopping the link. That is the same kind of bounded leak and is left for a follow-up because it touchesiomfb_v14_7.c.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 lab Mac reaches iomfb_v26_6 (J613/J615 only); boot-clean regression rows only.