Repository navigation
soc: apple: rtkit: let ordinary firmware traffic through the committed v27 display stop - #2913
Conversation
…d v27 display stop
The firmware-27 late display stop checks each display coprocessor once
before the sleep's commit and again right before its stop, after the
commit, where any failure ends in panic("Apple committed display stop
failed"). Two steps failed on ordinary firmware traffic:
- apple_rtkit_v27_check() consumed any pending mailbox message into the
scope FIFO and returned -EAGAIN, also when called after the commit.
The stop that follows reads the mailbox itself.
- apple_rtkit_v27_idle_atomic() returned -EPROTO for any message that
was neither one of the three power-state answers nor an owed OSLOG
counter, e.g. a syslog line or an application endpoint's message.
The check op now learns whether the sleep is committed (the sleep core
passes entry_committed). Before the commit a pending message still
refuses the sleep and is kept for the disarm; after it, the check
leaves the message in the mailbox for the stop. The atomic idle keeps
messages from other endpoints in the scope FIFO, which the disarm
already replays after the restart, and goes on waiting for the
power-state answers within the same 100 ms budget. A management
message off the handshake, a crashlog message, a full FIFO and the
timeout still fail the stop, as before.
The panic itself stays: a coprocessor that did not stop still runs
with its DARTs unstopped, and the DART stop requires the initiator to
be stopped first.
tools/asahi/rtkit-v27-late-tests.py compiles both functions from the
source against a fake mailbox and firmware; its --consume-committed
and --fail-foreign mutations restore the old behaviour and fail.
Reported-by: erikwb <[email protected]>
Signed-off-by: Ryan Murray <[email protected]>
|
Review at 4b5650c. Read at 4b5650c. The
|
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist review at 4b5650c9f5115afcd748f12a419c560823747d97.
Checklist Summary
- §1 No model gating: Pass (reaches only existing
dcp_v27_late_opspath gated byapple_sleep_v27_late()). - §2 Production-ready, no hacks: Needs change — see blockers 1–2 below. (
apple_rtkit_v27_check(s, committed)itself is sound, and disarm replay ordering is protected becauseapple_mbox_hold_rx()keeps the mailbox RX IRQ disabled untilapple_mbox_release_rx()runs after thekfifo_getreplay loop.) - §3 Safety: Needs change — see blocker 1 below (deferring application endpoints weakens fail-closed stop safety).
- §4 Clean-room & attribution: Pass (commit carries human author/committer,
Reported-by:, andSigned-off-by: Ryan Murray <[email protected]>only, zero AI trailers in commit; PR body disclosure present). - §5 Evidence: Owed — see blocker 3 below.
- §6 Naming: Pass (registers new host test in existing
tools/asahi/run-host-tests.pyharness).
Blockers
- Overbroad endpoint pass-through (
drivers/soc/apple/rtkit-v27-late.inc:199-212): Theelsebranch defers every endpoint exceptAPPLE_RTKIT_EP_MGMTandAPPLE_RTKIT_EP_CRASHLOG, including application endpoints (msg.msg1 >= APPLE_RTKIT_APP_ENDPOINT_START). Notably,dcp_v27_sleep_inventory()leaves IOMFB (0x37) open and relies on it being quiesced; an application-endpoint message arriving duringapple_rtkit_v27_idle_atomic()means firmware is mid-call, and replaying it viaapple_rtkit_rx_dispatch()inapple_rtkit_v27_disarm()after IDLE/restart replays pre-sleep RPC state into a restarted coprocessor. Restrict the deferred pass-through strictly to non-MGMT/non-CRASHLOG system endpoints (msg.msg1 < APPLE_RTKIT_APP_ENDPOINT_START), keep-EPROTOfor application endpoints (>= APPLE_RTKIT_APP_ENDPOINT_START), and updatetools/asahi/rtkit-v27-late-tests.py:311to verify0x37fails closed with-EPROTO. - Syslog echo/ack deferral deadlock risk (
drivers/soc/apple/rtkit.c:1270-1330,rtkit-v27-late.inc:205-212):apple_rtkit_syslog_rx_log()acknowledges syslog lines by echoing them back to firmware (apple_rtkit_send_message(rtk, APPLE_RTKIT_EP_SYSLOG, msg, ...)), andrtkit.cnotes that records must be acknowledged for the coprocessor to make progress. Unlike owedOSLOG(echoed inline at line 196), a deferredSYSLOG_LOGmessage is not echoed until disarm after wake. If T6050 firmware blocks completing the IDLE handshake while a syslog ack is outstanding, the 100 ms idle loop still hits-ETIMEDOUTand panics. Either echoAPPLE_RTKIT_SYSLOG_LOGinline (avoiding double-echo on disarm replay) or prove on T6050 hardware that firmware completes IDLE with an unacked syslog line pending. - §5 T6050 hardware evidence owed: None of the tested machines (M2, Neo, M3 Air, t6041) execute
apple_sleep_v27_late()/apple_rtkit_v27_*. Owed: a T6050 (J714s/J716c) hardware row at the updated head exercising s2idle/sleep cycles with internal + external display and a syslog line in the stop window, plus regression check (0 SELinux denials, 0 failed units, 0 new kernel errors).
Assisted-by: LLM (Gemini 4 Neon)
…ay stop Acknowledge SYSLOG and IOREPORT notifications in the atomic idle loop using the existing bounded echo path. An acknowledged record can be recycled, so leave it out of the deferred FIFO. Preserve the stop refusal for application traffic and replay only other system messages after a successful stop. Signed-off-by: Ryan Murray <[email protected]>
DjDeveloperr
left a comment
There was a problem hiding this comment.
Formal §1–§6 pre-PR checklist re-review at 1b68ad86e50a6bc9f3009b426db00f103e249383.
Verdict: REQUEST_CHANGES (0 code/CI blockers remaining; blocked solely on owed §5 T6050 hardware evidence on this non-draft PR).
Prior Finding Verification (1b68ad86e50a)
- Overbroad endpoint pass-through (
drivers/soc/apple/rtkit-v27-late.inc:196-202) — FIXED:apple_rtkit_v27_idle_atomic()now fails closed with-EPROTOand poisons the scope formsg.msg1 >= APPLE_RTKIT_APP_ENDPOINT_STARTalongside unexpectedEP_MGMTandEP_CRASHLOG. Live IOMFB (0x37) / application RPC traffic can no longer slip through or replay pre-sleep state on disarm.tools/asahi/rtkit-v27-late-tests.pynow verifiesAPPLE_RTKIT_APP_ENDPOINT_STARTreturns-EPROTOwithsc.failed && !sc.stopped && rk.strict_idle_poisoned.
- Syslog echo/ack deferral deadlock risk (
drivers/soc/apple/rtkit-v27-late.inc:203-207,rtkit.c:1610-1620) — FIXED:apple_rtkit_notification_msg()(EP_SYSLOG/SYSLOG_LOGandEP_IOREPORT/UNKNOWN1/UNKNOWN2) is now acknowledged inline via the existing boundedecho_pendingpath alongside owedOSLOG, and omitted froms->deferredso disarm neither double-echoes nor reads recycled ring entries.apple_rtkit_v27_idle_atomic()requires!echo_pendingbefore returning0, ensuring the ack is transmitted before completion.- Disarm replay order remains safe (
apple_mbox_hold_rx()holds the RX IRQ disabled untilapple_mbox_release_rx()runs after thekfifo_getreplay loop).
- CI at
1b68ad86e50a— ALL GREEN (7/7):host-tests,source,rust-build,kunit,DWC3/ATC builtin-no-atc,DWC3/ATC modular-no-atc,DWC3/ATC builtin-modular-atcallCOMPLETED / SUCCESS.
Remaining Blocker (§5 Evidence)
- §5 T6050 hardware proof still owed (also acknowledged under
## Still to run):- None of the 4 lab machines (M2, Neo, M3 Air, t6041) execute
apple_sleep_v27_late()/apple_rtkit_v27_*. - Owed before approval /
MERGETRAIN-LINUX4: a T6050 (J714s/J716c) hardware sleep-entry row at this head exercising s2idle cycles with internal + external display and a syslog line in the committed stop window, plus regression check (0 SELinux denials, 0 failed units, 0 new kernel errors).
- None of the 4 lab machines (M2, Neo, M3 Air, t6041) execute
Checklist Summary
- §1 No model gating: Pass.
- §2 Production-ready / §3 Safety: Pass (all prior code/safety blockers resolved).
- §4 Clean-room & attribution: Pass (both commits carry human author/committer
Ryan Murray <[email protected]>and humanSigned-off-by:only, zero AI trailers in commits; PR body includesAssisted-by:disclosure). - §5 Evidence: Blocked on owed T6050 hardware row (not ready for
MERGETRAIN-LINUX4until satisfied or converted to draft). - §6 Naming: Pass.
Non-blocking Note
tools/asahi/rtkit-v27-late-tests.pyverifies inline echo forSYSLOG_LOGand deferred FIFO ordering for non-notificationSYSLOG/IOREPORTmessages; adding an inline echo test case forIOREPORT(UNKNOWN1/UNKNOWN2) and having--fail-foreignalso mutate the notification echo branch would make the negative control even tighter.
Assisted-by: LLM (Gemini 4 Neon)
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
Keep the main branch's secure-port idle callback and pass the commit state through the DCP late-check callback to RTKit. Signed-off-by: Ryan Murray <[email protected]>
|
Forwarded to current main without rewriting the branch. The new head is 6c9bb91. The only conflict was the DCP late-check declaration. The forward preserves main's secure-port idle callback and the PR's committed-state check. All six PR files retain the same added and removed lines. The existing RTKit host fixture passed, the DCP layout suite passed 5/5, and the three affected objects compiled with W=1 on ARM64 with 16 KiB pages and Rust disabled. Hosted checks and the exact T6050 short-sleep display row are pending. Please re-review the forward and record the result at this head. |
Bring in the G16-disabled build fix for the SEP KUnit configuration. Keep the existing RTKit change and add its test to the current host test registry. Signed-off-by: Ryan Murray <[email protected]>
|
Forwarded this branch to current main at The new SEP KUnit run and the T6050 default-command-line display/suspend row remain open. |
|
PASS on a 14-inch MacBook Pro (J714s, M5 Pro/T6050, G17S B1), kernel Candidate The merged heads were #2906 All 3 displays, including the internal panel, were active before a 30.7 s deep sleep. The log recorded The sleep check used deep The command line matched the default. SELinux was disabled. |
DjDeveloperr
left a comment
There was a problem hiding this comment.
Verdict: MERGE at 48b6d70dde9e
Blockers: none. Both earlier points are fixed. Application endpoints now fail closed with -EPROTO during the late idle, and syslog and ioreport notifications are acknowledged inline instead of deferred. The two later commits only merge main; the PR's own diff is unchanged.
Checked: this path runs only in the v27 late sleep (apple_sleep_v27_late()), which only the T6050 takes. The J714s row at this head passes a firmware-27 sleep with the display active and the committed stop exercised. CI is green, and rtkit-v27-late-tests.py covers the endpoint and acknowledgement cases.
Superseded by the review at 48b6d70
Problem
On firmware-27 machines, the late display stop at sleep entry checks each display co-processor once before the sleep is committed and again right before its stop, after the commit, where any failure ends in a panic. Two of those steps treated ordinary firmware traffic as a failure:
apple_rtkit_v27_check()consumed any pending mailbox message and returned-EAGAIN, also after the commit, although the stop that follows reads the mailbox itself.apple_rtkit_v27_idle_atomic()returned-EPROTOfor any message that was not one of the three power-state answers or an owed OSLOG counter (for example a syslog line).So a log line arriving in that window turned a normal sleep into a panic.
Change
checkop learns whether the sleep is committed. Before the commit, a pending message still refuses the sleep and is kept for the disarm, as today. After it, the check leaves the message for the stop.Testing
1b68ad86, including notification echo, FIFO order and application endpoint refusal. Both existing negative controls failed at their intended assertions.Still to run