Skip to content

drm: apple: dcp: V27 sleep: take messages that come during the settle (J714s -16 refusal) - #2602

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
djdev/m5-j714s-dcp-settle-aop-order
Nov 21, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
djdev/m5-j714s-dcp-settle-aop-order

Conversation

@DjDeveloperr

@DjDeveloperr DjDeveloperr commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

A J714s (M5 Pro) deep-sleep fix, copied from macOS 27 traced under the hypervisor on the same machine. On integration/aurora df62a8c.

drm: apple: dcp: V27 sleep: take messages that come during the settle.

  • The symptom. The panel's display processor (48ae00000.dcp) refused a deep sleep with -EBUSY and nothing else in the log, 3 times in 40 sleeps after a replug of a display's port. One of the three was a dark wake's re-suspend. The aborted resume then logged a GPU "firmware never stopped" line, and once an external display's link timeout.
  • The cause. The V27 settle ended with a one-shot snapshot of the RTKit receive side (apple_rtkit_v27_rx_drained() ? 0 : -EBUSY). It is the only silent -EBUSY in the internal processor's path: the polls before it time out with -110, and every other refusal logs.
    • Each refusal came ~5 ms after the panel firmware logged a brightness change.
    • It logs one 3-15 ms after each external display processor releases its display, in the same, concurrent, async suspend.
    • A syslog line still being handled at the snapshot was enough to refuse.
  • macOS. It answers what the firmware sends during the display sleep and goes on. In a trace with three external displays attached, its first stop request to the panel's processor follows its answer to the panel's last syslog line by 31 µs.
  • The change.
    • When a message came during the checks, it is taken and all of them run again, including the inventory of messages left unhandled.
    • A processor still sending after 1 s, or a check that times out after such a message, refuses with -EBUSY as before, so the refusal is still undone.
    • A refused sleep of the internal processor now logs its steps, as the external ones' always do.

An independent review (two rounds) found two issues in the first version, both fixed here: the inventory ran only once, and a timeout after a late message returned -ETIMEDOUT, which marks the processor crashed instead of undoing it. An AOP endpoint-order commit was in the first version and is dropped. The J714s device tree already gives the AOP macOS's stop order, so it fixed nothing on the J714s.

Hardware (J714s).

🤖 Generated with Claude Code

On the J714s the panel's display processor (48ae00000.dcp) refused a
deep sleep with -EBUSY and no reason in the log, 3 times in 40 sleeps
that came after a replug of a display's port. Each refused sleep then
left a GPU "firmware never stopped" line, and one an external display's
link timeout, in the aborted resume.

The refusal is the settle's last check. After the endpoint checks it took
a snapshot of the RTKit receive side and refused the sleep if anything
was in flight. Each refusal came ~5 ms after the panel's firmware logged
a brightness change. It logs one each time an external display processor,
suspending at the same time, releases its display, so a syslog line in
flight at that instant was enough.

macOS answers what the firmware sends during its display sleep and goes
on. In a trace with three displays attached, its first stop request to
the panel follows its answer to the panel's last syslog line by 31 us.
The settle now does the same: when a message came during the checks, it
is taken and all of them run again, including the inventory of messages
left unhandled. A processor that still sends after 1 s, or a check that
times out after such a message, refuses the sleep with -EBUSY as before,
so the refusal is still undone cleanly.

A refused sleep of the internal processor also logs its steps now, as
the external ones' always do; a step's refusal there was silent.

Signed-off-by: Diljit Singh <hey@djdev.me>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DjDeveloperr
DjDeveloperr force-pushed the djdev/m5-j714s-dcp-settle-aop-order branch 2 times, most recently from 0fe7c29 to af33408 Compare November 20, 2026 20:13
@DjDeveloperr DjDeveloperr changed the title drm: apple: dcp, soc: apple: aop: J714s: no refused sleep after a display release; macOS's AOP endpoint order drm: apple: dcp: V27 sleep: take messages that come during the settle (J714s -16 refusal) Nov 20, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

The loop makes sense to me, and running the inventory again after the last drain covers the earlier review point. Two things:

  • Results: the body ends with "Results follow here." and I can't find them. Could you post the J714s replug and sleep runs: how many sleeps, how often "a message came during the settle" was logged, and whether any "still sends" refusal or GPU "firmware never stopped" line remained?
  • dcp-v27-sleep.inc:874 turns any -ETIMEDOUT into -EBUSY once a late message was seen. That also covers a timeout of iomfb_queue_settle() (:840) or of an endpoint's afk_v27_sleep_check (:847), which means the firmware stopped answering, not that it kept sending. In the second settle (after A500 and the closes, :1616) the error goes to uncertain:. There dcp_v27_ext_undoable() (:771) refuses undo only for -ETIMEDOUT, so an external processor that stopped answering after a late message is now reopened live instead of failed, which is what happened before this patch. Mapping only the apple_rtkit_v27_rx_drained poll timeout (:837) to -EBUSY would keep the new behaviour for the case it is meant for.
  • Minor: apple_rtkit_v27_rx_drained() is also false while v27_rx_failed is set (rtkit.c:2090), and that flag stays set. If an ack fails mid-round, the loop treats it as a late message and spends another round before refusing. The result is the same -EBUSY as before, but checking the flag on its own would end the loop at once and report a failure instead of a busy refusal.

Assisted-by: LLM (Claude:Opus 5.5)

@DjDeveloperr

Copy link
Copy Markdown
Contributor Author

Hardware gate (J714s, M5 Pro), pe1, 20:06-20:27: 6 of 6 clean.

  • Kernel: 7.3.0-m5-kits6, a native warm build on the M5 of m5-test/kitS6-20261120 305b58c7. That is merged integration/aurora d1d26ab plus this commit (byte-identical), soc: apple: t6050-aop: stop AOP2 before AOP, well before the commit, as macOS #2606, and a log-only AOP line.
  • Cycle: a debugfs replug of the Dell's Type-C port, then 20 s later a logind deep sleep with a 30 s RTC alarm. Three external displays, the TB5 dock and the Dell hub were attached.
  • Result:
    • every sleep held 27.7-28.2 s and woke on the alarm;
    • 0 refused sleeps: no platform_pm_suspend returns -16, no failed to suspend;
    • 0 GPU "sleep refused before the commit" lines and 0 GPU fault lines;
    • 0 dcp_timeout;
    • every device check passed after each wake.
  • The slot ended with the default restored and verified byte-identical.

The refusal this fixes came 3 times in 40 replug sleeps on the old code, so 6 clean sleeps are a gate, not a proof. More cycles follow after the merge, in the gates this rides.

🤖 Generated with Claude Code

@DjDeveloperr
DjDeveloperr merged commit 2b387cc into integration/aurora Nov 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants