Skip to content

iommu/apple-dart: wait out stalled display invalidates on locked DARTs - #3125

Merged
RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
m0d16l14n1:j815/dart-display-locked
Nov 26, 2026
Merged

RyanTheTide merged 1 commit into
aurora-silicon:mainfrom
m0d16l14n1:j815/dart-display-locked

Conversation

@m0d16l14n1

Copy link
Copy Markdown
Contributor

What: the display DART's stalled-invalidate wait (911de8e, for J700) now applies to every locked display DART, not only to ones with the firmware table handoff. The J815's display DART is locked without the handoff, so its range invalidates still failed after 2 ms, and kwin's framebuffer import failed at the same instant.
Tested: J815 (MacBook Air 15" M5) at 4ad71b88134d: 0 TLB command ... timed out, 0 kwin framebuffer failures on both test boots at this head and on one more with the same patch (before: 2 to 32 timeouts and 1 to 13 failed imports per boot). Host test apple-dart-tlb-stall-tests.py PASS, and current main fails its new no-handoff case. Regression at boot: 0 SELinux denials (SELinux off), 0 failed units, 0 new kernel errors from this change.
Risk: two-way door. Locked display DARTs on every Mac. Handed-off DARTs are always locked, so J700 keeps the same wait; unlocked DARTs and other devices' DARTs are unchanged.
Not yet: none of these boots stalled, so the wait itself has not run on the J815 yet (0 "stayed busy" lines). Rows on J700 and J813 at this head.

Details

The J815 logs, when the compositor starts and when the display powers back on:

apple-dart 286300000.iommu: TLB command 0x1 for stream 0 timed out (0x8700e100)
kwin_wayland: drmPrimeFDToHandle failed: Invalid argument
kwin_wayland: Failed to create framebuffer: Invalid argument

0x8700e100 is busy plus a FLUSH_SID by range (V2, RANGE, STT) on the display subsystem's stream 0: the same stall J700 shows, which 911de8e waits out. That wait was gated on dart->fw_handoff (apple,firmware-root-handoff). The J815's loader leaves disp0 locked without that handoff, so the 2 ms timeout still failed there.

The wait only needs the DART to be one the display scans out through and to take range invalidates, which only locked DARTs get. display_scanout is now decided from the lock. The DCP firmware DARTs, other devices' DARTs, and DARTs with sleep lists or a CTC flush keep the short timeout.

tools/asahi/apple-dart-tlb-stall-tests.py: the no-handoff case now expects the wait (it waits out 40 ms). The mutation that drops the scan-out check is renamed every-dart and is still killed.

Evidence

J815, macOS 27.2 stub, command line default plus pcie_aspm=off and three sleep opt-ins that don't touch the DART.

Boot Kernel TLB timeouts kwin failed imports
4 boots before without this change 32, 11, 6, 3 13, 3, 2, 1
1 boot before without this change 2 1
c5d4cd3e the same patch on our J815 tree 0 0
421a7963 this head, on main a977440 + the J815 PRs 0 0
ab3dfc4a this head, on main 2943fff + the J815 PRs 0 0

Host test: tools/asahi/run-host-tests.py (apple-dart-tlb-stall-tests.py --dtc) PASS; the old revision and the every-dart mutation are killed.

On the MacBook Air 15" M5 (J815) the internal display's DART logs

  apple-dart 286300000.iommu: TLB command 0x1 for stream 0 timed out (0x8700e100)

when the compositor starts and when the display powers back on, 0 to 32
lines per boot, and kwin's framebuffer import fails at the same instant:

  kwin_wayland: drmPrimeFDToHandle failed: Invalid argument
  kwin_wayland: Failed to create framebuffer: Invalid argument

That is the J700 stall that 911de8e ("iommu/apple-dart: wait out
stalled J700 display invalidates") waits out: a FLUSH_SID by range (V2,
RANGE, STT) of the display subsystem's stream 0, still busy after 2 ms.
The wait was gated on the reserved firmware table handoff, which J700's
loader sets up. J815's loader leaves disp0 locked without the handoff,
so the same stall still fails there after 2 ms.

What the wait relies on is the DART being one the display subsystem
scans out through, and taking range invalidates, which only locked DARTs
get. Decide display_scanout from the lock instead of the handoff; every
handed-off DART is locked, so J700 keeps the wait. The DCP firmware
DARTs, other devices' DARTs and DARTs with sleep lists or a CTC flush
still fail after the short wait.

The host test's no-handoff case now expects the wait, and the mutation
that drops the scan-out check is renamed every-dart.

Signed-off-by: Nick <[email protected]>
@m0d16l14n1
m0d16l14n1 requested review from a team and DjDeveloperr as code owners November 25, 2026 04:41
@github-actions github-actions Bot added area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) door:two-way Revertible or not, from Merge risk (bot) needs-review No approving review from Core or Omarchy Mac yet (bot) labels Nov 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Merge readiness at 4ad71b88: not ready yet

