From c07143d6abdceadafc72ab37b24e6196015e8514 Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Thu, 19 Nov 2026 22:42:20 +1100 Subject: [PATCH] drm/asahi: mmu: publish a binding without the VM reservation 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: 24f67337c9d5 ("drm/asahi: add the T8132 G16 firmware backend") Link: https://github.com/aurora-silicon/linux/issues/1563 Signed-off-by: Ryan Murray Co-Authored-By: Claude Opus 5.5 --- drivers/gpu/drm/asahi/mmu.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/asahi/mmu.rs b/drivers/gpu/drm/asahi/mmu.rs index 4337024993025..a38b2e6888fd6 100644 --- a/drivers/gpu/drm/asahi/mmu.rs +++ b/drivers/gpu/drm/asahi/mmu.rs @@ -1233,6 +1233,9 @@ pub(crate) struct Vm { private_bytes: Arc, /// [`UatQuirks::narrow_pool_window`]. narrow_pool_window: bool, + /// The UAT this VM was created on, the same one [`VmInner`] holds. Kept here so that + /// [`Vm::mark_binding_published`] reaches it without the VM reservation. + uat_inner: Arc, } no_debug!(Vm); @@ -2538,7 +2541,7 @@ impl Vm { bind_sequence: bind_sequence.clone(), epoch: Some(0), mm, - uat_inner, + uat_inner: uat_inner.clone(), binding: binding.clone(), id, sparse_tiles: [None, None], @@ -2566,6 +2569,7 @@ impl Vm { binding, private_bytes: Arc::new(AtomicU64::new(0), GFP_KERNEL)?, narrow_pool_window, + uat_inner, }) } @@ -3125,8 +3129,11 @@ impl Vm { } /// Spend the binding generation only for an incarnation exposed to firmware. + /// + /// G16 publishes jobs inside a `SignallingGuard` section, so this must not take the VM + /// reservation: a thread holding it may wait for a fence that this publication signals. pub(crate) fn mark_binding_published(&self) -> Result { - let uat = self.gpuvm.lock_inner().uat_inner.clone(); + let uat = &self.uat_inner; let binding = self.binding.lock(); let slot = binding.binding.as_ref().ok_or(EIO)?.slot() as usize + UAT_USER_CTX_START; let mut shared = uat.lock();