Repository navigation
dart: release aura's L2 tables from a locked DART at shutdown - #311
DjDeveloperr wants to merge 1 commit into
Conversation
dart_get_l2() adds heap L2 tables under a locked DART's roots when aura
maps a range there (the J773g boot modeset maps its RTKit buffers and
temporary framebuffer through the locked DCP DART), but shutdown only
freed aura's handle of a locked DART. The roots kept pointing at those
tables while the heap went to the OS as RAM: the IOMMU could walk freed
memory, and Linux refuses such a DART ("root[8] ... child outside ADT").
At shutdown, unlink each heap L2 table that maps nothing any more,
invalidate, and free it. One that still maps pages is reported with its
first DVAs and kept.
Signed-off-by: Diljit Singh <hey@djdev.me>
44a66d1 to
0033959
Compare
|
The format-check failure comes from main, not from this change: all 34 violations are in 🤖 Generated with Claude Code |
|
Thanks, this explains the root[8] refusal well. Two points in dart_release_locked_l2(). First, tlb_invalidate() can time out and mark the DART failed, and later calls then return early, but the loop still frees each L2. Those pages could still be walked. Could it check dart->failed after invalidating and keep the tables (returning false) in that case? Unlinking all empty tables, invalidating once, then freeing would also avoid one TLBI per table. Second, a heap L2 that still maps pages is logged as kept, but it is still aura heap that the OS receives, and dart_collect_tables() skips locked DARTs, so nothing reserves it. Returning false from dart_shutdown_checked() there, or listing those L2s in dart_collect_tables(), would keep it fail-closed. Also, the new helper sits between dart_shutdown_checked()'s comment and its body. Happy to run a J616s no-regression boot. |
Summary
dart_get_l2()adds heap L2 tables under a locked DART's roots whenever aura maps a range there. On the J773g, the boot modeset maps its RTKit buffers and a temporary framebuffer through the locked DCP DART at DVA 0x10000000+. Butdart_shutdown_checked()only freed aura's handle of a locked DART (display DARTs are opened withkeepas well). The roots kept pointing at those heap tables while the heap went to the OS:DCP admission: root[8]=0000001000eadc01 child=1000eadc000 outside ADT [105ffeec000,105fff1c000).At shutdown of a locked DART, this unlinks each heap L2 table that no longer maps anything, invalidates, then frees it. A table that still maps pages is logged with its first DVAs and kept. The bootloader's own tables (not heap) are never touched.
Testing
Owner's Mac mini J773g (26.6.2 stub), 2026-11-19, aura-try trial. The Stage 2 was the boot-HDMI test series plus #113/#199/#258 and this commit:
display: Quiescing DCP (external, no reset), thendart[30a340000 23]: released aura's empty L2 tables from the locked DART.apple-dart 30a340000.iommu: Preserving DCP SID23 root 0x00000105ffeec000 and 2 foreign 32-MiB slots. Without this commit the same boot refused root[8] as above.test_locked_dart_tables.py,test_dart_failure_lifetime.py,test_display_dart_view.py,test_native_dart_tables.pyandtest_dart_gen3_tlbi_l2_roots.pypass (35). The two harnesses that compiledart_shutdown_checked()now also extract the new helper.USE_CLANG=1 BUILDSTD=1 RELEASE=1 CHAINLOADING=1 ESP_STAGE2=1).🤖 Generated with Claude Code