Repository navigation
drm/asahi: mmu: publish a binding without the VM reservation - #2341
RyanTheTide wants to merge 1 commit into
Conversation
G16 publishes a job from inside a SignallingGuard section
(Shared::submit() from run_job, and Shared::run_poll()). Publishing
calls Vm::mark_binding_published() on the job's VM, which took the VM's
shared reservation through GpuVm::lock_inner() only to clone the UAT
handle out of VmInner:
run_job -> SchedJob::run -> Job::start -> Shared::submit (signalling)
-> Firmware::publish -> publish_prefix -> publish_prefix_into
-> Vm::mark_binding_published -> GpuVm::lock_inner -> dma_resv_lock
dma-fence signalling rules forbid that: code holding a reservation may
wait for fences, so a fence-signalling path that takes one can deadlock
against it, and dma_resv_lockdep() primes lockdep with exactly that
order. The comment in g16/job.rs already says work inside the guard must
not take reservations.
The UAT handle never changes after the VM is created. Keep a second
reference to it in Vm, next to the one in VmInner, and use it in
mark_binding_published(). The binding mutex and the UAT lock it takes
next are driver locks and stay as they are. The M3 caller gets the same
change and does not need the reservation either.
Fixes: 24f6733 ("drm/asahi: add the T8132 G16 firmware backend")
Link: #1563
Signed-off-by: Ryan Murray <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Blockers: 1.
The change itself is right. HW row: the change has never run. It needs a CONFIG_PROVE_LOCKING boot on this head on the G16 backend (M4 Air, J713), with a desktop session and a GPU benchmark long enough to publish jobs: 0 lockdep reports (in particular none naming Assisted-by: LLM (Claude:Opus 5.5) |
|
Replaced by #2799: the same changes with the commit trailers fixed, on the current integration/aurora. |
Fixes #1563
G16 publishes a job inside a
SignallingGuardsection:Shared::submit()fromrun_job, andShared::run_poll(). Publishing callsVm::mark_binding_published(), which took the VM's shared reservation throughGpuVm::lock_inner()(dma_resv_lock) only to clone the UAT handle out ofVmInner:That breaks the dma-fence signalling rules, because a holder of the reservation may wait for the fence this path signals, and
dma_resv_lockdep()primes lockdep with that order.g16/job.rsalready says work inside the guard must not take reservations.The UAT handle never changes after the VM is created, so
Vmnow keeps a secondArc<UatInner>next to the one inVmInner, andmark_binding_published()uses it. The binding mutex and the UAT lock it takes next are driver locks and are unchanged. No other path underg16/callslock_inner()orexec_lock*(). The M3 caller (m3_runtime.rs) gets the same change and does not need the reservation either. The VM state is selected exactly as before, so every chip with this backend gets the fix.Evidence
integration/aurora0abc2f3. arm64LLVM=1build ofdrivers/soc/apple/,drivers/gpu/drm/asahi/anddrivers/media/platform/apple/avd/with the fleet config (DRM_ASAHI=mwith G15/G16/G18/M5,APPLE_AOP=m; rustc 1.97.1, bindgen 0.73.2): rc 0, and no error or warning in the changed file.checkpatch.pl --strict: 0 errors. The only warnings are about theCo-Authored-Bytrailer form.Not run on hardware (no G16 machine here). A
CONFIG_PROVE_LOCKINGboot on an M4 with one published job is the hardware check: the circular-locking report described in #1563 should not appear.Assisted-by: LLM (Claude:Opus 5.5)