drm/msm: Fix debugfs deadlock
authorRob Clark <robdclark@chromium.org>
Thu, 1 Apr 2021 01:27:20 +0000 (18:27 -0700)
committerRob Clark <robdclark@chromium.org>
Wed, 7 Apr 2021 18:05:43 +0000 (11:05 -0700)
commit6ed0897cd800c38b92a33d335d9086c7b092eb15
tree750784c11ed9a90dba54f4b45761a9558be05c29
parentcc8a4d5a1bd84a37ff1827e2902c459e9b2d4e25
drm/msm: Fix debugfs deadlock

In normal cases the gem obj lock is acquired first before mm_lock.  The
exception is iterating the various object lists.  In the shrinker path,
deadlock is avoided by using msm_gem_trylock() and skipping over objects
that cannot be locked.  But for debugfs the straightforward thing is to
split things out into a separate list of all objects protected by it's
own lock.

Fixes: d984457b31c4 ("drm/msm: Add priv->mm_lock to protect active/inactive lists")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Tested-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Link: https://lore.kernel.org/r/20210401012722.527712-4-robdclark@gmail.com
Signed-off-by: Rob Clark <robdclark@chromium.org>
drivers/gpu/drm/msm/msm_debugfs.c
drivers/gpu/drm/msm/msm_drv.c
drivers/gpu/drm/msm/msm_drv.h
drivers/gpu/drm/msm/msm_gem.c
drivers/gpu/drm/msm/msm_gem.h