Repository navigation
nvme-apple: issue T6050 sleep shutdown notification in suspend_late - #3780
tully-8888 wants to merge 1 commit into
Conversation
On T6050 (M5 Pro), apple_nvme_m5_final_stop() currently issues CC.SHN with interrupts disabled after the point of no return and polls CSTS.SHST atomically for only 1 s (APPLE_ANS_SLEEP_SHN_TIMEOUT). After heavy write workloads, ANS FTL context save can exceed 1 s (macOS waits up to 35 s), causing final_stop to time out after commit and fence ANS on wake rather than refusing sleep cleanly. Moving a 35 s wait into .suspend is unsafe when CONFIG_DPM_WATCHDOG=y (15 s panic timeout on J714s kernels), because the DPM watchdog covers .suspend/.resume. Move T6050 CC.SHN to a new apple_nvme_suspend_late() callback, which is sleepable with interrupts enabled, outside the DPM watchdog, and ordered before the SART supplier's suspend_late snapshot via the managed device link in devm_apple_sart_get(): - Export apple_sleep_ans_m5_wd2_remaining_ms() from apple-sleep so suspend_late checks the exact remaining WD2 budget armed at .begin and refuses sleep before writing CC.SHN if the wait plus margin cannot fit inside WD2. - Verify live CC/CSTS readiness and zero pending CQEs on both the NVMe and NVMMU apertures before read-modify-writing only CC.SHN on the NVMMU aperture. - Verify CSTS.SHST completion in apple_nvme_m5_last_check() and keep apple_nvme_m5_final_stop() read-only for CC/CSTS (RTKit polled idle only). - Track shn_issued so refused-sleep controller reset clears and verifies the NVMMU aperture within the rebuild owner's remaining deadline, honors rebuild_aborted/retained fences before reap or queue programming, and refuses queue setup if an issued shutdown remains unresolved. Related: aurora-silicon#3338 Signed-off-by: vlad <tulituvlad@gmail.com>
|
Partial live J714s hardware test row (
|
|
Hi, the CI runs on my open PRs are still waiting for workflow approval (action_required), so their build checks have not run yet. Could a maintainer approve the pending runs when you look at the diffs? linux: #3780 #3784 #3840 #3843 #3946 #3947 #3964 #3978 #4229 #4230 #4231 #4282 #4283 #4284 #4286 #4314 I am building one test kernel that merges all of these heads unchanged on current main, and I will post a hardware row on each PR from it. I will not open new PRs until these are merged or closed. |
What: Move T6050 (M5 Pro) ANS sleep
CC.SHNfrom the 1 s IRQ-off atomic poll inapple_nvme_m5_final_stop()into a newapple_nvme_suspend_late()callback (sleepable, IRQs on, outsideCONFIG_DPM_WATCHDOG, before SART'ssuspend_latesnapshot), with a 35 s macOS-matched bound capped against the platform WD2 deadline (apple_sleep_ans_m5_wd2_remaining_ms()), pre-SHN readiness checks on both NVMe/NVMMU apertures, and bounded dual-window reset cleanup on sleep refusal. Related to #3338 (keeping root-cause attribution provisional until a baseline post-I/Ofinal stop:log is captured).Tested: J714s MacBook Pro 14" M5 Pro (Mac17,9, T6050) at
9654de6dfbec, in the batched Boot #11 kernel7.3.0-j714s-b11+(main9ece2d8202d2plus 16 open PR heads unchanged, this one included, plus local J714s patches), 2026-12-04: boots, 0 failed units, 0 new kernel warnings against the previous boot. Storage I/O runs with 0 NVMe timeout, reset or I/O error lines. The sleep path of this PR did not run: both deep sleep attempts were refused beforesuspend_lateby the external display controller, with -16 while the TV stayed connected (V27 sleep: refused before its calls: a DPTX port still connected).Boot #11 row
Kernel: local branch
j714s-boot11-testate7ab6d7b65c2. Its last commit is a test-only patch with runtime switches that turn single PR changes off, for same-kernel A/B runs. In an A/B row the "off" arm is that switch, which emulates the old code; it is not the old tree.Non-default command line:
nvme_apple.flush_interval=0 cpuidle.governor=teo ane_t6021.irq_wait=0 ane_t6021.irq_wait_switch=1 ane_t6021.bridge_record=1 appledrm.ext_pq_as_hlg=1 kvm.halt_poll_ns_grow_start=100000 macsmc.m5_pcio_budget=2 macsmc.m5_n1_budget=3 arm64.nowfxt zswap.enabled=0 softlockup_panic=1.Earlier rows
Base
aurora-silicon/linuxmain (352cd953c779):drivers/nvme/host/apple.oanddrivers/soc/apple/sleep.o, Clang 23.1.5,W=1, 16 KiB pages, Apple SoC sleep + NVMe enabled): clean with zero new warnings vs base.scripts/checkpatch.plandgit diff --check: 0 errors, 0 warnings.rtkit_ready, WD2 remaining-budget refusal/clamping, and owner rebuild-deadline abort before reap/queue writes.7.3.0-17.v272-27-ARCH/proc/config.gz) thatCONFIG_DPM_WATCHDOG=y(TIMEOUT=15,WARNING_TIMEOUT=5), confirming a 35 s wait in.suspendwould panic.Risk: two-way door · affects T6050 firmware sleep (
PM_SUSPEND_MEMwithpm_suspend_via_firmware()) only; s2idle, hibernation, and other SoCs are untouched (apple_nvme_suspend_late()is a no-op unlessAPPLE_M5_ANS_PREPARED). Kept as Draft until hardware deep-sleep and refusal-reset (pm_test=platform) testing is completed on J714s.Not yet:
apple-build+ KUnit (nvme-apple).O_DIRECTstress sleep,pm_test=platformrefusal-after-SHN reset + subsequent disk I/O and second sleep, and confirmation of whethermmio_nvmmu(0x41dcc0000) andmmio_nvme(0x45dcc0000) aliasCC/CSTSand whether ANS storage power words stay on/auto afterCC.SHN.