From 978d13efe5719b28ea90b95d21bf25066df75ca8 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 16 Mar 2017 15:52:55 +0530 Subject: 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 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 --- drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') 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) return -EINVAL; nvgpu_mutex_acquire(&g->cde_app.mutex); - cde_ctx = gk20a_cde_get_context(g); + nvgpu_mutex_release(&g->cde_app.mutex); if (IS_ERR(cde_ctx)) { err = PTR_ERR(cde_ctx); goto exit_unlock; @@ -1121,7 +1121,6 @@ exit_unlock: if (surface) dma_buf_vunmap(compbits_scatter_buf, surface); - nvgpu_mutex_release(&g->cde_app.mutex); return err; } -- cgit v1.2.2