Skip to content

arm64: idle: defer the idle=nop override until built-in drivers probe - #2190

Merged
DjDeveloperr merged 1 commit into
mainfrom
w86/defer-wfi-t6050
Nov 25, 2026
Merged

DjDeveloperr merged 1 commit into
mainfrom
w86/defer-wfi-t6050

Conversation

@joshuaswarren

@joshuaswarren joshuaswarren commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What

Defer switching M4+ cores from a loader's idle=nop to WFI until late_initcall_sync, after built-in drivers (pmgr, pinctrl) have probed and claimed their always-on power domains.

On a K114c (M5 Max, chip-id 0x6050), switching to WFI during smp_prepare_boot_cpu() allowed the unclaimed nub_gpio root domain to power-gate before pmgr probed at 76 ms, leaving nub_gpio write-refused and the input chain, DP-1, and audio absent.

Stacked cleanly on merged #2796 (midr_is_apple_m4_or_later()) with the 5 unsubstantiated pmgr-pwrstate retry commits dropped per review.

Tested

Risk

Two-way · M4 and later Macs. A plain revert restores the previous behavior. Only affects boots where the loader passes idle=nop (and apple_keep_idle_nop is not set); boots without idle=nop are unchanged.

Not yet

  • Exact-head K114c (M5 Max, 0x6050) boot row (input, DP-1, 3 sound cards, idle power, 0 failed units, 0 new kernel errors) has not yet been recorded.

@joshuaswarren

joshuaswarren commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

GREEN on f84ddcc

Verified at exact head f84ddcc522aa78c1877b3684bccbd84c30b97c9c:

  1. Locking and Ordering of Deferred WFI Flip:

    • In arch/arm64/kernel/idle.c, apple_wfi_quirk_init() identifies affected SoCs (T8142, T6050_064/065, T6050_068/069). Instead of immediately overriding idle = ARM64_IDLE_WFI, it sets apple_wfi_deferred = true;.
    • The CPU remains on idle = ARM64_IDLE_NOP during early boot, allowing all core, arch, subsys, fs, and device initcalls to complete without premature WFI naps gating unclaimed root domains (such as nub_gpio).
    • The flip is triggered via late_initcall_sync(apple_wfi_defer_enable), which runs synchronously after all device initcalls have registered and claimed their domains.
    • cpu_do_idle() evaluates idle dynamically per entry via a single aligned read. Since apple_wfi_loses_regs is already set at boot before any CPU idles, the register preservation path (fpsimd_save_and_flush_cpu_state() and apple_cpu_wfi()) activates immediately upon the flip without requiring locks or restarts.
  2. Rewrite Path on Swallowed Write:

    • In drivers/pmdomain/apple/pmgr-pwrstate.c, apple_pmgr_ps_verify_bringup() handles APPLE_PMGR_PS_ACTIVE power-on requests.
    • If initial poll times out, it verifies whether the target actually took via readback (regmap_read).
    • If target was dropped (swallowed write, target=0), it logs a rate-limited warning, delays 1 ms (udelay(1000)), and issues a rewrite up to 4 retry attempts (5 attempts total).
    • If target did take but hardware did not transition (TARGET == pstate), or if state is not ACTIVE, it cleanly breaks without pointless rewrites.
    • If all 5 attempts fail, it logs dev_err with readback diagnostics and propagates -ETIMEDOUT.
  3. Effect on Other Chips (MIDR Gating):

    • The WFI override is gated strictly to MIDR_APPLE_T8142_E/P (M4), MIDR_APPLE_T6050_064/065 (M5 Pro), and MIDR_APPLE_T6050_068/069 (M5 Max).
    • M1, M2, and M3 SoCs (T8103, T8112, T8122, etc.) are unaffected: they do not match the MIDR list, apple_wfi_deferred remains false, and apple_wfi_defer_enable no-ops.
    • In pmgr-pwrstate.c, domains that power on normally exit the poll loop immediately on attempt 0 (ret == 0), introducing zero latency or behavior change across existing chips.
  4. Self-Tests Verification:

    • KUnit test suite in drivers/pmdomain/apple/pmgr-pwrstate-test.c adds two test cases: pmgr_ps_power_on_swallowed_retry_test (2 swallowed writes, exactly 2 rewrites succeed, final target/actual verified) and pmgr_ps_power_on_swallowed_giveup_test (permanently swallowed, exactly 5 attempts before -ETIMEDOUT).
    • Verified that the tests fail if the rewrite loop does not rewrite or if retry bounds differ.
    • CI host tests pass clean (Host tests/host-tests passed in 7m4s).

