Repository navigation
M3 Pro GPU crash fix: preserve new mappings during deferred GEM close - #214
Conversation
Return success when a VM BO has no mappings instead of returning an uninitialized stack value. Deferred-close cleanup can reach this case; a garbage error return marks cleanup failed and blocks the VM. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja>
Allow immediate-mode drivers to remove selected mappings of one GEM without allocating an operation list. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja>
A dma-buf reimport can return the same GEM while cleanup for a closed handle is queued. Stamp each binding and remove only mappings covered by the close-time sequence, preserving later maps instead of unmapping them. Keep the indexed BO path when no newer binding exists. A map step that takes its sequence after the close snapshot survives deferred cleanup. Signed-off-by: Eryk Wieliczko <eryk@wieliczko.ninja>
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThis PR limits deferred GEM-close cleanup to mappings covered by the close’s saved binding sequence.
No actionable issues were found. The review checked source paths; it did not run a build or hardware tests.
|
|
GREEN at 13c3371 Read: the full diff (7 files) and, at this head, mmu.rs, mmu/bind.rs and mmu/lifetime.rs around every changed line, plus drm_gpuvm_bo_unmap() in drm_gpuvm.c. I did not build it and did not run it; nothing below comes from a boot. Lifetime and ordering, traced:
drm_gpuvm.c: Non-blocking nits:
Not checked: build, rustfmt, any run. The description reports 50/50 regression cases, 10 Settings launches and 10 Light/Dark cycles on a 14-inch M3 Pro; those do not deterministically hit "close, reimport, bind, drain" in that order, so a unit-level or loop test for that order would be the next thing worth having, but I do not hold the merge for it. |
There was a problem hiding this comment.
Reviewed 13c3371ce23dceabad0fffd1d16ee121adb93dff. No blocking finding in the changed code. The close-time bound is applied consistently to GPUVAs, context bindings and shared bindings; remap pieces retain their original sequence, and both ENOMEM paths use filtered cleanup. Initializing the empty BO-unmap result is also needed.
Built and booted that exact head on a 16-inch M3 Pro (J516S), M1 MacBook Pro (J293) and M1 Air (J313), with native Mesa 147a62f619 unchanged.
Independent shared-buffer stress on each Mac: 100/100 cycles passed, checking all 16,384 words after GPU readback each time. A separate DRM file retains the producer dma-buf; the Vulkan consumer closes and reimports it while unrelated valid GPU work is outstanding, waits for that work to retire, then fills and reads the imported buffer. The fence remained pending across close and reimport in every cycle. A libdrm observer confirmed actual GEM closes, PRIME imports and new VM binds. This exercises the relevant userspace traffic, but does not instrument the kernel's exact drain scheduling.
OpenGL and Vulkan rendered-pixel checks also passed on all three, with no GPU/DART faults observed during the test workloads. Connected external displays remained active: 4K/120 on J293, 1080p/60 on J313, and two 4K/60 outputs on J516S.
| Machine | vkQuake demo1 median FPS | glmark2 | vkmark |
|---|---|---|---|
| M1 MacBook Pro | 512.0 | 1280 | 7592 |
| M1 Air | 510.0 | 1227 | 7328 |
| M3 Pro | 187.5 | 709 | 2272 |
vkQuake used the same executable/assets/settings, screenshot-confirmed 1920×1080, one warmup and three measured runs. Differences from our earlier kernels were small; these results do not establish a performance gain.
Limits: I have not independently reproduced the original Plasma crash on an unpatched kernel. Our desktop differs from stock KWin, and this is neither full CTS nor forced-ENOMEM coverage. This is not full hardware qualification. Both M1s returned to their normal kernels with original boot files/packages verified. The M3 return-boot failure was traced to our local cleanup service deleting the baseline kernel’s unowned modules during the test boot. This was a module-retention mistake outside this diff. The M3 is back on its preserved fallback; the deleted modules are restored and retained, but the newer baseline has not been boot-tested again.
chriskearney
left a comment
There was a problem hiding this comment.
Approved at 13c3371 after code review and hardware testing on J516S, J293 and J313. Detailed results and test limitations are in my earlier review; no blocking finding in this diff.
|
Hand build of integration/aurora tip 19f4965 (this PR, merged; also carries #211/#212/#213). Package release 7.2.11-tip19f49651-ARCH+, package sha256 36952afbd4b3f4270ccbb166857dab926c6abf56a0bb0bac185c3ab765c17d80, one-shot boot only, stock default untouched.
CI on this PR: 12 pass, 2 skipped. Regressions: none found. Boot/wifi/input/display/audio/ANE all pass; dmesg error classes match the stock baseline (no new GPU/MMU/UAT/fault lines — the only grep hit is the benign "iommu: Default domain type" boot line); GPU driver, Vulkan and OpenGL checks pass; SEP stays healthy (no failure/refusal lines; this machine has an enrolled fingerprint, and the driver behaved with xart writes enabled). glmark2-es2 on the candidate: build 9352, shading 9031 — the stock numbers taken the same day (6513/5489) were measured at 18% battery while charging, so the pair is not a like-for-like comparison; treat it as "runs, no faults", not a perf claim. Limit: this machine has an M2 GPU, so this PR's M3-Pro deferred-close path is not exercised — it proves the surrounding gpuvm/GEM changes compile, boot and do not regress the shared path on M2. |
Bring drivers/gpu/drm/asahi up to the aurora-silicon/linux state at d3cf19b, the base of the G17 performance series that follows, merged three-way on top of integration/aurora with the 7.2.10 merge point 44d5afc as base. integration/aurora's own work is kept: the G15 backend, the M3 T8122 runtime, UAT adoption, deferred-close binding sequences (omacom#214) and the 7.2.11 shared-code adaptations. The G16 (T8132) backend is not carried. This carries the G17 work merged on the aurora side since 7.2.10, including the T6040 (M4 Pro) and 25G83 firmware support and the render replay/recovery series by Jonathan Goyvaerts, the watchdog, replay and backing-population changes by Ryan Murray, the tracked VM lifetime work by Eryk Wieliczko, and the G17 queue, capacity and timestamp changes by DjDeveloperr (aurora-silicon/linux AsahiLinux#382, #391, AsahiLinux#397, AsahiLinux#400). Adaptations to 7.2.11: - module parameters return references; THIS_MODULE replaces kernel::module::this_module; a local raw_try_init replaces the newer pin-init helper; of_device_table! takes the MODULE_OF_TABLE name. - regs.rs keeps G17's sgx window as Devres<IoMem>, as 7.2 has no DevresIoMem. - The shared feature flags keep G17's opt-out of soft faults. - G15 and the M3 runtime use the shared timestamp::Buffer and the reserved-table aware root walk; omacom's G15 vm_closed hook becomes vm_destroyed, next to the G17 vm_closed. - Crate and helper pieces the driver needs: the shmem SG lease and pages_no_reclaim (drm_gem_shmem_helper), DRM file memory stats, fdinfo and is_current_master, and the mm RSS counter. Signed-off-by: DjDeveloperr <hey@djdev.me>
<ai>
Fix deferred GEM-close cleanup removing new mappings when the same dma-buf is reimported. Found while investigating M3 Pro GPU crashes in Plasma Settings.
Use binding sequences to preserve newer mappings while retaining the indexed cleanup fast path. Also initialize the empty BO-unmap result.
Tested the complete series on M3 Pro with stock KWin: clean build and boot, 50/50 GPU regression cases, 10 Settings launches and 10 Breeze Light/Dark cycles. No GPU/MMU faults or compositor restarts.
</ai>