Repository navigation
drm/asahi: fix global upper-half TLBI fallback and enable T6050 range TLBI - #4284
RyanTheTide merged 2 commits into
Conversation
Kernel mappings live in the upper half of the GPU VA space, in the one table that is not owned by a user VM, and its leaves are written global (nG clear). tlbi aside1os only removes non-global entries, so it leaves cached global translations of an unmapped kernel range behind. tlbi_range_or_asid() falls back to an ASID flush for ranges of 32 MiB or more, and tlbi_pages(), used in page TLBI mode, does the same above 2048 pages. A kernel mapping of that size that is unmapped through either path keeps stale translations for its old pages. For an upper-half range, never take the ASID fallback. In range mode, issue as many tlbi rvae1os operations as the range needs: a by-VA operation matches global entries whatever the ASID, and even the whole 64 GiB kernel window takes two operations. In page mode, which avoids range operations, use tlbi vmalle1os. Lower-half ranges, whose leaves are all non-global, keep the ASID fallback. Signed-off-by: vlad <tulituvlad@gmail.com>
The M5 Pro inherited page_tlbi from the M5 Ultra policy. With it, every unmap of up to 2048 pages issues one tlbi vae1os per 16 KiB page, and any larger one flushes the whole ASID. The CPU is ARMv8.4, and the PublishedRoots path already encodes tlbi rvae1os operations for 16 KiB granules, so a range below 32 MiB takes one instruction. Larger user ranges flush the ASID, and larger kernel ranges, whose leaves are global, take range operations as well. Clear page_tlbi for the M5 Pro only. clean_tables stays set: no M4 or M5 SoC has run without it (T6040 and T6041 set it, and the T8142 entry stops at the identity check before the UAT is touched), so there is no proof yet that the walker snoops the CPU caches. Signed-off-by: vlad <tulituvlad@gmail.com>
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Hardware row: T6050 / J714s MacBook Pro 14" M5 Pro (Mac17,9), local candidate
This is a regression row only. The gpubench numbers in the description are from Boot #7 vs Boot #8, which differ by 15 commits, so I am not using them as a measure of this change. Evidence |
|
Hardware row: T6050 / J716s (MacBook Pro 16-inch, M5 Pro), pass
Note: the before kernel is the older packaged pin (51), not 53 without this PR, so the score comparison spans more than these two commits. |
There was a problem hiding this comment.
Verdict: MERGE at 3c14eebe3558d72d99f063f5b984779f4f94f4c7
Blockers: None.
Checked: The UAT kernel window has bit 63 set. Above the page-by-page threshold it takes a full flush, and large ranges on the range-capable path retain address-based invalidation. The user window keeps the ASID fallback. The T6050 config changes only the range-invalidation setting and still cleans page-table writes.
Evidence
Executed the exact Rust routing helpers with the instruction invocations recorded on the host. All 13 address, zero-length and threshold cases passed. The ARM instruction definitions confirm that range invalidation covers global entries matching the address. No DT files change. The author reports 441 host tests and a J714s run from a different base with both changed files byte-identical. Exact-head fork CI still requires workflow approval.
RyanTheTide
left a comment
There was a problem hiding this comment.
ORCH5 merge sweep: passes the six-point gate (CI green at 3c14eeb, independent review approval by aurora-silicon-review[bot], no taint, no Stage 1/LocalPolicy change).
What: Prevent
tlbi_pages()andtlbi_range_or_asid()from falling back to ASID-onlyTLBI ASIDE1OSon global upper-half kernel mappings, and enable ARMv8.4 range TLBI (page_tlbi = false) on T6050 M5 Pro (clean_tablesremainstrue).Tested: J714s MacBook Pro 14" M5 Pro (Mac17,9, T6050) at
3c14eebe3558, in the batched Boot #11 kernel7.3.0-j714s-b11+(main9ece2d8202d2plus 16 open PR heads unchanged, this one included, plus local J714s patches), 2026-12-04: boots, 0 failed units, 0 new kernel warnings against the previous boot. 3 fullgpubench-vkrecords (82 results each) andgpubench-stress-vk17 of 17 pass, 0 GPU or UAT fault, timeout or recovery lines. Same-kernel A/B of the range TLBI change (switched back to page TLBI, blocks off, on, on, off, core set): 23 of 23 rows overlap, no measurable difference. compute.light d=4 20.62 us (18.58-22.29) vs 20.64 (19.16-21.45); render.light triangle d=4 31.62 (31.07-32.06) vs 31.70 (31.46-32.09). The single-run Boot #7 to #8 deltas under Evidence are not reproduced.Boot #11 row
Kernel: local branch
j714s-boot11-testate7ab6d7b65c2. Its last commit is a test-only patch with runtime switches that turn single PR changes off, for same-kernel A/B runs. In an A/B row the "off" arm is that switch, which emulates the old code; it is not the old tree.Non-default command line:
nvme_apple.flush_interval=0 cpuidle.governor=teo ane_t6021.irq_wait=0 ane_t6021.irq_wait_switch=1 ane_t6021.bridge_record=1 appledrm.ext_pq_as_hlg=1 kvm.halt_poll_ns_grow_start=100000 macsmc.m5_pcio_budget=2 macsmc.m5_n1_budget=3 arm64.nowfxt zswap.enabled=0 softlockup_panic=1.page_tlbicommit only; themem.rsfix is in both arms.Earlier rows
J714s MacBook Pro 14" M5 Pro (Mac17,9, T6050), local kernel
7.3.0-j714s-b8+carrying both commits patch-identical to3c14eebeon another base;drivers/gpu/drm/asahi/mem.rsanddrivers/gpu/drm/asahi/hw/t6050.rsare byte-identical to the head: boots cleanly and passes the fullgpubench-vksuite (>100,000 submits acrosscopy.bw,render.heavy/light,compute.heavy/light,idle.wake) with 0 GPU or UAT faults. All 441 Asahi host tests pass (g17-382/382,g14-v27-234/34,g15-18/18,g16-2/2,t60504/4,hardware-defaults1/1) andW=1 LLVM=1adds 0 warnings.Risk: two-way door · all Apple Silicon Macs using
drm/asahi(global upper-half TLBI safety fix inmem.rs) and T6050 / M5 Pro Macs (page_tlbi = false; Max/Ultra and M4 Pro/Max stay unchanged).Not yet: explicit 32 MiB+ kernel-upper mapping drop torture on hardware; a second-generation row for the shared
mem.rschange. No performance claim: the A/B above shows no measurable difference.Details
drm/asahi: mem: do not use ASID-only TLBI for global upper mappings: upper-half GPU VAs (bit 63 set) carry global (nG == 0) leaves, whichtlbi aside1osleaves cached. Intlbi_pages()abovePAGE_TLBI_MAX_PAGES(2048 pages), upper-half ranges now calltlbi_all()(vmalle1os); intlbi_range_or_asid()whenva == 0 || len >= 32 MiB, upper-half ranges now usetlbi_range_ops()(rvae1osby VA, which matches global leaves regardless of ASID). Lower-half non-global user ranges keeptlbi_asid().drm/asahi: hw: t6050: enable range TLBI (page_tlbi = false): setspage_tlbi: falseont6050::CONFIG(M5 Pro) while keepingclean_tables: trueinherited fromCONFIG_ULTRA.uat_quirks.Evidence
fix/asahi-global-tlbi-and-t6050-range, head3c14eebe3558don9c9e5f035baa2scripts/checkpatch.pl --strict --no-tree --git 9c9e5f035baa2..3c14eebe3558d: 0 errors, 0 warnings, 0 checks on both commitsmake ARCH=arm64 LLVM=1 W=1 drivers/gpu/drm/asahi/: 0 new warningstools/asahi/run-host-tests.py: 441/441 passed (g17-382,g14-v27-234,g15-18,g16-2,t60504,hardware-defaults1)7.3.0-j714s-b8+, touched files byte-identical to the head): fullgpubench-vksuite (>100,000 submits), 0 GPU/UAT faultsDiagnostics, not an A/B of this change:
gpubench-vkon7.3.0-j714s-b7+vs7.3.0-j714s-b8+. Boot #8 adds 15 commits to Boot #7: this PR's two, the commits of #4286 (clpc), #4283 (drm/apple) and #4282 (Centauri Wi-Fi), and one more Centauri commit. Each value is a single run with no spread, so these deltas are not a measure of this change.render.light d=4: 28.30 -> 27.27 uscompute.light d=4: 19.92 -> 19.15 usidle.wake: 651.22 -> 627.56 us