Applying as is.
On Fri, 06 Nov 2026 18:55:18 +0400, Mirian Shilakadze wrote:
> Thomas Hellström (1):
> ms/drm/amdgpu: Fix init ordering in amdgpu_vram_mgr_init()
Thanks. Your reading of the probe path is right: a failed GMC sw_init
never reaches amdgpu_ttm_fini(), so the crash cannot happen here.
Separate patches, not needed for this one; I created a task for
each:
1. amdgpu_vram_mgr_init(): free the buddy allocator when
drmm_cgroup_register_region() fails, call drm_buddy_fini(&mgr->mm)
before "return PTR_ERR(man->cg);".
Why: the registration now runs after drm_buddy_init(), and with no
teardown on that path an -ENOMEM at probe leaks the buddy memory.
Upstream added the same call in bd4f284df04d ("drm/amdgpu: Wire up
dmem cgroup reclaim for VRAM manager"), the reclaim wiring we did
not take.
https://virtuozzo.atlassian.net/browse/VSTOR-154845
2. Backport 7d0507772406 ("drm/buddy: release free_trees array on buddy
mm teardown").
Why: our drm_buddy_fini() frees each free tree but not the
free_trees array itself, so every amdgpu or xe unload leaks it.
https://virtuozzo.atlassian.net/browse/VSTOR-154850
3. amdgpu_ttm_init() and gmc_v*_sw_init(): undo ttm_device_init() on
the error paths after it. Fix it upstream first (amd-gfx), then
backport.
Why: a probe that fails after ttm_device_init() (a VRAM or GTT heap
error, gart_init, -ENOMEM) never reaches ttm_device_fini(), because
sw_fini is skipped for a block whose sw_init failed. The bdev stays
on the TTM global device list while adev is freed with the failed
probe, and the next TTM swapout or ttm_device_init() of another GPU
walks into freed memory. Mainline has the same code.
https://virtuozzo.atlassian.net/browse/VSTOR-154875
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel