gpu: nvgpu: add refcounting for TSG

Add refcounting for TSGs and manage the refcounts as below :
- initialize ref when TSG is opened
- get ref when channel is bound to TSG
- drop the ref when channel is unbound (i.e. during channel close)
- drop the ref when TSG is closed
- when refcount drops to zero, we free the TSG

This refcounting makes it possible to close channels or TSG
in any order

Bug 1470692

Change-Id: Ia4b39164a4582c8169da62a91b9131094c67f5f8
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/495667
(cherry picked from commit be1e198a663d2102e9674978f3d2cca0f2327a6b)
Reviewed-on: http://git-master/r/495955
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Deepak Nibade
2014-09-04 19:09:26 +05:30
committed by Dan Willemsen
parent ffd25f3905
commit 18eee7effe

View File

@@ -27,6 +27,8 @@
static void gk20a_tsg_release(struct kref *ref); static void gk20a_tsg_release(struct kref *ref);
static void gk20a_tsg_release(struct kref *ref);
bool gk20a_is_channel_marked_as_tsg(struct channel_gk20a *ch) bool gk20a_is_channel_marked_as_tsg(struct channel_gk20a *ch)
{ {
return !(ch->tsgid == NVGPU_INVALID_TSG_ID); return !(ch->tsgid == NVGPU_INVALID_TSG_ID);