Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amdgpu: fix root reservation in amdgpu_vm_handle_fault

svm_range_restore_pages might reserve the root bo so it must
be called after unreserving it.

Fixes: 1b135c6da061 ("drm/amdgpu: extract amdgpu_vm_lock_by_pasid from amdgpu_vm_handle_fault")
Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 5cdc219fe86a1720aa4b5b4f42f11913146e6a93)

authored by

Pierre-Eric Pelloux-Prayer and committed by
Alex Deucher
686e5985 fe2b84f9

+14 -3
+14 -3
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
··· 3023 3023 3024 3024 is_compute_context = vm->is_compute_context; 3025 3025 3026 - if (is_compute_context && !svm_range_restore_pages(adev, pasid, vmid, 3027 - node_id, addr >> PAGE_SHIFT, ts, write_fault)) { 3026 + if (is_compute_context) { 3027 + /* Unreserve root since svm_range_restore_pages might try to reserve it. */ 3028 + /* TODO: rework svm_range_restore_pages so that this isn't necessary. */ 3028 3029 amdgpu_bo_unreserve(root); 3030 + 3031 + if (!svm_range_restore_pages(adev, pasid, vmid, 3032 + node_id, addr >> PAGE_SHIFT, ts, write_fault)) { 3033 + amdgpu_bo_unref(&root); 3034 + return true; 3035 + } 3029 3036 amdgpu_bo_unref(&root); 3030 - return true; 3037 + 3038 + /* Re-acquire the VM lock, could be that the VM was freed in between. */ 3039 + vm = amdgpu_vm_lock_by_pasid(adev, &root, pasid); 3040 + if (!vm) 3041 + return false; 3031 3042 } 3032 3043 3033 3044 addr /= AMDGPU_GPU_PAGE_SIZE;