]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/msm: use trylock for debugfs
authorRob Clark <robdclark@chromium.org>
Sun, 29 Jun 2025 20:13:22 +0000 (13:13 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:25:56 +0000 (16:25 +0200)
commit6e8421d4f231a15268583fe783f2424ef528ca6c
tree50030efe9b4ce53fe9509a764e0d9e8807f1a1b8
parented032248af5b927668ea56c8c9945d2e0cac1f06
drm/msm: use trylock for debugfs

[ Upstream commit 0a1ff88ec5b60b41ba830c5bf08b6cd8f45ab411 ]

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/
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/msm/msm_gem.c
drivers/gpu/drm/msm/msm_gem.h