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 <[email protected]>
---
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
[email protected]
https://lists.openvz.org/mailman/listinfo/devel