aboutsummaryrefslogtreecommitdiffstats
path: root/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1608-drm-amdgpu-Ignore-eviction-fence-during-unmap.patch
blob: 19faf2cff937729347dce270caf91766b6265b4c (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
From 2daaf24eab7ed751c8aa7f0c23ea85e324eeb3c2 Mon Sep 17 00:00:00 2001
From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Date: Tue, 14 Mar 2017 16:35:47 -0400
Subject: [PATCH 1608/4131] drm/amdgpu: Ignore eviction fence during unmap

Remove eviction fence from PD (and thereby from PTs too as they share
the resv. object. Otherwise during PT update job (see
amdgpu_vm_bo_update_mapping), eviction fence will get added to job->sync
object. This will trigger unnecessary evictions when the scheduler tries
to execute the job.

This change will also enable to revert the temporary
commit 6bb00e491bfb ("drm/amdgpu: Use AMDGPU_FENCE_OWNER_VM in unmap")

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

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 9a26cff..801c34e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -886,11 +886,24 @@ static int unmap_bo_from_gpuvm(struct amdgpu_device *adev,
 {
 	struct amdgpu_bo_va *bo_va = entry->bo_va;
 	struct amdgpu_vm *vm = bo_va->vm;
+	struct amdkfd_vm *kvm = container_of(vm, struct amdkfd_vm, base);
+	struct amdgpu_bo *pd = vm->page_directory;
 
+	/* Remove eviction fence from PD (and thereby from PTs too as they
+	 * share the resv. object. Otherwise during PT update job (see
+	 * amdgpu_vm_bo_update_mapping), eviction fence will get added to
+	 * job->sync object
+	 */
+	amdgpu_amdkfd_remove_eviction_fence(pd,
+					    kvm->process_info->eviction_fence,
+					    NULL, NULL);
 	amdgpu_vm_bo_unmap(adev, bo_va, entry->va);
 
 	amdgpu_vm_clear_freed(adev, vm, &bo_va->last_pt_update);
 
+	/* Add the eviction fence back */
+	amdgpu_bo_fence(pd, &kvm->process_info->eviction_fence->base, true);
+
 	amdgpu_sync_fence(adev, sync, bo_va->last_pt_update);
 
 	/* Sync objects can't handle multiple GPUs (contexts) updating
-- 
2.7.4