linux/drivers/remoteproc
Alex Elder 0b145574b6 remoteproc: re-check state in rproc_trigger_recovery()
Two places call rproc_trigger_recovery():
  - rproc_crash_handler_work() sets rproc->state to CRASHED under
    protection of the mutex, then calls it if recovery is not
    disabled.  This function is called in workqueue context when
    scheduled in rproc_report_crash().
  - rproc_recovery_write() calls it in two spots, both of which
    the only call it if the rproc->state is CRASHED.

The mutex is taken right away in rproc_trigger_recovery().  However,
by the time the mutex is acquired, something else might have changed
rproc->state to something other than CRASHED.

The work that follows that is only appropriate for a remoteproc in
CRASHED state.  So check the state after acquiring the mutex, and
only proceed with the recovery work if the remoteproc is still in
CRASHED state.

Delay reporting that recovering has begun until after we hold the
mutex and we know the remote processor is in CRASHED state.

Signed-off-by: Alex Elder <elder@linaro.org>
Link: https://lore.kernel.org/r/20200228183359.16229-2-elder@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2020-03-25 22:29:43 -07:00
..
da8xx_remoteproc.c remoteproc: Remove dev_err() usage after platform_get_irq() 2019-08-26 21:59:58 -07:00
imx_rproc.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
Kconfig rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
keystone_remoteproc.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
Makefile remoteproc/mediatek: add SCP support for mt8183 2020-01-20 10:29:54 -08:00
mtk_common.h rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
mtk_scp_ipi.c rpmsg: add rpmsg support for mt8183 SCP. 2020-01-20 10:29:56 -08:00
mtk_scp.c remoteproc/mediatek: Use size_t type for len in scp_da_to_va 2020-03-25 22:29:42 -07:00
omap_remoteproc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
omap_remoteproc.h remoteproc/omap: add a remoteproc driver for OMAP4 2012-02-08 22:53:47 +02:00
qcom_common.c remoteproc: qcom: Move glink_ssr notification after stop 2019-07-24 16:01:14 -07:00
qcom_common.h remoteproc: qcom: Introduce sysmon 2018-02-12 16:57:22 -08:00
qcom_q6v5_adsp.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
qcom_q6v5_mss.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
qcom_q6v5_pas.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
qcom_q6v5_wcss.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
qcom_q6v5.c remoteproc: Remove dev_err() usage after platform_get_irq() 2019-08-26 21:59:58 -07:00
qcom_q6v5.h remoteproc: q6v5: Extract common resource handling 2018-06-18 15:55:57 -07:00
qcom_sysmon.c remoteproc: qcom: Remove unneeded semicolon 2019-12-18 23:13:29 -08:00
qcom_wcnss_iris.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
qcom_wcnss.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00
qcom_wcnss.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
remoteproc_core.c remoteproc: re-check state in rproc_trigger_recovery() 2020-03-25 22:29:43 -07:00
remoteproc_debugfs.c remoteproc: Use size_t instead of int for rproc_mem_entry len 2020-03-25 22:29:39 -07:00
remoteproc_elf_helpers.h remoteproc: Add elf helpers to access elf64 and elf32 fields 2020-03-25 22:29:39 -07:00
remoteproc_elf_loader.c remoteproc: Adapt coredump to generate correct elf type 2020-03-25 22:29:41 -07:00
remoteproc_internal.h remoteproc: Add elf64 support in elf loader 2020-03-25 22:29:40 -07:00
remoteproc_sysfs.c remoteproc: Add a sysfs interface for name 2019-08-26 14:50:16 -07:00
remoteproc_virtio.c remoteproc: fix kernel-doc warnings 2020-03-25 22:29:38 -07:00
st_remoteproc.c remoteproc: Rename rproc_elf_sanity_check for elf32 2020-03-25 22:29:40 -07:00
st_slim_rproc.c remoteproc: Rename rproc_elf_sanity_check for elf32 2020-03-25 22:29:40 -07:00
stm32_rproc.c remoteproc: stm32: demote warning about optional property absence 2020-03-25 22:29:42 -07:00
wkup_m3_rproc.c remoteproc: Use size_t type for len in da_to_va 2020-03-25 22:29:38 -07:00