Skip to content

Revert "drm/asahi: drain deferred BO cleanup after immediate GEM close" - #1885

Merged
DjDeveloperr merged 1 commit into
integration/aurorafrom
fix/revert-f8a53798-gem-close-bo-drain
Nov 14, 2026
Merged

DjDeveloperr merged 1 commit into
integration/aurorafrom
fix/revert-f8a53798-gem-close-bo-drain

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

Revert "drm/asahi: drain deferred BO cleanup after immediate GEM close" (f8a5379).

Symptom

On a J314/J316 (M1 Pro, G13S), under sustained Vulkan CTS with the shipped Mesa, the GPU firmware takes an intermittent RTKit EL1t data abort: ESR 0x96000004, FAR non-canonical and different each time (e.g. 0x5000000000, 0x14bd48..., 0x72800ffffffa0), and the GPU wedges until reboot. Rate is about one crash per two full mustpass passes.

Mechanism

f8a5379 added a synchronous self.bo_deferred_cleanup() to drop_mappings_now(), the immediate GEM-close path, so an imported object's final VM-BO put is reclaimed at close instead of on a later deferred pass.

The deferred-cleanup list exists so a BO's backing and GPUVM mappings are freed at a firmware-quiescent point. GEM close is not such a point: draining there frees and unmaps memory the firmware may still be storing through for in-flight work. The firmware then stores through a stale/unmapped GPUVA and faults with a wild FAR, wedging the GPU.

A/B

fleet73 base (integration 17a7c5fa), shipped Mesa held constant, 1 pass = 246 chunks / 1,470,718 cases:

kernel contents result
base f8a5379 present 2 crashes in ~3 passes (FAR 0x5000000000, 0x14bd48...)
r1 revert the unrelated g13 stamp-lifecycle commit 88aa658, f8a5379 present crashed on pass 2 (FAR 0x72800ffffffa0) — 88aa658 is not the cause
r2 revert f8a5379, 88aa658 kept 3 full back-to-back passes, 4,412,154 cases, 0 firmware crashes

88aa658 is exonerated and kept; reverting f8a5379 restores the firmware-safe deferred free.

Follow-up

The dma-buf import retention f8a5379 targeted (linux-aurora#458) is a delayed free, not a leak. It should be re-addressed by triggering the deferred cleanup from a firmware-completion/idle point rather than from GEM close.

Host tests

tools/asahi/run-host-tests.py 319/319 pass; apple-dcp selftests 88 ok / 0 not ok. (The revert removes gem-close-cleanup-tests.py, which exercised the reverted code path, dropping the host-test count from 323 to 319.)

This reverts commit f8a5379.

That commit added a synchronous self.bo_deferred_cleanup() to
drop_mappings_now(), the immediate GEM-close path, so that an imported
object's final VM-BO put is reclaimed at close instead of on a later
deferred-cleanup pass. The deferred cleanup list exists precisely so a
BO's backing and GPUVM mappings are freed at a firmware-quiescent point:
GEM close is not such a point. Draining it there frees and unmaps memory
the GPU firmware may still be storing through for in-flight work, so the
firmware stores through a stale/unmapped GPUVA and takes a data abort with
a wild FAR, wedging the GPU.

Reproduced on a J314/J316 (M1 Pro, G13S) under sustained Vulkan CTS with
the shipped Mesa: an intermittent RTKit EL1t data abort (ESR 0x96000004),
FAR non-canonical and different each time (e.g. 0x5000000000, 0x14bd48...,
0x72800ffffffa0), GPU wedged until reboot, about once per two full mustpass
passes. A/B on the fleet73 base (integration 17a7c5f), shipped Mesa held
constant: with this commit present, 2 crashes in ~3 mustpass passes, and a
kernel with the unrelated g13 stamp-lifecycle commit 88aa658 reverted (this
commit still present) crashed again on its second pass; with this commit
reverted (88aa658 kept) 3 full back-to-back mustpass passes (4,412,154
cases) ran with zero firmware crashes.

Reverting restores the firmware-safe deferred free. The dma-buf import
retention this commit targeted (Anees Iqbal, linux-aurora#458) is a delayed
free, not a leak, and should be re-addressed by triggering the deferred
cleanup from a firmware-completion/idle point rather than from GEM close.

Reported-by: Anees Iqbal <[email protected]>
Link: omacom/linux-aurora#458
Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
@RyanTheTide

Copy link
Copy Markdown
Contributor Author

Soak follow-up on an M1 Pro (T6000, G13S), production shipped Mesa 26.3.0-23 (ICD 1.4.363), full Vulkan vk-full mustpass, 246 chunks / 1,470,718 cases per pass.

Ran 4 more full passes on the kernel with this revert applied (integration 17a7c5f + revert of f8a5379, keeping 88aa658; source 456f03f7), one-shot boot, no other change:

pass chunks Pass NotSupported Fail GPU fw crashes
1 246/246 456647 1014071 0 0
2 246/246 456644 1014071 3 0
3 246/246 456647 1014071 0 0
4 246/246 456646 1014071 1 0

5,882,872 cases, 0 GPU firmware crashes, 0 GPU wedges, no co-processor has crashed in dmesg or any per-chunk kernel log. The 4 Fails are the pre-existing transient blit / multisample-resolve dPM-timeout artifact (present on the un-reverted kernel too, 0–3 per pass); not a crash and not a new Pass→Fail.

Combined with the earlier 3 clean passes on the same kernel: 7 full passes, 10,295,026 cases, 0 GPU firmware crashes.

The un-reverted kernel takes this fault about once per two passes (EL1t data abort, ESR 0x96000004, wild non-canonical FAR, GPU wedged until reboot). Probability of 0 crashes across 7 passes if the revert made no difference is ~3% at that rate (~97% confidence; ~99.5% at the higher observed rate of ~0.75/pass). A sibling kernel that reverts only the other suspect (88aa658) while keeping f8a5379 still crashed with the same wild-FAR signature, so f8a5379 is the differentiator.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants