aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3456-drm-amdkfd-Remove-temporary-hack-to-enable-notificat.patch
blob: ae396bde102bc762e755ea029e6851c2cc200128 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From 0aa0298f87c949ec54c5a282e90760c68a6cbad4 Mon Sep 17 00:00:00 2001
From: Laurent Morichetti <laurent.morichetti@amd.com>
Date: Fri, 9 Aug 2019 15:05:59 -0700
Subject: [PATCH 3456/4256] drm/amdkfd: Remove temporary hack to enable
 notification to debugger

The code that sends a SIGUSR2 to the debugger when events signal
in the debugged process is no longer needed. The debugger now uses
the new notification mechanism.

Change-Id: Ic3fe4a0f6d7f08029d98126b727ad326cb546b79
Signed-off-by: Laurent Morichetti <laurent.morichetti@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 42 +------------------------
 1 file changed, 1 insertion(+), 41 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index 88c05303a30d..b5a7b6bb4a60 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -32,7 +32,6 @@
 #include "kfd_events.h"
 #include "kfd_iommu.h"
 #include <linux/device.h>
-#include <linux/ptrace.h>
 
 /*
  * Wrapper around wait_queue_entry_t
@@ -453,36 +452,6 @@ static void acknowledge_signal(struct kfd_process *p, struct kfd_event *ev)
 	page_slots(p->signal_page)[ev->event_id] = UNSIGNALED_EVENT_SLOT;
 }
 
-/* HACK: Temporary hack to enable signaling to debuggers running in a
- * separate process. Remove this when the real signaling mechanism is
- * implemented.
- */
-static void signal_event_to_debugger(struct kfd_process *p)
-{
-	struct kfd_process_device *pdd;
-	struct task_struct *tracer;
-
-	/* Check that a debugger is attached to the process */
-	rcu_read_lock();
-	tracer = ptrace_parent(p->lead_thread);
-	if (tracer)
-		get_task_struct(tracer);
-	rcu_read_unlock();
-	if (!tracer)
-		return;
-
-	/* Check that GPU debugging is enabled for at least one device
-	 * for this process
-	 */
-	list_for_each_entry(pdd, &p->per_device_data, per_device_list)
-		if (pdd->is_debugging_enabled) {
-			send_sig(SIGUSR2, tracer, 0);
-			break;
-		}
-
-	put_task_struct(tracer);
-}
-
 static void set_event_from_interrupt(struct kfd_process *p,
 					struct kfd_event *ev)
 {
@@ -495,7 +464,6 @@ static void set_event_from_interrupt(struct kfd_process *p,
 void kfd_signal_event_interrupt(unsigned int pasid, uint32_t partial_id,
 				uint32_t valid_id_bits)
 {
-	bool debug_events_signaled = false;
 	struct kfd_event *ev = NULL;
 
 	/*
@@ -515,7 +483,6 @@ void kfd_signal_event_interrupt(unsigned int pasid, uint32_t partial_id,
 							 valid_id_bits);
 	if (ev) {
 		set_event_from_interrupt(p, ev);
-		debug_events_signaled |= (ev->type == KFD_EVENT_TYPE_DEBUG);
 	} else if (p->signal_page) {
 		/*
 		 * Partial ID lookup failed. Assume that the event ID
@@ -537,11 +504,8 @@ void kfd_signal_event_interrupt(unsigned int pasid, uint32_t partial_id,
 				if (id >= KFD_SIGNAL_EVENT_LIMIT)
 					break;
 
-				if (slots[id] != UNSIGNALED_EVENT_SLOT) {
+				if (slots[id] != UNSIGNALED_EVENT_SLOT)
 					set_event_from_interrupt(p, ev);
-					debug_events_signaled |=
-					(ev->type == KFD_EVENT_TYPE_DEBUG);
-				}
 			}
 		} else {
 			/* With relatively many events, it's faster to
@@ -552,13 +516,9 @@ void kfd_signal_event_interrupt(unsigned int pasid, uint32_t partial_id,
 				if (slots[id] != UNSIGNALED_EVENT_SLOT) {
 					ev = lookup_event_by_id(p, id);
 					set_event_from_interrupt(p, ev);
-					debug_events_signaled |=
-					(ev->type == KFD_EVENT_TYPE_DEBUG);
 				}
 		}
 	}
-	if (debug_events_signaled)
-		signal_event_to_debugger(p);
 
 	mutex_unlock(&p->event_mutex);
 	kfd_unref_process(p);
-- 
2.17.1