From e21e253f8372d8f2589a19f1df4e180ef6f57d1d Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 27 Dec 2017 02:02:17 -0800 Subject: gpu: nvgpu: fix TSG leak from CDE code In gk20a_cde_remove_ctx(), we unbind the channel from TSG and close the channel. But we do not drop the TSG refcount leaking the TSG reference After allocating sufficient contexts, we see TSG creation fails as below nvgpu: 17000000.gp10b: gk20a_cde_load:1286 [ERR] cde: could not create TSG Fix this by explicitly dropping TSG refcount Also, do not explicitly unbind the channel from TSG gk20a_channel_close() will internally unbind the channel from TSG Bug 200374011 Change-Id: If6d75b20d5e03d710c0597d7a320d1157206a2a5 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/1627116 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/cde.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/common/linux/cde.c b/drivers/gpu/nvgpu/common/linux/cde.c index 02ee27bc..5f0dfb0b 100644 --- a/drivers/gpu/nvgpu/common/linux/cde.c +++ b/drivers/gpu/nvgpu/common/linux/cde.c @@ -106,12 +106,12 @@ __must_hold(&cde_app->mutex) nvgpu_gmmu_unmap(vm, &g->gr.compbit_store.mem, cde_ctx->backing_store_vaddr); - /* free the channel */ - if (cde_ctx->tsg && ch) { - gk20a_tsg_unbind_channel(cde_ctx->ch); - } - + /* + * free the channel + * gk20a_channel_close() will also unbind the channel from TSG + */ gk20a_channel_close(ch); + nvgpu_ref_put(&cde_ctx->tsg->refcount, gk20a_tsg_release); /* housekeeping on app */ nvgpu_list_del(&cde_ctx->list); -- cgit v1.2.2