From: "Cavitt, Jonathan" <jonathan.cavitt@intel.com>
To: "Brost, Matthew" <matthew.brost@intel.com>
Cc: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"Gupta, Saurabhg" <saurabhg.gupta@intel.com>,
"Zuo, Alex" <alex.zuo@intel.com>,
"thomas.hellstrom@linux.intel.com"
<thomas.hellstrom@linux.intel.com>,
"maarten.lankhorst@linux.intel.com"
<maarten.lankhorst@linux.intel.com>
Subject: RE: [PATCH v2] drm/pagemap_util: Ensure proper cache lock management on free
Date: Tue, 24 Feb 2026 23:15:09 +0000 [thread overview]
Message-ID: <CH0PR11MB5444626B957BE2E7B5F66D9CE574A@CH0PR11MB5444.namprd11.prod.outlook.com> (raw)
In-Reply-To: <aZ4wJle/SaHCpj5A@lstrano-desk.jf.intel.com>
-----Original Message-----
From: Brost, Matthew <matthew.brost@intel.com>
Sent: Tuesday, February 24, 2026 3:12 PM
To: Cavitt, Jonathan <jonathan.cavitt@intel.com>
Cc: dri-devel@lists.freedesktop.org; Gupta, Saurabhg <saurabhg.gupta@intel.com>; Zuo, Alex <alex.zuo@intel.com>; thomas.hellstrom@linux.intel.com; maarten.lankhorst@linux.intel.com
Subject: Re: [PATCH v2] drm/pagemap_util: Ensure proper cache lock management on free
>
> On Tue, Feb 24, 2026 at 03:48:33PM +0000, Jonathan Cavitt wrote:
> > Static analysis issue:
> >
> > Though probably unnecessary given the cache is being freed at this step,
> > for the sake of consistency, ensure that the cache lock is always
> > unlocked after drm_pagemap_cache_fini.
> >
> > v2:
> > - Use requested code flow (Maarten)
> >
> > Fixes: 77f14f2f2d73f ("drm/pagemap: Add a drm_pagemap cache and shrinker")
> > Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> > Cc: Thomas Hellstrom <thomas.hellstrom@linux.intel.com>
> > Cc: Matthew Brost <matthew.brost@intel.com>
> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> > ---
> > drivers/gpu/drm/drm_pagemap_util.c | 13 ++++---------
> > 1 file changed, 4 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_pagemap_util.c b/drivers/gpu/drm/drm_pagemap_util.c
> > index 14ddb948a32e..66203a19f8f6 100644
> > --- a/drivers/gpu/drm/drm_pagemap_util.c
> > +++ b/drivers/gpu/drm/drm_pagemap_util.c
> > @@ -65,18 +65,13 @@ static void drm_pagemap_cache_fini(void *arg)
> > drm_dbg(cache->shrinker->drm, "Destroying dpagemap cache.\n");
> > spin_lock(&cache->lock);
> > dpagemap = cache->dpagemap;
> > - if (!dpagemap) {
> > - spin_unlock(&cache->lock);
> > - goto out;
> > - }
> > + if (dpagemap && !drm_pagemap_shrinker_cancel(dpagemap))
> > + dpagemap = NULL;
> > + spin_unlock(&cache->lock);
> >
> > - if (drm_pagemap_shrinker_cancel(dpagemap)) {
> > - cache->dpagemap = NULL;
> > - spin_unlock(&cache->lock);
> > + if (dpagemap)
> > drm_pagemap_destroy(dpagemap, false);
>
> The logic is different here as 'cache->dpagemap' never gets set to NULL
> under cache->lock when drm_pagemap_shrinker_cancel returns true.
I forgot to add this back in as a part of the v2 request, although in this case,
cache->dpagemap = NULL can just be assigned as such without checking the
return of drm_pagemap_shrinker_cancel.
I'll fix this for V3 and add the intel-xe list at that time. Thank you.
-Jonathan Cavitt
>
> Also be sure to include intel-xe list for CI too.
>
> Matt
>
> > - }
> >
> > -out:
> > mutex_destroy(&cache->lookup_mutex);
> > kfree(cache);
> > }
> > --
> > 2.43.0
> >
>
next prev parent reply other threads:[~2026-02-24 23:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-24 15:48 [PATCH v2] drm/pagemap_util: Ensure proper cache lock management on free Jonathan Cavitt
2026-02-24 23:11 ` Matthew Brost
2026-02-24 23:15 ` Cavitt, Jonathan [this message]
2026-02-27 5:07 ` Claude review: " Claude Code Review Bot
2026-02-27 5:07 ` Claude Code Review Bot
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=CH0PR11MB5444626B957BE2E7B5F66D9CE574A@CH0PR11MB5444.namprd11.prod.outlook.com \
--to=jonathan.cavitt@intel.com \
--cc=alex.zuo@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matthew.brost@intel.com \
--cc=saurabhg.gupta@intel.com \
--cc=thomas.hellstrom@linux.intel.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