diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-03-16 06:22:55 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-23 10:13:50 -0400 |
commit | 978d13efe5719b28ea90b95d21bf25066df75ca8 (patch) | |
tree | 43042a95fa8871eb33d78abe4d7e3ee6d0dab4fb /drivers/gpu/nvgpu/gk20a | |
parent | ebe71ea9a2542fcd75dfa75b4995d953a84b7c1a (diff) |
gpu: nvgpu: hold mutex to get cde context only
In gk20a_cde_convert(), we hold cde_app.mutex almost
for everything which is unnecessary
Also, this causes a deadlock scenario when gk20a_do_idle()
is called
In some cases it is possible that Thread 1
holds the lock and is trying to power on GPU, and
Thread 2 is trying to power off GPU and then grab
cde_app.mutex to cleanup GPU state
To fix this, grab the mutex only for gk20a_cde_get_context()
and then release it
Bug 200287073
Change-Id: Ic4856604652d0d4024abdeb5c2f8f03910c601a5
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1324328
(cherry picked from commit 3c8eef0d0e9ef3307e2792e3e127c10f3ff118a7)
Reviewed-on: http://git-master/r/1322030
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index c8434f3d..8f9d7831 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c | |||
@@ -950,8 +950,8 @@ __releases(&cde_app->mutex) | |||
950 | return -EINVAL; | 950 | return -EINVAL; |
951 | 951 | ||
952 | nvgpu_mutex_acquire(&g->cde_app.mutex); | 952 | nvgpu_mutex_acquire(&g->cde_app.mutex); |
953 | |||
954 | cde_ctx = gk20a_cde_get_context(g); | 953 | cde_ctx = gk20a_cde_get_context(g); |
954 | nvgpu_mutex_release(&g->cde_app.mutex); | ||
955 | if (IS_ERR(cde_ctx)) { | 955 | if (IS_ERR(cde_ctx)) { |
956 | err = PTR_ERR(cde_ctx); | 956 | err = PTR_ERR(cde_ctx); |
957 | goto exit_unlock; | 957 | goto exit_unlock; |
@@ -1121,7 +1121,6 @@ exit_unlock: | |||
1121 | if (surface) | 1121 | if (surface) |
1122 | dma_buf_vunmap(compbits_scatter_buf, surface); | 1122 | dma_buf_vunmap(compbits_scatter_buf, surface); |
1123 | 1123 | ||
1124 | nvgpu_mutex_release(&g->cde_app.mutex); | ||
1125 | return err; | 1124 | return err; |
1126 | } | 1125 | } |
1127 | 1126 | ||