drm/msm: Move submit bo flags update from obj lock
authorRob Clark <robdclark@chromium.org>
Mon, 20 Mar 2023 14:43:24 +0000 (07:43 -0700)
committerRob Clark <robdclark@chromium.org>
Sat, 25 Mar 2023 23:31:43 +0000 (16:31 -0700)
The flags are only accessed (1) when submit is constructed, before
enqueuing to gpu sched (ie. when still visible to only the task calling
the submit ioctl), (2) here, where we own a reference to the submit and
are serialized on the gpu sched thread, and (3) after the submit is
retired and last reference is dropped, which is serialized on the
submit's reference count.  Hence locking is unneeded here.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/527830/
Link: https://lore.kernel.org/r/20230320144356.803762-3-robdclark@gmail.com
drivers/gpu/drm/msm/msm_ringbuffer.c

index a62b45e..a80447c 100644 (file)
@@ -26,8 +26,8 @@ static struct dma_fence *msm_job_run(struct drm_sched_job *job)
                msm_gem_lock(obj);
                msm_gem_unpin_vma_fenced(submit->bos[i].vma, fctx);
                msm_gem_unpin_locked(obj);
-               submit->bos[i].flags &= ~(BO_VMA_PINNED | BO_OBJ_PINNED);
                msm_gem_unlock(obj);
+               submit->bos[i].flags &= ~(BO_VMA_PINNED | BO_OBJ_PINNED);
        }
 
        /* TODO move submit path over to using a per-ring lock.. */