Check Detail
CI at head no failing: host-tests, host-tests, KUnit ane-pm, KUnit dcp-fabric, KUnit asahi, KUnit spi-hid-apple
Review ok approved by satchlj
Requested changes ok none
Hardware row at head ok in the PR body at 4ad71b88
Conflicts ok none
PR text ok Risk: two-way · . Locked display DARTs on every Mac. Handed-off DARTs are always locked, so J700 keeps the same wait; unlocked DARTs and other devices' DARTs are unchanged.

Areas: area:gpu, area:platform

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

@m0d16l14n1

Copy link
Copy Markdown
Contributor Author

J815 (MacBook Air 15" M5) row at 4ad71b88134d, 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.

Two boots (65e8a168, 6aaae3d9), desktop session plus GPU load (es2gears + vkcube), and a deep sleep and wake on the second: 0 DART TLB invalidate timeouts, 0 kwin framebuffer failures, 0 stalls waited out. No stall happened on these boots, so the wait itself is not exercised by this row.

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.

@satchlj satchlj left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: MERGE at 4ad71b88134d
Blockers: none
Checked: full diff, hardware verification status, and live CI

Evidence
  • Previously audited diff at 4ad71b88134d is clean with no regressions or unresolved review blockers.
  • Live CI is now 100% green (19/19 checks passed, 0 pending, 0 failed) with exact-head hardware verification recorded on the PR.

@github-actions github-actions Bot removed the needs-review No approving review from Core or Omarchy Mac yet (bot) label Nov 25, 2026
@RyanTheTide

Copy link
Copy Markdown
Contributor

4ad71b88134d (batched cleanly in J616s Batch #1 f07c8e067bc2 over main f3bfe5007089, 0 merge-tree diffs across all 3 changed files) J616s (MacBook Pro 16" M4 Pro, T6040, Apple M4 Pro (G16S B1), macOS 26.6.2 fw, guarded one-shot 7.3.0-aurora-pr2905+, default cmdline, stock Stage 2 1.0.0b17, boot_id=e83ea75b) PASS: 0 failed units, Enforcing, 0 new AVC (1 matching baseline), 0 GPU faults, 0 subsystem errors, real rtc1 s2idle 2/2 (success=2 fail=0), TB 0-1 20.0 Gb/s x2 pre/post-sleep, Borealis VK dEQP-VK.api.smoke.* 8/8 (pre & post-sleep) + descriptor_pool.* 6/6, eDP connected pre/post-sleep, /dev/accel/accel0 + ane_t6021 + apple_sio + pmc + dart + hid_magicmouse loaded; stock 7.3.0-aurora-fleet89 restored & verified (7d2519ed).

@RyanTheTide
RyanTheTide merged commit d10e972 into aurora-silicon:main Nov 26, 2026
43 of 58 checks passed
@RyanTheTide

Copy link
Copy Markdown
Contributor

Merged into main (ORCH5 batch, 11-26). Thanks @m0d16l14n1! The exact-head hardware row it landed on is #3125 (comment).

Assisted-by: LLM (Claude:Opus 5.5)

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

Labels

area:gpu Area from CODEOWNERS (bot) area:platform Area from CODEOWNERS (bot) blast:all Macs affected, from Merge risk (bot) ci-failing A check failed at the PR head (bot) door:two-way Revertible or not, from Merge risk (bot)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants