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
|
From e247f8244befaab5656bf6f5ec0dc873bc1f809b Mon Sep 17 00:00:00 2001
From: Jonathan Kim <jonathan.kim@amd.com>
Date: Wed, 7 Aug 2019 11:22:18 -0400
Subject: [PATCH 3543/4256] drm/amdkfd: add new queue status
add new queue status to avoid aba problem for debugger
Change-Id: Ibf1c07758512b56cf5ad2a49b46006cffab0f905
Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c | 16 ++++++++++++++--
drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 +
.../drm/amd/amdkfd/kfd_process_queue_manager.c | 1 +
include/uapi/linux/kfd_ioctl.h | 1 +
4 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c
index df42b1dd8b4b..1681107a2aa6 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_debug_events.c
@@ -97,6 +97,10 @@ static int kfd_dbg_ev_release(struct inode *inode, struct file *filep)
((x) = ((x) & ~(KFD_DBG_EV_STATUS_TRAP \
| KFD_DBG_EV_STATUS_VMFAULT)) | (e))
+#define KFD_DBG_EV_SET_NEW_QUEUE_STATE(x, n) \
+ ((x) = (n) ? (x) | KFD_DBG_EV_STATUS_NEW_QUEUE : \
+ (x) & ~KFD_DBG_EV_STATUS_NEW_QUEUE)
+
int kfd_dbg_ev_query_debug_event(struct kfd_process_device *pdd,
unsigned int *queue_id,
unsigned int flags,
@@ -126,8 +130,12 @@ int kfd_dbg_ev_query_debug_event(struct kfd_process_device *pdd,
q->properties.debug_event_type);
KFD_DBG_EV_SET_SUSPEND_STATE(*event_status,
q->properties.is_suspended);
- if (flags & KFD_DBG_EV_FLAG_CLEAR_STATUS)
+ KFD_DBG_EV_SET_NEW_QUEUE_STATE(*event_status,
+ q->properties.is_new);
+ if (flags & KFD_DBG_EV_FLAG_CLEAR_STATUS) {
+ q->properties.is_new = false;
q->properties.debug_event_type = 0;
+ }
goto out;
} else {
@@ -142,9 +150,13 @@ int kfd_dbg_ev_query_debug_event(struct kfd_process_device *pdd,
pqn->q->properties.debug_event_type);
KFD_DBG_EV_SET_SUSPEND_STATE(*event_status,
pqn->q->properties.is_suspended);
- if (flags & KFD_DBG_EV_FLAG_CLEAR_STATUS)
+ KFD_DBG_EV_SET_NEW_QUEUE_STATE(*event_status,
+ pqn->q->properties.is_new);
+ if (flags & KFD_DBG_EV_FLAG_CLEAR_STATUS) {
+ pqn->q->properties.is_new = false;
pqn->q->properties.debug_event_type
= 0;
+ }
goto out;
}
}
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 73aa6a3330eb..5d3cffc9d0ec 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -493,6 +493,7 @@ struct queue_properties {
bool is_evicted;
bool is_suspended;
bool is_active;
+ bool is_new;
/* Not relevant for user mode queues in cp scheduling */
unsigned int vmid;
/* Relevant only for sdma queues*/
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
index 7a61a5b09ed8..d47ab53d613b 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
@@ -318,6 +318,7 @@ int pqm_create_queue(struct process_queue_manager *pqm,
if (q) {
pr_debug("PQM done creating queue\n");
+ q->properties.is_new = true;
print_queue_properties(&q->properties);
}
diff --git a/include/uapi/linux/kfd_ioctl.h b/include/uapi/linux/kfd_ioctl.h
index 42551e2c6d59..86805463e1d3 100644
--- a/include/uapi/linux/kfd_ioctl.h
+++ b/include/uapi/linux/kfd_ioctl.h
@@ -191,6 +191,7 @@ struct kfd_ioctl_dbg_wave_control_args {
#define KFD_DBG_EV_STATUS_TRAP 1
#define KFD_DBG_EV_STATUS_VMFAULT 2
#define KFD_DBG_EV_STATUS_SUSPENDED 4
+#define KFD_DBG_EV_STATUS_NEW_QUEUE 8
#define KFD_DBG_EV_FLAG_CLEAR_STATUS 1
#define KFD_INVALID_QUEUEID 0xffffffff
--
2.17.1
|