Repository navigation
drm/asahi: keep work-queue firmware structures until the context is invalidated - #601
Conversation
…nvalidated When a queue is destroyed while it still has jobs on the GPU, drm_sched_fini() cancels the scheduler jobs, but the firmware keeps running the commands it already holds. Each work queue then stays alive only through its event slot and is dropped from the completion path as soon as its last stamp is seen. Dropping it frees its queue info (ring state, ring and notifier list), and the last command frees the queue's notifier and threshold. Those come from the shared and private kernel allocators, so the memory can be reused right away. The GPU context that the firmware still associates those structures with is only invalidated at the next alloc(), so until then the firmware can still refer to a work queue whose memory has already been handed out. The context data already keeps the tile vertex buffer alive until it is invalidated. Do the same for the queue structures. A GpuContext now keeps a list of retained objects. A work queue moves its queue info there when it is dropped, and the queue adds its notifier when it is created. The list travels with the context data to the garbage list and is freed once DestroyContext has completed. The queue info points to the context weakly now, since the context owns it from then on. This closes the lifetime window for those two objects. On its own it does not stop the sustained-teardown firmware crash on the M1 Pro (G13X): that crash still reproduces with this change, so at least one other kernel object on the teardown path is read by the firmware after it is freed and reused. Investigation continues. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]> (cherry picked from commit d5ee0bd) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The convergence stack build is still waiting for a buildbox slot, because every slot is busy with other builds. It is buildbox |
|
The stack build passed: |
|
Boot-tested in fleet10 (7.3.0-aurora-fleet10): integration/aurora 1173b79 plus 587, 588, 589, 590, 596, 599, 600, 601, 603, 604, 605, 607 and 608, built with the shipping recipe (Fedora Asahi base + asahi.config, 0 mismatches, all distro gates). apple-dcp host selftests 80/80, and the other host tests match integration/aurora exactly (62 pass, the same 26 pre-existing failures). One-shot boots on the Neo (J700), the M2 and the M1 Pro, compared with each machine's fleet9 boot; fleet10 is now the default on all three. Full dmesg and journals are in aurora-ctl reports/fleet10-20261030. Result for this PR: pass.
|
This carries d5ee0bd from aurora-wip onto integration/aurora, as part of converging the two kernel lines.
A queue destroyed with jobs still on the GPU dropped its work queues' firmware structures (queue info, ring, notifier list) and its notifier as soon as the last stamp was seen. The GPU context those structures belong to is only invalidated at the next
alloc(), so until then the firmware could still refer to memory that had been handed out again. AGpuContextnow keeps these objects until DestroyContext has completed. This is the same thing the context data already does for the tile vertex buffer.The original commit says so too: this closes the window for those two objects, but on its own it does not stop the sustained-teardown firmware crash on the M1 Pro (G13X). At least one other object on that path is still read after it is freed.
Testing
🤖 Generated with Claude Code