aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1411-drm-amdkfd-Don-t-report-invalid-event-data-on-VM-fau.patch
blob: 07da1ece94cdc999a18b6b6ad149894cacd8631e (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
From d047663dc9038582c7b288f6766cc719a89e64d8 Mon Sep 17 00:00:00 2001
From: shaoyunl <Shaoyun.Liu@amd.com>
Date: Fri, 1 Apr 2016 15:54:56 -0400
Subject: [PATCH 1411/4131] drm/amdkfd: Don't report invalid event data on VM
 fault

KFD may get mulitple interrupt callback with different IH entry for the vm
fault since driver only disable the fault status and address updating when
handling the  VM fault ISR.

Ignore the IH entries that don't have correct address and status value.

Set imprecise flag on events where the VMID of the fault info doesn't match
the IH ring entry. This can happen when several processes generate faults at
almost the same time.

Change-Id: I25bd82dea4a9432cc68e02ad97d295c3d841dea4
Signed-off-by: shaoyun liu <shaoyun.liu@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c | 4 ++++
 drivers/gpu/drm/amd/amdkfd/kfd_events.c          | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c b/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c
index 02a9082..996b49e 100644
--- a/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c
+++ b/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c
@@ -70,8 +70,12 @@ static void cik_event_interrupt_wq(struct kfd_dev *dev,
 		ihre->source_id == CIK_INTSRC_GFX_MEM_PROT_FAULT) {
 		struct kfd_vm_fault_info info;
 
+		memset(&info, 0, sizeof(info));
 		dev->kfd2kgd->get_vm_fault_info(dev->kgd, &info);
 		kfd_process_vm_fault(dev->dqm, ihre->pasid);
+		if (!info.page_addr && !info.status)
+			return;
+
 		if (info.vmid == ihre->vmid)
 			kfd_signal_vm_fault_event(dev, ihre->pasid, &info);
 		else
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 23b5936..eb51873 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -1105,6 +1105,7 @@ void kfd_signal_vm_fault_event(struct kfd_dev *dev, unsigned int pasid,
 		return; /* Presumably process exited. */
 	memset(&memory_exception_data, 0, sizeof(memory_exception_data));
 	memory_exception_data.gpu_id = dev->id;
+	memory_exception_data.failure.imprecise = true;
 	/* Set failure reason */
 	if (info) {
 		memory_exception_data.va = (info->page_addr) << PAGE_SHIFT;
@@ -1114,6 +1115,7 @@ void kfd_signal_vm_fault_event(struct kfd_dev *dev, unsigned int pasid,
 			info->prot_exec ? true : false;
 		memory_exception_data.failure.ReadOnly =
 			info->prot_write ? true : false;
+		memory_exception_data.failure.imprecise = false;
 	}
 	mutex_lock(&p->event_mutex);
 
-- 
2.7.4