aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/2130-drm-amdgpu-Sync-KFD-fence-only-for-move-evict.patch
blob: 91edd4a7c352e04d943d1cd56e8cbf71c9d9b280 (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
From 56136184a0419b80d202083066b959821f0fefc8 Mon Sep 17 00:00:00 2001
From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Date: Thu, 19 Oct 2017 11:53:03 -0400
Subject: [PATCH 2130/4131] drm/amdgpu: Sync KFD fence only for move/evict

A single KFD eviction fence is attached to all the BOs of a process
including BOs imported. This fence ensures that all BOs belonging to
that process stays resident when the process queues are active.

Don't add this eviction fence to any sync object unless it is a move or
evict job. These jobs are identified by the fence owner
AMDGPU_FENCE_OWNER_UNDEFINED

v2: Always sync to exclusive fence
v3: avoid unncessary diverge from amd-staging-drm-next

Change-Id: I8752d1cf6b2a1c4f2a57292b7c2cd308d5b6f9b7
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
index 3985025..a20d4ba 100755
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c
@@ -197,11 +197,12 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
 	if (resv == NULL)
 		return -EINVAL;
 
-	f = reservation_object_get_excl(resv);
-	fence_owner = amdgpu_sync_get_owner(f);
-	if (fence_owner != AMDGPU_FENCE_OWNER_KFD ||
-			owner != AMDGPU_FENCE_OWNER_VM)
-		r = amdgpu_sync_fence(adev, sync, f);
+        /* always sync to the exclusive fence */
+        f = reservation_object_get_excl(resv);
+        r = amdgpu_sync_fence(adev, sync, f);
+
+        if (explicit_sync)
+                return r;
 
 	flist = reservation_object_get_list(resv);
 	if (!flist || r)
@@ -212,7 +213,7 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
 					      reservation_object_held(resv));
 		fence_owner = amdgpu_sync_get_owner(f);
 		if (fence_owner == AMDGPU_FENCE_OWNER_KFD &&
-				owner == AMDGPU_FENCE_OWNER_VM)
+			owner != AMDGPU_FENCE_OWNER_UNDEFINED)
 			continue;
 
 		if (amdgpu_sync_same_dev(adev, f)) {
-- 
2.7.4