diff options
author | Rob Clark <robdclark@chromium.org> | 2020-10-23 09:51:14 -0700 |
---|---|---|
committer | Rob Clark <robdclark@chromium.org> | 2020-11-04 16:00:56 -0800 |
commit | d984457b31c4c53d2af374d5e78b3eb64debd483 (patch) | |
tree | 6906b429387b1b6dfa172ea47e67398940b887db /drivers/gpu/drm/msm/msm_drv.c | |
parent | 2a86efb1bf72d25c64de3f2ff529a89e76ce7705 (diff) | |
download | lwn-d984457b31c4c53d2af374d5e78b3eb64debd483.tar.gz lwn-d984457b31c4c53d2af374d5e78b3eb64debd483.zip |
drm/msm: Add priv->mm_lock to protect active/inactive lists
Rather than relying on the big dev->struct_mutex hammer, introduce a
more specific lock for protecting the bo lists.
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Signed-off-by: Rob Clark <robdclark@chromium.org>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_drv.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_drv.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 49685571dc0e..81cb2cecc829 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -7,6 +7,7 @@ #include <linux/dma-mapping.h> #include <linux/kthread.h> +#include <linux/sched/mm.h> #include <linux/uaccess.h> #include <uapi/linux/sched/types.h> @@ -441,6 +442,12 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv) init_llist_head(&priv->free_list); INIT_LIST_HEAD(&priv->inactive_list); + mutex_init(&priv->mm_lock); + + /* Teach lockdep about lock ordering wrt. shrinker: */ + fs_reclaim_acquire(GFP_KERNEL); + might_lock(&priv->mm_lock); + fs_reclaim_release(GFP_KERNEL); drm_mode_config_init(ddev); |