drm/amdgpu: avoid restore process run into dead loop.
Subsystems (3)
PATCH 1/1 drm/amdgpu: avoid restore process run into dead loop.
In restore process worker, pinned BO cause update PTE fail, then the function re-schedule the restore_work. This will generate dead loop.
Signed-off-by Gang Ba <[email protected]>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4 -1
@@ -2586,7 +2586,7 @@ int amdgpu_amdkfd_gpuvm_export_ipc_obj(struct amdgpu_device *adev, void *vm,struct dma_buf *dmabuf;int r; -if (!adev|| !vm || !mem) +if (!adev || !vm || !mem)return -EINVAL ;mutex_lock (&mem->lock);
@@ -3170,6 +3170,9 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef)if (!attachment->is_mapped)continue ; +if (attachment->bo_va->base.bo->tbo.pin_count) +continue ; +kfd_mem_dmaunmap_attachment (mem, attachment); ret =update_gpuvm_pte (mem, attachment, &sync_obj);if (ret) {
Signature · 1 line
2.34.1
Am 2023-03-02 um 13:15 schrieb Gang Ba:
Quoted 4 lines
In restore process worker, pinned BO cause update PTE fail, then the function re-schedule the
restore_work. This will generate dead loop.Signed-off-by Gang Ba <[email protected]>
Reviewed-by Felix Kuehling <[email protected]>
Quoted 27 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4
-1@@ -2586,7 +2586,7 @@ int amdgpu_amdkfd_gpuvm_export_ipc_obj(struct amdgpu_device *adev, void *vm,struct dma_buf *dmabuf;int r; -if (!adev|| !vm || !mem) +if (!adev || !vm || !mem)return -EINVAL ;mutex_lock (&mem->lock);@@ -3170,6 +3170,9 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence **ef)if (!attachment->is_mapped)continue ; +if (attachment->bo_va->base.bo->tbo.pin_count) +continue ; +kfd_mem_dmaunmap_attachment (mem, attachment); ret =update_gpuvm_pte (mem, attachment, &sync_obj);if (ret) {