mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: rob.clark@oss.qualcomm.com
Cc: dri-devel@lists.freedesktop.org,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Dmitry Baryshkov <lumag@kernel.org>,
	Abhinav Kumar <abhinav.kumar@linux.dev>,
	Jessica Zhang <jesszhan0024@gmail.com>,
	Sean Paul <sean@poorly.run>,
	Marijn Suijten <marijn.suijten@somainline.org>,
	Steven Price <steven.price@arm.com>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:DRM DRIVER for Qualcomm display hardware"
	<linux-arm-msm@vger.kernel.org>,
	"open list:DRM DRIVER for Qualcomm display hardware"
	<freedreno@lists.freedesktop.org>
Subject: Re: [PATCH v2] drm/gem: Drop ticket arg to lru_scan()
Date: Thu, 3 Sep 2026 17:11:44 +0200	[thread overview]
Message-ID: <9e61d418-f8a6-4261-82e5-3b47df87e8fa@suse.de> (raw)
In-Reply-To: <CACSVV03XSo8U+8XR3Z=mQtD_kvHU_G22ne+Mb9yL1VHLc9SLTw@mail.gmail.com>

Hi

Am 03.09.26 um 16:09 schrieb Rob Clark:
> On Tue, Sep 1, 2026 at 11:57 PM Thomas Zimmermann <tzimmermann@suse.de> 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@oss.qualcomm.com>
>>> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
>>> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
>> Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
> Could someone take this via drm-misc?

Merged into drm-misc-next.

Best regards
Thomas

>
> 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)
>>
>>

-- 
--
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)



      reply	other threads:[~2026-09-03 15:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 16:45 Rob Clark
2026-09-02  6:57 ` Thomas Zimmermann
2026-09-03 14:09   ` Rob Clark
2026-09-03 15:11     ` Thomas Zimmermann [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9e61d418-f8a6-4261-82e5-3b47df87e8fa@suse.de \
    --to=tzimmermann@suse.de \
    --cc=abhinav.kumar@linux.dev \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jesszhan0024@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lumag@kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mripard@kernel.org \
    --cc=rob.clark@oss.qualcomm.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®