From 42e6775484839e7ffaeaa18bf09196466736ec1c Mon Sep 17 00:00:00 2001 From: Manish Bhardwaj Date: Wed, 17 Mar 2021 12:59:50 +0530 Subject: [PATCH] tegra: platform: dce: use mutex_lock API properly Improper use of mutex_lock API is leading to below crash with rt kernel, this patch fixes the below crash. dce: dce_req_boot_irq_sync:70 Waiting on dce fw to boot... ------------[ cut here ]------------ DEBUG_LOCKS_WARN_ON(rt_mutex_owner(lock) != current) WARNING: CPU: 0 PID: 126 at /dvs/git/dirty/git-master_modular/out/ aarch64-arm64-tegra_defconfig-rt_patches-debug-extmod_ubuntu18.04_aarch64 -extmod_linux_x86_64/kernel/src-rt/kernel-5.10/kernel/locking/ rtmutex-debug.c:47 debug_rt_mutex_unlock+0x5c/0x68 Modules linked in: CPU: 0 PID: 126 Comm: dce_worker_thre Not tainted 5.10.17-rt32-tegra #2 Hardware name: t234pre_si (DT) pstate: 00800089 (nzcv daIf -PAN +UAO -TCO BTYPE=--) pc : debug_rt_mutex_unlock+0x5c/0x68 lr : debug_rt_mutex_unlock+0x5c/0x68 sp : ffff8000137fbc90 x29: ffff8000137fbc90 x28: 0000000000000000 x27: 0000000000000000 x26: ffff800012241180 x25: ffff000082b7e090 x24: ffff800010e781d0 x23: 0000000000000000 x22: ffff8000137fbd18 x21: ffff8000137fbd08 x20: 0000000000000000 x19: ffff000082b7e0b8 x18: ffffffffffffffff x17: 00000000000000c0 x16: fffffe0001eadf40 x15: ffff800011e6f988 x14: ffff8000937fb817 x13: ffff8000137fb825 x12: 2065756c61562020 x11: 0000000005f5e0ff x10: ffff8000137fb770 x9 : ffff8000137fbc90 x8 : 4e5241575f534b43 x7 : 000000000000001f x6 : ffff80001224a65c x5 : 00000000ffffe163 x4 : 00000000ffffe163 x3 : ffff800011f3ba50 x2 : 0000000100000001 x1 : 0e62cf1b356d1e00 x0 : 0000000000000000 Call trace: debug_rt_mutex_unlock+0x5c/0x68 rt_mutex_slowunlock+0x38/0x98 rt_mutex_unlock+0x5c/0x98 __rt_mutex_unlock+0x20/0x30 _mutex_unlock+0x20/0x30 dce_worker_thread_wait+0x88/0x300 dce_wait_boot_complete+0x74/0x118 dce_worker+0x24/0x1c8 dce_thread_proxy+0x20/0x30 kthread+0x194/0x1a0 ret_from_fork+0x10/0x18 ---[ end trace 0000000000000001 ]--- JIRA ESLC-5710 Signed-off-by: Manish Bhardwaj Change-Id: I0a67b4792515ca8212dc4a3b34ead5bde9f94f49 Reviewed-on: https://git-master.nvidia.com/r/c/linux-t23x/+/2499983 Tested-by: mobile promotions Reviewed-by: Arun Swain Reviewed-by: svcacv Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/platform/tegra/dce/dce-worker.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/platform/tegra/dce/dce-worker.c b/drivers/platform/tegra/dce/dce-worker.c index 1235ab3d..efb03a06 100644 --- a/drivers/platform/tegra/dce/dce-worker.c +++ b/drivers/platform/tegra/dce/dce-worker.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -91,8 +91,6 @@ void dce_worker_thread_wait(struct tegra_dce *d, if (new_state == STATE_DCE_WORKER_BOOT_WAIT) timeout_val_ms = 1000; - dce_mutex_unlock(&w->lock); - ret = DCE_COND_WAIT_INTERRUPTIBLE(&w->cond, dce_worker_wakeup_cond(d), timeout_val_ms);