From: Matthew Auld <matthew.auld@intel.com>
To: "Upadhyay, Tejas" <tejas.upadhyay@intel.com>,
"intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>
Cc: "Brost, Matthew" <matthew.brost@intel.com>,
"thomas.hellstrom@linux.intel.com"
<thomas.hellstrom@linux.intel.com>,
"Ghimiray, Himal Prasad" <himal.prasad.ghimiray@intel.com>
Subject: Re: [PATCH] drm/xe: Destroy mutex on gpu_buddy_init failure in VRAM manager init
Date: Tue, 28 Apr 2026 13:02:49 +0100 [thread overview]
Message-ID: <f73ddff4-86af-424b-a1c4-2636057887d7@intel.com> (raw)
In-Reply-To: <SN6PR11MB323249C2BF34D0C8805A2D9B81372@SN6PR11MB3232.namprd11.prod.outlook.com>
On 28/04/2026 12:40, Upadhyay, Tejas wrote:
>
>
>> -----Original Message-----
>> From: Auld, Matthew <matthew.auld@intel.com>
>> Sent: 28 April 2026 16:36
>> To: Upadhyay, Tejas <tejas.upadhyay@intel.com>; intel-
>> xe@lists.freedesktop.org
>> Cc: Brost, Matthew <matthew.brost@intel.com>;
>> thomas.hellstrom@linux.intel.com; Ghimiray, Himal Prasad
>> <himal.prasad.ghimiray@intel.com>
>> Subject: Re: [PATCH] drm/xe: Destroy mutex on gpu_buddy_init failure in
>> VRAM manager init
>>
>> On 28/04/2026 11:38, Matthew Auld wrote:
>>> On 28/04/2026 11:32, Tejas Upadhyay wrote:
>>>> In __xe_ttm_vram_mgr_init(), if gpu_buddy_init() fails, the function
>>>> returns early without calling mutex_destroy() on mgr->lock which was
>>>> previously initialized via mutex_init(). The normal cleanup path in
>>>> xe_ttm_vram_mgr_fini() is registered via drmm_add_action_or_reset()
>>>> only after gpu_buddy_init() succeeds, so it never runs for this error
>>>> case.
>>>>
>>>> Add mutex_destroy() before the early return to properly clean up the
>>>> initialized mutex.
>>>>
>>>> Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM buddy based VRAM
>>>> manager")
>>
>> Wait, where does this commit title come from? How did you generate this?
>
> Took claude AI recommendation on wording.
Ok, we shouldn't make up new commits that don't exist. The fixes tag
needs to always match a real commit, including the commit title. Also,
AFAIK this needs to be labelled with Assisted-by: <>, to be fully
transparent.
https://docs.kernel.org/process/coding-assistants.html
>
> Tejas
>>
>>>> Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com>
>>>> ---
>>>> drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 4 +++-
>>>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/
>>>> xe/xe_ttm_vram_mgr.c index 5fd0d5506a7e..3189e4b7ad05 100644
>>>> --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
>>>> +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
>>>> @@ -319,8 +319,10 @@ int __xe_ttm_vram_mgr_init(struct xe_device
>> *xe,
>>>> struct xe_ttm_vram_mgr *mgr,
>>>> ttm_resource_manager_init(man, &xe->ttm, size);
>>>> err = gpu_buddy_init(&mgr->mm, man->size, default_page_size);
>>>> - if (err)
>>>> + if (err) {
>>>> + mutex_destroy(&mgr->lock);
>>>> return err;
>>>> + }
>>>
>>> Can we not use drmm_mutex_init() instead? Also can then drop the
>>> manual destroy in fini(().
>>>
>>>> ttm_set_driver_manager(&xe->ttm, mem_type, &mgr->manager);
>>>> ttm_resource_manager_set_used(&mgr->manager, true);
>>>
>
next prev parent reply other threads:[~2026-04-28 12:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-28 10:32 [PATCH] drm/xe: Destroy mutex on gpu_buddy_init failure in VRAM manager init Tejas Upadhyay
2026-04-28 10:38 ` Matthew Auld
2026-04-28 11:05 ` Matthew Auld
2026-04-28 11:40 ` Upadhyay, Tejas
2026-04-28 12:02 ` Matthew Auld [this message]
2026-04-28 12:07 ` Upadhyay, Tejas
2026-04-28 13:42 ` ✗ CI.checkpatch: warning for " Patchwork
2026-04-28 13:43 ` ✓ CI.KUnit: success " Patchwork
2026-04-28 14:50 ` ✓ Xe.CI.BAT: " Patchwork
2026-04-29 1:27 ` ✗ Xe.CI.FULL: failure " Patchwork
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=f73ddff4-86af-424b-a1c4-2636057887d7@intel.com \
--to=matthew.auld@intel.com \
--cc=himal.prasad.ghimiray@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@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