blob: a4fafa5ea9eb0effc54d3b690adc9806f33d6f63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
From 8fa29272172b5ef42486e4e9c70abd1d619f2605 Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
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 <Felix.Kuehling@amd.com>
---
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
|