Repository navigation
drm/asahi: mmu: publish a binding without the VM reservation - #2799
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]>
|
Review at 24f98b9 (non-author, draft). No blocker found; ready once a lockdep boot row is in.
Small points, not blocking:
Assisted-by: LLM (Claude:Opus 5.5) |
Signed-off-by: Ryan Murray <[email protected]>
There was a problem hiding this comment.
Verdict: MERGE at 12ed5b3 after the lockdep and required hosted checks.
Checked: Vm and VmInner receive references to the same UAT at construction. Publication now uses the VM's retained reference directly. The binding-to-UAT acquisition order, live slot/root validation and publication update are preserved, with no VM reservation acquisition in this method. No DT change. The J713 submit and fresh-client row covers ordinary operation, with M1 Pro and J473 shared-MMU smoke. Please keep a lockdep-enabled G16 submit row to validate the signalling section and its remaining locks.
|
code-owner ping <@422957901716652033> / @DjDeveloperr: merge train at |
|
Merge readiness at
Areas: Updated by pr-readiness on pushes, edits, reviews and comments, and on a schedule. Rules: merge policy · labels. |
|
Merging under the 6-point rule (Ryan 09:29, permanent), at |
What: G16:
Vm::mark_binding_published()no longer takes the VM reservation. It runs inside the job's signalling section, where taking a reservation breaks the dma-fence rules (#1563). The VM keeps its own handle to the UAT. Fixes #1563.Tested: J713 (M4 Air, G16G) at 24f98b9 in the combined one-shot kernel 7.3.0-aurora-dsw2: gpubench-vk submit/compute/render at depths 1 and 4 rc 0, 30 fresh short-lived Vulkan clients 0 failed, no GPU fault/timeout/recovery lines, 0 WARN/BUG, s2idle rc 0, 0 failed units. Shared mmu.rs regression on three more GPU families, same kernel and tests, all clean: M1 Pro (G13S), J473 (G14G), J616s (M4 Pro, G16S B1: gpubench submit/compute/render rc 0, 30 fresh Vulkan clients 0 failed, 0 GPU fault/timeout lines, s2idle rc 0).
Risk: two-way · all Macs on drm/asahi (shared mmu.rs; the change is G16's publish path)
Not yet: a lockdep-enabled run that triggers the old splat (the fleet config has no lockdep)
Evidence
CONFIG_USB_BILLBOARD=m), LLVM 22.1.6 / rustc 1.97.1. Build warnings are the same as main's. This PR's files there are byte-identical to the head 12ed5b3, which is 24f98b9 + a cleanMerge main into isw/g16-mark-published-resv-v2.grub2-reboot, no Stage 2 or DTB change. Each Mac went back to its saved fleet kernel, the test kernel was removed, and production state was verified: saved entry, empty next_entry, Enforcing, 0 failed units.charge_behaviour=force-dischargewindow on both kernels, one 15 s s2idle on the wakeup RTC, error-level dmesg diffed against the fleet kernel's boot. On J713 the one new line (external display processor unusable (probe failed: -110)) comes from main code since 11-25 and shows on other main-based J713 boots too. The others come from the s2idle and match the fleet kernel's own s2idle.Original description
Replaces #2341 (same changes, commit trailers fixed).
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, 0 warnings.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.