aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1587-drm-amdgpu-Correct-incomplete-fix-for-userptr-restor.patch
blob: d6f3601fd76851a8904c47b751c24a8b8a820a2b (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
42
43
44
From ac96253629478e151092b280de24ab87bb89a160 Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Thu, 9 Feb 2017 13:31:51 -0500
Subject: [PATCH 1587/4131] drm/amdgpu: Correct incomplete fix for userptr
 restore race

Missed one place where we drop the lock and need to mark the buffer
as busy to prevent restore cancellation while a restore is in progress.

Bug: SWDEV-113047, SWDEV-113032
Change-Id: I12f8f8b0021f03807ef9d996963f07b5e2b22469
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c       | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
index b613ce0..7d10b71 100755
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
@@ -286,6 +286,7 @@ static void amdgdu_amdkfd_restore_mem_worker(struct work_struct *work)
 			mem->evicted = 0;
 	}
 
+	BUG_ON(mem->mm != mm);
 	mem->mm = NULL;
 
 	mutex_unlock(&mem->lock);
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 155de54..8dffb3a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -858,6 +858,7 @@ static int update_user_pages(struct kgd_mem *mem, struct mm_struct *mm,
 			release_pages(pages, bo->tbo.ttm->num_pages, 0);
 			ttm_eu_backoff_reservation(&ctx->ticket, &ctx->list);
 			ctx->reserved = false;
+			mem->busy = true;
 			mutex_unlock(&mem->lock);
 		}
 
-- 
2.7.4