drm/amdgpu: avoid memory allocation in the critical code path v3
authorChristian König <christian.koenig@amd.com>
Wed, 29 Oct 2025 14:36:32 +0000 (15:36 +0100)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 14 Nov 2025 16:27:46 +0000 (11:27 -0500)
commit20459c098d688971237e56e30263ddce467c8c9b
tree1245f4d9412bfa1199e7680a676648b9626324c3
parentf8bdb559c01e8291f1862ee9ab4a7eb13d6d62ac
drm/amdgpu: avoid memory allocation in the critical code path v3

When we run out of VMIDs we need to wait for some to become available.
Previously we were using a dma_fence_array for that, but this means that
we have to allocate memory.

Instead just wait for the first not signaled fence from the least recently
used VMID to signal. That is not as efficient since we end up in this
function multiple times again, but allocating memory can easily fail or
deadlock if we have to wait for memory to become available.

v2: remove now unused VM manager fields
v3: fix dma_fence reference

Signed-off-by: Christian König <christian.koenig@amd.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4258
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h