diff options
author | Felix Kuehling <Felix.Kuehling@amd.com> | 2017-09-27 00:09:54 -0400 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@gmail.com> | 2017-09-27 00:09:54 -0400 |
commit | bc920fd4f4350a2e3094c165a77798d721f39e7b (patch) | |
tree | eacd4bf02a22b52cff8dded993c99ee399dc962a | |
parent | e6f791b1b068b168c6f5203f29040b972d7fbc20 (diff) |
drm/amdkfd: Clean up process queue management
Removed unused num_concurrent_processes.
Implemented counting of queues in QPD. This makes counting the queue
list repeatedly in several places unnecessary.
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
4 files changed, 8 insertions, 14 deletions
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index dd7e44593cfe..c0685cd64d12 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | |||
@@ -189,6 +189,7 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, | |||
189 | } | 189 | } |
190 | 190 | ||
191 | list_add(&q->list, &qpd->queues_list); | 191 | list_add(&q->list, &qpd->queues_list); |
192 | qpd->queue_count++; | ||
192 | if (q->properties.is_active) | 193 | if (q->properties.is_active) |
193 | dqm->queue_count++; | 194 | dqm->queue_count++; |
194 | 195 | ||
@@ -347,6 +348,7 @@ static int destroy_queue_nocpsch_locked(struct device_queue_manager *dqm, | |||
347 | 348 | ||
348 | deallocate_vmid(dqm, qpd, q); | 349 | deallocate_vmid(dqm, qpd, q); |
349 | } | 350 | } |
351 | qpd->queue_count--; | ||
350 | if (q->properties.is_active) | 352 | if (q->properties.is_active) |
351 | dqm->queue_count--; | 353 | dqm->queue_count--; |
352 | 354 | ||
@@ -856,6 +858,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, | |||
856 | goto out; | 858 | goto out; |
857 | 859 | ||
858 | list_add(&q->list, &qpd->queues_list); | 860 | list_add(&q->list, &qpd->queues_list); |
861 | qpd->queue_count++; | ||
859 | if (q->properties.is_active) { | 862 | if (q->properties.is_active) { |
860 | dqm->queue_count++; | 863 | dqm->queue_count++; |
861 | retval = execute_queues_cpsch(dqm, | 864 | retval = execute_queues_cpsch(dqm, |
@@ -1014,6 +1017,7 @@ static int destroy_queue_cpsch(struct device_queue_manager *dqm, | |||
1014 | dqm->sdma_queue_count--; | 1017 | dqm->sdma_queue_count--; |
1015 | 1018 | ||
1016 | list_del(&q->list); | 1019 | list_del(&q->list); |
1020 | qpd->queue_count--; | ||
1017 | if (q->properties.is_active) | 1021 | if (q->properties.is_active) |
1018 | dqm->queue_count--; | 1022 | dqm->queue_count--; |
1019 | 1023 | ||
@@ -1204,6 +1208,7 @@ static int process_termination_cpsch(struct device_queue_manager *dqm, | |||
1204 | goto out; | 1208 | goto out; |
1205 | } | 1209 | } |
1206 | list_del(&q->list); | 1210 | list_del(&q->list); |
1211 | qpd->queue_count--; | ||
1207 | mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); | 1212 | mqd->uninit_mqd(mqd, q->mqd, q->mqd_mem_obj); |
1208 | } | 1213 | } |
1209 | 1214 | ||
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c index e5a15babb4f3..5d1770e577e9 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager.c | |||
@@ -140,8 +140,6 @@ static int pm_create_map_process(struct packet_manager *pm, uint32_t *buffer, | |||
140 | struct qcm_process_device *qpd) | 140 | struct qcm_process_device *qpd) |
141 | { | 141 | { |
142 | struct pm4_mes_map_process *packet; | 142 | struct pm4_mes_map_process *packet; |
143 | struct queue *cur; | ||
144 | uint32_t num_queues; | ||
145 | 143 | ||
146 | packet = (struct pm4_mes_map_process *)buffer; | 144 | packet = (struct pm4_mes_map_process *)buffer; |
147 | 145 | ||
@@ -156,10 +154,7 @@ static int pm_create_map_process(struct packet_manager *pm, uint32_t *buffer, | |||
156 | packet->bitfields10.gds_size = qpd->gds_size; | 154 | packet->bitfields10.gds_size = qpd->gds_size; |
157 | packet->bitfields10.num_gws = qpd->num_gws; | 155 | packet->bitfields10.num_gws = qpd->num_gws; |
158 | packet->bitfields10.num_oac = qpd->num_oac; | 156 | packet->bitfields10.num_oac = qpd->num_oac; |
159 | num_queues = 0; | 157 | packet->bitfields10.num_queues = (qpd->is_debug) ? 0 : qpd->queue_count; |
160 | list_for_each_entry(cur, &qpd->queues_list, list) | ||
161 | num_queues++; | ||
162 | packet->bitfields10.num_queues = (qpd->is_debug) ? 0 : num_queues; | ||
163 | 158 | ||
164 | packet->sh_mem_config = qpd->sh_mem_config; | 159 | packet->sh_mem_config = qpd->sh_mem_config; |
165 | packet->sh_mem_bases = qpd->sh_mem_bases; | 160 | packet->sh_mem_bases = qpd->sh_mem_bases; |
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h index 7f141730de41..7d86ec9790d3 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h | |||
@@ -405,7 +405,6 @@ struct scheduling_resources { | |||
405 | struct process_queue_manager { | 405 | struct process_queue_manager { |
406 | /* data */ | 406 | /* data */ |
407 | struct kfd_process *process; | 407 | struct kfd_process *process; |
408 | unsigned int num_concurrent_processes; | ||
409 | struct list_head queues; | 408 | struct list_head queues; |
410 | unsigned long *queue_slot_bitmap; | 409 | unsigned long *queue_slot_bitmap; |
411 | }; | 410 | }; |
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 63c569b62cee..88ad178bffb6 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | |||
@@ -149,8 +149,6 @@ int pqm_create_queue(struct process_queue_manager *pqm, | |||
149 | struct queue *q; | 149 | struct queue *q; |
150 | struct process_queue_node *pqn; | 150 | struct process_queue_node *pqn; |
151 | struct kernel_queue *kq; | 151 | struct kernel_queue *kq; |
152 | int num_queues = 0; | ||
153 | struct queue *cur; | ||
154 | enum kfd_queue_type type = properties->type; | 152 | enum kfd_queue_type type = properties->type; |
155 | 153 | ||
156 | q = NULL; | 154 | q = NULL; |
@@ -168,11 +166,8 @@ int pqm_create_queue(struct process_queue_manager *pqm, | |||
168 | * If we are just about to create DIQ, the is_debug flag is not set yet | 166 | * If we are just about to create DIQ, the is_debug flag is not set yet |
169 | * Hence we also check the type as well | 167 | * Hence we also check the type as well |
170 | */ | 168 | */ |
171 | if ((pdd->qpd.is_debug) || | 169 | if ((pdd->qpd.is_debug) || (type == KFD_QUEUE_TYPE_DIQ)) { |
172 | (type == KFD_QUEUE_TYPE_DIQ)) { | 170 | if (pdd->qpd.queue_count >= dev->device_info->max_no_of_hqd/2) |
173 | list_for_each_entry(cur, &pdd->qpd.queues_list, list) | ||
174 | num_queues++; | ||
175 | if (num_queues >= dev->device_info->max_no_of_hqd/2) | ||
176 | return -ENOSPC; | 171 | return -ENOSPC; |
177 | } | 172 | } |
178 | 173 | ||