Skip to content

Commit

Permalink
drm/kfd: Correct pinned buffer handling at kfd restore and validate p…
Browse files Browse the repository at this point in the history
…rocess

This reverts commit 8a774fe ("drm/amdgpu: avoid restore process run into dead loop")
since buffer got pinned is not related whether it needs mapping
And skip buffer validation at kfd driver if the buffer has been pinned.

Signed-off-by: Xiaogang Chen <[email protected]>
Reviewed-by: Felix Kuehling <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
  • Loading branch information
Xiaogang Chen authored and alexdeucher committed May 17, 2024
1 parent b194d21 commit f326d7c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 pinned, 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);
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f326d7c

Please sign in to comment.