OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
* [Devel] [PATCH hci-8.1] drm/amdgpu: free the buddy allocator when dmem region registration fails
@ 2026-11-16  3:38 Mirian Shilakadze
  2026-11-16  3:45 ` no-reply
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Mirian Shilakadze @ 2026-11-16  3:38 UTC (permalink / raw)
  To: khorenko; +Cc: devel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-16 16:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16  3:38 [Devel] [PATCH hci-8.1] drm/amdgpu: free the buddy allocator when dmem region registration fails Mirian Shilakadze
2026-11-16  3:45 ` no-reply
2026-11-16 16:03 ` Konstantin Khorenko
2026-11-16 16:03 ` Konstantin Khorenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox