From: Christoph Hellwig <hch@xxxxxx> Subject: amdgpu: a NULL ->mm does not mean a thread is a kthread Use the proper API instead. Link: http://lkml.kernel.org/r/20200404094101.672954-1-hch@xxxxxx Link: http://lkml.kernel.org/r/20200404094101.672954-2-hch@xxxxxx Fixes: 70539bd795002 ("drm/amd: Update MEC HQD loading code for KFD") Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: Felix Kuehling <Felix.Kuehling@xxxxxxx> Reviewed-by: Jens Axboe <axboe@xxxxxxxxx> Tested-by: Jens Axboe <axboe@xxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: Alex Deucher <alexander.deucher@xxxxxxx> Cc: Zhenyu Wang <zhenyuw@xxxxxxxxxxxxxxx> Cc: Zhi Wang <zhi.a.wang@xxxxxxxxx> Cc: Felipe Balbi <balbi@xxxxxxxxxx> Cc: "Michael S. Tsirkin" <mst@xxxxxxxxxx> Cc: Jason Wang <jasowang@xxxxxxxxxx> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h~amdgpu-a-null-mm-does-not-mean-a-thread-is-a-kthread +++ a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h @@ -196,7 +196,7 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_coun pagefault_disable(); \ if ((mmptr) == current->mm) { \ valid = !get_user((dst), (wptr)); \ - } else if (current->mm == NULL) { \ + } else if (current->flags & PF_KTHREAD) { \ kthread_use_mm(mmptr); \ valid = !get_user((dst), (wptr)); \ kthread_unuse_mm(mmptr); \ _