From 535e9b1dd73cca91bf2217ccce49585c7b1afdeb Mon Sep 17 00:00:00 2001 From: Sumit Gupta Date: Wed, 20 Jan 2021 16:55:25 +0530 Subject: gpu: nvgpu: fix mutex wrong acquire Wrong acquire/release sequence. DEBUG_LOCKS_WARN_ON(rt_mutex_owner(lock) != current) .... CPU: 4 PID: 5404 Comm: cyclictest.sh Not tainted 4.9.201-rt134-tegra #1 Hardware name: Jetson-AGX (DT) .... Call trace: [] debug_rt_mutex_unlock+0x58/0x68 [] rt_mutex_unlock+0x4c/0xb0 [] _mutex_unlock+0x20/0x2c [] nvgpu_cg_elcg_set_elcg_enabled+0x78/0xf0 [nvgpu] [] nvgpu_intr_nonstall_cb+0x21bc/0x22f0 [nvgpu] [] dev_attr_store+0x44/0x60 [] sysfs_kf_write+0x5c/0x78 [] kernfs_fop_write+0xc0/0x1d8 [] __vfs_write+0x48/0x128 [] vfs_write+0xac/0x1b8 [] SyS_write+0x5c/0xc8 Bug 3227296 Suggested-by: Bibek Basu Signed-off-by: Sumit Gupta Change-Id: I932a23700539422c07de045dde516c52dd8348cf Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2472903 Reviewed-by: svc-mobile-coverity Reviewed-by: Sagar Kamble Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: Bibek Basu Tested-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/power_features/cg/cg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/common/power_features/cg/cg.c b/drivers/gpu/nvgpu/common/power_features/cg/cg.c index 7b66a81d..2c61fb29 100644 --- a/drivers/gpu/nvgpu/common/power_features/cg/cg.c +++ b/drivers/gpu/nvgpu/common/power_features/cg/cg.c @@ -473,7 +473,7 @@ void nvgpu_cg_elcg_set_elcg_enabled(struct gk20a *g, bool enable) gk20a_gr_wait_initialized(g); - nvgpu_mutex_release(&g->cg_pg_lock); + nvgpu_mutex_acquire(&g->cg_pg_lock); if (enable) { if (!g->elcg_enabled) { g->elcg_enabled = true; -- cgit v1.2.2