Use s2idle on T2 Macs with a discrete GPU - #9105
Open
T1mmsquared wants to merge 1 commit into
Open
Conversation
Deep suspend cannot complete where a discrete GPU is present: amdgpu fails its
noirq suspend ("GPU mode1 reset failed", pci_pm_suspend_noirq returns -22), the
whole transition unwinds, and systemd retries with s2idle anyway. Every failed
pass also rewrites four Apple EFI secure-boot variables.
Integrated-only T2 Macs still get deep, so the suspend fix from omacom#6562 is kept
where it works. A migration moves existing discrete-GPU installs off deep and
rebuilds the boot image.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
install/hardware/apple/fix-t2.shdetects T2 Macs by PCI ID (106b:180[12]) and gives every one of them the same kernel command line, includingmem_sleep_default=deep. That works on integrated-only models, but a T2 Mac with a discrete GPU can never complete a deep suspend.On a MacBookPro16,1 (Radeon Pro 5500M), every suspend attempt fails and falls back:
Counted over the journal on this machine: 3 deep attempts, 3
noirq suspend of devices failed, 3GPU mode1 reset failed— a 100% failure rate. The machine still sleeps, because systemd retries with s2idle, so the symptom is easy to miss.Two costs beyond the wasted transition:
AppleSecureBootFailureReason,AppleSecureBootKernelFailureReason,AppleSecureBootWindowsFailureReason,AppleFailedBootVolumeUUID— so every suspend/resume writes NVRAM on hardware where that wear is not free.Approach
mem_sleep_default=deepwas added deliberately in #6562, so this does not remove it. It selects the sleep state from the GPU configuration using the existingomarchy-hw-hybrid-gpuhelper:Integrated-only T2 Macs produce a byte-identical config file to today, so #6562's fix is preserved exactly where it works. Only discrete-GPU models change, and they change to the state the kernel was already falling back to on its own.
Included
install/hardware/apple/fix-t2.sh— pick the sleep state from the GPU configurationmigrations/1788072498.sh— move existing discrete-GPU installs offdeepand rebuild the boot image, following the repair-marker pattern frommigrations/1785944594.shso a pre-reboot rerun stays idempotenttest/shell.d/t2-hardware-test.sh— a stubbedomarchy-hw-hybrid-gpu, plus coverage for the discrete-GPU repair, its idempotency, the integrated-only path that must keepdeep, and non-T2 hardwareTesting
test/shell.d/t2-hardware-test.sh— 10/10 pass (6 pre-existing, 4 new)./test/all— 4 failures, all pre-existing and environmental on this machine: three need a siblingomarchy-pkgscheckout that isn't present, one is a network-dependent theme URL check. None touch T2, suspend, or migrations.linux-t27.1.8. After the change/sys/power/mem_sleepreads[s2idle] deepand the failing deep pass is gone.Scope of the evidence
I can only confirm this directly on a MacBookPro16,1. The other T2 models with discrete GPUs — MacBookPro15,1 / 15,3 / 16,4, iMacPro1,1, MacPro7,1 — should be affected by the same amdgpu failure, but I have not tested them. Happy to adjust the detection if a T2 owner reports otherwise.