]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/msm: make sure last_fence is always updated
authorAnna Maniscalco <anna.maniscalco2000@gmail.com>
Sat, 11 Oct 2025 13:45:10 +0000 (15:45 +0200)
committerRob Clark <robin.clark@oss.qualcomm.com>
Thu, 16 Oct 2025 14:47:40 +0000 (07:47 -0700)
Update last_fence in the vm-bind path instead of kernel managed path.

last_fence is used to wait for work to finish in vm_bind contexts but not
used for kernel managed contexts.

This fixes a bug where last_fence is not waited on context close leading
to faults as resources are freed while in use.

Fixes: 92395af63a99 ("drm/msm: Add VM_BIND submitqueue")
Signed-off-by: Anna Maniscalco <anna.maniscalco2000@gmail.com>
Patchwork: https://patchwork.freedesktop.org/patch/680080/
Message-ID: <20251011-close_fence_wait_fix-v3-1-5134787755ff@gmail.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
drivers/gpu/drm/msm/msm_gem_submit.c

index 3ab3b27134f93b01236fec5833a18a6e2ad2cf5e..75d9f357437006ff261db148901e176eae670d41 100644 (file)
@@ -414,6 +414,11 @@ static void submit_attach_object_fences(struct msm_gem_submit *submit)
                                         submit->user_fence,
                                         DMA_RESV_USAGE_BOOKKEEP,
                                         DMA_RESV_USAGE_BOOKKEEP);
+
+               last_fence = vm->last_fence;
+               vm->last_fence = dma_fence_unwrap_merge(submit->user_fence, last_fence);
+               dma_fence_put(last_fence);
+
                return;
        }
 
@@ -427,10 +432,6 @@ static void submit_attach_object_fences(struct msm_gem_submit *submit)
                        dma_resv_add_fence(obj->resv, submit->user_fence,
                                           DMA_RESV_USAGE_READ);
        }
-
-       last_fence = vm->last_fence;
-       vm->last_fence = dma_fence_unwrap_merge(submit->user_fence, last_fence);
-       dma_fence_put(last_fence);
 }
 
 static int submit_bo(struct msm_gem_submit *submit, uint32_t idx,