From: Christoph Hellwig Date: Fri, 12 Jun 2020 00:34:58 +0000 (-0700) Subject: amdgpu: a NULL ->mm does not mean a thread is a kthread X-Git-Tag: baikal/mips/sdk5.9~13400^2 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=f23061330583f838bff80f54d353eff7db30e459;p=kernel.git amdgpu: a NULL ->mm does not mean a thread is a kthread Use the proper API instead. Fixes: b6443a21cfc1f ("drm/amd: Update MEC HQD loading code for KFD") Signed-off-by: Christoph Hellwig Signed-off-by: Andrew Morton Tested-by: Jens Axboe Reviewed-by: Felix Kuehling Reviewed-by: Jens Axboe Cc: Al Viro Cc: Alex Deucher Cc: Zhenyu Wang Cc: Zhi Wang Cc: Felipe Balbi Cc: "Michael S. Tsirkin" Cc: Jason Wang Cc: Greg Kroah-Hartman Link: http://lkml.kernel.org/r/20200404094101.672954-1-hch@lst.de Link: http://lkml.kernel.org/r/20200404094101.672954-2-hch@lst.de Signed-off-by: Linus Torvalds --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h index 142746836838c..ffe149aafc393 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h @@ -196,7 +196,7 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s 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); \