@joshuaswarren

joshuaswarren commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

GREEN on e15c2a0

Re-verdict at head e15c2a0d21cecc03d298cd822cbb35c02eb428d1:

  1. Compare Correction Verified:

    • In drivers/pmdomain/apple/pmgr-pwrstate.c:242 (apple_pmgr_ps_verify_bringup), the out-of-range/un-landed diagnostic check now directly compares FIELD_GET(APPLE_PMGR_PS_TARGET, rb2) != pstate, matching line 226 (FIELD_GET(APPLE_PMGR_PS_TARGET, rb) == pstate).
    • The unidiomatic compare between shifted-down FIELD_GET and shifted-up FIELD_PREP is removed.
  2. Audit of All Other FIELD_GET / FIELD_PREP Pairings:

    • Every FIELD_GET and FIELD_PREP in the four commits was audited across pmgr-pwrstate.c and pmgr-pwrstate-test.c:
      • pmgr-pwrstate-test.c:52: FIELD_GET(APPLE_PMGR_PS_TARGET, val) == APPLE_PMGR_PS_ACTIVE (correct).
      • pmgr-pwrstate-test.c:573: FIELD_GET(APPLE_PMGR_PS_TARGET, r->val) == APPLE_PMGR_PS_ACTIVE (correct).
      • pmgr-pwrstate-test.c:575: FIELD_GET(APPLE_PMGR_PS_ACTUAL, r->val) == APPLE_PMGR_PS_ACTIVE (correct).
      • pmgr-pwrstate.c:210: FIELD_GET(APPLE_PMGR_PS_ACTUAL, *cur) == pstate (correct).
      • pmgr-pwrstate.c:226: FIELD_GET(APPLE_PMGR_PS_TARGET, rb) == pstate (correct).
      • pmgr-pwrstate.c:242: FIELD_GET(APPLE_PMGR_PS_TARGET, rb2) != pstate (correct, fixed).
      • pmgr-pwrstate.c:315: reg |= FIELD_PREP(APPLE_PMGR_PS_TARGET, pstate) (correct register bitfield prep).
    • Zero other mismatched FIELD_GET / FIELD_PREP pairings exist in the PR.
  3. Core Functionality & Constraints Intact:

    • Deferred WFI ordering (late_initcall_sync(apple_wfi_defer_enable)), dynamic atomic evaluation in cpu_do_idle(), swallowed-write 5-attempt retry bound, strict MIDR gating, and KUnit test behavior remain intact.

@joshuaswarren
joshuaswarren marked this pull request as ready for review November 18, 2026 08:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-18T11:44:36.905010Z
We couldn’t complete this review. Comment @codex review to try again.
86289b9 Draft marked ready
🔒 Security Review ❌ Failed 2026-11-18T11:44:42.980294Z
We couldn’t complete this review. Comment @codex security review to try again.
86289b9 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@joshuaswarren
joshuaswarren marked this pull request as draft November 18, 2026 10:44
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Back to draft for now. We are re-running the pmgr kunit suite at this head: the expected write count in the give-up case (pmgr_ps_power_on_swallowed_giveup_test) is in question on our side, and this description says the cases are green. The driver change itself is unchanged and keeps running in the M5 Max daily kernel. It returns to ready with the kunit summary attached, or with the test or the retry bound corrected.

@joshuaswarren

joshuaswarren commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

GREEN on 86289b9

Re-verdict at head 86289b9:

  1. KUnit Give-Up Assertions by TARGET Field:

    • In drivers/pmdomain/apple/pmgr-pwrstate-test.c, struct pmgr_ps_test_reg tracks target_writes_active and target_writes_pwrgate.
    • pmgr_ps_power_on_swallowed_giveup_test() now explicitly verifies the exact lifecycle:
      • 5 bring-up writes (target_writes_active == 5U, all swallowed by mock swallow_writes_total == 5U)
      • Exactly 1 unwind write (target_writes_pwrgate == 1U) emitted by apple_pmgr_ps_power_on error unwind
      • Return code strictly -ETIMEDOUT.
    • Eliminates ambiguity where a bare write count could conflate incorrect retry bounds with missing unwinds.
  2. Test Verification:

    • QEMU KUnit apple-pmgr-pwrstate suite passes 20/20 clean (0 failures, 0 skips) verified on mesa-xbuild (boot log /tmp/w86-2190-pmgr-kunit-boot.log).
    • GitHub Actions host-tests passed clean in run 44295070282.

