When we set time from max77851 pmic RTC, it hangs because
it calls read_time function which locks via mutex twice. System
goes in deadlock state. Reading time is not required during time set
as it is not performing anything thus removing it.
Following logs are seen during hang:
[ 242.930292] INFO: task systemd-timedat:1127 blocked for more than 120 seconds.
[ 242.937695] Tainted: G E 5.10.104-tegra #1
[ 242.943743] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 242.951643] task:systemd-timedat state:D stack: 0 pid: 1127 ppid: 1 flags:0x00000808
[ 242.960074] Call trace:
[ 242.962618] __switch_to+0xd0/0x120
[ 242.966193] __schedule+0x404/0xab0
[ 242.969709] schedule+0x78/0x110
[ 242.972963] schedule_preempt_disabled+0x2c/0x50
[ 242.977621] __mutex_lock.isra.0+0x1b4/0x5b0
[ 242.981925] __mutex_lock_slowpath+0x48/0x90
[ 242.986226] mutex_lock+0x74/0x80
[ 242.989610] max77851_rtc_read_time+0x48/0xf0
[ 242.994004] max77851_rtc_set_time+0xd4/0x1a0
[ 242.998398] rtc_set_time+0xac/0x220
[ 243.002003] rtc_dev_ioctl+0x478/0x950
[ 243.005805] __arm64_sys_ioctl+0xac/0xf0
[ 243.009773] el0_svc_common.constprop.0+0x80/0x1d0
[ 243.014605] do_el0_svc+0x38/0xb0
[ 243.017950] el0_svc+0x1c/0x30
[ 243.021029] el0_sync_handler+0xa8/0xb0
[ 243.024898] el0_sync+0x16c/0x180
Bug 200749982
Change-Id: I6f7d88871184bf64a03fa789746a189e0c0aa826
Signed-off-by: Shubhi Garg <shgarg@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2726550
(cherry picked from commit 129e9c03af0db8857d65e65ea72ce19ae2656b27)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-5.10/+/2728925
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2947784
Tested-by: Bitan Biswas <bbiswas@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>