Repository navigation
drm/apple: let go of the CRTC when a Type-C cable is unplugged (Andy Wei's fix, ported) - #2097
joshuaswarren wants to merge 4 commits into
Conversation
|
CHANGES on 54c1ab0 Compared with Andy's original. The release work, the module parameter and the hook in 1. The new work item is never stopped at teardown (blocks). This tree stops every connector work item before the connector or the DCP goes away. 2. "The code applied as it was" is not accurate. This tree renamed the atomic state type. The work function uses 3. Reach is narrower than the body says.
4. Unsourced claim. "Andy's testing was on an M1 Pro" is not in his commit message. Cite where it comes from or drop it. Checked and fine: the port's second |
54c1ab0 to
2c318a5
Compare
|
[Joshua's agent] New head 2c318a5. Done: release_crtc_wq is cancelled in appledrm_connector_cleanup() and disabled in the unbind loop next to hotplug_wq, bl_sync_wq and bl_commit_wq; the body and commit message now name the drm_atomic_state to drm_atomic_commit rename, say the cancel and disable are an addition to Andy's change, and state the narrower reach (early returns in dcp_dptx_disconnect_oob(), and a connector already reset to fixed_connector queues nothing; which event comes first is not checked). M1 Pro claim dropped. Rebuilt: clang, drm/apple, exit 0, no warnings. Not booted. |
|
GREEN on 2c318a5 Re-review against my first comment. The blocker is fixed. The diff from The other findings are addressed in the commit message and the body: the renamed atomic types are listed, the reach is narrowed to what the code does (including the Not checked by me: the cancel and disable paths at unbind (the body lists this too), and which of the unplug and route-release events comes first. The branch is based on the current head of |
|
Review at head 2c318a5 — draft, not booted. The atomic sequence is correct: drm_atomic_set_crtc_for_connector(NULL) clears connector_mask and drops the connector ref, drm_atomic_set_mode_for_crtc(NULL) disables, active=false, commit under LOCK_ALL. Both helpers come from drm_atomic_uapi.h (the new include is required and correct). INIT_WORK in both create paths, cancel_work_sync in cleanup, disable_work_sync in quiesce — all covered. The module_param escape hatch is reasonable for narrowing on hardware. Findings:
|
|
Thanks for porting this. Three points:
Row: a machine with two Type-C ports that share a pipeline: move a display from port A to port B x5 under GNOME and Hyprland. Pass: it lights within 5 s each time, with no "failed valid clone check" in dmesg. Also unplug and replug the same port within 1 s x10: it stays lit. After that, we can run no-regression rows on our M4 Pro and A18 Pro. |
|
[Joshua's agent] Thanks for the careful read. 1: Will drop 2: Will fold the unplug path through the same 3: Under modeset locks, re-check Evidence: Draft only on our side. Prior bring-up logs ( Hardware row (two Type-C ports sharing a pipeline, M5): move display A→B ×5 (GNOME + Hyprland), unplug/replug same port within 1 s ×10; pass = lit ≤5 s, no |
|
Thanks for agreeing to the three changes. The head is still 2c318a5, so they aren't pushed yet:
Then the row on a machine with two Type-C ports that share a pipeline. Move a display from port A to port B x5 under GNOME and Hyprland: it lights within 5 s each time, with no "failed valid clone check". Then replug the same port within 1 s x10: it stays lit. Andy's After that we'll run no-regression rows on our M4 Pro and A18 Pro. |
|
The work item takes the modeset locks with flags
|
|
Thanks. 06dc7e5 covers all three points. The module parameter is gone. Unplug and route move share What's left before review:
After that we'll run no-regression rows on our M4 Pro and A18 Pro. |
Use the route-move modeset helper to release the CRTC and notify userspace once the release completes. Recheck the connector and its cable under the modeset locks to skip a stale unplug after replug. Remove the module parameter and the redundant atomic commit setup. Built apple_drv.o and iomfb.o for arm64 with LLVM 18 and CONFIG_RUST=n. Signed-off-by: Joshua Warren <[email protected]>
06dc7e5 to
54ba8a2
Compare
|
54ba8a2 is one commit on integration GitHub reports the PR can merge without conflicts. Checkpatch found zero errors and warnings. The two-port and fast replug tests, Andy's own sign-off, and your M4 Pro and A18 Pro regression tests remain open. |
|
Thanks, 54ba8a2 is rebased (0 behind) and folded into one commit with Andy as author. The code matches what we reviewed at 06dc7e5. Left before review:
After that we'll run no-regression rows on our M4 Pro and A18 Pro. |
A disconnected Type-C connector can keep its CRTC and make DRM reject the next port on that pipeline at the clone check. The driver releases that CRTC through the route-move helper. Extract the real release helper with the retrain worker. The host fixture passes and rejects its native26 negative control. Original: AndyWeiBoan/linux@a6ca477 Signed-off-by: Joshua Warren <[email protected]>
c4338b9 to
f2338a1
Compare
|
I updated the PR description to explain the stale connector state and link Andy's original patch. The CI run passed 425 of 427 cases. Both failures came from the retrain fixture: it extracted the worker but omitted @AndyWeiBoan, please apply or approve this message for your commit. We won't rewrite the commit under your name. Please also provide your own The two hardware rows remain open. The PR stays in draft. |
|
Thanks. The body now describes the bug and links Andy's original, and f2338a1 fixes the fixture correctly ( Two points on the new commits:
Still open from before: Andy's |
|
Host tests are green on |
|
J775c (lobata) row request — two Type-C displays (sheet row U4) Posted by Joshua's lane (wB4) from the 2026-11-20 K114c row set. We supply no image for this; it needs a tree with the J775c DTB, built on the PR's folded final head ( Commands: hot-unplug during connect and replug, A to B and B to A, x5 each in GNOME and Hyprland; same-port replug within 1 s x10; record connector and display return on every trial. Pass: display returns on every trial in both compositors; no mode drop. |
|
Review of Host regression checkI compiled the actual disconnect, relink, enqueue and release functions with Clang ASan/UBSan and mocked DRM/DCP operations. The test runs the queued release work during the relink wait. Both the exact PR head and its clean merge onto Both USB-C connectors on J413 share a dcpext, so it is a useful hardware control for the two-port move. The check above is host-only. A cable move, rapid replug and attached sleep on the revised head are still needed. |
|
Happy for this to go in as a port of my change. Signed-off-by: Andy Wei [email protected] Hardware: MacBook Pro 14" M1 Pro (J314s) with a Studio Display (2022) over Thunderbolt. |
|
@joshuaswarren checking open drafts today. To come out of draft, this still needs:
If it's no longer needed, say so here and we'll close it. Otherwise it stays open as a draft until these are done. |
Signed-off-by: Joshua Warren <[email protected]>
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins. |
There was a problem hiding this comment.
Verdict: FINISH, then merge at f93a5be7
Blockers:
- Missing exact-head
f93a5be7hardware verification rows (shared-pipeline A-to-B display moves withoutcrtc failed valid clone check, same-port replugs, and M4 Pro / A18 Pro regression checks, as listed underNot yet). - Queued CI checks (
apple-build,host-tests,kunit,pr-text,readiness, KUnit suites) are still pending; wait for green CI.
Checked:
f93a5be7cleanly mergesmainover54ba8a2f/f2338a10(reusing the shared CRTC release path on Type-C unplug with selftest coverage);MERGEABLEonmain, no Apple material, tool attribution, or private serials.
Evidence
- Head:
f93a5be7(base: main,mergeable: MERGEABLE,+70/-4across 5 files).
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Keep the mode validation forward declaration and the atomic CRTC release helper. Signed-off-by: DjDeveloperr <[email protected]>
There was a problem hiding this comment.
The forward merge is mergeable, and the patch still queues the shared CRTC release on Type-C unplug with synchronous work teardown. Current hosted checks and hardware are pending. Please post the shared-pipeline A-to-B display moves and same-port replugs at this head, plus the M4 Pro and A18 Pro regressions listed in the PR.
There was a problem hiding this comment.
Superseded 12-01: not a hold under the merge bar (no shown failure). No code affirmation; follow-ups: show display move and replug on affected topology; M4 Pro/A18 Pro matrix later
Narrowing the review evidence to the shared-pipeline Type-C failure this PR fixes. Please show that moving the display and replugging still work on the affected topology. The broader M4 Pro and A18 Pro matrix can follow separately unless it exposes a regression from this diff.
|
Merged main into 9c652e2. The CRTC release helper and main’s mode-validation declaration are both present. All three changed arm64 display objects compiled. |
What
Ports Andy Wei's patch (
a6ca477e1e36, commit54ba8a2fa736) so unplugging a Type-C display releases the CRTC when multiple Type-C ports share a pipeline. Without this, moving a display to another port on the shared pipeline can leave the unplugged connector holding the CRTC and cause DRM to reject the new modeset withcrtc failed valid clone check.The unplug worker reuses the same CRTC release path as a route move, verifies connector and cable state under the modeset locks so a fast replug keeps its display, and sends the hotplug event after releasing those locks. Scoped to the existing Type-C route path.
@AndyWeiBoan, please provide your exact
Signed-off-by:for the carried patch.Tested
native26catalogue check.Risk
two-way · Macs with shared-pipeline Type-C external displays using apple-dcp.
Not yet
No hardware run on this head yet. Pending: five A-to-B display moves in GNOME and five in Hyprland on a shared-pipeline Mac (picture within 5 s, no clone-check error), ten same-port replugs within 1 s, and M4 Pro / A18 Pro regression runs.