habanalabs: Skip updating CI of internal queues if not in use
authorTomer Tayar <ttayar@habana.ai>
Mon, 27 Jul 2020 21:28:51 +0000 (00:28 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 30 Nov 2020 08:47:32 +0000 (10:47 +0200)
There are no internal queues if H/W queues are being used.
In this case we can skip the redundant traversal over the queues array,
looking for internal queues.

Signed-off-by: Tomer Tayar <ttayar@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/hw_queue.c

index 44155a6..e808e66 100644 (file)
@@ -48,6 +48,11 @@ void hl_int_hw_queue_update_ci(struct hl_cs *cs)
                return;
 
        q = &hdev->kernel_queues[0];
+
+       /* There are no internal queues if H/W queues are being used */
+       if (!hdev->asic_prop.max_queues || q->queue_type == QUEUE_TYPE_HW)
+               return;
+
        for (i = 0 ; i < hdev->asic_prop.max_queues ; i++, q++) {
                if (q->queue_type == QUEUE_TYPE_INT)
                        atomic_add(cs->jobs_in_queue_cnt[i], &q->ci);