I found another problem as I was looking at adapting KFD's userptr code.

On 2017-09-05 11:37 AM, Christian König wrote:
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -622,6 +622,8 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, 
> struct page **pages)
>       if (!(gtt->userflags & AMDGPU_GEM_USERPTR_READONLY))
>               flags |= FOLL_WRITE;
>  
> +     down_read(&current->mm->mmap_sem);
> +
>       if (gtt->userflags & AMDGPU_GEM_USERPTR_ANONONLY) {
>               /* check that we only use anonymous memory
>                  to prevent problems with writeback */
> @@ -657,6 +659,8 @@ int amdgpu_ttm_tt_get_user_pages(struct ttm_tt *ttm, 
> struct page **pages)
>  
>       } while (pinned < ttm->num_pages);
>  
> +     up_read(&current->mm->mmap_sem);
> +
>       return 0;
>  
>  release_pages:

You need another up_read in the release_pages error handing path.

Regards,
  Felix
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to