Skip to content

Commit fcf00f8

Browse files
xiaogang-chen-amdalexdeucher
authored andcommitted
drm/amdkfd: Remove skiping userptr buffer mapping when mmu notifier marks it as invalid
mmu notifier does not always hold mm->sem during call back. That causes a race condition between kfd userprt buffer mapping and mmu notifier which leds to gpu shadder or SDMA access userptr buffer before it has been mapped to gpu VM. Always map userptr buffer to avoid that though it may make some userprt buffers mapped two times. Suggested-by: Felix Kuehling <[email protected]> Signed-off-by: Xiaogang Chen <[email protected]> Reviewed-by: Felix Kuehling <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 79b72db commit fcf00f8

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,16 +1907,6 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
19071907
*/
19081908
mutex_lock(&mem->process_info->lock);
19091909

1910-
/* Lock mmap-sem. If we find an invalid userptr BO, we can be
1911-
* sure that the MMU notifier is no longer running
1912-
* concurrently and the queues are actually stopped
1913-
*/
1914-
if (amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) {
1915-
mmap_write_lock(current->mm);
1916-
is_invalid_userptr = atomic_read(&mem->invalid);
1917-
mmap_write_unlock(current->mm);
1918-
}
1919-
19201910
mutex_lock(&mem->lock);
19211911

19221912
domain = mem->domain;

0 commit comments

Comments
 (0)