On 11/17/26 2:54 PM, Shahyan Soltani wrote:
Anytime amdgpu_vm_pt_clear() is called, a job is committed through vm->update_funcs->commit(). If the GPU is currently using SDMA, this triggers the function amdgpu_vm_sdma_commit(), which requires a fence slot due to it utilizing dma_resv_add_fence(). Since this slot is not provided in amdgpu_vm_validate() a kernel crash can occur.Reserve a fence slot with dma_resv_reserve_fences() before amdgpu_vm_pt_clear() is called. Fixes: ddc3c87584e2 ("drm/amdgpu: clear vm pts upon a vm->generation mismatch") Signed-off-by: Shahyan Soltani <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 3bcfe0f3b35a..d5b758b5eb82 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -658,6 +658,9 @@ int amdgpu_vm_validate(struct amdgpu_device *adev, struct amdgpu_vm *vm, bo_base->moved = true;if (vm->generation != new_vm_generation) {+ r = dma_resv_reserve_fences(bo_base->bo->tbo.base.resv, 1); + if (r) + return r; r = amdgpu_vm_pt_clear(adev, vm, to_amdgpu_bo_vm(bo_base->bo), false); if (r) return r;
Just noticed the patch subject line typo. Should be: "drm/amdgpu: reserve fence slot within amdgpu_vm_validate()" Thanks, Shahyan
