Repository navigation
smp: keep the SMP_SHARED state in .bss, out of the file (16 KiB on every toolchain) - #611
Conversation
The state a core reads with its MMU off or uncached (reset stacks, spin table, S2R mailbox, kernel park slots) had a 16 KiB page of its own in .data. Every byte of it but three initial values is zero, yet the page sat in the file part of every image, before _file_vital_end, where the ESP Stage 2 has to end below the panel DCP's log buffer. Put it on its own pages at the start of .bss (.bss.smp_shared) in both linker scripts. memory.c still maps exactly those pages uncached and smp.c still cleans them to PoC; S2R cleans [_data_start, _bss_end) as before. _start_c clears .bss and then calls smp_shared_init(), which sets the three values that do not start as zero: boot_cpu_idx -1, spin_table at spin_table_image, and an MPIDR of ~0 in every smp_reset_stacks entry. Nothing reads them earlier: no secondary runs and no reset can come back to this image before smp_init(). This frees 16 KiB of the file on every toolchain. Packed relocations (aura#609) free more, but only with lld or GNU ld 2.43 and later; the release workflow and the installer's UEFI-only build link with Ubuntu 24.04's GNU ld 2.42, which ignores -z pack-relative-relocs on AArch64. gcc + GNU ld 2.42, ESP Stage 2 headroom: main 4160 B, this 27392 B; main + this + #601 + #604 (with or without #609) 10424 B. Signed-off-by: Ryan Murray <81541646+RyanTheTide@users.noreply.github.com>
|
Merge readiness at
Areas: none matched in CODEOWNERS Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
There was a problem hiding this comment.
Verdict: HOLD at e7a148f0 for hosted checks and the SMP hardware rows.
Checked: The normal entry reaches the BSS clear and restores the three nonzero initial values before secondary bring-up. The linker scripts keep the shared state on its own aligned pages. The non-T8152 uncached mappings and T8152 clean still use the shared bounds, and the S2R full-data clean spans the new BSS placement. The T8142 alternate secondary block remains separate. Seven focused SMP and linker-layout cases passed locally across GNU ld and lld.
Please retain the two-family one-shot boot and CPU reset coverage and a real S2R mailbox resume at the landing head, with the existing owner approval for the Stage 1 trial.
|
SMP + S2R row on the MacBook Neo (J700, T8140), built together with #609. PASS. Tested:
Evidence: traces/boot/20261130-609-611-neo (README, per-boot logs). Rows 1 (J615) and 2 (J473) of the list in the description |
There was a problem hiding this comment.
Verdict: HOLD at e7a148f0 for the remaining CPU boot/reset rows. Hosted CI and the live S2R row are satisfied.
Checked: The Neo combined Stage 2 includes this exact head and #609. It brought all six CPUs online, hotplugged CPU 1–5 before and after sleep, and completed both deep resumes via the boot object. The saved-image control and restoration receipt preserve the baseline. That is the requested Neo S2R coverage.
Keep the outstanding J615 and J473 CPU boot/reset rows, or record the maintainer's disposition for their scope. The Neo trial used the installed Stage 1 and covers the new Stage 2 path.
|
Row 1 (J615, MacBook Air M3, T8122): method-T chain one-shot of Stage 1 + ESP Stage 2 built with #609 and this PR. PASS. Tested:
Second family: the Neo (T8140) combined row above (CPUs, offline/online, s2idle and two deep resumes through the boot object). Maintainer note: the J473 row is replaced by the Neo row, because the J473 is held by ORCH5. Risk: low. Boot-path change, now exercised on T8122 through both a chained Stage 1 and the ESP Stage 2, and on T8140 through the |
There was a problem hiding this comment.
Verdict: MERGE at e7a148f with the documented second-family disposition.
Checked: Hosted CI passed. The J615 combined method-T trial included the exact #611 head in both candidate stages, brought all eight CPUs online, completed 21 secondary CPU returns and one s2idle resume, and restored the saved boot. The Neo combined Stage 2 row exercised six CPUs, hotplug and two live deep resumes through the boot object. The maintainer accepted it in place of J473. These receipts cover the requested initialization and S2R paths at their tested compositions.
|
Merging at |
The SMP state that a core reads with its MMU off or uncached (reset stacks, spin table, S2R mailbox, kernel park slots:
SMP_SHAREDinsmp.c) had a 16 KiB page of its own at the start of.data. All of it is zero except three initial values, but the page was in the file part of every image, before_file_vital_end. That is the part the ESP Stage 2 has to keep below the panel DCP's log buffer.This puts those pages at the start of
.bss(.bss.smp_shared) inaura-raw.ldandaura.ld. They are still 16 KiB pages of their own:memory.cmaps exactly[_smp_shared_start, _smp_shared_end)uncached,smp.ccleans that range to PoC for T8152, and S2R cleans[_data_start, _bss_end)as before._start_cclears.bssand then calls the newsmp_shared_init(), which sets the three values that don't start as zero:boot_cpu_idx = -1,spin_table = spin_table_image, and an MPIDR of~0in everysmp_reset_stacksentry. Nothing reads them earlier. No secondary runs, and no reset comes back into the image, beforesmp_init(). On T8142 the secondaries already avoid the whole boot object (.bssincluded), so that path is unchanged.Why this and not only #609: packed relocations (#609) free about 70 KB, but only with lld or GNU ld 2.43 and later. GNU ld 2.42 (Ubuntu 24.04) ignores
-z pack-relative-relocson AArch64. Every distribution package links with lld (fedora-auroraaura.spec, alarm-auroraPKGBUILD, nixos-aurorapkgs/aura.nix, allUSE_CLANG=1). Two shipping builds link with GNU ld 2.42, though: this repo'srelease.yml(the release assets,ubuntu-latest) and aurora-installer'suefi-only-build.yaml(ESP_STAGE2=1). So a binutils bump on thegccCI leg alone, or a check that refuses ld < 2.43, wouldn't fix what ships. This change frees 16 KiB with every toolchain. It doesn't depend on #609 and merges with it cleanly in either order.ESP Stage 2 headroom in bytes (
tools/stage1_size.sh, floor 4096, warning below 8192), base main fa05512:Stage 1 (dev) headroom, gcc 2.42: main 44056, this 60440, all four 43472. fedora: main 44592, this 60976, all four 125904. All flavours pass in every run. The release workflow's own configuration (
make ARCH=aarch64-linux-gnu- RELEASE=1 CHAINLOADING=1 ESP_STAGE2=0/1, GNU ld 2.42) gives the same numbers.Tested:
tests/python/test_smp_shared_bss.py: noSMP_SHAREDdeclaration has an initializer (re-adding= -1fails it),smp_shared_init()sets the three values and_start_ccalls it right after clearing.bss, and both linker scripts place.bss.smp_sharedon its own pages at the start of.bss.test_stage1_room.py's layout check on a real link now also asserts_file_end <= _bss_start == _smp_shared_start < _smp_shared_end.stage1_size.shwith gcc + GNU ld 2.42 (aurora-s1gcc), gcc 15 + GNU ld 2.46 (ubuntu:26.04) and fedora:44 clang (Fedora RUSTFLAGS,BUILDSTD=1) on the trees in the table.DEBUGUSB_PROXY=1,SPTM_VIRT=1 SPTM_VIRT_ESP=1 AURACTL=1 -Oz, and default Stage 1. All link.readelf:.bssis still NOBITS, and_smp_shared_start == _bss_start == _file_end, 16 KiB aligned, with theSMP_SHAREDsymbols inside it.Rows needed before merge: this changes SMP init on every Mac.
nproc, noSMP:failure lines in the aura log), and do a CPU offline/online cycle (reset stacks).rtc0). Those structures moved.They can be combined with #609's J615/J473 rows by building main + #609 + this.
Risk: two-way · all Macs (SMP bring-up, reset and S2R state now zeroed at start and initialized in
smp_shared_init())@DjDeveloperr: code-owner ping. This is the toolchain-independent room for #601/#604, which #609 can't give on GNU ld 2.42.