summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2014-04-20 06:10:52 -0400
committerDan Willemsen <dwillemsen@nvidia.com>2015-03-18 15:09:43 -0400
commiteea79aaa60087174adf7e6876ac089cb4734ebaf (patch)
tree486c0ba2e0e25dab00c6bac8c6be524a6d4eff61 /drivers/gpu/nvgpu/gk20a/channel_gk20a.c
parentd4030081a867865be95cd3ede1407f0d35d5c761 (diff)
gpu: nvgpu: gk20a: free syncpt when channel becomes idle
All of the channel's submit jobs are added to the list channel->jobs In channel_update(), we iterate over this list and check if any job has completed. If any job is complete then we remove it from the list. If this list is empty then it means channel is idle and we can free its syncpt. Hence after iterating this list, check if it is empty or not. If it is empty AND if we are aggressive to free the syncpt (syncpt_aggressive_destroy flag is set) then free the syncpt at this point. Keep the syncpt free code inside submit_lock to avoid race conditions. Also, do not free the syncpt if we have already scheduled WFI on some other path. In that case, syncpt is still needed to check for channel idle. Once WFI completes, we free the syncpt anyway. Bug 1305024 Change-Id: I1654e1db3b76b7ad14644dbb900b03f195ca3b2c Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/398617 Reviewed-by: Shridhar Rasal <srasal@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/channel_gk20a.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
index b7bd55ea..d52e3f7e 100644
--- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c
@@ -1419,6 +1419,19 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed)
1419 kfree(job); 1419 kfree(job);
1420 gk20a_idle(g->dev); 1420 gk20a_idle(g->dev);
1421 } 1421 }
1422
1423 /*
1424 * If job list is empty then channel is idle and we can free
1425 * the syncpt here (given aggressive_destroy flag is set)
1426 * Note: if WFI is already scheduled on some other path
1427 * then syncpt is still required to check for idle
1428 */
1429 if (list_empty(&c->jobs) && !c->last_submit_fence.wfi) {
1430 if (c->sync && c->sync->syncpt_aggressive_destroy) {
1431 c->sync->destroy(c->sync);
1432 c->sync = NULL;
1433 }
1434 }
1422 mutex_unlock(&c->jobs_lock); 1435 mutex_unlock(&c->jobs_lock);
1423 mutex_unlock(&c->submit_lock); 1436 mutex_unlock(&c->submit_lock);
1424 1437