Skip to content

soc: apple: sleep: T8142: start the cores and write the cluster words as XNU (on #2192) - #2193

Merged
RyanTheTide merged 2 commits into
aurora-silicon:mainfrom
m0d16l14n1:j815/t8142-sleep-xnu-wake
Nov 26, 2026
Merged

RyanTheTide merged 2 commits into
aurora-silicon:mainfrom
m0d16l14n1:j815/t8142-sleep-xnu-wake

Conversation

@m0d16l14n1

@m0d16l14n1 m0d16l14n1 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #2192 (the pen fix, the first commit here). The burst below needs it.

In a traced macOS 27.2 sleep on J813 (boot, a 40 s sleep, the wake and three more entries), XNU differs from us in three places. This PR does the same as XNU:

XNU (trace) Before Now
Wake 16.5 ms after the wake, the boot core starts all nine other cores in one 0.23 ms burst, three words each (+4 the core, +8 the E core or 0, +0xc the P core or 0) each core later, at its own bring-up, two words the burst, for the cores online at .begin; they wait in the holding pen and each bring-up only releases its core. The per-core start in sleep_cpu_on() stays for runtime hotplug
Commit clusters' words read-modify-written: 0xf → 0 after boot, 0x2f → 0x20 after every wake 0 every time the read-modify-write
Perf states the SoC/DCS perf-state page is never touched lowered before the memory stop not touched: t8142_perf_down() and its call are gone

T8142's data has no cpu_clusters, so the burst takes the cluster from the MPIDR.

Changed on this head (review): apple_sleep.cpu_burst, cluster_rmw and perf_down are removed. The defaults they had (burst Y, RMW Y, perf-down N) are now the only behaviour, which is what the J815 and both J813 rows ran. Reverting the commit is how to go back. The per-core "released from the pen" line is now pr_debug, next to integration's dynamic-debug start trace. The "N cores started in one burst" line stays. t8142_cpu_burst() moved above t8142_wake()'s comment. Rebased onto integration/aurora cc14570.

Tested on J815 (MacBook Air 15" M5), on the previous head with the defaults:

  • Two real deep sleeps (256 s and 172 s), woken by the keyboard/trackpad. Each had one "9 cores started in one burst" and nine "Booted secondary processor".
  • After each wake: all CPUs online, display, NVMe, Wi-Fi and Bluetooth back.
  • An earlier 366 s sleep ran with the RMW and no perf-state step alone.

J813: sithglan (alarm and lid wakes) and gig3m ran the defaults; their rows are in the comments.

Checks: W=1 adds no warnings in drivers/soc/apple/ at either commit; checkpatch --strict is clean on this commit.

Still owed (HW rows): J815 and J813 on this head with the default command line: 3+ alarm wakes and 1 lid wake each, "9 cores started in one burst" + 9 "Booted secondary processor" per wake, CPUs 0-9 online, suspend_stats fail 0, 0 AVC, 0 failed units, 0 new kernel errors.

Part of the J815 bring-up; board results are summarised in #135.

@sithglan

Copy link
Copy Markdown
Contributor

Tested the head (8e270f6, on integration/aurora 0abc2f3, so #2192 and #2177 are in) on my J813 with no other patches and the config of my daily kernel. Setup: macOS 27.2 (26B123) stub, the enrolled EL2 aura 8b9c92ea, apple_sleep.deep=1 nvme_apple.sleep_untested=1 appledrm.s2r_untested=1 idle=nop arm64.nowfxt maxcpus=1. The other nine CPUs are onlined from userspace after boot, and SEP is attached.

Eight real deep sleeps on one boot, woken by the PMU alarm (t8142_wake_s), Sway on the internal panel:

  • Defaults (cpu_burst=Y cluster_rmw=Y perf_down=N): 8, 20, 60 and 180 s. Each wake logged one "9 cores started in one burst", nine "started in the wake burst, released from the pen" and nine "Booted secondary processor".
  • Then the old behaviour on the same boot (cpu_burst=0 cluster_rmw=0 perf_down=1 written to /sys/module/apple_sleep/parameters): 8 and 20 s, cores started one by one.
  • Then the defaults again: 8 and 30 s.
  • All eight: suspend_stats success 0 -> 8, fail 0, boot object resumes 0 -> 8, wake source NUB.SPMI0.SW3, same boot ID, elapsed within 0.9 s of the alarm.
  • After each wake, all of these passed:
    • CPUs 0-9 online, and each one ran a task;
    • the panel enabled;
    • a GPU clear and readback;
    • Bluetooth powered, with the factory address;
    • a Wi-Fi ping to the gateway;
    • a 32 MiB direct NVMe read with the expected checksum.
  • The first ping, 6 s after the wake, sometimes lost a packet (3 of 8 wakes, in both modes); Wi-Fi was clean right after.
  • dmesg: no oops, warning or "failed to come online". Only the messages the boot already has (IRQ affinity -38, DCP syslog lines).
  • The nine cores came up in 2.8-2.9 ms with the burst and 3.3-3.4 ms one by one.

Not covered: a lid wake.

@sithglan

Copy link
Copy Markdown
Contributor

Lid wake too, on the same boot with the defaults (cpu_burst=Y cluster_rmw=Y perf_down=N) and the normal lid policy (untested_commit=1, t8142_wake_s=0). I closed the lid, waited about 10 s and opened it:

  • It was a real sleep: boot object resumes 8 -> 9, and suspend_stats success went to 9 with fail 0.
  • Wake source MTP.DOCK.CHANNELS.AP0.IRQ, with macsmc-input logging lid open ... at +11857 ms in sleep.
  • The wake started the nine cores in one burst, and the pen released each one.
  • After the wake, all of these passed:
    • CPUs 0-9;
    • the panel back on in Sway, eDP-1 active and powered at 2560x1600;
    • a GPU clear and readback;
    • Bluetooth with the factory address;
    • Wi-Fi 3/3;
    • the 32 MiB direct NVMe read.
  • No oops. dmesg has the same messages as on the alarm wakes.

@gig3m

gig3m commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Tested on my J813 (macOS 27.2 / 26B123 stub, EL2 aura 8b9c92ea) with this PR's two commits picked onto #2135's merged head 408e27268fd6. Also on top, as in my #2135 comments: #1732's Touch ID node, #2019, #2142's rear USB4 commits, the J813 palm change, a local XRGB8888 plane patch and #2195. Boot arguments: appledrm.s2r_untested=1 apple_sleep.deep=1 nvme_apple.sleep_untested=1 apple_centauri.alpha_sleep_untested=1 idle=nop arm64.nowfxt, with no maxcpus, so all ten CPUs start at boot through the closed pen (nine "Booted secondary processor").

Six real deep sleeps on one boot, Hyprland on the internal panel:

  • Four woken by the alarm, through systemctl suspend:
    • defaults (cpu_burst=Y cluster_rmw=Y perf_down=N) for 30, 60 and 120 s;
    • the old behaviour (cpu_burst=0 cluster_rmw=0 perf_down=1) for 30 s.
    • Each woke 1-2 s after its alarm with wake source: NUB.SPMI0.SW3.
  • Two woken by the lid, with the defaults and untested_commit=1: 3 min 56 s and 47 s (lid open ... at +235190 ms in sleep and +46546 ms).
  • Boot object resumes went 0 -> 6, and suspend_stats ended at success 6, fail 0.
  • Each default-mode wake (three alarm, two lid) logged one "9 cores started in one burst", nine "released from the pen" and nine "Booted secondary processor". The old-mode wake had no burst and nine one-by-one starts.
  • From the first to the ninth "Booted secondary processor", the burst took 7.7 ms and the one-by-one start 8.3 ms.
  • After each alarm wake, a script checked these 15 s after the wake, and all passed:
    • CPUs 0-9 online;
    • Wi-Fi gateway ping 3/3 (no first-ping loss);
    • Bluetooth Powered: yes;
    • a 32 MiB direct NVMe read;
    • a VP9 decode through the AVD, bit-exact against libavcodec.
  • After the two lid wakes, the panel and the keyboard backlight came back on. I checked the rest once after the second: CPUs 0-9, ping 3/3, Bluetooth powered.
  • dmesg: no oops, warning or "failed to come online". Only the IRQ affinity -38 warnings and the DCP syslog lines the boot already has.

The machine was on AC for these, so there's no power number yet. A lid-closed night on battery with t8142_wake_s=3600 follows, to compare with the same stack without this PR (about 0.21 W over 8.9 h, in my #2135 comment).

🤖 Generated with Claude Code

@RyanTheTide

Copy link
Copy Markdown
Contributor

Blockers: 2.

The burst and pen changes read correctly: spin_table_stop_finished() (closes the pen, arch/arm64/kernel/smp_spin_table.c:337) runs before ops->wake() (drivers/soc/apple/sleep.c:5681-5684), so every core the burst starts waits for its own release. Clearing secondary_data.task after a successful __cpu_up() (arch/arm64/kernel/smp.c:142-151) is safe because the secondary has read it in __secondary_switched before it completes cpu_running. The J813 runs above (alarm and lid, both modes) cover the wake well.

  1. drivers/soc/apple/sleep.c:2244, :2255, :2269: three module parameters choose between two code paths in the sleep sequence (:8989, :9012, :9149), so the default command line runs one path and the other only gets tested by hand. J815 and two J813s now show the burst, the read-modify-write and no perf-state writes working. Drop cpu_burst, cluster_rmw and perf_down. Make the burst and the RMW the only behaviour, and delete t8142_perf_down() and its call if nothing else uses them. The per-core start in sleep_cpu_on() is still needed for runtime hotplug, so keep that. Reverting the commit is how to go back.
  2. Commit trailers: both commits (3cf4478, 8e270f6) carry a Co-Authored-By: for a model and repeat Signed-off-by: Nick. Keep one human Signed-off-by and drop the co-author line. Also replace the closing "Generated with Claude Code" line of the PR body with Assisted-by: LLM (<Vendor>:<Model>).

Nit: drivers/soc/apple/sleep.c:9141: t8142_cpu_burst() sits between t8142_wake()'s block comment and t8142_wake(), so that comment now describes the wrong function. Move the new function above the comment.

HW row: after the parameters are removed, J815 and J813 on the default command line (no apple_sleep.cpu_burst/cluster_rmw/perf_down): 3+ alarm wakes and 1 lid wake each, "9 cores started in one burst" + 9 "Booted secondary processor" per wake, CPUs 0-9 online, suspend_stats fail 0, 0 AVC, 0 failed units, 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

secondary_holding_pen_release is written with a CPU's MPIDR to let it
out of the pen and never reset, so after boot it still names the last
CPU released. secondary_data.task likewise keeps that CPU's idle task:
__cpu_up() only clears it on failure.

With the restartable spin table (aurora,rvbar-spin-table) a CPU comes
back through the pen whenever the SoC restarts it at its reset vector:
after a system sleep's commit, and at the wake. The CPU whose MPIDR is
still in the pen walks straight through into secondary_startup, ahead of
its own bring-up, and runs secondary_start_kernel() as that CPU with
the stale task. The hotplug state machine has not started it, so no
STARTING callback runs (no arch timer, no tick device), yet it marks
itself online and completes cpu_running, so the real bring-up returns
at once. It idles quietly while cpuidle is paused and faults at the
first menu_select() after cpuidle_resume():

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000020
  CPU: 9 UID: 0 PID: 0 Comm: swapper/9
  pc : tick_nohz_get_sleep_length+0x68/0xd4
  Call trace:
   tick_nohz_get_sleep_length+0x68/0xd4 (P)
   menu_select+0x414/0x774
   cpuidle_select+0x1c/0x28
   do_idle+0x1e8/0x310
   cpu_startup_entry+0x34/0x38
   secondary_start_kernel+0x198/0x1bc
  Kernel panic - not syncing: Attempted to kill the idle task!

Seen on a J815 (MacBook Air 15" M5) when every core was started at the
end of the wake, as macOS does, instead of one by one at its bring-up.

Reset the release to INVALID_HWID in the released CPU's cpu_postboot,
which runs before complete(&cpu_running), so it can't race with the
next bring-up; and again before a suspend's hold and after the wake,
before any CPU is started. Clear secondary_data.task after a successful
bring-up too, as kernels before 5.x did, so a core that still reaches
__secondary_switched without a bring-up of its own waits in
__secondary_too_slow instead of running as another CPU.

Tested on J815: two real deep sleeps (256 s and 172 s) with all nine
secondary cores started together at the wake, all back online, where
the same kernel without this change panicked on the first wake.

Signed-off-by: Nick <[email protected]>
@m0d16l14n1
m0d16l14n1 force-pushed the j815/t8142-sleep-xnu-wake branch from 8e270f6 to ac12cac Compare November 21, 2026 12:51
@m0d16l14n1

m0d16l14n1 commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor Author

@RyanTheTide done.

  • cpu_burst, cluster_rmw and perf_down are gone: the burst and the RMW are the only behaviour.
  • t8142_perf_down(), t8142_perf_request(), their constants and the perf result fields are deleted.
  • The per-core start stays for hotplug.
  • t8142_cpu_burst() now sits above t8142_wake()'s comment.
  • The trailers are fixed.

Rebase note: integration's dynamic-debug start trace landed in sleep_cpu_on(). The burst release now returns before it, and its per-core line is pr_debug. "N cores started in one burst" stays pr_info.

HW rows (J815 + J813, defaults, 3 alarm + 1 lid wake each) to follow.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of ac12cac: No blockers.

Earlier points: 1 resolved: cpu_burst, cluster_rmw and perf_down are gone. The burst (drivers/soc/apple/sleep.c:9116-9142, called at :9204) and the read-modify-write of the cluster words (:8989-8993) are now the only behaviour, the perf-state step and its fields are removed, and the per-core start in sleep_cpu_on() stays for hotplug, behind the burst release at :2523-2528. 2 resolved: both commits carry one human Signed-off-by and no co-author line, and the body ends with the Assisted-by line. The nit is resolved: t8142_cpu_burst() now sits above t8142_wake()'s comment.

The new code reads correctly. sleep_cpus_awake is taken in .begin (:6389), before the PM core takes the other CPUs down, and each bring-up clears its own bit with cpumask_test_and_clear_cpu(). Without cpu_start the mask stays empty, so the per-core path is used.

Nit: sleep.c:8307-8310: the block comment on the SoC/DCS perf-state words now has nothing under it, because the constants it described were removed. Delete it with them.

HW row (still owed): J815 and J813 on this head with the default command line: 3+ alarm wakes and 1 lid wake each, "9 cores started in one burst" + 9 "Booted secondary processor" per wake, CPUs 0-9 online, suspend_stats fail 0, 0 AVC, 0 failed units, 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

… as XNU

A traced macOS 27.2 sleep on a J813 (boot, a 40 s sleep, the wake and
three more entries) differs from ours in three places:

- The wake: 16.5 ms after it, right after the memory side and the WD2
  stop, the boot core starts all nine other cores in one 0.23 ms burst,
  three words each (+4 the core's bit, +8 the E core's bit or 0, +0xc
  the P core's bit or 0). We started each core later, from its own
  bring-up, with two words.
- The commit: the clusters' words are read-modify-written. The first
  sleep after boot reads 0xf and writes 0; every commit after a wake
  reads 0x2f and writes 0x20, keeping bit 5. We wrote 0 every time.
- The SoC/DCS perf-state page is never accessed.

Do the same:

- At the end of the wake, start the cores that were online when the
  sleep began, in one burst with those three words. They come up
  through the boot object into the kernel's holding pen and wait there;
  each bring-up only releases its core. The per-core start stays for
  runtime hotplug. T8142's data has no cpu_clusters, so the cluster
  comes from the MPIDR.
- Clear only the clusters' on bits at the commit.
- Drop the SoC/DCS perf-state step (t8142_perf_down()) and the
  apple_sleep.perf_down switch that chose it.

The burst depends on the holding pen being closed behind each released
CPU ("arm64: spin table: close the holding pen behind each released
CPU"); without it the last CPU booted runs ahead of its bring-up.

Tested on J815 (MacBook Air 15" M5): two real deep sleeps (256 s and
172 s), each with "9 cores started in one burst" and nine "Booted
secondary processor", all CPUs back, display, NVMe, Wi-Fi and Bluetooth
up; the read-modify-write and no perf-state step in a third sleep of
366 s before that. On two J813s (sithglan, gig3m) alarm and lid wakes
with the same behaviour. Reverting this commit is how to go back.

Signed-off-by: Nick <[email protected]>
@m0d16l14n1
m0d16l14n1 force-pushed the j815/t8142-sleep-xnu-wake branch from ac12cac to 8be9e73 Compare November 22, 2026 15:33
@RyanTheTide

Copy link
Copy Markdown
Contributor

Re-review of 8be9e73: no blockers. The only change since ac12cac is the removal of the leftover perf-state block comment (old drivers/soc/apple/sleep.c:8307-8310), so the earlier points stay resolved.

HW row (still owed, at 8be9e73, default command line): J815 and J813, 3+ alarm wakes and 1 lid wake each. Each wake should show "9 cores started in one burst" and 9 "Booted secondary processor", CPUs 0-9 online, suspend_stats fail 0, 0 AVC, 0 failed units and 0 new kernel errors.

Assisted-by: LLM (Claude:Opus 5.5)

@m0d16l14n1

m0d16l14n1 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor Author

@RyanTheTide nit done in 8be9e731. The orphaned block comment on the SoC/DCS perf-state words is deleted with the constants it described. Only the top commit changed, so #2192's commit (c5daf572) is the same.

The J815/J813 rows on the default command line are still owed.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Review at 8be9e73: no blockers.

Since ac12cac only the orphaned perf-state comment block went away (range-diff: the #2192 commit is identical, the top commit loses four comment lines). I re-read the whole PR at this head anyway.

  • The burst runs in t8142_wake() after spin_table_stop_finished() has closed the pen, and only for the CPUs that were online at .begin, so every core it starts waits for its own release. A burst-started core that never arrives is not lost: sleep_cpu_on() clears its bit on the first attempt, the 5 s timeout leaves it in spin_table_cpus_off, and the next online attempt pulses it per core.
  • Clearing secondary_data.task after a successful __cpu_up() is safe: the secondary read it in __secondary_switched long before it completes cpu_running, and bring-ups are serialized.
  • No command-line or module parameter is added (three are removed). A test merge onto integration/aurora 6732e74 is clean, and the merged sleep.c has no leftover user of the removed perf fields. CI is green.

Merge order: this PR carries #2192's commit (c5daf57) as its first commit and #2192 is still open, so #2192 goes in first.

Non-blocking:

  1. A burst-started core whose bring-up fails before cpu_boot (an earlier hotplug callback failing at thaw) stays awake in the pen with its bit left in sleep_cpus_burst, while spin_table_cpus_off still counts it as off. If the next sleep starts before it is onlined, spin_table_all_held() passes it and it reaches the commit without cpu_stop. A timed-out per-core start has the same hole on integration today, so this is not new, but .begin could refuse (or re-park) while sleep_cpus_burst is not empty.
  2. Relative to integration the perf-state step goes from on to off. The rows above ran it off, so function is covered; the lid-closed battery night gig3m mentioned would show there is no power cost.
  3. The burst lives in the T8142 wake only. That matches the evidence (the trace is T8142's), but if T8132/T8140 turn out to start their cores the same way, it should move to the common path keyed on the cpu-start block, not get a second copy.

Still owed, as before: J815 and J813 at 8be9e73 on the default command line (3+ alarm wakes and 1 lid wake each, one burst line and 9 "Booted secondary processor" per wake, CPUs 0-9 online, suspend_stats fail 0, 0 AVC, 0 failed units, 0 new kernel errors).

Assisted-by: LLM (Claude:Opus 5.5)

@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.

Formal §1–§6 review at 8be9e731e3137c498a7b7dc5b0f09cce3fcf4a2c against pre-pr-checklist.md (verified against live integration/aurora 70a00e583b03: not superseded).

0 code, policy, attribution, or CI blockers — holding only for §5 exact-head default-cmdline hardware & regression evidence (plus stack ordering with #2192).

Blocker

  1. §5 (Missing exact-head default-cmdline hardware & regression evidence on 8be9e731e313):
    • All reported J815 and J813 sleep runs were collected on the previous head (8e270f62) with lab/non-default boot parameters (apple_sleep.deep=1, nvme_apple.sleep_untested=1, appledrm.s2r_untested=1, idle=nop, arm64.nowfxt, maxcpus=1) and before removing the three module parameters and updating sleep_cpu_on().
    • As already noted in the PR body ("Still owed"), please post exact-head (8be9e731e313) default-cmdline hardware runs on J815 and J813: 3+ alarm wakes and 1 lid wake each, confirming "9 cores started in one burst" and 9 "Booted secondary processor" per wake, CPUs 0–9 online, suspend_stats fail 0, and explicit regression counts (0 SELinux AVCs, 0 failed units, 0 new kernel errors).

Merge-Order Note

  • This branch carries #2192's commit (c5daf572c69c, "arm64: spin table: close the holding pen behind each released CPU") while #2192 is still open; #2192 should land first (or coordinate merge order).

Checklist Verification

  • §1–§3 (Correctness / locking / memory / no hacks): Clean.
    • arch/arm64/kernel/smp.c:140-151: clearing secondary_data.task + dcache_clean_inval_poc() after cpu_online(cpu) is safe because the secondary reads it in __secondary_switched before completing cpu_running.
    • arch/arm64/kernel/smp_spin_table.c: closing the pen with write_pen_release(INVALID_HWID) in spin_table_hold_parked(), spin_table_stop_finished() (which runs before ops->wake()), and smp_rvbar_spin_table_postboot() prevents early wake-burst cores from racing ahead of their bring-up.
    • drivers/soc/apple/sleep.c: all three A/B module parameters (cpu_burst, cluster_rmw, perf_down), t8142_perf_down()/t8142_perf_request(), and the orphaned perf-state comment block are cleanly removed with no dead references left behind; sleep_cpus_awake is snapshotted in .begin before CPU offline; cluster words use RMW (~CLUSTER_ON); per-core sleep_cpu_on() remains intact for runtime hotplug.
  • §4 & §6 (Attribution / clean-room / naming): Clean. Both commits carry human author/committer (Nick <[email protected]>) and single human Signed-off-by: only (zero AI commit trailers); Assisted-by: disclosed in PR body.
  • Live CI: All 7 checks green on 8be9e731e313 (host-tests, source, rust-build, kunit, DWC3/ATC × 3).

@github-actions github-actions Bot added area:platform Area from CODEOWNERS (bot) changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot) labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at 8be9e731: not ready yet

Check Detail
CI at head ok 8 checks passed
Review no needs one approving review from Core or Omarchy Mac (not the author)
Requested changes ok none
Hardware row at head ok comment at 8be9e731
Conflicts ok none
PR text adopt when you next edit add a 'Tested:' line; a 'Risk:' line (door and Macs) (guide)

Areas: area:platform

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

DjDeveloperr
DjDeveloperr previously approved these changes Nov 25, 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 8be9e731e313: the code is ready; it needs only a row at this head.

Blockers: none in the code. Missing row: the J815 and J813 sleep runs used lab parameters (apple_sleep.deep=1, nvme_apple.sleep_untested=1, appledrm.s2r_untested=1, idle=nop). Needed: one J813 or J815 deep sleep at this head on the default command line. It's stacked on #2192, so it merges after that.

Checked: no Apple material, no gates: the cores are started and the cluster words written in the order the firmware expects. CI green.

@DjDeveloperr
DjDeveloperr dismissed their stale review November 25, 2026 05:39

Superseded by the review at 8be9e73

@github-actions github-actions Bot removed changes-requested A reviewer requested changes (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

J815 (MacBook Air 15" M5) row at 8be9e731e313 (on #2192 c5daf572c69c), in a batched candidate.

Candidate: m0d16l14n1/linux j815/prtest-r6 8ad9358 = main 70381bd with these PR heads merged unchanged: #2384 f9d03e8, #2385 b1c3392, #2192 c5daf57, #2193 8be9e73, #3123 227c89b, #3124 1a272ce, #3125 4ad71b8, #3129 6d5ec4d, #3130 76bf36c, plus the open J815 PRs. Stage 2: aura main 508390223 + aura#391/#165/#363. Command line: default + pcie_aspm=off apple_sleep.deep=1 nvme_apple.sleep_untested=1 appledrm.s2r_untested=1 apple_sep.xart_writes=0 apple_sep.provision_keybag=0.

The earlier J815 rows couldn't reach the commit (refused by DCP/SEP before it). With #2384, #3129 and #3130 in the same tree, one timed deep sleep and wake:

apple-sleep: wake: 9 cores started in one burst; stop/sys/e/p now 0/0/0/0
Timekeeping suspended for 24.464 seconds
sleep 1: rc 0, '9 cores started in one burst' x1, 9 Booted secondary processor, online 0-9, suspend_stats fail 0

No panic on the wake, no core retried.

Regression on the same boot (6aaae3d9, after the wake): 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors vs the previous boot, 0 WARN/BUG/Oops.

Not yet: more than one cycle per boot; J813.

@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

J815 (MacBook Air 15" M5) row at 8be9e731e313 unchanged: PASS.

Candidate: m0d16l14n1/linux j815/prtest-r7 d70fd05 = main a60fef7 with these PR heads merged unchanged: #2384 f9d03e8, #2385 b1c3392, #2192 c5daf57, #2193 8be9e73, #3123 822a1dd, #3124 1a272ce, #3125 4ad71b8, #3129 6d5ec4d, #3130 76bf36c, plus the open J815 PRs (r6 + #3123's new head). Stage 2 as on r6. Command line: default + pcie_aspm=off apple_sleep.deep=1 nvme_apple.sleep_untested=1 appledrm.s2r_untested=1 apple_sep.xart_writes=0 apple_sep.provision_keybag=0 apple_sleep.t8142_wake_s=0 (the last one turns off the timed PMU wake, so the sleep lasts until a key).

One deep sleep with no timer, woken by a key on the built-in keyboard after about 10 minutes (boot 9325546c): Timekeeping suspended for 603.654 seconds, 9 cores started in one burst, CPUs 0-9 online, suspend_stats success=1 fail=0; the wake source is the built-in keyboard/trackpad. Panel, NVMe, Wi-Fi (up 5 s after the wake) and Bluetooth (LE mouse still connected, 0 TX/RX errors, exec 2 / IPC 2) back.

Regression on the same boot, after the wake: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors vs the previous boot, 0 WARN/BUG/Oops.

@gig3m

gig3m commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

J813 (MacBook Air 13" M5) row at 8be9e731e313 (on #2192 c5daf572c69c), in m0d16l14n1/linux j815/prtest-r8 7b4bbe9 plus the local XRGB plane patch, default command line (no sleep words): PASS.

  • 3 alarm wakes in one boot (apple_sleep.t8142_wake_s=30 written at runtime for these three, back to 0 after): each "PMU alarm after the timer: 0" with the compare 30 s ahead, wake source NUB.SPMI0.SW3.
  • 1 lid wake on the same boot: logind "Lid closed", deep entry, 4 min 30 s, "Lid opened", wake source MTP.DOCK.CHANNELS.AP0.IRQ.
  • Every one of the 4 wakes: "wake: 9 cores started in one burst; stop/sys/e/p now 0/0/0/0" and 9 "Booted secondary processor", CPUs 0-9 online after.
  • suspend_stats success 5, fail 0 (one earlier key wake on this boot, with an external display). SELinux is off, so no AVC. 0 failed units, 0 WARN/BUG/Oops. The only new kernel error lines are from the USB Ethernet adapter (asix ... Failed to write Medium Mode), once per alarm wake; its link stayed up.
  • Earlier boot of the same tree: 2 key wakes, the same burst and 9 secondaries each.

Assisted-by: LLM (Claude:Opus 5.5)

@m0d16l14n1
m0d16l14n1 dismissed DjDeveloperr’s stale review November 25, 2026 19:26

The merge-base changed after approval.

DjDeveloperr
DjDeveloperr previously approved these changes Nov 25, 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.

LGTM — re-approving at 8be9e731e313 after base retarget onto main following #2192's merge.

@m0d16l14n1
m0d16l14n1 dismissed DjDeveloperr’s stale review November 25, 2026 19:32

The merge-base changed after approval.

@RyanTheTide

Copy link
Copy Markdown
Contributor

The exact J815 and J813 rows are recorded, and the prerequisite is on main. GitHub is still dismissing approvals at 8be9e731e313 when it recalculates the merge base. Could you merge current main normally and note whether the sleep and SMP changes are unchanged? If the forward preserves them, we can carry the two rows and review the new head.

@github-actions github-actions Bot added needs-review No approving review from Core or Omarchy Mac yet (bot) and removed ready-to-merge Meets the merge policy: merge it (bot) labels Nov 25, 2026
RyanTheTide
RyanTheTide previously approved these changes Nov 26, 2026

@RyanTheTide RyanTheTide 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: MERGE at 8be9e731e313 once one non-T8142 regression row is posted (queued in our lab, on J713)

Blockers: none in the code.

Checked:

  • The T8142 part: the burst starts only the cores that were online at .begin, takes the cluster from the MPIDR (no cpu_clusters in the data), skips itself and any cluster above 1, and each later bring-up only releases its core from the pen. Runtime hotplug keeps the per-core start. The cluster words are now read-modify-written, perf_down and its module parameter are gone, and so are the Apple method names in comments. There's nothing to set on the command line any more.
  • Shared arm64 code: in __cpu_up, clearing secondary_data.task after cpu_online() makes a late core take the existing cbz … __secondary_too_slow path, which is safe. write_pen_release(INVALID_HWID) in smp_rvbar_spin_table_postboot(), spin_table_hold_parked() and spin_table_stop_finished() closes the pen behind each core. arm64 brings CPUs up one at a time (__cpu_up waits for cpu_running), so one CPU's postboot can't clear another's pending release.
  • Rows at this head: J815 (one deep sleep woken by a key; that run used extra command-line words) and gig3m's J813 on the default command line (3 alarm wakes + 1 lid wake, 9 cores in one burst each time, suspend_stats 5/0, 0 failed units).

Still needed before merge: the smp.c/smp_spin_table.c hunks run on every Mac that boots through the spin table, not only T8142. One row on another generation will cover it: CPU hotplug offline/online cycles plus a few s2idle wakes, 0 failed units and no __secondary_too_slow or tick warnings. I've queued that on J713 together with #1702. If it passes and nothing else changes, this can merge on that row. If you forward-merge main first and the changed files stay byte-identical, the rows carry over.

@m0d16l14n1
m0d16l14n1 dismissed RyanTheTide’s stale review November 26, 2026 05:55

The merge-base changed after approval.

@RyanTheTide

Copy link
Copy Markdown
Contributor

8be9e73 Neo (J700, T8140) + J616s (M4 Pro, T6040) + J615 (M3 Air 15", T8122) PASS: batched on main 7f00dc6 (0 merge-tree diffs), default cmdline; Neo 20/20 E+P CPU online/offline (0 errors, online 0-5) + 3/3 rtc0 s2idle wakes; J616s 3/3 rtc1 s2idle (0-13) + J615 3/3 rtc0 s2idle (0-7); 0 __secondary_too_slow / hotplug / tick warnings, 0 failed units, Enforcing, 0 new AVC, 0 new kernel errors; stock defaults restored.

RyanTheTide
RyanTheTide previously approved these changes Nov 26, 2026

@RyanTheTide RyanTheTide 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.

Re-approving at 8be9e731e313. GitHub dismissed the earlier approval when the base moved, and the head is unchanged. The regression row this needed is posted: Neo 20/20 E+P CPU offline/online and 3/3 s2idle, J616s and J615 3/3 s2idle each, 0 spin-table or tick warnings.

@m0d16l14n1
m0d16l14n1 dismissed RyanTheTide’s stale review November 26, 2026 06:56

The merge-base changed after approval.

@RyanTheTide
RyanTheTide merged commit dc2a435 into aurora-silicon:main Nov 26, 2026
18 checks passed
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merged into main. Thank you! It merged on the hardware rows at this head and a non-author review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:platform Area from CODEOWNERS (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) needs-template PR body lacks Tested or Risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants