omap_remoteproc: Deadlock due to runtime PM
Hi!
I'm seeing a reproducible deadlock in omap_remoteproc during system reboot or shutdown while the remote processor is running.
The deadlock occurs as follows:rproc_cdev_release() -> rproc_shutdown() -> mutex_lock_interruptible(&rproc->lock) -> rproc_stop() -> omap_rproc_stop() -> pm_runtime_get_sync()
pm_runtime_get_sync() triggers omap_rproc_runtime_resume(), which attempts to take rproc->lock again, leading to a deadlock.
In other words, rproc->lock is being used within the omap_remoteproc runtime PM ops, which can conflict with other call paths that already hold the same lock.
It was introduced with the following change:
commit 5f31b232c67434199558fd236e7644b432636b76
Author: Suman Anna <[email protected]> Date: Tue Mar 24 13:00:32 2020 +0200
remoteproc/omap: Add support for runtime auto-suspend/resume
It seems the lock is taken in the PM ops likely because rproc->state is accessed, but perhaps this can be relaxed or refactored to avoid the circular dependency.
Has anyone else encountered this issue,
or is there a known fix or approach to address it?
Thanks,
//richard