From: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1] drm/amdgpu: free the buddy allocator when dmem region registration fails
Date: Mon, 16 Nov 2026 07:38:01 +0400 [thread overview]
Message-ID: <20261116033832.26787-1-mirian.shilakadze@virtuozzo.com> (raw)
Since commit ffbc4c6f4d0b ("ms/drm/amdgpu: Fix init ordering in
amdgpu_vram_mgr_init()") the dmem cgroup region is registered after
drm_buddy_init(). When drmm_cgroup_register_region() fails,
amdgpu_vram_mgr_init() returns without drm_buddy_fini(), so a probe
failing there leaks the buddy allocator.
Free it on that error path. Upstream does the same in commit
bd4f284df04d ("drm/amdgpu: Wire up dmem cgroup reclaim for VRAM
manager"), which also wires up dmem reclaim and is not taken here.
Fixes: ffbc4c6f4d0b ("ms/drm/amdgpu: Fix init ordering in amdgpu_vram_mgr_init()")
https://virtuozzo.atlassian.net/browse/VSTOR-154845
Feature: fix ms/drm
Signed-off-by: Mirian Shilakadze <mirian.shilakadze@virtuozzo.com>
---
Item 1 from the review of VSTOR-153702.
Not run: we have no node with an AMD GPU. Build-tested only,
amdgpu_vram_mgr.o compiles with the 211.52.1.22.22 config.
drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
index 2e457a0388a3..11679506de47 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c
@@ -932,8 +932,10 @@ int amdgpu_vram_mgr_init(struct amdgpu_device *adev)
return err;
man->cg = drmm_cgroup_register_region(adev_to_drm(adev), "vram", adev->gmc.real_vram_size);
- if (IS_ERR(man->cg))
+ if (IS_ERR(man->cg)) {
+ drm_buddy_fini(&mgr->mm);
return PTR_ERR(man->cg);
+ }
ttm_set_driver_manager(&adev->mman.bdev, TTM_PL_VRAM, &mgr->manager);
ttm_resource_manager_set_used(man, true);
--
2.43.0
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
next reply other threads:[~2026-11-16 3:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 3:38 Mirian Shilakadze [this message]
2026-11-16 3:45 ` no-reply
2026-11-16 16:03 ` Konstantin Khorenko
2026-11-16 16:03 ` Konstantin Khorenko
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=20261116033832.26787-1-mirian.shilakadze@virtuozzo.com \
--to=mirian.shilakadze@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.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 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.