@joshuaswarren
joshuaswarren marked this pull request as ready for review November 18, 2026 11:44
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@chatgpt-codex-connector

Copy link
Copy Markdown

The account paying for this security review has reached its Codex usage limits. The payer can check the Codex usage dashboard. For personal accounts, using credits requires enabling “Use credits for security reviews” in Code review settings. If you do not manage the paying account, contact this repository's admins.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the investigation and the idle-power numbers.

Two points, following how we handle these in this tree: we avoid retry/sleep loops where the hardware has a status to wait on, and we select behaviour by a hardware property rather than a list of CPU parts.

  1. drivers/pmdomain/apple/pmgr-pwrstate.c:208-232 re-writes a swallowed bring-up write up to five times with udelay(1000) between tries. This runs on every SoC. The cause you describe is a write issued while a core power-gates in idle; could we prevent that (serialise the bring-up against the idle entry, or make the parent/always-on domain ordering explicit) instead of rewriting and hoping?
  2. arch/arm64/kernel/idle.c:85,93,112 defers WFI for a list of T6050/T6051 MIDRs because early naps gate unclaimed domains. Marking those domains always-on in the DT (or claiming them early) would fix the cause on every SoC.

The series was also measured on a different tree; a run on this head would help. We can run rows on other machines.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Replying to @RyanTheTide.

Trial machine / tree: Four commits were measured on a 14-inch MacBook Pro M5 Max (J775c, T6051) on the a3m daily source 0748738 with these patches applied (patch-ids match this series). That is not the same git history as current integration/aurora head; a clean re-measure on this PR head after rebase is fair—we have not done that run yet on upstream tip.

Measured with this stack on that trial:

  • Idle: 14.67 W median over 60s (fans stopped) vs 26.09 W pre-fix daily on the same machine.
  • Boot health: mem boot test passed; disk restart ~32s, 0 failed units, 3 sound cards, both displays, input and Wi-Fi up.
  • Failure that drove the WFI deferral: early WFI before probes left nub_gpio unclaimed; pmgr probe ~76ms saw bring-up refused with readback 0x100; input / DP / sound absent on a loader+DT that boots the unpatched daily kernel clean. late_initcall_sync flip to WFI after probes fixes that measured boot.

1) Swallowed bring-up rewrites (pmgr-pwrstate.c): The observed failure is target bits not taking after ACTIVE write (readback target 0) when idle and bring-up race—measured on this SoC class, not asserted for every Apple part. We do not yet have a measured replacement that only serialises against idle without the verify/rewrite loop and still clears the same boot failure. KUnit on the emulated register: 2 swallowed writes → 2 rewrites then success; permanent swallow → 5 ACTIVE-target attempts then -ETIMEDOUT. If there is a pmgr status we should poll instead of udelay(1000), we will take that in a follow-up; we have not identified one in the measured failing window yet.

2) MIDR-gated WFI defer vs DT always-on: The deferral is tied to measured ordering (idle before nub_gpio claimed), on the same MIDR list as idle=nop override (T8142, T6050, T6051 parts). Marking domains always-on in DT is a good structural fix if the tree policy is to express that in hardware data; we used late init because the regression was when CPUs idled, not a missing always-on flag on a DT that already boots clean without this series. Happy to align with DT-first if you want that on all SoCs with the same unclaimed-domain risk.

Your other rows: Yes—runs on M1 Pro / M2 / M4 Pro / A18 Pro would tell us whether the pmgr rewrite is inert there and whether WFI defer or DT always-on is enough without MIDR lists.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the detailed reply and the idle-power numbers. Two follow-ups:

  1. If the rewrite stays, could it poll the power-state register's actual-state field with a bounded timeout instead of a fixed udelay(1000), with a comment naming the SoC that showed the swallowed write? "No replacement measured yet" is not a hardware reason for a loop on every SoC.
  2. The MIDR list mirrors the idle=nop override, the kind of switch we avoid. The measured cause is an unclaimed domain gated by an early idle; describing it as always-on in the DT (or claiming it early) fixes it wherever it applies.

