Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: Tejas Upadhyay <tejas.upadhyay@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <matthew.auld@intel.com>,
	<thomas.hellstrom@linux.intel.com>,
	<himal.prasad.ghimiray@intel.com>
Subject: Re: [PATCH] drm/xe: Use drmm_mutex_init for VRAM manager lock
Date: Wed, 29 Apr 2026 19:53:40 -0700	[thread overview]
Message-ID: <afLENIUh3fpDj9KF@gsse-cloud1.jf.intel.com> (raw)
In-Reply-To: <20260429093138.3899280-2-tejas.upadhyay@intel.com>

On Wed, Apr 29, 2026 at 03:01:39PM +0530, Tejas Upadhyay wrote:
> Replace mutex_init()/mutex_destroy() with drmm_mutex_init() for the
> VRAM manager lock. This leverages DRM managed infrastructure to
> automatically destroy the mutex during device teardown, eliminating
> manual mutex_destroy() calls in both the normal fini path and the
> gpu_buddy_init() error path.
> 
> Assisted-by: Claude:claude-opus-4.6
> Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>

Reviewed-by: Matthew Brost <matthew.brost@intel.com>

> ---
>  drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> index 5fd0d5506a7e..6ba47996bc7c 100644
> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
> @@ -292,8 +292,6 @@ static void xe_ttm_vram_mgr_fini(struct drm_device *dev, void *arg)
>  	ttm_resource_manager_cleanup(&mgr->manager);
>  
>  	ttm_set_driver_manager(&xe->ttm, mgr->mem_type, NULL);
> -
> -	mutex_destroy(&mgr->lock);
>  }
>  
>  int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr,
> @@ -312,7 +310,9 @@ int __xe_ttm_vram_mgr_init(struct xe_device *xe, struct xe_ttm_vram_mgr *mgr,
>  
>  	man->func = &xe_ttm_vram_mgr_func;
>  	mgr->mem_type = mem_type;
> -	mutex_init(&mgr->lock);
> +	err = drmm_mutex_init(&xe->drm, &mgr->lock);
> +	if (err)
> +		return err;
>  	mgr->default_page_size = default_page_size;
>  	mgr->visible_size = io_size;
>  	mgr->visible_avail = io_size;
> -- 
> 2.52.0
> 

      parent reply	other threads:[~2026-04-30  2:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-29  9:31 [PATCH] drm/xe: Use drmm_mutex_init for VRAM manager lock Tejas Upadhyay
2026-04-29  9:35 ` Matthew Auld
2026-04-29 11:24 ` ✓ CI.KUnit: success for " Patchwork
2026-04-29 12:31 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-29 21:02 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-04-30  2:53 ` Matthew Brost [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=afLENIUh3fpDj9KF@gsse-cloud1.jf.intel.com \
    --to=matthew.brost@intel.com \
    --cc=himal.prasad.ghimiray@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=tejas.upadhyay@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