From: "Michał Grzelak" <michal.grzelak@intel.com>
To: "Lin, Shuicheng" <shuicheng.lin@intel.com>
Cc: "Grzelak, Michal" <michal.grzelak@intel.com>,
"intel-xe@lists.freedesktop.org"
<intel-xe@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"Brost, Matthew" <matthew.brost@intel.com>,
"thomas.hellstrom@linux.intel.com"
<thomas.hellstrom@linux.intel.com>,
"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
"Auld, Matthew" <matthew.auld@intel.com>
Subject: RE: [RESEND 1/1] drm/buddy: release free_trees array on buddy mm teardown
Date: Tue, 23 Dec 2025 08:35:34 +0100 (CET) [thread overview]
Message-ID: <771e8879-4122-8bea-826f-97f9f75932d8@intel.com> (raw)
In-Reply-To: <DM4PR11MB54560DF369537BCE07175297EAA9A@DM4PR11MB5456.namprd11.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 1840 bytes --]
On Fri, 19 Dec 2025, Lin, Shuicheng wrote:
> On Fri, Dec 19, 2025 11:33 AM Michał Grzelak wrote:
>> During initialization of DRM buddy memory manager at drm_buddy_init,
>> mm->free_trees array is allocated for both clear and dirty RB trees.
>> During cleanup happening at drm_buddy_fini it is never freed, leading to
>> following memory leaks observed on xe module load & unload cycles:
>>
>> kmemleak_alloc+0x4a/0x90
>> __kmalloc_cache_noprof+0x488/0x800
>> drm_buddy_init+0xc2/0x330 [drm_buddy]
>> __xe_ttm_vram_mgr_init+0xc3/0x190 [xe]
>> xe_ttm_stolen_mgr_init+0xf5/0x9d0 [xe]
>> xe_device_probe+0x326/0x9e0 [xe]
>> xe_pci_probe+0x39a/0x610 [xe]
>> local_pci_probe+0x47/0xb0
>> pci_device_probe+0xf3/0x260
>> really_probe+0xf1/0x3c0
>> __driver_probe_device+0x8c/0x180
>> driver_probe_device+0x24/0xd0
>> __driver_attach+0x10f/0x220
>> bus_for_each_dev+0x7f/0xe0
>> driver_attach+0x1e/0x30
>> bus_add_driver+0x151/0x290
>>
>> Deallocate array for free trees when cleaning up buddy memory manager in
>> the same way as if going through out_free_tree label.
>>
>> Fixes: d4cd665c98c1 ("drm/buddy: Separate clear and dirty free block trees")
>> Signed-off-by: Michał Grzelak <michal.grzelak@intel.com>
>> Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
>
> I also meet this issue. And the fix LGTM. It has the same logic as the failure path of drm_buddy_init().
> Reviewed-by: Shuicheng Lin <shuicheng.lin@intel.com>
Thank you Shuicheng for the review and confirmation. Will update the
commit message along your R-B in next round of resend.
BTW, do you have any recommendation regarding the tree via which this
change should be merged? Asking since I don't have the commit bit to any
of drm-* trees.
BR,
Michał
next prev parent reply other threads:[~2025-12-23 7:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 19:32 [RESEND 1/1] drm/buddy: release free_trees array on buddy mm teardown Michał Grzelak
2025-12-19 20:38 ` Lin, Shuicheng
2025-12-23 7:35 ` Michał Grzelak [this message]
2025-12-23 17:14 ` Lin, Shuicheng
2025-12-22 14:59 ` ✓ CI.KUnit: success for series starting with [RESEND,1/1] " Patchwork
2025-12-22 15:54 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-12-23 8:07 ` Michał Grzelak
2025-12-22 17:13 ` ✓ Xe.CI.Full: success " Patchwork
2026-01-19 16:25 ` [RESEND 1/1] " Matthew Auld
2026-01-20 5:27 ` Arunpravin Paneer Selvam
2026-01-20 10:40 ` Matthew Auld
-- strict thread matches above, loose matches on Subject: below --
2025-12-08 10:27 [RESEND 0/1] " Michał Grzelak
2025-12-08 10:27 ` [RESEND 1/1] " Michał Grzelak
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=771e8879-4122-8bea-826f-97f9f75932d8@intel.com \
--to=michal.grzelak@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=matthew.brost@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=shuicheng.lin@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