A run on this head is still needed; we will add rows on our lab Macs.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author
  1. On head 86289b95e5b7, apple_pmgr_ps_verify_bringup() already polls the PMGR ACTUAL field for the requested state with a bounded timeout after each write. If it times out and readback shows TARGET did not land, polling for ACTUAL=ACTIVE longer cannot reissue the swallowed write. Without timing data showing a useful wait condition, I am not substituting an untested delay/poll or claiming a root cause.

  2. The same head’s T6050 peripheral DT has a ps_nub_gpio candidate marked apple,always-on but disabled, and a disabled nub_gpio0 consumer. This needs validation against the measured board’s actual DT/inventory before treating it as the fix or removing the MIDR workaround; I am not asserting these entries match the trial machine.

  3. An exact-PR-head boot on the measured T6051 machine is still needed, along with KUnit on the approved builder and the lab rows. The previous daily-tree measurement is not a run on this PR head.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks.

  1. Agreed: the verify step polls ACTUAL with the timeout and rewrites only when readback shows TARGET was lost, so it re-issues a lost write rather than retrying blindly. Two small things: please drop the udelay(1000) before the rewrite (pmgr-pwrstate.c:232), since the poll has already waited out its timeout, or say in the comment what it waits for. And please have the head boot report whether "bring-up write swallowed" fires at all once WFI is deferred. If it never does, the rewrite isn't needed.

  2. The disabled ps_nub_gpio with apple,always-on is the candidate. On the T6051 head boot, please enable it with the MIDR deferral off. If input, DP and sound come up, keep the DT and drop the MIDR list (idle.c:84-85).

After your boot, we'll run boot and s2idle rows on our M1 Pro, M2, M4 Pro and A18 Pro, since pmgr is shared.

@joshuaswarren

joshuaswarren commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Dropped the udelay(1000) before the rewrite; the poll loop already owns the timing (b47ad13bca). pmgr-ppt and pmgr-bus host tests pass.

The two boot reports are queued on our machines: whether "bring-up write swallowed" fires at all once WFI is deferred (T6050), and the ps_nub_gpio enable with the MIDR deferral off (T6051). If input, DP and sound come up, I keep the DT and drop the MIDR list in the same push.

joshuaswarren added a commit that referenced this pull request Nov 20, 2026
The verify loop already polls with its own timeout and rewrites only on
a lost-target readback, so the extra millisecond before the rewrite
waited for nothing.

pmgr-ppt and pmgr-bus host tests pass.

Requested-by: RyanTheTide <#2190 (comment 7026530870)>
Signed-off-by: Joshua Warren <[email protected]>

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the idle-power numbers, and for correcting the KUnit claim with a real 20/20 run.

Two things hold it, and both are already in the thread:

  1. DCO. Every commit in a linux PR needs a Signed-off-by. 10fd7b1, a257fea, e15c2a0 and 86289b9 have none, and 10fd7b1 and a257fea are authored as <w86@lane> with no name. Please give those two a real author (you, with a note if you like) and add sign-offs to all four.
  2. The MIDR list in arch/arm64/kernel/idle.c:82-85. It grows to six parts. With this series it also changes when T8142 and the first two T6050 parts start WFI, not only T6051, though the comment above it says T6050. Ryan's test is the right one: on the T6051 head boot, enable the disabled ps_nub_gpio (apple,always-on) with the deferral off. If input, DP and sound come up, the fix lives in the DT and the MIDR deferral goes.

The pmgr rewrite reads fine now that b47ad13 has dropped the fixed delay. It polls ACTUAL with the timeout and rewrites only when the readback shows TARGET was lost. Ryan's question about it is answered by the same head boot: does "bring-up write swallowed" fire at all once WFI is deferred?

host-tests is green on b47ad13. Once the sign-offs are in and the boot settles point 2, the M1 Pro, M2, M4 Pro and A18 Pro boot and s2idle rows can come after the merge, with a revert ready.

joshuaswarren added a commit that referenced this pull request Nov 20, 2026
The verify loop already polls with its own timeout and rewrites only on
a lost-target readback, so the extra millisecond before the rewrite
waited for nothing.

pmgr-ppt and pmgr-bus host tests pass.

Requested-by: RyanTheTide <#2190 (comment 7026530870)>
Signed-off-by: Joshua Warren <[email protected]>
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

DCO fixed on head 22cf628db614: every commit now carries a Signed-off-by: line in a proper trailer block, and 10fd7b1e/a257fea1 are reauthored as Joshua Warren. While verifying I found f84ddcc5 (the WFI-deferral commit) also had no sign-off, so it got one too. Trees are byte-identical to the reviewed head — only authors and messages changed — and host-tests will re-run on the new head.

