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: use trylock for debugfs

This resolves a potential deadlock vs msm_gem_vm_close(). Otherwise for
_NO_SHARE buffers msm_gem_describe() could be trying to acquire the
shared vm resv, while already holding priv->obj_lock. But _vm_close()
might drop the last reference to a GEM obj while already holding the vm
resv, and msm_gem_free_object() needs to grab priv->obj_lock, a locking
inversion.

OTOH this is only for debugfs and it isn't critical if we undercount by
skipping a locked obj. So just use trylock() and move along if we can't
get the lock.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
Tested-by: Antonino Maniscalco <antomani103@gmail.com>
Reviewed-by: Antonino Maniscalco <antomani103@gmail.com>
Patchwork: https://patchwork.freedesktop.org/patch/661525/

authored by

Rob Clark and committed by
Rob Clark
0a1ff88e 05a24968

+8 -1
+2 -1
drivers/gpu/drm/msm/msm_gem.c
··· 938 938 uint64_t off = drm_vma_node_start(&obj->vma_node); 939 939 const char *madv; 940 940 941 - msm_gem_lock(obj); 941 + if (!msm_gem_trylock(obj)) 942 + return; 942 943 943 944 stats->all.count++; 944 945 stats->all.size += obj->size;
+6
drivers/gpu/drm/msm/msm_gem.h
··· 280 280 dma_resv_lock(obj->resv, NULL); 281 281 } 282 282 283 + static inline bool __must_check 284 + msm_gem_trylock(struct drm_gem_object *obj) 285 + { 286 + return dma_resv_trylock(obj->resv); 287 + } 288 + 283 289 static inline int 284 290 msm_gem_lock_interruptible(struct drm_gem_object *obj) 285 291 {