Re: [PATCH v2] drm/gem: Drop ticket arg to lru_scan()
From: Rob Clark
Date: Thu Sep 03 2026 - 10:20:59 EST
On Tue, Sep 1, 2026 at 11:57 PM Thomas Zimmermann <tzimmermann@xxxxxxx> wrote:
>
>
>
> Am 01.09.26 um 18:45 schrieb Rob Clark:
> > Commit 3392291fc509 ("drm/msm: Fix shrinker deadlock") dropped the only
> > use of the ticket arg, but at the time left drm_gem_lru_scan() unchanged
> > to avoid conflicts with in-flight panthor shrinker support. This commit
> > is the followup to remove the unused arg.
> >
> > Signed-off-by: Rob Clark <robin.clark@xxxxxxxxxxxxxxxx>
> > Reviewed-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx>
> > Reviewed-by: Liviu Dudau <liviu.dudau@xxxxxxx>
>
> Reviewed-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
Could someone take this via drm-misc?
BR,
-R
> > ---
> >
> > v2: Drop left over kerneldoc param description, fix panthor spelling
> >
> > drivers/gpu/drm/drm_gem.c | 14 +++-----------
> > drivers/gpu/drm/msm/msm_gem_shrinker.c | 22 ++++++++++------------
> > drivers/gpu/drm/panthor/panthor_gem.c | 14 ++++++--------
> > drivers/gpu/drm/panthor/panthor_mmu.c | 5 ++---
> > drivers/gpu/drm/panthor/panthor_mmu.h | 3 +--
> > include/drm/drm_gem.h | 3 +--
> > 6 files changed, 23 insertions(+), 38 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> > index e3ed684ddcf2..3113b4a53b99 100644
> > --- a/drivers/gpu/drm/drm_gem.c
> > +++ b/drivers/gpu/drm/drm_gem.c
> > @@ -1649,15 +1649,13 @@ EXPORT_SYMBOL(drm_gem_lru_move_tail);
> > * @nr_to_scan: The number of pages to try to reclaim
> > * @remaining: The number of pages left to reclaim, should be initialized by caller
> > * @shrink: Callback to try to shrink/reclaim the object.
> > - * @ticket: Optional ww_acquire_ctx context to use for locking
> > */
> > unsigned long
> > drm_gem_lru_scan(struct drm_device *dev,
> > struct drm_gem_lru *lru,
> > unsigned int nr_to_scan,
> > unsigned long *remaining,
> > - bool (*shrink)(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket),
> > - struct ww_acquire_ctx *ticket)
> > + bool (*shrink)(struct drm_gem_object *obj))
> > {
> > struct drm_gem_lru still_in_lru;
> > struct drm_gem_object *obj;
> > @@ -1690,20 +1688,17 @@ drm_gem_lru_scan(struct drm_device *dev,
> > */
> > mutex_unlock(&dev->gem_lru_mutex);
> >
> > - if (ticket)
> > - ww_acquire_init(ticket, &reservation_ww_class);
> > -
> > /*
> > * Note that this still needs to be trylock, since we can
> > * hit shrinker in response to trying to get backing pages
> > * for this obj (ie. while it's lock is already held)
> > */
> > - if (!ww_mutex_trylock(&obj->resv->lock, ticket)) {
> > + if (!ww_mutex_trylock(&obj->resv->lock, NULL)) {
> > *remaining += obj->size >> PAGE_SHIFT;
> > goto tail;
> > }
> >
> > - if (shrink(obj, ticket)) {
> > + if (shrink(obj)) {
> > freed += obj->size >> PAGE_SHIFT;
> >
> > /*
> > @@ -1727,9 +1722,6 @@ drm_gem_lru_scan(struct drm_device *dev,
> >
> > dma_resv_unlock(obj->resv);
> >
> > - if (ticket)
> > - ww_acquire_fini(ticket);
> > -
> > tail:
> > drm_gem_object_put(obj);
> > mutex_lock(&dev->gem_lru_mutex);
> > diff --git a/drivers/gpu/drm/msm/msm_gem_shrinker.c b/drivers/gpu/drm/msm/msm_gem_shrinker.c
> > index 9d2788f79ace..3514d5c84989 100644
> > --- a/drivers/gpu/drm/msm/msm_gem_shrinker.c
> > +++ b/drivers/gpu/drm/msm/msm_gem_shrinker.c
> > @@ -102,7 +102,7 @@ with_vm_locks(void (*fn)(struct drm_gem_object *obj),
> > }
> >
> > static bool
> > -purge(struct drm_gem_object *obj, struct ww_acquire_ctx *unused)
> > +purge(struct drm_gem_object *obj)
> > {
> > if (!is_purgeable(to_msm_bo(obj)))
> > return false;
> > @@ -114,7 +114,7 @@ purge(struct drm_gem_object *obj, struct ww_acquire_ctx *unused)
> > }
> >
> > static bool
> > -evict(struct drm_gem_object *obj, struct ww_acquire_ctx *unused)
> > +evict(struct drm_gem_object *obj)
> > {
> > if (is_unevictable(to_msm_bo(obj)))
> > return false;
> > @@ -133,21 +133,21 @@ wait_for_idle(struct drm_gem_object *obj)
> > }
> >
> > static bool
> > -active_purge(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket)
> > +active_purge(struct drm_gem_object *obj)
> > {
> > if (!wait_for_idle(obj))
> > return false;
> >
> > - return purge(obj, ticket);
> > + return purge(obj);
> > }
> >
> > static bool
> > -active_evict(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket)
> > +active_evict(struct drm_gem_object *obj)
> > {
> > if (!wait_for_idle(obj))
> > return false;
> >
> > - return evict(obj, ticket);
> > + return evict(obj);
> > }
> >
> > static unsigned long
> > @@ -156,7 +156,7 @@ msm_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
> > struct msm_drm_private *priv = shrinker->private_data;
> > struct {
> > struct drm_gem_lru *lru;
> > - bool (*shrink)(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket);
> > + bool (*shrink)(struct drm_gem_object *obj);
> > bool cond;
> > unsigned long freed;
> > unsigned long remaining;
> > @@ -180,8 +180,7 @@ msm_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
> > stages[i].freed =
> > drm_gem_lru_scan(priv->dev, stages[i].lru, nr,
> > &stages[i].remaining,
> > - stages[i].shrink,
> > - NULL);
> > + stages[i].shrink);
> > nr -= stages[i].freed;
> > freed += stages[i].freed;
> > remaining += stages[i].remaining;
> > @@ -222,7 +221,7 @@ msm_gem_shrinker_shrink(struct drm_device *dev, unsigned long nr_to_scan)
> > static const int vmap_shrink_limit = 15;
> >
> > static bool
> > -vmap_shrink(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket)
> > +vmap_shrink(struct drm_gem_object *obj)
> > {
> > if (!is_vunmapable(to_msm_bo(obj)))
> > return false;
> > @@ -250,8 +249,7 @@ msm_gem_shrinker_vmap(struct notifier_block *nb, unsigned long event, void *ptr)
> > unmapped += drm_gem_lru_scan(priv->dev, lrus[idx],
> > vmap_shrink_limit - unmapped,
> > &remaining,
> > - vmap_shrink,
> > - NULL);
> > + vmap_shrink);
> > }
> >
> > *(unsigned long *)ptr += unmapped;
> > diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
> > index 54535bae2b0c..17408f832af3 100644
> > --- a/drivers/gpu/drm/panthor/panthor_gem.c
> > +++ b/drivers/gpu/drm/panthor/panthor_gem.c
> > @@ -1392,8 +1392,7 @@ panthor_gem_shrinker_count(struct shrinker *shrinker, struct shrink_control *sc)
> > return count ? count : SHRINK_EMPTY;
> > }
> >
> > -static bool panthor_gem_try_evict_no_resv_wait(struct drm_gem_object *obj,
> > - struct ww_acquire_ctx *ticket)
> > +static bool panthor_gem_try_evict_no_resv_wait(struct drm_gem_object *obj)
> > {
> > /*
> > * Track last locked entry for unwinding locks in error and
> > @@ -1479,8 +1478,7 @@ static bool panthor_gem_try_evict_no_resv_wait(struct drm_gem_object *obj,
> > return ret == 0;
> > }
> >
> > -static bool panthor_gem_try_evict(struct drm_gem_object *obj,
> > - struct ww_acquire_ctx *ticket)
> > +static bool panthor_gem_try_evict(struct drm_gem_object *obj)
> > {
> > struct panthor_gem_object *bo = to_panthor_bo(obj);
> >
> > @@ -1488,7 +1486,7 @@ static bool panthor_gem_try_evict(struct drm_gem_object *obj,
> > if (dma_resv_wait_timeout(obj->resv, DMA_RESV_USAGE_BOOKKEEP, false, 10) <= 0)
> > return false;
> >
> > - return panthor_gem_try_evict_no_resv_wait(&bo->base, ticket);
> > + return panthor_gem_try_evict_no_resv_wait(&bo->base);
> > }
> >
> > static unsigned long
> > @@ -1503,13 +1501,13 @@ panthor_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
> >
> > freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.unused,
> > sc->nr_to_scan - freed, &remaining,
> > - panthor_gem_try_evict_no_resv_wait, NULL);
> > + panthor_gem_try_evict_no_resv_wait);
> > if (freed >= sc->nr_to_scan)
> > goto out;
> >
> > freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.mmapped,
> > sc->nr_to_scan - freed, &remaining,
> > - panthor_gem_try_evict_no_resv_wait, NULL);
> > + panthor_gem_try_evict_no_resv_wait);
> > if (freed >= sc->nr_to_scan)
> > goto out;
> >
> > @@ -1523,7 +1521,7 @@ panthor_gem_shrinker_scan(struct shrinker *shrinker, struct shrink_control *sc)
> >
> > freed += drm_gem_lru_scan(&ptdev->base, &ptdev->reclaim.gpu_mapped_shared,
> > sc->nr_to_scan - freed, &remaining,
> > - panthor_gem_try_evict, NULL);
> > + panthor_gem_try_evict);
> >
> > out:
> > #ifdef CONFIG_DEBUG_FS
> > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> > index e10dbd18d8cf..ab070bc74857 100644
> > --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> > +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> > @@ -3133,8 +3133,7 @@ int panthor_vm_prepare_mapped_bos_resvs(struct drm_exec *exec, struct panthor_vm
> > unsigned long
> > panthor_mmu_reclaim_priv_bos(struct panthor_device *ptdev,
> > unsigned int nr_to_scan, unsigned long *remaining,
> > - bool (*shrink)(struct drm_gem_object *,
> > - struct ww_acquire_ctx *))
> > + bool (*shrink)(struct drm_gem_object *))
> > {
> > unsigned long freed = 0;
> > LIST_HEAD(remaining_vms);
> > @@ -3160,7 +3159,7 @@ panthor_mmu_reclaim_priv_bos(struct panthor_device *ptdev,
> >
> > freed += drm_gem_lru_scan(&ptdev->base, &vm->reclaim.lru,
> > nr_to_scan - freed,
> > - remaining, shrink, NULL);
> > + remaining, shrink);
> >
> > mutex_lock(&ptdev->base.gem_lru_mutex);
> >
> > diff --git a/drivers/gpu/drm/panthor/panthor_mmu.h b/drivers/gpu/drm/panthor/panthor_mmu.h
> > index 3522fbbce369..abc36e7204be 100644
> > --- a/drivers/gpu/drm/panthor/panthor_mmu.h
> > +++ b/drivers/gpu/drm/panthor/panthor_mmu.h
> > @@ -52,8 +52,7 @@ int panthor_vm_evict_bo_mappings_locked(struct panthor_gem_object *bo);
> > unsigned long
> > panthor_mmu_reclaim_priv_bos(struct panthor_device *ptdev,
> > unsigned int nr_to_scan, unsigned long *remaining,
> > - bool (*shrink)(struct drm_gem_object *,
> > - struct ww_acquire_ctx *));
> > + bool (*shrink)(struct drm_gem_object *));
> > int panthor_vm_prepare_mapped_bos_resvs(struct drm_exec *exec,
> > struct panthor_vm *vm,
> > u32 slot_count);
> > diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h
> > index 8a704f6a65c1..ffa607c91aa2 100644
> > --- a/include/drm/drm_gem.h
> > +++ b/include/drm/drm_gem.h
> > @@ -616,8 +616,7 @@ drm_gem_lru_scan(struct drm_device *dev,
> > struct drm_gem_lru *lru,
> > unsigned int nr_to_scan,
> > unsigned long *remaining,
> > - bool (*shrink)(struct drm_gem_object *obj, struct ww_acquire_ctx *ticket),
> > - struct ww_acquire_ctx *ticket);
> > + bool (*shrink)(struct drm_gem_object *obj));
> >
> > int drm_gem_evict_locked(struct drm_gem_object *obj);
> >
>
> --
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
> GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
>
>