drm/amdkfd: fix the clean up when amdgpu_hmm_range_alloc fails
Subsystems (3)
PATCH v3 1/1 drm/amdkfd: fix the clean up when amdgpu_hmm_range_alloc fails
we need to unreserve the bo's too during clean up along with freeing the memory of context.
Fixes c549912cd8 (drm/amdkfd: add missing return value check for range)
Signed-off-by Sunil Khatri <[email protected]>
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +4 -6
@@ -1738,14 +1738,12 @@ static int svm_range_validate_and_map(struct mm_struct *mm,WRITE_ONCE (p->svms.faulting_task, current); range =amdgpu_hmm_range_alloc (NULL ); -if (unlikely (!range)) { - r = -ENOMEM ; - goto free_ctx; - } - - r =amdgpu_hmm_range_get_pages (&prange->notifier, addr, npages, +if (likely (range)) + r =amdgpu_hmm_range_get_pages (&prange->notifier, addr, npages, readonly, owner, range); +else + r = -ENOMEM ;WRITE_ONCE (p->svms.faulting_task,NULL );if (r) {amdgpu_hmm_range_free (range);
Signature · 1 line
2.34.1
Quoted 17 lines · Sunil Khatri
we need to unreserve the bo's too during clean up along with freeing the memory of context.
Fixes c549912cd8 (drm/amdkfd: add missing return value check for range)Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)drivers/gpu/drm/amd/amdkfd/kfd_svm.c +0
-0@@ -1738,14 +1738,12 @@ static int svm_range_validate_and_map(struct mm_struct *mm,WRITE_ONCE (p->svms.faulting_task, current); range =amdgpu_hmm_range_alloc (NULL );
drivers/gpu/drm/amd/amdkfd/kfd_svm.c static int svm_range_validate_and_map(struct mm_struct *mm, · line 1744
Quoted 10 lines
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +2
-6-if (unlikely (!range)) { - r = -ENOMEM ; - goto free_ctx; - } - - r =amdgpu_hmm_range_get_pages (&prange->notifier, addr, npages, +if (likely (range)) + r =amdgpu_hmm_range_get_pages (&prange->notifier, addr, npages, readonly, owner, range);
Please fix the indentation here so the parameters line up with the open parenthesis. With that fixed, the patch is
Reviewed-by Felix Kuehling <[email protected]>
Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +2
-0+else + r = -ENOMEM ;WRITE_ONCE (p->svms.faulting_task,NULL );if (r) {amdgpu_hmm_range_free (range);