diff options
author | Arto Merilainen <amerilainen@nvidia.com> | 2014-08-05 10:50:51 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:10:47 -0400 |
commit | 19b8f854ce5861598bb7749775440bd2f946c348 (patch) | |
tree | 5dd044e1626f63124babfa557c05712c4730ca8a /drivers | |
parent | ae3ba04955966f371447dfa96d05564418882021 (diff) |
gpu: nvgpu: Fix semaphore refcounting
This patch fixes a refcounting issue in semaphore handling.
Change-Id: I03327c60ed6923a90663f0b845566e81af4b94d4
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/453056
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 3 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index 4d366fa9..ef9e3a37 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | |||
@@ -458,6 +458,9 @@ static int gk20a_channel_semaphore_wait_fd( | |||
458 | goto fail; | 458 | goto fail; |
459 | } | 459 | } |
460 | 460 | ||
461 | /* worker takes one reference */ | ||
462 | gk20a_semaphore_get(w->sema); | ||
463 | |||
461 | gk20a_channel_alloc_priv_cmdbuf(c, 8, &wait_cmd); | 464 | gk20a_channel_alloc_priv_cmdbuf(c, 8, &wait_cmd); |
462 | if (wait_cmd == NULL) { | 465 | if (wait_cmd == NULL) { |
463 | gk20a_err(dev_from_gk20a(c->g), | 466 | gk20a_err(dev_from_gk20a(c->g), |
diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index 1a28e660..3b1f1024 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c | |||
@@ -139,6 +139,7 @@ static const struct gk20a_fence_ops gk20a_semaphore_fence_ops = { | |||
139 | .is_expired = &gk20a_semaphore_fence_is_expired, | 139 | .is_expired = &gk20a_semaphore_fence_is_expired, |
140 | }; | 140 | }; |
141 | 141 | ||
142 | /* This function takes ownership of the semaphore */ | ||
142 | struct gk20a_fence *gk20a_fence_from_semaphore( | 143 | struct gk20a_fence *gk20a_fence_from_semaphore( |
143 | struct sync_timeline *timeline, | 144 | struct sync_timeline *timeline, |
144 | struct gk20a_semaphore *semaphore, | 145 | struct gk20a_semaphore *semaphore, |
@@ -163,7 +164,7 @@ struct gk20a_fence *gk20a_fence_from_semaphore( | |||
163 | #endif | 164 | #endif |
164 | return NULL; | 165 | return NULL; |
165 | } | 166 | } |
166 | gk20a_semaphore_get(semaphore); | 167 | |
167 | f->semaphore = semaphore; | 168 | f->semaphore = semaphore; |
168 | f->semaphore_wq = semaphore_wq; | 169 | f->semaphore_wq = semaphore_wq; |
169 | return f; | 170 | return f; |