Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm/vma: Avoid lock in VM_BIND fence signaling path

Use msm_gem_unpin_active(), similar to what is used in the GEM_SUBMIT
path. This avoids needing to hold the obj lock, and the end result is
the same. (As with GEM_SUBMIT, we know the fence isn't signaled yet.)

Reported-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Fixes: 2e6a8a1fe2b2 ("drm/msm: Add VM_BIND ioctl")
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/712230/
Message-ID: <20260316184442.673558-1-robin.clark@oss.qualcomm.com>

Rob Clark 8a7023b0 9d24ec32

+9 -3
+3
drivers/gpu/drm/msm/msm_gem.c
··· 507 507 */ 508 508 void msm_gem_unpin_active(struct drm_gem_object *obj) 509 509 { 510 + struct msm_drm_private *priv = obj->dev->dev_private; 510 511 struct msm_gem_object *msm_obj = to_msm_bo(obj); 512 + 513 + GEM_WARN_ON(!mutex_is_locked(&priv->lru.lock)); 511 514 512 515 msm_obj->pin_count--; 513 516 GEM_WARN_ON(msm_obj->pin_count < 0);
+6 -3
drivers/gpu/drm/msm/msm_gem_vma.c
··· 696 696 msm_vma_job_run(struct drm_sched_job *_job) 697 697 { 698 698 struct msm_vm_bind_job *job = to_msm_vm_bind_job(_job); 699 + struct msm_drm_private *priv = job->vm->drm->dev_private; 699 700 struct msm_gem_vm *vm = to_msm_vm(job->vm); 700 701 struct drm_gem_object *obj; 701 702 int ret = vm->unusable ? -EINVAL : 0; ··· 739 738 if (ret) 740 739 msm_gem_vm_unusable(job->vm); 741 740 741 + mutex_lock(&priv->lru.lock); 742 + 742 743 job_foreach_bo (obj, job) { 743 - msm_gem_lock(obj); 744 - msm_gem_unpin_locked(obj); 745 - msm_gem_unlock(obj); 744 + msm_gem_unpin_active(obj); 746 745 } 746 + 747 + mutex_unlock(&priv->lru.lock); 747 748 748 749 /* VM_BIND ops are synchronous, so no fence to wait on: */ 749 750 return NULL;