From 8fa29272172b5ef42486e4e9c70abd1d619f2605 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Tue, 24 Jan 2017 20:44:07 -0500 Subject: [PATCH 1577/4131] drm/amdkfd: Avoid calling resume_mm during process termination When unmap_memory_from_gpu is called during process termination, don't call resume_mm. It would fail because current->mm is NULL in a work queue. Change-Id: I720e4dbb4c3928d894f1e131de626d1c3a9b1ffb Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 097d336..c440419 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1534,10 +1534,13 @@ int amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu( unreserve_out: unreserve_bo_and_vms(&ctx, false); - while (num_to_resume--) { - /* Now resume GPU's queues while bo and VMs are unreserved. - * resume_mm() is reference counted, and that is why we can - * call it multiple times. + while (current->mm && num_to_resume--) { + /* Now resume GPU's queues while bo and VMs are + * unreserved. This function runs in a work queue + * during process termination. Only resume queues if + * we're running in process context. resume_mm() is + * reference counted, and that is why we can call it + * multiple times. */ ret = kgd2kfd->resume_mm(adev->kfd, current->mm); if (ret != 0) { -- 2.7.4