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 <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1627116
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2017-12-27 02:02:17 -08:00
committed by mobile promotions
parent 965ff380cf
commit e21e253f83

View File

@@ -106,12 +106,12 @@ __must_hold(&cde_app->mutex)
nvgpu_gmmu_unmap(vm, &g->gr.compbit_store.mem, nvgpu_gmmu_unmap(vm, &g->gr.compbit_store.mem,
cde_ctx->backing_store_vaddr); cde_ctx->backing_store_vaddr);
/* free the channel */ /*
if (cde_ctx->tsg && ch) { * free the channel
gk20a_tsg_unbind_channel(cde_ctx->ch); * gk20a_channel_close() will also unbind the channel from TSG
} */
gk20a_channel_close(ch); gk20a_channel_close(ch);
nvgpu_ref_put(&cde_ctx->tsg->refcount, gk20a_tsg_release);
/* housekeeping on app */ /* housekeeping on app */
nvgpu_list_del(&cde_ctx->list); nvgpu_list_del(&cde_ctx->list);