aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/msm/msm_gem.h
diff options
context:
space:
mode:
authorRob Clark <robdclark@chromium.org>2021-03-31 18:27:20 -0700
committerRob Clark <robdclark@chromium.org>2021-04-07 11:05:43 -0700
commit6ed0897cd800c38b92a33d335d9086c7b092eb15 (patch)
tree750784c11ed9a90dba54f4b45761a9558be05c29 /drivers/gpu/drm/msm/msm_gem.h
parentdrm/msm: Avoid mutex in shrinker_count() (diff)
downloadlinux-dev-6ed0897cd800c38b92a33d335d9086c7b092eb15.tar.xz
linux-dev-6ed0897cd800c38b92a33d335d9086c7b092eb15.zip
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>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gem.h')
-rw-r--r--drivers/gpu/drm/msm/msm_gem.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h
index 13aabfe92dac..e6b28edb1db9 100644
--- a/drivers/gpu/drm/msm/msm_gem.h
+++ b/drivers/gpu/drm/msm/msm_gem.h
@@ -61,9 +61,15 @@ struct msm_gem_object {
uint8_t vmap_count;
/**
+ * Node in list of all objects (mainly for debugfs, protected by
+ * priv->obj_lock
+ */
+ struct list_head node;
+
+ /**
* An object is either:
- * inactive - on priv->inactive_dontneed/willneed/purged depending
- * on status
+ * inactive - on priv->inactive_dontneed or priv->inactive_willneed
+ * (depending on purgability status)
* active - on one one of the gpu's active_list.. well, at
* least for now we don't have (I don't think) hw sync between
* 2d and 3d one devices which have both, meaning we need to