Repository navigation
drm/apple: stop the DCPLink when a notification fails - #2458
RyanTheTide wants to merge 2 commits 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]>
dcp_v14_idle() and dcp_v26_idle() handle the firmware callbacks that arrive while no call is in progress. When one of them fails (a callback handler error, a malformed callback, a reply nobody asked for, or a failed reply), they mark the session failed, "recovery requires a reboot", and return with the link still running. From then on the loop condition (!failed) means nothing pumps the link again, but dcp_vNN_link_receive() keeps accepting every later firmware callback and queues a kmalloc'd copy of each, up to the 32-event limit, and queues the idle work for each, which then does nothing. The copies stay on the list until reboot unless a 33rd event arrives: the link state outlives the device and nothing else frees them. This is the leak Chris Kearney fixed for abandoned calls in the 14.7 client, commit d203ba4 ("drm/apple: stop the T6030 DCPLink when a call is abandoned"), and commit adbab6a ("drm/apple: stop the J613 DCPLink when a call is abandoned") in the 26.6 copy; the notification path of both was left out. Stop the link there the same way: call dcp_vNN_link_fail(), which frees the queued events under the link lock, wakes any waiter, and makes the receive path drop whatever arrives next. The two idle functions stay identical. Nothing that worked before stops working: every later call already returns -EIO on the failed session (dcp_v14_call_guarded(), dcp_v26_call()), and the firmware buffers and RPC memory are still kept until reboot. If the link had already failed (the pump returned -EIO for that reason), link_fail() is idempotent. The 14.7 code runs on T6030 (J514s/J516s panel and external processors), T6031 (J514c/J516c) and T8122 (J613/J615) with the 14.7 DCP image; the 26.6 code only on J613/J615 with the 25G83 image. Fixes: 98d767e ("drm/apple, media: apple: avd: T6030 internal panel, external display and AVD fixes") Fixes: aa504d6 ("drm: apple: add the J613 v26 display backend and guarded coldplug") Signed-off-by: Ryan Murray <[email protected]>
|
No blockers. I checked the top commit 36c07e5 against both link layers at the head. This depends on #2386, which is still a draft, for the v26 HW row (owner Mac, not in the lab): J514s/J516s (T6030) on 14.7 and J613 on 25G83 with this head. Panel up, an external display on the J514s, and Assisted-by: LLM (Claude:Opus 5.5) |
Stacked on #2386 (
hack/drm-misc-retry-a), whoselink_fail()iniomfb_v26_6_link.cfrees the queued events; review only the top commit. Merge #2386 first.Problem
dcp_v14_idle()(drivers/gpu/drm/apple/iomfb_v14_7.c:1447) anddcp_v26_idle()(iomfb_v26_6.c:774) handle firmware callbacks that arrive while no call is in progress. If one fails (a callback handler error, a malformed callback, an unsolicited reply, or a failed reply), they mark the session failed ("recovery requires a reboot") and return with the DCPLink still running.After that, nothing pumps the link again, because the loop stops on
failed.dcp_vNN_link_receive()keeps accepting every firmware callback, queues a kmalloc'd copy of each (up to 32), and queues the idle work again for each, which then does nothing. The copies stay until reboot unless a 33rd event arrives: the link state outlives the device, and nothing else frees the list.This is the leak that Chris Kearney's d203ba4 fixed for abandoned calls in the 14.7 client, and #2386 fixed in the 26.6 copy. Neither fix covered the notification path.
Change
On that failure path, both idle functions call
dcp_vNN_link_fail(), the same mechanism the call paths use. It frees the queued events under the link lock, wakes any waiter, and makes the receive path drop whatever arrives next. The two functions stay identical.link_fail()is idempotent, so the case where the pump failed because the link had already failed (-EIO) is unaffected.Nothing that worked before stops working. Every later call already returns -EIO on a failed session (
dcp_v14_call_guarded(),dcp_v26_call()). The firmware buffers and RPC memory are still kept until reboot.Which SoCs reach this code:
iomfb_v14_7.c(DCP_FIRMWARE_V_14_7): T6030 J514s/J516s (internal panel and the nativeapple,t6030-dcpextsession), T6031 J514c/J516c, and T8122 J613/J615 internal panels with the 14.7 DCP image.iomfb_v26_6.c(DCP_FIRMWARE_V_26_6): J613/J615 with the 25G83 image only.Testing
iomfb_v14_7.oandiomfb_v26_6.o, 0 warnings.--no-treealways gives.tools/asahi/run-host-tests.py --only ...): display26, dcp14-panel, dcp14-backlight and backlight-coldboot (with negative controls): all passed. The apple-dcp selftest suite hit the 30-minute cap on the loaded box after 53 cases, all ok and none failed.dcp_vNN_link_fail()from one more place, so no new suite was written.Still to run
tools/asahi/run-host-tests.py --only apple-dcprun (capped here after 53/53 ok).None of the lab Macs (Neo T8140, J616s T6040, M1 Pro T6000, M2 T8112) runs either file, so the lab has no row for this change. Owner rows:
dmesg | grep -E 'DCP notification failed|DCP link stopped'is empty, as on the base kernel.DCP link stopped; firmware buffers are kept until rebootnow followsDCP notification failedimmediately, and no furthercallback ... failedlines or idle-work activity follow. With kmemleak, there are no new unreferenced objects fromlink_event.Port of Chris Kearney's DCPLink stop-on-failure fixes to the notification path.
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 these paths; boot-clean regression rows only.
Assisted-by: LLM (Claude:Opus 5.5)