From: sashiko-bot@kernel.org
To: "Mario Limonciello" <mario.limonciello@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/3] drm/amdgpu: unwind bo_init on GMC sw_init failure
Date: Fri, 13 Nov 2026 14:56:54 +0000 [thread overview]
Message-ID: <sashiko-outbox-213039@kernel.org> (raw)
In-Reply-To: <20261113-superm1-amdgpu-memory-leak-v1-2-4a495cfc2c92@amd.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amdgpu: gmc_v*_sw_init() calls amdgpu_bo_fini() with
GART/PDB0 BOs pinned
--
commit 4e2abeed7577cfdf2a67e81d9af414ebfbc361c6
Author: Mario Limonciello <mario.limonciello@amd.com>
drm/amdgpu: unwind bo_init on GMC sw_init failure
This commit unwinds amdgpu_bo_init() and amdgpu_vm_manager_init() when
gmc_v*_sw_init() fails after initializing the memory manager across GMC v6
through v12.
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> index 49f593fe2a876..e59fee3955af0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v10_0.c
> @@ -861,7 +861,7 @@ static int gmc_v10_0_sw_init(struct amdgpu_ip_block *ip_block)
>
> r = gmc_v10_0_gart_init(adev);
> if (r)
> - return r;
> + goto err_bo_fini;
>
> /*
> * number of VMs
> @@ -880,9 +880,15 @@ static int gmc_v10_0_sw_init(struct amdgpu_ip_block *ip_block)
>
> r = amdgpu_gmc_ras_sw_init(adev);
> if (r)
> - return r;
> + goto err_vm_fini;
>
> return 0;
> +
> +err_vm_fini:
> + amdgpu_vm_manager_fini(adev);
> +err_bo_fini:
> + amdgpu_bo_fini(adev);
> + return r;
> }
[Severity: Medium]
Does jumping to err_vm_fini tear down TTM while adev->gart.bo is still
pinned?
gmc_v10_0_gart_init() allocates and pins adev->gart.bo in VRAM. If
amdgpu_gmc_ras_sw_init() fails, err_vm_fini calls amdgpu_bo_fini() without
first freeing the GART table as gmc_v10_0_sw_fini() does. Because pinned
BOs cannot be evicted during amdgpu_ttm_fini(), gpu_buddy_fini() and
drm_mm_takedown() hit warnings and leak the pinned BOs and their backing
allocations.
The same missing GART cleanup affects the err_vm_fini paths in GMC v7, v8,
v9, v11, and v12. On GMC v9 and v12, gmc_v*_gart_init() also allocates
and pins adev->gmc.pdb0_bo when amdgpu_gmc_is_pdb0_enabled() is true, so
both err_vm_fini and a failure in amdgpu_gmc_pdb0_alloc() within
gmc_v*_gart_init() reach amdgpu_bo_fini() with pinned BOs still allocated.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113-superm1-amdgpu-memory-leak-v1-0-4a495cfc2c92@amd.com?part=2
next prev parent reply other threads:[~2026-11-13 14:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 14:41 [PATCH 0/3] drm/amdgpu: fix TTM device_list use-after-free on failed probe Mario Limonciello
2026-11-13 14:41 ` [PATCH 1/3] drm/amdgpu: unwind TTM on amdgpu_ttm_init() failure Mario Limonciello
2026-11-13 14:41 ` [PATCH 2/3] drm/amdgpu: unwind bo_init on GMC sw_init failure Mario Limonciello
2026-11-13 14:56 ` sashiko-bot [this message]
2026-11-13 15:47 ` Mario Limonciello
2026-11-13 14:41 ` [PATCH 3/3] drm/amdgpu: release WC memtype and MTRR when amdgpu_bo_init() fails Mario Limonciello
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=sashiko-outbox-213039@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=mario.limonciello@amd.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.