summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
diff options
context:
space:
mode:
authorFelix Kuehling <Felix.Kuehling@amd.com>2019-06-29 08:50:35 +0300
committerAlex Deucher <alexander.deucher@amd.com>2019-07-03 22:31:57 +0300
commitf4fd28b6c78cef054daf8d8b8dff8ef614ddfc00 (patch)
tree937ff0200150157f55bd48ab487c14fec0f7b1b7 /drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
parente7e2505326496c140db26c797fafea48a492b8c2 (diff)
downloadlinux-f4fd28b6c78cef054daf8d8b8dff8ef614ddfc00.tar.xz
drm/amdgpu: Fix tracking of invalid userptrs
Restore the code that resets mem->invalid. Othewise so mapping userptrs after they got an MMU notifiers would always be skipped. This also avoids unnecessarily calling get_user_pages on BOs that have not been invalidated since the last try. Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com> Reviewed-by: Philip Yang <Philip.Yang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 764c8efad372..d02750cb5446 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1740,6 +1740,12 @@ static int update_invalid_user_pages(struct amdkfd_process_info *process_info,
}
amdgpu_ttm_tt_get_user_pages_done(bo->tbo.ttm);
+
+ /* Mark the BO as valid unless it was invalidated
+ * again concurrently.
+ */
+ if (atomic_cmpxchg(&mem->invalid, invalid, 0) != invalid)
+ return -EAGAIN;
}
return 0;