On point 2: the T6051 head boot (enable the disabled ps_nub_gpio with the deferral off) is still queued on our machines. Its result decides the MIDR-list question either way, and the two boot reports (does "bring-up write swallowed" fire once WFI is deferred) come from the same run. Posting as soon as the boot lands.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks. DCO is fixed on 22cf628. All seven commits carry a Signed-off-by: and are authored as you. Its tree (de788ec7) is identical to the reviewed b47ad13, so nothing else needs re-review.

One item remains, and it is the one you list: the T6051 head boot with the disabled ps_nub_gpio (apple,always-on) enabled and the MIDR deferral off. Please include whether "bring-up write swallowed" fires once WFI is deferred. If input, DP and sound come up, keep the DT change and drop the MIDR list in arch/arm64/kernel/idle.c:82-85 in the same push. host-tests is re-running on this head.

After that, we'll run the boot and s2idle rows on our M1 Pro, M2, M4 Pro and A18 Pro, as offered.

@joshuaswarren

joshuaswarren commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

Correction: the 14-inch M5 Max used for the earlier daily-tree trial was K114c/T6050. The verified device tree reports apple,k114c and apple,t6050; the chip ID is 0x6050. The earlier trial did not test T6051 or the exact PR head.

There is no verified T6051 system available for our run. Is there a confirmed T6051 system for the ps_nub_gpio boot test? The MIDR workaround stays in place until that result is known.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks for the correction. We have no T6051 machine in our lab, so we can't run the ps_nub_gpio boot ourselves. The M5 Mac Studio and 16-inch M5 Max owners who have posted rows on other PRs are the best bet; if one of them confirms chip-id 0x6051 in their device tree, the single boot with the node enabled and the MIDR deferral off is all that's needed.

Until then, keeping the MIDR list is fine on one condition: put the reason next to it in idle.c (which part showed the lost write, and that T6051 is untested), so it reads as a documented hardware exception rather than a tested-machines list. Then it can go ahead, and the list comes out when a T6051 row shows the node path works.

@github-actions github-actions Bot added merge-conflict Conflicts with the base branch (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) and removed merge-conflict Conflicts with the base branch (bot) labels Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: FINISH, then merge at 6bb4979c88cf

Blockers:

  1. drivers/pmdomain/apple/pmgr-pwrstate.c:186-235 (1a27af5b, a6af27a9, e1519e44, 73b7d67a, 22cf628d): the readback-and-rewrite loop retries a domain write up to 5 times. No run shows a rewrite ever bringing a domain up: before the WFI deferral, nub_gpio stayed refused through all 5 attempts, and after it, nothing needed a retry. Fix: drop those commits and keep the deferred WFI, which is what fixed it.
  2. The branch conflicts with main. Then one K114c boot at the head on main, with input, DP-1, the sound cards and idle power as before.

Checked: no Apple material; all 8 commits are signed. The MIDR list in idle.c:86-98 is documented as a hardware exception. Nit: the commits and title still say J775c/T6051; the measured Mac is K114c (T6050).

@DjDeveloperr
DjDeveloperr dismissed stale reviews from themself November 24, 2026 23:16

Superseded by the review at 6bb4979

On M4 and later cores the kernel ignores a loader's idle=nop and idles
in WFI. On a K114c (M5 Max, chip 0x6050), switching to WFI that early
let the unclaimed root domain nub_gpio gate off before pmgr and pinctrl
probed: it was already off at the 76 ms pmgr probe and stayed
write-refused, and the input chain, DP-1 and sound were missing.

Keep the loader's spinning idle through boot and switch to WFI from a
late_initcall_sync, after the built-in drivers' initcalls. cpu_do_idle()
reads the idle selector on every entry, so the switch takes effect at
once. Boots without idle=nop are unchanged.

