Repository navigation
drm/asahi: g14_v27_2: mirror FirmwareWindow L2 growth and avoid runtime alloc.private leaks - #3250
Conversation
|
Merge readiness at
Areas: 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.
The two-phase mirror checks a new slot before publishing and cleans the new L3 page first. For a previously mirrored slot it returns early on shadow descriptor == entries[idx] without checking that the corresponding shared_l2 entry still matches. intact() checks the roots and context, so it does not establish the shared slot contents. Please verify existing shared descriptors too, or document the invariant that firmware and resume cannot clear or replace a slot while those roots remain unchanged. Include a host case for an existing shadow slot with a missing shared descriptor. Keep the landing gate on a firmware-27.2 G13G/G14G soak that crosses more than 32 MiB, churns queues, and repeats growth after resume.
Fix two long-running workload bugs in the G14 firmware 27.2 backend: 1. Dynamic FirmwareWindow L2 mirroring past 32 MiB FirmwareWindow previously mirrored the shadow kernel L2 page table into the firmware's shared_l2 table once during start() and then discarded ownership with core::mem::forget(window). Each L2 entry spans 32 MiB (2048 * 16 KiB pages), so any post-boot mapping in alloc.gpu, alloc.shared, or the kernel window that allocated a fresh L2 table past the boot-time 32 MiB span updated only the driver's shadow L2 and never populated shared_l2, causing immediate UAT translation faults. Attach FirmwareWindow to kernel_vm's VmInner via Uat::attach_firmware_window() after boot succeeds and invoke VmInner::sync_firmware_window() from VmInner::map_node(), Vm::map_io(), and Uat::prepare_tables() under the existing exclusive kernel GPUVM lock (introducing no new locks or lock-order edges). FirmwareWindow::sync_range() validates window bounds, intactness, and every covered shadow L2 entry in a read-only pass (including verifying previously mirrored slots still match shared_l2 so cleared or replaced descriptors fail closed), cleans each new L3 page to PoC (clean_page + dsb sy) before atomically publishing its descriptor into shared_l2, then cleans the updated shared_l2 span to PoC and issues mem::sync() + mem::tlbi_range(0, span_start, span_len) + mem::sync(). Any failure returns before mutating shared_l2 so discard_partial_map() rolls back cleanly. 2. Eliminate unbounded alloc.private garbage accumulation G14 27.2 maps alloc.private with PROT_FW_PRIV_RW (non-coherent ASC cached) and has no device-control cache flush path, so alloc.private keeps keep_garbage = true and GarbageAction::Hold to prevent stale ASC cache lines from being exposed by reuse. Every other G14 27.2 alloc.private object is boot-only and retained for the life of the boot, except Buffer::new(), which allocated the legacy 13.5 buffer::Info wrapper from alloc.private on every render-queue create/destroy cycle. G14 27.2 firmware never receives buffer::Info's GPU VA (QueueRender builds its own 27.2 Binding::info record in alloc.shared). Add ParameterListPlacement::info_in_private() returning false for ParameterListPlacement::KernelGpu so Buffer::new() allocates the unused wrapper from uncached alloc.shared (keep_garbage = false). Runtime render-queue churn now performs zero alloc.private allocations and immediately reclaims Buffer allocations on Buffer::drop once all RenderFlights holding the Scene/Buffer have retired (while fail_all() retains in-flight flights on timeout/fault). Add a host test harness in tools/asahi/g14-v27-2-fw-window-gc-tests.py (registered in tools/asahi/run-host-tests.py) exercising real extracted code from mmu.rs, buffer.rs, and gpu.rs across multi-L2 growth (32/64/96 MiB), PoC/TLBI ordering, fail-closed rollback (including missing or replaced shared_l2 entries on previously mirrored slots), and render-flight reclamation with 10 negative-control mutations. Closes: aurora-silicon#3067 Signed-off-by: AxxzyWasTaken <[email protected]>
80412b4 to
c12e589
Compare
|
Updated at
Keeping the landing gate on a firmware-27.2 G13G/G14G soak crossing >32 MiB, churning queues, and repeating growth after resume (no M1/M2 hardware locally). |
There was a problem hiding this comment.
Verdict: HOLD at c12e58916d3b. The source fix resolves my earlier shared L2 finding.
Blockers: Complete the hosted checks and attach the firmware 27.2 G13G/G14G qualification for growth across an L2 boundary, queue churn and new allocations after resume.
Checked: The first pass now compares each previously mirrored descriptor against the live shared entry, rejects cleared or replaced entries, and validates the full range before publishing any new descriptors.
Evidence
The source fixture covers missing and replaced descriptors and a range spanning a new slot followed by a mismatched live slot, with the first slot still unpublished after the error. The PR records an author arm64 compile and keeps the hardware soak open.
|
Tested c12e589 on J473 (M2 mini, G14G B0, fw 27.2): PASS, as part of a batch boot. Kernel: Row (one guarded one-shot, restored to fleet89 after):
Evidence: For this PR: the 10 fresh Vulkan clients and the GL loops create and destroy render queues on every client. No firmware-window or allocation errors were logged, and nothing failed. I didn't measure |
|
Tested c12e589 on J316s. G13 row: tested on J316s (M1 Pro, G13S C0) at this head, PASS. Kernel
The J473 G14 27.2 row on the same kernel also passes (heavy 12/12, GL 8/8, Vulkan 10/10, s2idle 4/4). Evidence: |
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: Fix both long-running workload failures in the G14 firmware 27.2 backend:
FirmwareWindowL2 mirroring past 32 MiB (drivers/gpu/drm/asahi/mmu.rs,g14_v27_2.rs,gpu/v27_2.rs): RetainFirmwareWindowinsidekernel_vm'sVmInnerviaUat::attach_firmware_window()after boot instead of discarding it withcore::mem::forget(). Mirror newly allocated kernel-window L2 entries intoshared_l2onVmInner::map_node(),Vm::map_io(), andUat::prepare_tables()underkernel_vm's existing exclusive GPUVM lock (zero new locks).FirmwareWindow::sync_range()validates bounds, window intactness, and every covered L2 slot in a read-only pass (including confirming previously mirrored slots still matchshared_l2so cleared or replaced firmware descriptors fail closed), PoC-cleans each new L3 page (clean_page+dsb sy) before atomic Release publication toshared_l2, then PoC-cleans the updatedshared_l2span and issuestlbi_range(0, span_start, span_len).alloc.privategarbage leak (drivers/gpu/drm/asahi/buffer.rs): On G14 27.2,alloc.privateis mappedPROT_FW_PRIV_RWwithkeep_garbage = true/GarbageAction::Hold. Auditing all G14 27.2alloc.privatecallers shows every allocation is boot-only exceptBuffer::new(), which allocated the unused legacy 13.5buffer::Infowrapper on every render-queue create/destroy cycle (27.2 firmware receives its ownBinding::infoinalloc.shared, neverbuffer::Info's GPU VA). AddParameterListPlacement::info_in_private()returningfalseforKernelGpusobuffer::Infois placed in uncachedalloc.shared(keep_garbage = false), eliminating runtimealloc.privategrowth while keepingkeep_garbage = trueintact and legacyVmPrivateunchanged.tools/asahi/g14-v27-2-fw-window-gc-tests.py): Registered intools/asahi/run-host-tests.py, covering multi-L2 growth across 32/64/96 MiB boundaries, PoC/TLBI ordering, atomic rollback (including missing/replacedshared_l2descriptors on previously mirrored slots), and render-flight reclamation with 10 negative-control mutations.Tested:
python3 tools/asahi/run-host-tests.py --only g14-v27-2-fw-window-gc: 11/11 PASS (10/10 negative-control mutations killed, includingskip-existing-shared-check).python3 tools/asahi/run-host-tests.py --only asahi-m4: 1/1 PASS.ARCH=arm64 LLVM=1 drivers/gpu/drm/asahi/aurora.o) withCONFIG_DRM_ASAHI_G14_V27_2=y: PASS, 0 warnings in touched files.git diff --checkclean;scripts/checkpatch.pl --strict: 0 errors, 0 style warnings.Not yet: On-hardware G13G (T8103) / G14G (T8112) firmware 27.2 soak test crossing >32 MiB kernel-window growth, repeated render-queue create/destroy cycles, and post-S2R allocations.
Risk: two-way · G13G (T8103) and G14G (T8112) GPUs running the
g14_v27_2firmware 27.2 backend; legacy 12.x/13.5 and G15/G16/G17/G18 paths are untouched.Closes: #3067