Re: [PATCH v1 7/7] drm/shmem-helper: Switch to reservation lock
From: Emil Velikov
Date: Mon Apr 03 2023 - 10:02:14 EST
Hi Dmitry,
On Sun, 2 Apr 2023 at 17:49, Dmitry Osipenko
<dmitry.osipenko@xxxxxxxxxxxxx> 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@xxxxxxxxx>
HTH
-Emil