[PATCH 2/2] drm/amdgpu: Fix tracking of invalid userptrs
Kuehling, Felix
Felix.Kuehling at amd.com
Tue Jul 2 19:16:45 UTC 2019
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 at amd.com>
Reviewed-by: Philip Yang <Philip.Yang at amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 867af66c2126..58cecfe57f8b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1739,6 +1739,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;
--
2.17.1
More information about the amd-gfx
mailing list