Repository navigation
Conversation
Add system suspend/resume support for the Apple M3 (G15G / T8122) GPU driver across firmware-driven deep sleep: - Drain in-flight work, idle RTKit, release the PMP GPU power vote, and lower PS_GFX via apple-sleep on suspend so the sleep controller can commit deep sleep cleanly. - On resume, restore the PMP GPU power vote and PS_GFX domain, perform an RTKit warm restart of the GPU coprocessor without tearing down user DRM state, and resume command submission. - Avoid sleeping under RCU read locks during the suspend/resume teardown and restart path. Tested across 3 consecutive real deep sleep cycles (mem/deep, pm_test=none) on MacBook Air 13" M3 (J613, T8122) with live Borealis Vulkan and OpenGL ES (glmark2-es2-drm) rendering after every wake. Signed-off-by: Satya Benson <[email protected]>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: FINISH, then merge at 8e6a5b81
Blockers:
pr-textCI failure (runs/46128162271): add the requiredTested:line (exact head SHA + Mac + result) andRisk:line (two-wayorone-way+ affected Macs) to the PR description sopr-textpasses.- Wait for the remaining queued KUnit CI jobs to finish green.
Checked:
- M3 (
T8122/G15G) firmware-driven deep sleep suspend/resume path (drain GPU work, idle RTKit, release PMP GPU power vote, lowerPS_GFX; restore vote +PS_GFXand warm-restart RTKit on resume) is clean and proven across 3 consecutive realmem/deepcycles on J613 (boot object resumes 0 -> 3). - Checked for Apple material, tool attribution, private serials, and board gating: clean;
MERGEABLEonmain; humanSigned-off-bypresent.
Evidence
- Head:
8e6a5b81(base: main,mergeable: MERGEABLE,+674/-20across 9 files).
Keep .untested = true and .display_no_restart = true on t8122_sleep_soc so /sys/power/mem_sleep remains [s2idle] by default until all T8122 deep-sleep prerequisites (aurora-silicon#3425, aurora-silicon#3504, aurora-silicon#3445, aurora-silicon#3452) have landed and 27.2-firmware T8122 boards (J615) have a matching display sleep path. With .untested and .display_no_restart preserved, default s2idle and apple_sleep.deep=1 dry runs stay intact on both 26.6.2 (J613) and 27.2 (J615), while committed J613 deep sleep runs via apple_sleep.deep=1 apple_sleep.untested_commit=1. Signed-off-by: Satya Benson <[email protected]>
|
Second T8122 row, on a J615 (M3 Air 15", 27.2 firmware). Kernel: main 965d4a7 + this PR (8e6a5b8) + #3505 (263ce82), one-shot boot with
So on 27.2 boards this PR changes nothing. No regression from the J615, but its deep sleep isn't covered either. That needs the G16 T8122 row to gain deep sleep, which is separate from this PR. |
|
Hardware row at this head on J613 (MacBook Air 13" M3, T8122): 3/3 Setup: Results:
Not yet: a GPU workload across a deep sleep. The desktop was idle, and this row did not render after each wake. |
There was a problem hiding this comment.
Verdict: MERGE at 8e6a5b81735d
Converts this App's earlier review at the same head to an approval under the 12-01 merge bar (better than before and doesn't break; block only on a shown failure). No code blocker was found in it. The merge gate (a row on one Mac at this head + fast CI) is tracked by pr-readiness, not held here.
Checked: - M3 (T8122/G15G) firmware-driven deep sleep suspend/resume path (drain GPU work, idle RTKit, release PMP GPU power vote, lower PS_GFX; restore vote + PS_GFX and warm-restart RTKit on resume) is clean and proven across 3 consecutive real mem/deep cycles on J613 (boot object resumes 0 -> 3).
- Checked for Apple material, tool attribution, private serials, and board gating: clean;
MERGEABLEonmain; humanSigned-off-bypresent.
Follow-ups (not blocking): add Tested/Risk lines so pr-text passes; queued KUnit
|
Hardware rows at this head ( Kernel:
After every wake, in A2 and B (15 wakes):
Not covered: M3 Pro and M3 Max. Deep sleep still needs |
DjDeveloperr
left a comment
There was a problem hiding this comment.
An aborted deep suspend can leave the GPU offline. In m3_runtime.rs:1619–1624, sleep_suspend detaches the RTKit mailbox and stops the ASC before releasing the PMP vote. If the release returns an error, m3_drm.rs returns before setting sleep_stopped. On PM unwind, sleep_complete sees neither sleep_stopped nor a commit descriptor and reopens submission without restarting the firmware. Track each completed suspend step and recover it on abort. Please test a PMP release failure after ASC stop and verify the GPU still completes work.
The firmware stop in .suspend() detaches the RTKit mailbox, stops the ASC, then releases the PMP GPU power vote. If the release failed, the error returned before sleep_stopped was set; on the PM core's unwind, .complete() saw neither sleep_stopped nor a commit descriptor and reopened submission on stopped firmware, leaving the GPU offline. Record each step as it completes (mailbox detached, ASC stopped, PMP vote released, PS_GFX lowered) in m3_sleep_steps::Steps. .complete() undoes exactly the recorded steps, in reverse order: raise PS_GFX only if it was lowered, take the PMP vote again only if it was released, then warm-restart the coprocessor whenever any step ran, before submission reopens. A stop that never started leaves firmware alone, as before. If the undo itself fails, the runtime is marked failed and pending work is failed, as for a failed wake. The step sequence and the undo plan live in a module with no kernel dependencies, so the production code runs in host tests (tools/asahi/m3-sleep-steps-tests.py). They inject a PMP release failure after the ASC stop and an ASC stop failure after the mailbox detach, and check that firmware is restarted, without re-acquiring a vote that was never released, before submission may reopen. Two negative controls (restart only after a full stop; record the ASC stop only after the PMP release) are both killed. Signed-off-by: Satya Benson <[email protected]>
|
@DjDeveloperr Thanks, you're right: that abort path reopened submission on stopped firmware. Head What changed (
Tests
Untested on hardware. "The GPU still completes work after an aborted suspend" has not run on a Mac at
Our J613's recovery path is down right now, so these wait until it is back. I'll post them as a regression request. |
RyanTheTide
left a comment
There was a problem hiding this comment.
Rechecked the reported abort. A failed PMP release after ASC stop now leaves enough state for completion to restart the firmware before reopening submissions. It reacquires the vote only when the release succeeded. The focused fault-injection test covers the reported ordering.
|
Hardware row (Row 2) on MacBook Air 13" M3 (J613, T8122, 26.6.2 / 25G83 stub), exact head
Not yet tested on hardware at
|
What: Add firmware-driven deep sleep (
mem/deep) suspend/resume support for the Apple M3 (G15G / T8122) GPU driver (aurora), draining in-flight work, loweringPS_GFXand releasing the PMP GPU vote on suspend, and warm-restarting RTKit on resume without tearing down DRM/userspace state.Tested: J613 M3 Air 13" at 8e6a5b8: 3/3 consecutive real
mem/deepcycles (boot object resumes 0 -> 1 -> 2 -> 3), GPU firmware warm-restarted in 827–1353 µs (real=true),healthy=1, live Borealis Vulkan and 911 FPSglmark2-es2-drm, 0 failed units.Risk: two-way · M3 (T8122)
Not yet: M3 Pro / M3 Max (T603x) deep sleep (tested on T8122 J613).
Details
PS_GFXviaapple-sleepso the T8122 sleep controller can commit deep sleep.PS_GFXdomain, perform an RTKit warm restart of the GPU coprocessor without tearing down DRM/userspace state, and resume command submission.Evidence
Verified on MacBook Air 13" M3 (J613, T8122, macOS 26.6.2 / 25G83 firmware) at
8e6a5b81across 3 consecutive realmem/deep(pm_test=none) cycles:boot object resumes:0 -> 1 -> 2 -> 31209 us,1353 us,827 us(real=true)/sys/kernel/debug/asahi-m3/progress:healthy=1,completed311 -> 393 -> 456 -> 529 -> 2353vulkaninfo --summary:Apple M3 (G15G C0), Borealis (Mesa 26.3.0-devel)glmark2-es2-drm --off-screen -b build:duration=2.0:911 FPS(glmark2 Score: 910)dmesg;systemctl --failed=0.