summaryrefslogtreecommitdiff
path: root/drivers/misc/habanalabs/common/command_submission.c
diff options
context:
space:
mode:
authorOfir Bitton <obitton@habana.ai>2020-09-10 10:56:26 +0300
committerOded Gabbay <ogabbay@kernel.org>2020-11-30 10:47:30 +0200
commit5de406c0b5c747c40277861ecf204ebfa095caa5 (patch)
treee079d2f94313bf2383c1db91d5db77723244574f /drivers/misc/habanalabs/common/command_submission.c
parent0940cabafde98466bec8ba32dd567f0ec060478d (diff)
habanalabs: sync stream collective support
Implement sync stream collective for GAUDI. Need to allocate additional resources for that and add ctx_fini() to clean up those resources. Signed-off-by: Ofir Bitton <obitton@habana.ai> Reviewed-by: Oded Gabbay <ogabbay@kernel.org> Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc/habanalabs/common/command_submission.c')
-rw-r--r--drivers/misc/habanalabs/common/command_submission.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
index 2dbd42b6ad0c..5ece52588ec6 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -142,7 +142,7 @@ static void hl_fence_init(struct hl_fence *fence)
init_completion(&fence->completion);
}
-static void cs_get(struct hl_cs *cs)
+void cs_get(struct hl_cs *cs)
{
kref_get(&cs->refcount);
}
@@ -917,6 +917,9 @@ static int cs_ioctl_signal_wait_create_jobs(struct hl_device *hdev,
job->job_cb_size = job->user_cb_size;
hl_cb_destroy(hdev, &hdev->kernel_cb_mgr, cb->id << PAGE_SHIFT);
+ /* increment refcount as for external queues we get completion */
+ cs_get(cs);
+
cs->jobs_in_queue_cnt[job->hw_queue_id]++;
list_add_tail(&job->cs_node, &cs->job_list);
@@ -1070,11 +1073,7 @@ static int cs_ioctl_signal_wait(struct hl_fpriv *hpriv, enum hl_cs_type cs_type,
cs, q_idx, collective_engine_id);
if (rc)
- goto put_cs;
-
-
- /* increment refcount as for external queues we get completion */
- cs_get(cs);
+ goto free_cs_object;
rc = hl_hw_queue_schedule_cs(cs);
if (rc) {