[Intel-gfx] [PATCH v1 7/7] drm/shmem-helper: Switch to reservation lock

Emil Velikov emil.l.velikov at gmail.com
Mon Apr 3 14:01:57 UTC 2023


Hi Dmitry,

On Sun, 2 Apr 2023 at 17:49, Dmitry Osipenko
<dmitry.osipenko at collabora.com> wrote:

> -void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem)
> +static int drm_gem_shmem_pin_locked(struct drm_gem_shmem_object *shmem)
>  {
> -       mutex_lock(&shmem->pages_lock);
> -       drm_gem_shmem_put_pages_locked(shmem);
> -       mutex_unlock(&shmem->pages_lock);
> +       struct drm_gem_object *obj = &shmem->base;
> +       int ret;
> +
> +       dma_resv_assert_held(shmem->base.resv);
> +
> +       drm_WARN_ON(obj->dev, obj->import_attach);
> +

We don't need this WARN_ON to happen with a reservation lock, do we?
If so, let's leave that in the caller.

> +       ret = drm_gem_shmem_get_pages(shmem);
> +
> +       return ret;
> +}
> +
> +static void drm_gem_shmem_unpin_locked(struct drm_gem_shmem_object *shmem)
> +{
> +       struct drm_gem_object *obj = &shmem->base;
> +
> +       dma_resv_assert_held(shmem->base.resv);
> +
> +       drm_WARN_ON(obj->dev, obj->import_attach);
> +

Ditto.

With that the series is:
Reviewed-by; Emil Velikov <emil.l.velikov at gmail.com>

HTH
-Emil


More information about the Intel-gfx mailing list