aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1590-drm-amdgpu-Drop-last_vm_update-fence-after-KFD-VM-up.patch
blob: 83d39922a368d92439f41dd7e3981056443e66bd (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
From fe3221262c2a338f21c942c1899437e15838dbf5 Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Tue, 14 Feb 2017 19:11:57 -0500
Subject: [PATCH 1590/4131] drm/amdgpu: Drop last_vm_update fence after KFD VM
 updates

KFD can use one sync object while updating multiple GPUs' page tables
at once during evictions. This violates an assumption that the
sync->last_vm_update fence is always updated with fences from the
same context (using amdgpu_sync_keep_later), resulting in lots of
WARNs in the kernel log.

KFD doesn't need this fence. It seems to be used only for selecting
VMs for the graphics drivers. So we just drop that fence after KFD
page table updates to avoid context mismatches in later page table
updates using the same sync object.

Bug: SWDEV-113250

Change-Id: Id36664d26bd6e981d8d4776409e5c6ff8fabd769
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index e1bea18..c27abc7 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -893,6 +893,15 @@ static int unmap_bo_from_gpuvm(struct amdgpu_device *adev,
 
 	amdgpu_sync_fence(adev, sync, bo_va->last_pt_update);
 
+	/* Sync objects can't handle multiple GPUs (contexts) updating
+	 * sync->last_vm_update. Fortunately we don't need it for
+	 * KFD's purposes, so we can just drop that fence.
+	 */
+	if (sync->last_vm_update) {
+		fence_put(sync->last_vm_update);
+		sync->last_vm_update = NULL;
+	}
+
 	return 0;
 }
 
@@ -930,6 +939,15 @@ static int update_gpuvm_pte(struct amdgpu_device *adev,
 	/* Remove PTs from LRU list (reservation removed PD only) */
 	amdgpu_vm_move_pt_bos_in_lru(adev, vm);
 
+	/* Sync objects can't handle multiple GPUs (contexts) updating
+	 * sync->last_vm_update. Fortunately we don't need it for
+	 * KFD's purposes, so we can just drop that fence.
+	 */
+	if (sync->last_vm_update) {
+		fence_put(sync->last_vm_update);
+		sync->last_vm_update = NULL;
+	}
+
 	return 0;
 }
 
-- 
2.7.4