[PATCH 08/25] drm/gem: Drop struct_mutex requirement from drm_gem_mmap_obj

David Herrmann dh.herrmann at gmail.com
Thu Oct 15 01:34:03 PDT 2015


Hi

On Thu, Oct 15, 2015 at 9:36 AM, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:
> Since
>
> commit 131e663bd6f1055caaff128f9aa5071d227eeb72
> Author: Daniel Vetter <daniel.vetter at ffwll.ch>
> Date:   Thu Jul 9 23:32:33 2015 +0200
>
>     drm/gem: rip out drm vma accounting for gem mmaps
>
> there is no need for this any more.
>
> Signed-off-by: Daniel Vetter <daniel.vetter at intel.com>

Looks good to me.

Reviewed-by: David Herrmann <dh.herrmann at gmail.com>

Thanks
David

> ---
>  drivers/gpu/drm/drm_gem.c                   | 4 ----
>  drivers/gpu/drm/drm_gem_cma_helper.c        | 2 --
>  drivers/gpu/drm/msm/msm_fbdev.c             | 5 -----
>  drivers/gpu/drm/msm/msm_gem_prime.c         | 2 --
>  drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c   | 2 --
>  drivers/gpu/drm/rockchip/rockchip_drm_gem.c | 2 --
>  6 files changed, 17 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index 3c2d4abd71c5..7dc4a8a066a3 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -810,8 +810,6 @@ EXPORT_SYMBOL(drm_gem_vm_close);
>   * drm_gem_mmap() prevents unprivileged users from mapping random objects. So
>   * callers must verify access restrictions before calling this helper.
>   *
> - * NOTE: This function has to be protected with dev->struct_mutex
> - *
>   * Return 0 or success or -EINVAL if the object size is smaller than the VMA
>   * size, or if no gem_vm_ops are provided.
>   */
> @@ -820,8 +818,6 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size,
>  {
>         struct drm_device *dev = obj->dev;
>
> -       lockdep_assert_held(&dev->struct_mutex);
> -
>         /* Check for valid size. */
>         if (obj_size < vma->vm_end - vma->vm_start)
>                 return -EINVAL;
> diff --git a/drivers/gpu/drm/drm_gem_cma_helper.c b/drivers/gpu/drm/drm_gem_cma_helper.c
> index 86cc793cdf79..4fb4c45d039f 100644
> --- a/drivers/gpu/drm/drm_gem_cma_helper.c
> +++ b/drivers/gpu/drm/drm_gem_cma_helper.c
> @@ -484,9 +484,7 @@ int drm_gem_cma_prime_mmap(struct drm_gem_object *obj,
>         struct drm_device *dev = obj->dev;
>         int ret;
>
> -       mutex_lock(&dev->struct_mutex);
>         ret = drm_gem_mmap_obj(obj, obj->size, vma);
> -       mutex_unlock(&dev->struct_mutex);
>         if (ret < 0)
>                 return ret;
>
> diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c
> index f97a1964ef39..3f6ec077b51d 100644
> --- a/drivers/gpu/drm/msm/msm_fbdev.c
> +++ b/drivers/gpu/drm/msm/msm_fbdev.c
> @@ -68,12 +68,7 @@ static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma)
>         if (drm_device_is_unplugged(dev))
>                 return -ENODEV;
>
> -       mutex_lock(&dev->struct_mutex);
> -
>         ret = drm_gem_mmap_obj(drm_obj, drm_obj->size, vma);
> -
> -       mutex_unlock(&dev->struct_mutex);
> -
>         if (ret) {
>                 pr_err("%s:drm_gem_mmap_obj fail\n", __func__);
>                 return ret;
> diff --git a/drivers/gpu/drm/msm/msm_gem_prime.c b/drivers/gpu/drm/msm/msm_gem_prime.c
> index 831461bc98a5..121975b07cd4 100644
> --- a/drivers/gpu/drm/msm/msm_gem_prime.c
> +++ b/drivers/gpu/drm/msm/msm_gem_prime.c
> @@ -45,9 +45,7 @@ int msm_gem_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
>  {
>         int ret;
>
> -       mutex_lock(&obj->dev->struct_mutex);
>         ret = drm_gem_mmap_obj(obj, obj->size, vma);
> -       mutex_unlock(&obj->dev->struct_mutex);
>         if (ret < 0)
>                 return ret;
>
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> index 0cc71c9d08d5..04da8c2ff9fe 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c
> @@ -146,9 +146,7 @@ static int omap_gem_dmabuf_mmap(struct dma_buf *buffer,
>         if (WARN_ON(!obj->filp))
>                 return -EINVAL;
>
> -       mutex_lock(&dev->struct_mutex);
>         ret = drm_gem_mmap_obj(obj, omap_gem_mmap_size(obj), vma);
> -       mutex_unlock(&dev->struct_mutex);
>         if (ret < 0)
>                 return ret;
>
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> index a6d9104f7f15..dc6d16c22db5 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_gem.c
> @@ -82,9 +82,7 @@ int rockchip_gem_mmap_buf(struct drm_gem_object *obj,
>         struct drm_device *drm = obj->dev;
>         int ret;
>
> -       mutex_lock(&drm->struct_mutex);
>         ret = drm_gem_mmap_obj(obj, obj->size, vma);
> -       mutex_unlock(&drm->struct_mutex);
>         if (ret)
>                 return ret;
>
> --
> 2.5.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list