Repository navigation
Conversation
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Tested this PR on J493 ( Issue with
|
|
@lucasvllima @JJRPF you should upgrade to 27.2 stub, 13.5 is not supported for long and S2R is designed to work only on new stub going forward |
|
@DjDeveloperr Got it, thanks! I'm running Omarchy ( |
|
Long sleep on the same J414s (13.5 OS stub), same commit
|
On the legacy GPU backend (G13/G14 firmware older than 27.2, such as the M2 Pro/Max G14X on the 13.5 firmware) sleep_prepare() has no handler, so it returns -EBUSY for every deep sleep and the system suspend fails. With the J414s defaulting to deep sleep (apple,sleep-tested), and the installer giving a J414s the 13.5 stub, a J414s installed today cannot suspend at all. Give the legacy GpuManager the steps the 27.2 backend takes: - sleep_prepare() lets submitted work retire (up to one second) and refuses the sleep with -EBUSY if any is still running. It then registers a stop with the sleep driver instead of idling the firmware, which keeps running until the commit, after every refusal. - suspend_noirq refuses the sleep if work started after the prepare, keeps the GPU power domain on for the commit, and from then on nothing is sent to the firmware until sleep_complete(). - At the commit the stop idles the firmware by polling and clears the ASC run bit. - sleep_complete() restarts a firmware that was stopped: a warm RTKit restart, the coprocessor started again through ASC CPU_CONTROL, a boot, then a kick. A sleep refused before the commit leaves it running, so nothing has to be woken. - A dry run never reaches the commit, so the firmware keeps running; the stop is registered all the same, since the sleep driver's checks look for it. No other backend's behaviour changes. The ASC control register is kept mapped for the stop and the restart, so probe starts the coprocessor through the same mapping, and Resources::start_cpu() goes. Signed-off-by: Justin Pfister <git@jjrpf.com>
|
@DjDeveloperr understood that 27.2 is the target. The catch is that a J414s installed today still gets 13.5: aurora-installer offers 13.5 to every model and its 27.2 list has no j414s, and there's no in-place stub upgrade yet (aurora-installer#238 / #240). With #4228 making deep the J414s default, those installs fail every suspend until they reinstall. If you'd rather not carry legacy GPU sleep at all, the smaller fix is for the legacy backend to register a deep veto (#4245) so those Macs go to s2idle instead. I can switch this PR to that. Which do you prefer? |
There was a problem hiding this comment.
Verdict: FINISH, then merge at 19e136d
Failure: drivers/gpu/drm/asahi/driver.rs:296 unconditionally calls the external symbol apple_sleep_dry_run from the installed PM callback. With DRM_ASAHI=y and APPLE_SOC_SLEEP=n, Kconfig still permits the GPU driver, but the Makefile omits the only external definition. The disabled configuration's C inline stub does not emit a symbol for Rust. An isolated link of the exact Rust callback fails with undefined symbol: apple_sleep_dry_run. The base callback links without the provider, and the new callback links when the provider is present. Keep the no-SoC-sleep configuration free of that external reference.
Checked: Reviewed the three-file diff and traced PM callback registration, the ASC mapping lifetime and the commit-time stop and warm restart. The isolated test exercises the actual base and head callback bodies. The author reports eight passing J414s cycles with Apple SoC sleep enabled. The substantive hosted fork workflows were skipped.
19e136d to
d878965
Compare
|
@lucasvllima thanks for testing on J493 and for tracking that down. Folded in: the This also takes care of the review bot's point: the extern it flagged was the only new reference outside Retested at |
There was a problem hiding this comment.
Verdict: MERGE at d878965
Checked: The exact revised Rust sleep callback links and runs without the Apple SoC sleep provider. The removed helper has no remaining reference in the three changed files. The other Apple SoC sleep calls remain configuration-gated. The legacy dry run registers the stop for validation, and the firmware stop still runs through the commit hook. The G18 constructor initializes both legacy-only fields to None.
|
@JJRPF This branch now conflicts with
Could you forward-merge |
Resolve drivers/gpu/drm/asahi/driver.rs: keep the legacy backend's deep-sleep prepare, and give the remaining refusal main's warning. Signed-off-by: Justin Pfister <git@jjrpf.com>
|
Merged current |
|
Holding this one, please don't merge yet. I found a problem with my own testing. The deep sleeps above ran with a leftover appledrm module from an earlier bisect still in As far as I can tell, The GPU, Wi-Fi, Bluetooth and audio results above still hold with main's appledrm. I'm working on a 13.5 internal DCP restart as a separate PR and will link it here. This should land together with it or after it. Moving this to draft until then. |
|
The display side is up as #4411: it warm-restarts the internal 13.5 DCP after a deep sleep (and after one refused before the commit). With both on the same J414s (13.5 stub), the panel comes back with the desktop after every deep sleep I tried (7, plus one refused), and the GPU restarts warm each time. The GPU, Wi-Fi, Bluetooth and audio results above still hold with main's appledrm. Taking this out of draft: please merge it together with #4411, or after it, not before. |
|
@DjDeveloperr a question on the 13.5 side. You mentioned 13.5 is being phased out. With #3998, #3999 and aura#649 in, an M2 Pro on the 27.2 stub should get deep sleep through the 27.2 GPU backend and the 27.x DCP path, without this PR or #4411. Two things I'd like to know:
|
What: A J414s installed today gets the macOS 13.5 stub: aurora-installer offers every model 13.5 and has no j414s in its 27.2 list. With that stub the GPU runs the legacy backend, whose
sleep_prepare()refuses every deep sleep (-EBUSY). Since #4228 makes deep the J414s default, every suspend on a stock J414s install fails and the Mac stays awake. Neither #4245's veto (only Thunderbolt registers one) nor the PCIe-C fallback in30eef1aaf6a8catches a refusal from a device's prepare. This gives the legacy backend the steps the 27.2 backend already takes: let running work retire, have the sleep driver stop the firmware at its commit, and warm-restart it after the wake.Tested: J414s M2 Pro, OS firmware 13.5 / system firmware 27.2, at
d87896540c36on aurora/mainefef6707019e, stock command line (noapple_sleep.*): 8/8 deep sleeps on the full desktop (boot object resumes 0 -> 8), 3 of them with two GPU clients drawing (both still running after each wake). One sleep refused before the commit (pm_test=devices) left the firmware running, with no GPU error. Afterwards: 10 CPUs, Wi-Fi, Bluetooth and audio back;suspend_statssuccess 9, fail 0. aurora/main without this commit on the same Mac refused its deep sleep at the GPU (genpd_prepare returns -16); the code refuses unconditionally on this backend. The previous revision (19e136dff81eon828abb4aa624) also slept 4 x ~1 h back to back on battery (boot object resumes 8 -> 12, 0 GPU errors).Risk: two-way door · every Mac whose GPU runs the legacy backend (G13/G14 on firmware older than 27.2) once it reaches a deep sleep; today that is the J414s on the 13.5 stub. No change to s2idle or to the 27.2, M3, G15, G16, G17 or M5 backends.
Not yet: J416s/J474s and M2 Max; M1-family legacy (T8103/T600x) once their deep sleep is enabled; a refusal after the commit (the restart path is shared with a real wake, but no test reaches it);
pm_test=platform, which hung this Mac with the earlier version of this change after the GPU had already failed.Details
gpu.rs,sleep_prepare(): needs the sleep driver's commit to stop coprocessors (apple_sleep_commit_stops_coprocs()), else-EBUSYas before. Waits up to 1 s for the firmware's pending-submission count to reach 0, else-EBUSY. Then registers a commit-time stop (apple_sleep_coproc_register_first()). The firmware keeps running until the commit, after every refusal, so a refused sleep has nothing to undo.apple_rtkit_sleep_idle_polled(), the mailbox's receive off, ASCCPU_CONTROLrun bit cleared, as ing14_v27_2_commit_stop.suspend_noirq: refuses (-EBUSY) if work started after the prepare, holds the GPU power domain for the commit (asahi_sleep_pd_suspend_noirq_hold), and from then on nothing is sent to the firmware untilsleep_complete().sleep_complete(): unregisters the stop. A firmware that was stopped gets a warm RTKit restart, its coprocessor started again, a boot and a kick; a failed restart marks the GPU crashed. A sleep refused before the commit leaves it alone.driver.rs: the legacy branch ofsleep_preparepasses the ASC control register; a dry run registers the stop as a real sleep does, since the sleep driver's checks look for it; the firmware stops only at the commit, which a dry run never reaches. The G17 and other backends' branches are unchanged. Probe keeps the ASC mapping (regs::AscControl) and starts the coprocessor through it;Resources::start_cpu()is gone.None => EBUSYarm ofdriver.rs, so whichever lands second needs a small rebase. With this in, its GPU rule is no longer needed for the GPU's sake; its DCP below 14 rule is separate.Evidence
a0e5cf151159, one deep attempt):PM: suspend entry (deep),aurora 406400000.gpu: PM: device_prepare(): genpd_prepare returns -16,PM: Some devices failed to suspend.d87896540c36), per sleep:s2r: GPU firmware stops at the sleep commit,apple-sleep 28e080000.sleep-controller: back from sleep, boot object resumes N -> N+1,s2r: GPU firmware restarted warm (real true, idle ~2.7 ms, kick Ok(())). Walls 38/47/53/47 s idle (30/45/45/45 s alarms), 38/32/32 s under load, 32 s after the refusal (rtcwake -d rtc1 -m mem; on main rtc0 is macsmc-rtc, which has no wakeup).pm_test=devices):s2r: sleep refused before the commit; GPU firmware kept running.RTKit: IOP power acknowledgment failed: -62) and lost the GPU. This version doesn't idle before the commit.PS prores: resync after sleep failed: -5per wake; Bluetoothhci0: Opcode 0x0c24/0x0c01/0x0c1a failed: -110after alternate wakes and0x0c24 failed: -112at the next suspend entry (the-112also appears without this commit).