drm/kfd: Correct pined buffer handling at kfd restore and validate process
Subsystems (3)
PATCH 1/1 drm/kfd: Correct pined buffer handling at kfd restore and validate process
From: Xiaogang Chen <[email protected]>
This reverts 8a774fe912ff09e39c2d3a3589c729330113f388 "drm/amdgpu: avoid restore process run into dead loop" since buffer got pined is not related whether it needs mapping. And skip buffer validation at kfd driver if the buffer has been pinned.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +5 -4
@@ -415,6 +415,10 @@ static int amdgpu_amdkfd_bo_validate(struct amdgpu_bo *bo, uint32_t domain, "Called with userptr BO"))return -EINVAL ; +/* bo has been pined, not need validate it */ +if (bo->tbo.pin_count) +return 0 ; +amdgpu_bo_placement_from_domain (bo, domain); ret =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);
@@ -2736,7 +2740,7 @@ static int confirm_valid_user_pages_locked(struct amdkfd_process_info *process_i/* keep mem without hmm range at userptr_inval_list */ if (!mem->range) -continue ; +continue ;/* Only check mem with hmm range associated */ valid = amdgpu_ttm_tt_get_user_pages_done(
@@ -2981,9 +2985,6 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence __rcu *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.25.1
Quoted 4 lines · Xiaogang.Chen
From: Xiaogang Chen <[email protected]>
This reverts
8a774fe912ff09e39c2d3a3589c729330113f388"drm/amdgpu: avoid restore process run into dead loop" since buffer got pined is not related whether it
Spelling: pined -> pinned
Same in the commit headline.
Quoted 13 lines
needs mapping. And skip buffer validation at kfd driver if the buffer has been pinned.
Signed-off-by Xiaogang Chen <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c static int amdgpu_amdkfd_bo_validate(struct amdgpu_bo *bo, uint32_t domain, · line 418
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +1
-0@@ -415,6 +415,10 @@ static int amdgpu_amdkfd_bo_validate(struct amdgpu_bo *bo, uint32_t domain, "Called with userptr BO"))return -EINVAL ; +/* bo has been pined, not need validate it */
pined -> pinned
With those typos fixed, the patch is
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +4
-4+if (bo->tbo.pin_count) +return 0 ; +amdgpu_bo_placement_from_domain (bo, domain); ret =ttm_bo_validate (&bo->tbo, &bo->placement, &ctx);@@ -2736,7 +2740,7 @@ static int confirm_valid_user_pages_locked(struct amdkfd_process_info *process_i/* keep mem without hmm range at userptr_inval_list */ if (!mem->range) -continue ; +continue ;/* Only check mem with hmm range associated */ valid = amdgpu_ttm_tt_get_user_pages_done(@@ -2981,9 +2985,6 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *info, struct dma_fence __rcu *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) {