From df1852752a3ba9365ae6dca2795af4d43267896d Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Mon, 5 May 2014 17:27:39 +0530 Subject: gpu: nvgpu: gk20a: free syncpt if last submit is complete In channel_update(), we detect if channel is idle and if it is idle then we free the syncpt. We do not free the syncpt if WFI is scheduled on some other path. Instead of checking for WFI, we can check if last submit is complete or not (it can be WFI as well) and if last submit is complete then we can free the syncpt. Locking mechanism using submit lock will take care that syncpt is kept alive until last submit or WFI completes Bug 1305024 Change-Id: Ieafb82e1f924a01236ca73ed151eb03e88729835 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/405201 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/channel_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index 344223ae..00f8ac94 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -1423,11 +1423,12 @@ void gk20a_channel_update(struct channel_gk20a *c, int nr_completed) /* * If job list is empty then channel is idle and we can free * the syncpt here (given aggressive_destroy flag is set) - * Note: if WFI is already scheduled on some other path - * then syncpt is still required to check for idle + * Note: check if last submit is complete before destroying + * the sync resource */ - if (list_empty(&c->jobs) && !c->last_submit_fence.wfi) { - if (c->sync && c->sync->syncpt_aggressive_destroy) { + if (list_empty(&c->jobs)) { + if (c->sync && c->sync->syncpt_aggressive_destroy && + c->sync->is_expired(c->sync, &c->last_submit_fence)) { c->sync->destroy(c->sync); c->sync = NULL; } -- cgit v1.2.2