Repository navigation
mfd: macsmc: give atomic writes time for the SMC to answer - #918
Merged
RyanTheTide merged 1 commit intoNov 5, 2026
Merged
RyanTheTide merged 1 commit into
RyanTheTide merged 1 commit into
Conversation
Restart and power-off are issued as atomic SMC writes (MBSE = 'phra' / 'offw'). Since c243a5f ("mfd: macsmc: bound the atomic write poll"), apple_smc_write_atomic() waits SMC_TIMEOUT_MS (500 ms) for the reply and, with a command still pending, polls RTKit once and returns -EBUSY. On the M4 Mac mini (J773g, T8132) that is sometimes too short for the SMC: macsmc_restart() logs "Failed to issue MBSE = phra", the restart chain falls through to apple_wdt_restart(), and iBoot takes the watchdog reset as a crash (panicmedic-telemetry is set) and boots macOS instead of the configured Linux startup volume. Keep the bound that c243a5f introduced, but make it 5 s in the atomic paths: wait that long for a pending earlier command before refusing, and that long for the reply. Log replies slower than 100 ms, and failures, so slow SMCs show up in the log. Observed on the J773g: with the 500 ms bound a reboot from a test initramfs landed in macOS (2026-11-02 23:12); with this change the same path returned to Linux through the SMC (2026-11-03 10:59). Fixes: c243a5f ("mfd: macsmc: bound the atomic write poll") Signed-off-by: Sean Dolbec <sdolbec1@gmail.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
Merge train (MTL, 06/11). Gates passed on test tree 0412501 (integration/aurora 2661d71 + this batch):
|
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.
Regression on the Mac mini M4 (J773g, T8132) since c243a5f ("mfd: macsmc: bound the atomic write poll", #368): a reboot from Linux ends in macOS.
apple_smc_write_atomic()now gives the SMC 500 ms and, with a command still pending, polls once and returns-EBUSY(03dc729). On this J773g the restart write (MBSE = 'phra'frommacsmc_restart()) sometimes does not get its reply within 500 ms.macsmc_restart()only logs the failure and returnsNOTIFY_OK, so the restart chain reachesapple_wdt_restart(); iBoot takes the watchdog reset as a crash (panicmedic-telemetryis set) and boots macOS instead of the Linux startup volume. The unbounded poll before #368 does not show the problem (GravityLinux's macsmc still has it and reboots fine on the same machine).This keeps the bound that #368 introduced, but makes it 5 s in the atomic paths: wait that long for a pending earlier command before refusing, and that long for the reply. Replies slower than 100 ms, and failures, are logged so slow SMCs show up.
Tested: J773g,
integration/aurora@ 19f71a1 + this change, booted via m1n1-gravity → U-Boot → Limine with GravityLinux's J773g DT plus the NVMenvmmuwindow. Unpatched:reboot -ffrom a test initramfs → macOS (2026-11-02 23:12). Patched: the same path returned to Linux through the SMC (2026-11-03 10:59). The "reply after N us" number the patch logs has not been captured yet (no persistent console on that run); I'll add it from the next logged run.🤖 Generated with Claude Code