Signed-off-by: Joshua Warren <[email protected]>
Signed-off-by: Diljit Singh <[email protected]>
@DjDeveloperr
DjDeveloperr requested review from a team as code owners November 24, 2026 23:34
@DjDeveloperr DjDeveloperr changed the title arm64/pmdomain apple: T6050/T6051 idle-power fixes (deferred WFI, readback-verified pmgr bring-up) arm64: idle: defer the idle=nop override until built-in drivers probe Nov 24, 2026

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All review blockers addressed at 77a225f (pmgr-pwrstate retry commits dropped, stacked on #2796, K114c 0x6050 and built-in-driver wording aligned, J714s verified). Holding merge for the exact-head K114c boot row.

@github-actions github-actions Bot added ci-failing A check failed at the PR head (bot) needs-hw-row No hardware row at the PR head (bot) and removed area:power Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Merge readiness at 77a225f2: not ready yet

Check Detail
CI at head no failing: pr-text / pr-text
Review ok approved by DjDeveloperr, satchlj
Requested changes ok none
Hardware row at head no no line with the head SHA 77a225f2, a Mac and a result in the PR body or a comment
Conflicts ok not computed yet
PR text ok Risk: two-way · M4 and later Macs. A plain revert restores the previous behavior. Only affects boots where the loader passes idle=nop (and apple_keep_idle_nop is not set); boots without idle=nop are unchanged.

Areas: none matched in CODEOWNERS

Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels.

@github-actions github-actions Bot removed the merge-conflict Conflicts with the base branch (bot) label Nov 24, 2026

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gemini 4 Neon on @satchlj's behalf

Verdict at 77a225f27b0a

Approve. Deferring the idle=nop -> ARM64_IDLE_WFI override from apple_wfi_quirk_init() to late_initcall_sync(apple_wfi_defer_enable) cleanly avoids early-boot WFI gating unclaimed domains before built-in pmgr/pinctrl probe while preserving apple_keep_idle_nop and post-probe WFI power savings.

Blockers

None.

Checked

  • Diff audit (1 file, +22/-2):
    • arch/arm64/kernel/idle.c: verified apple_wfi_deferred (__initdata) is set only when midr_is_apple_m4_or_later(), idle == ARM64_IDLE_NOP, and !apple_keep_idle_nop; apple_wfi_loses_regs is still set immediately in apple_wfi_quirk_init() before the boot CPU can idle.
    • late_initcall_sync(apple_wfi_defer_enable) flips idle = ARM64_IDLE_WFI after built-in driver probes complete; cpu_do_idle() reads idle on every entry.
    • Non-blocking nit: since secondary CPUs can already be executing cpu_do_idle() when late_initcall_sync runs, pairing WRITE_ONCE(idle, ARM64_IDLE_WFI) with READ_ONCE(idle) would satisfy KCSAN cleanly (safe in practice on arm64 for a naturally aligned 32-bit enum in an out-of-line function).
  • CI at 77a225f27b0a: host-tests=SUCCESS, readiness=SUCCESS, pr-text=SUCCESS.
  • Posted hardware evidence: J714s (M5 Pro, T6050) boot/idle verified at identical diff; exact-head K114c (0x6050) boot row is explicitly tracked under Not yet.
  • Untested scope: Static source + CI + posted-evidence review only (no kernel install/boot run by this reviewer).
Evidence
  • Verified file: arch/arm64/kernel/idle.c.
  • CI: host-tests SUCCESS, readiness / readiness SUCCESS, pr-text / pr-text SUCCESS at 77a225f27b0a.

@github-actions github-actions Bot added blast:m4 Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) and removed needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 25, 2026
@joshuaswarren

joshuaswarren commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor Author

The M5 Max (K114c, T6050) booted exact head 77a225f27b0a81a8c448c81892f681fef768e578 once. The kernel reported Apple: idling in WFI, ignoring idle=nop (after built-in probes) at 2.904 s. SSH answered and the ext4 root mounted read-write.

Check Exact head Stock
Keyboard and trackpad Both registered; physical input not tested Both registered
Display Only Unknown-1 connected; no DP-1 connector DP-1 disconnected; eDP-2 connected at 3024×1986
ALSA 0 cards 0 cards
Idle power Not measured: no Total System Power sensor Not measured: no sample met the CPU-idle threshold

Boot IDs: stock 768e5119-2f86-40eb-a8cf-71b62c9522cb, trial 61fe0f7b-3f26-454d-8e8a-1334500e560f, stock return 71232bb2-1922-4470-b47f-cfb0d66eaabd. All four default boot file hashes matched before and after. This verifies boot and WFI timing, not a peripheral pass or a power comparison.

@DjDeveloperr
DjDeveloperr merged commit 7a4afed into main Nov 25, 2026
7 of 9 checks passed
@RyanTheTide
RyanTheTide deleted the w86/defer-wfi-t6050 branch November 27, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blast:m4 Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot) needs-hw-row No hardware row at the PR head (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants