Repository navigation
drm/apple: stop the DCPLink when a start or swap ends the session - #2460
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]>
A failed panel start (the fail: label of dcp_v14_start()/dcp_v26_start()) and a swap the firmware refuses on the internal panel mark the session failed but leave the DCPLink running. Nothing pumps a failed session, so the link keeps queueing the firmware's notifications as kmalloc'd events that nothing frees until reboot. This is the leak the failed-call and notification-error paths already close with dcp_v14_link_fail() and dcp_v26_link_fail(). Stop the link on these four paths as well, in both copies of the client. dcp_v*_link_fail() frees the queued events and refuses new ones; it takes only the link lock, which these paths never hold (the session lock is taken first, as in the idle work), and it is harmless on a link that never started. 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]>
…fused When the external display processor answers A401 or A455 with an unexpected status, dcp_v14_simple_call() returns -EPROTO with the link still running. The open path then marks the session failed, and the link keeps queueing notifications that nothing pumps or frees, the same leak as the start and swap paths fixed in the previous commit. Stop the link there as well, before reporting the session stopped. Fixes: b7b1076 ("drm/apple: t6030: start an external display processor on first use") Signed-off-by: Ryan Murray <[email protected]>
Both DCP starts (dcpext and the internal panel) boot RTKit up to four more times when apple_rtkit_wake() times out, and a retry that worked left no trace. Nothing records why the first handshake times out, so the loop cannot be replaced by a wait on the right event yet. Keep the bounded retry, say so where the bound is defined, and warn with the number of extra boots whenever one was needed, so owners of T6030 and T6031 Macs can tell whether it ever fires (tracked in #2461). Signed-off-by: Ryan Murray <[email protected]>
|
No blockers. This is stacked on #2458, not a replacement for it. I checked the three new commits at 47cf16e.
Merge order: #2386, then #2458, then this. #2464 also edits HW row (owner Mac): J514s/J516s (T6030) and J613 (25G83) on this head. Panel and external display up. No Assisted-by: LLM (Claude:Opus 5.5) |
|
#2458 is now folded in here, and #2386's commit (adbab6a) is carried too, so #2386 should be folded the same way or land first. Still needed: %d for the int retry count in the RTKit retry warning (iomfb_v14_7.c:2254 and :2440), and J514s/J516s and J613 rows with panel and external display up and no DCP link stopped or RTKit wake timeout lines, then it can be marked ready. |
Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
Reviewed the fatal paths for both sessions and the v26 queue drain and slot release under the link mutex. The combined boots only cover successful startup. Please exercise a submitted RPC that times out with a late reply and queued callback, verifying that the waiter exits, queue stays empty, and subsequent work sees a failed session. Also cover the internal-swap versus external-refusal behavior before landing.
The backlight fixture zero-allocated the v14 session and never initialised its link. Now that a refused internal swap stops the link, the v14_bl_failed_submit_unknown case walked an uninitialised event list and faulted (CI KUnit, display suites). Initialise the link with dcp_v14_link_init() as iomfb_v14_7_bind() does, with no RTKit behind it. Check the new behaviour too: the refused internal swap now leaves the link stopped, and a new case shows that an external display refusing a swap ends neither the session nor its link. Reported by the aurora-silicon review of #2460. Signed-off-by: Ryan Murray <[email protected]>
|
Pushed 307675b (one commit, no force push):
Still open from your review: the v26 timed-out RPC with a late reply and a queued callback (waiter exits, queue stays empty, later work sees a failed session). That needs a link-level harness, which I'm writing next. I'll post here when it's in. |
There was a problem hiding this comment.
Verdict: FINISH, then merge at 307675b6
Blockers:
- Wait for the 21 queued CI checks at
307675b6(specificallykunit/ display suites confirmingv14_bl_fixturepasses after failing on794c43b5). - Update
Tested:in the PR description to cite head SHA307675b6(noting runtime files remain byte-identical to47cf16efe55c/794c43b50e9aand KUnit passes at307675b6).
Checked:
- All 5 files (
iomfb_v14_7.c,iomfb_v14_7_backlight_lifetime_test.c,iomfb_v14_7_backlight_test.c,iomfb_v26_6.c,iomfb_v26_6_link.c): 0 code blockers.iomfb_v26_6_link.c: verifiedlink_fail()drainslink->events, resetsevent_count = 0, and wakeslink->waitunderlink->lock, anddcp_v26_link_call()clearscalls[nested].active = falseand stops the link on pre-send pump failure, missing-callback-EPROTO,IS_ERR(e), bad reply, callback error, and-ETIMEDOUT, matchingiomfb_v14_7_link.c.iomfb_v14_7.candiomfb_v26_6.c: verified every remaining fatalfailed = truesite callsdcp_v14_link_fail()/dcp_v26_link_fail(), and RTKit retry logging (#2461) warns only when extra boots occurred.- Commit
307675b6: verifieddcp_v14_link_init(&f.v14->link, dev, NULL)initializes the link list beforedcp_v14_link_fail()runs inv14_bl_failed_submit_unknown, andv14_bl_external_refusal_keeps_linkexercises the internal-swap vs external-refusal distinction requested at794c43b5.
Evidence
- Head:
307675b6(+75/-5across 5 files,MERGEABLEonmain). - CI at review time: 21 checks
QUEUED/PENDING(kunit,apple-build,host-tests,pr-text,readiness, 16 KUnit suites). - Note: the prior
794c43b5review also asked for unit coverage of a submitted v26 RPC timeout with a late reply and queued callback verifying queue drain and subsequent session failure;307675b6covers the internal-vs-external swap part only.
|
Per the review at 307675b: (1) noted, hosted CI is still queued. The local run of the same display KUnit recipe at 307675b passes, including the fixture case that failed at 794c43b. (2) Tested now names head 307675b and says what it adds over the 47cf16e hardware rows (a clean main merge plus a KUnit-only commit; the changed driver files are byte-identical). |
There was a problem hiding this comment.
Verdict: MERGE at 307675b6
Blockers: none (await the 20 queued CI checks at 307675b6 before merging)
Checked:
- PR description updated to cite exact head
307675b6with local arm64 QEMU KUnit (drivers/gpu/drm/apple/tests/display.kunitconfig: 169 run, 168 passed, 1 skipped — confirmingv14_bl_failed_submit_unknownandv14_bl_external_refusal_keeps_linkPASS) and runtime files (iomfb_v14_7.c,iomfb_v26_6*.c) byte-identical to the47cf16efJ615 & J473 hardware rows. - Code across all 5 files previously audited clean at
307675b6(iomfb_v26_6_link.cqueue drain and abandon paths matchiomfb_v14_7_link.c, every remaining fatalfailed = truesite stops the link, andv14_bl_fixtureinitializes the link).
Evidence
- Head:
307675b6(MERGEABLEonmain,+75/-5across 5 files, two-way door). - CI at review time: 20 checks
QUEUED, 0 failures.
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: A failed panel start or refused swap now stops the DCPLink, so a failed session stops queueing firmware notifications that are never freed.
Tested: head 307675b = 47cf16e (hardware rows) + a clean main merge (794c43b) + a KUnit-only commit (the backlight test fixture now runs
dcp_v14_link_init(), plus the internal/external refusal cases). Hardware at 47cf16e in the combined one-shot kernel 7.3.0-aurora-dsw1: J615 (v26_6 client) and J473 (external DCPs) start and swap normally, displays connected, no new DCP error lines against the fleet kernel, s2idle rc 0, 0 WARN/BUG.iomfb_v14_7.c/iomfb_v26_6*.care byte-identical at 307675b. KUnit at 307675b (local run of the CI recipe,drivers/gpu/drm/apple/tests/display.kunitconfig, arm64 QEMU): 169 run, 168 passed, 1 skipped;v14_bl_failed_submit_unknownandv14_bl_external_refusal_keeps_linkpass. The hostedkunitcheck failed at 794c43b, before the fixture fix.Risk: two-way · Macs on the v14_7 and v26_6 DCP clients (T6030/T6031, J613/J615, externals)
Not yet: a failed start or refused swap on real hardware (none reproduced); the failure paths are covered by reading the code only
Evidence
git merge-treemerges of linux#2263 power: supply: macsmc: Report net discharge as discharging on every battery #2303 soc: apple: sep: Count sensor bring-up and frame failures; document the remaining SEP retries #2363 drm/apple: dcp: give each Type-C reconnect request its whole budget #2364 drm/apple: name the brightness and 180 Hz probe retry budgets and report their exhaustion #2387 drm/apple: stop the DCPLink when a start or swap ends the session #2460 drm/apple, kbuild, tools/aurora-sep: drop dead kill switches, Kconfig/Makefile leftovers and the login refresh unit #2464 btrfs: verify large data reads in parts #2493 soc: apple: display-gate: request T8122 storage by soc-device record #2682 drm/asahi: mmu: publish a binding without the VM reservation #2799 soc: apple: aop: refuse EPIC calls once the firmware has crashed #2800 soc: apple: sep: gate per-user key bags on a proven capability, not the create variant #2806 soc: apple: sep: read the pnon digest on the two-to-four-page SEPs #2810 PCI: apple: T6050: wait for the radio's port with a wait queue #2377 PCI: apple: t6050: write the gen5 shadow tunables into the 32 GT/s bank #2794 wifi: apple: centauri: T6050: don't veto s2idle for a failed or stopped N1 #2795, fleet89 config (+CONFIG_USB_BILLBOARD=m), LLVM 22.1.6 / rustc 1.97.1; build warnings are the same as main's (23 rustc dead-code warnings, all present on main).grub2-rebootone-shot, no Stage 2 or DTB change. Each Mac went back to its saved fleet kernel, the test kernel was removed, and production state was verified: saved entry, empty next_entry, Enforcing, 0 failed units.genpd_prepare -11, brcmfmac LPAS fallback), and the fleet kernel's own s2idle shows them too. On J615, dsw1's boot also had one brcmfmacring 4: r_ptr 0 outside depth 0line, not seen on 3 fleet boots. No PR in the batch touches brcmfmac.Merge main into hack/round3-c(no conflicts).Original description
Problem
A failed panel start and a swap that the firmware refuses on the internal panel mark the DCP session failed, but leave the DCPLink running. Nothing pumps a failed session, so the link keeps queueing the firmware's notifications as kmalloc'd events that are never freed before reboot. The failed-call path (#2386) and the notification-error path (#2458) already stop the link in this case. These five paths did not.
Change
On these paths
dcp_v14_link_fail()/dcp_v26_link_fail()is now called right after the session is marked failed, in both copies of the client:fail:label of the v14_7 panel start (T6030/T6031 internal panel);dcp_v14_swap_locked();fail:label of the v26_6 start (J613/J615);dcp_v26_swap();dcp_v14_simple_call()returns -EPROTO with the link still running).link_fail()frees the queued events and refuses new ones. It takes only the link lock, which none of these paths hold: the session lock is taken first, the same order as the idle work. It is also harmless on a link that never started; it then only logs "DCP link stopped" once.This is stacked on #2458 (and #2386 under it). Those must merge first, and their commits show up in this diff until then.
Third commit: both v14_7 DCP starts reboot RTKit up to four times when
apple_rtkit_wake()times out, and a retry that worked left no trace. The bounded retry stays, because nothing records why the first handshake times out. It is now commented where the bound is defined and warns with the number of extra boots whenever one was needed (#2461).Testing
W=1build ofiomfb_v14_7.oandiomfb_v26_6.oon the combined tree: no warnings.failed = truesite in both files was checked. A call that fails once submitted already stops the link in the link layer (dcp_v1[4]/v26_link_call()); RTKit wake and link-start failures happen before the link carries events; the idle-work path is drm/apple: stop the DCPLink when a notification fails #2458. The five paths above were the remaining ones.Still to run
dmesg | grep -E 'display not started|DCP link stopped'is empty. If a start or swap does fail, "DCP link stopped" follows straight after it, and/sys/kernel/debug/kmemleak(where enabled) shows nodcp_v1[4]_event/dcp_v26_eventgrowth over 10 minutes.Credit: the start, swap and external-open paths are from Chris Kearney (98d767e, b7b1076) and Satya Benson (aa504d6).
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.