video: tegra: host: balance task ref counter

kref object reference counters set refcount to 1 on init.
Task references must be released after task submit done.

Reference acquired for command submission, free'd through task complete
notifier.

Jira DLA-718

Change-Id: I7aecfa45f90e19531e4ac57eadd1a20d72ab2291
Signed-off-by: Shridhar Rasal <srasal@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1654952
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Prashant Gaikwad <pgaikwad@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Shridhar Rasal
2018-02-09 14:53:45 +05:30
committed by Laxman Dewangan
parent 2ea8b58dd3
commit 0870b7d47e
3 changed files with 4 additions and 1 deletions

View File

@@ -394,5 +394,6 @@ int nvdla_free_gcov_region(struct platform_device *pdev, bool update_region);
int nvdla_emulator_submit(struct nvhost_queue *queue,
struct nvdla_emu_task *task);
void task_free(struct kref *ref);
#endif /* End of __NVHOST_NVDLA_H__ */

View File

@@ -816,6 +816,7 @@ static int nvdla_submit(struct nvdla_private *priv, void *arg)
err = nvdla_fill_task(queue, buffers, local_tasks + i, task);
if (err) {
nvdla_dbg_err(pdev, "failed to fill task[%d]", i + 1);
kref_put(&task->ref, task_free);
goto fail_to_fill_task;
}
nvdla_dbg_info(pdev, "local task[%d] filled", i + 1);
@@ -847,6 +848,7 @@ static int nvdla_submit(struct nvdla_private *priv, void *arg)
goto fail_to_send_postfences;
}
nvdla_dbg_info(pdev, "postfences of task[%d] sent", i + 1);
kref_put(&task->ref, task_free);
}
nvdla_dbg_fn(pdev, "Task submitted, done!");

View File

@@ -87,7 +87,7 @@ void nvdla_put_task_mem(struct nvdla_task *task)
task = NULL;
}
static void task_free(struct kref *ref)
void task_free(struct kref *ref)
{
struct nvdla_task *task = container_of(ref, struct nvdla_task, ref);
struct platform_device *pdev = task->queue->pool->pdev;