Commit 278a7087 authored by Alex Sierra's avatar Alex Sierra Committed by Alex Deucher

drm/amdkfd: use hmm range fault to get both domain pfns

Now that prange could have mixed domains (VRAM or SYSRAM),
actual_loc nor svm_bo can not be used to check its current
domain and eventually get its pfns to map them in GPU.
Instead, pfns from both domains, are now obtained from
hmm_range_fault through amdgpu_hmm_range_get_pages
call. This is done everytime a GPU map occur.
Signed-off-by: default avatarAlex Sierra <alex.sierra@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1fc160cf
...@@ -1426,7 +1426,6 @@ static int svm_range_validate_and_map(struct mm_struct *mm, ...@@ -1426,7 +1426,6 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
svm_range_reserve_bos(&ctx); svm_range_reserve_bos(&ctx);
if (!prange->actual_loc) {
p = container_of(prange->svms, struct kfd_process, svms); p = container_of(prange->svms, struct kfd_process, svms);
owner = kfd_svm_page_owner(p, find_first_bit(ctx.bitmap, owner = kfd_svm_page_owner(p, find_first_bit(ctx.bitmap,
MAX_GPU_INSTANCE)); MAX_GPU_INSTANCE));
...@@ -1453,16 +1452,13 @@ static int svm_range_validate_and_map(struct mm_struct *mm, ...@@ -1453,16 +1452,13 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
} }
prange->validated_once = true; prange->validated_once = true;
}
svm_range_lock(prange); svm_range_lock(prange);
if (!prange->actual_loc) {
if (amdgpu_hmm_range_get_pages_done(hmm_range)) { if (amdgpu_hmm_range_get_pages_done(hmm_range)) {
pr_debug("hmm update the range, need validate again\n"); pr_debug("hmm update the range, need validate again\n");
r = -EAGAIN; r = -EAGAIN;
goto unlock_out; goto unlock_out;
} }
}
if (!list_empty(&prange->child_list)) { if (!list_empty(&prange->child_list)) {
pr_debug("range split by unmap in parallel, validate again\n"); pr_debug("range split by unmap in parallel, validate again\n");
r = -EAGAIN; r = -EAGAIN;
...@@ -2797,16 +2793,6 @@ svm_range_trigger_migration(struct mm_struct *mm, struct svm_range *prange, ...@@ -2797,16 +2793,6 @@ svm_range_trigger_migration(struct mm_struct *mm, struct svm_range *prange,
best_loc == prange->actual_loc) best_loc == prange->actual_loc)
return 0; return 0;
/*
* Prefetch to GPU without host access flag, set actual_loc to gpu, then
* validate on gpu and map to gpus will be handled afterwards.
*/
if (best_loc && !prange->actual_loc &&
!(prange->flags & KFD_IOCTL_SVM_FLAG_HOST_ACCESS)) {
prange->actual_loc = best_loc;
return 0;
}
if (!best_loc) { if (!best_loc) {
r = svm_migrate_vram_to_ram(prange, mm); r = svm_migrate_vram_to_ram(prange, mm);
*migrated = !r; *migrated = !r;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment