linux/drivers/remoteproc
Alex Elder d7f8a548b8 FROMLIST: remoteproc: use freezable workqueue for crash notifications
When a remoteproc has crashed, rproc_report_crash() is called to
handle whatever recovery is desired.  This can happen at almost any
time, often triggered by an interrupt, though it can also be
initiated by a write to debugfs file remoteproc/remoteproc*/crash.

When a crash is reported, the crash handler worker is scheduled to
run (rproc_crash_handler_work()).  One thing that worker does is
call rproc_trigger_recovery(), which calls rproc_stop().  That calls
the ->stop method for any remoteproc subdevices before making the
remote processor go offline.

The Q6V5 modem remoteproc driver implements an SSR subdevice that
notifies registered drivers when the modem changes operational state
(prepare, started, stop/crash, unprepared).  The IPA driver
registers to receive these notifications.

With that as context, I'll now describe the problem.

There was a situation in which buggy modem firmware led to a modem
crash very soon after system (AP) resume had begun.  The crash caused
a remoteproc SSR crash notification to be sent to the IPA driver.
The problem was that, although system resume had begun, it had not
yet completed, and the IPA driver was still in a suspended state.

This scenario could happen to any driver that registers for these
SSR notifications, because they are delivered without knowledge of
the (suspend) state of registered recipient drivers.

This patch offers a simple fix for this, by having the crash
handling worker function run on the system freezable workqueue.
This workqueue does not operate if user space is frozen (for
suspend).  As a result, the SSR subdevice only delivers its
crash notification when the system is fully operational (i.e.,
neither suspended nor in suspend/resume transition).

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro>
Tested-by: Siddharth Gupta <sidgup@codeaurora.org>

Bug: 190545349
Change-Id: Ic9b81757f07eea0930480ff5e08a38d92a843606
Link: https://lore.kernel.org/linux-remoteproc/20210519234418.1196387-2-elder@linaro.org/
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2021-06-09 15:05:31 +00:00
..
da8xx_remoteproc.c
imx_rproc.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
ingenic_rproc.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
Kconfig remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem 2020-10-13 18:34:38 -05:00
keystone_remoteproc.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
Makefile remoteproc: k3-r5: Add a remoteproc driver for R5F subsystem 2020-10-13 18:34:38 -05:00
mtk_common.h remoteproc/mediatek: acknowledge watchdog IRQ after handled 2021-03-04 11:38:14 +01:00
mtk_scp_ipi.c remoteproc/mediatek: Add support for mt8192 SCP 2020-09-25 23:37:42 -05:00
mtk_scp.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
omap_remoteproc.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
omap_remoteproc.h remoteproc/omap: Switch to SPDX license identifiers 2020-03-25 22:29:51 -07:00
qcom_common.c remoteproc: qcom: Add missing slab.h 2020-07-13 11:54:27 -07:00
qcom_common.h remoteproc: qcom: Add per subsystem SSR notification 2020-07-08 21:45:03 -07:00
qcom_pil_info.c remoteproc: qcom: pil_info: avoid 64-bit division 2021-04-14 08:42:05 +02:00
qcom_pil_info.h remoteproc: qcom: Introduce helper to store pil info in IMEM 2020-07-01 22:10:18 -07:00
qcom_q6v5_adsp.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
qcom_q6v5_mss.c remoteproc: qcom_q6v5_mss: Validate p_filesz in ELF loader 2021-05-19 10:13:01 +02:00
qcom_q6v5_pas.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
qcom_q6v5_wcss.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
qcom_q6v5.c remoteproc: qcom: q6v5: Update running state before requesting stop 2020-07-27 23:21:31 -07:00
qcom_q6v5.h
qcom_sysmon.c remoteproc: sysmon: Ensure remote notification ordering 2020-12-30 11:54:28 +01:00
qcom_wcnss_iris.c
qcom_wcnss.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
qcom_wcnss.h
remoteproc_cdev.c remoteproc: Add remoteproc character device interface 2020-08-04 20:16:37 -07:00
remoteproc_core.c FROMLIST: remoteproc: use freezable workqueue for crash notifications 2021-06-09 15:05:31 +00:00
remoteproc_coredump.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
remoteproc_debugfs.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
remoteproc_elf_helpers.h UPSTREAM: remoteproc: coredump: Add minidump functionality 2021-02-18 20:10:00 +00:00
remoteproc_elf_loader.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
remoteproc_internal.h BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
remoteproc_sysfs.c remoteproc: Add recovery configuration to the sysfs interface 2020-10-13 19:22:51 -05:00
remoteproc_virtio.c dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
st_remoteproc.c remoteproc: remove rproc_elf32_sanity_check 2020-04-22 21:57:26 -07:00
st_slim_rproc.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
stm32_rproc.c remoteproc: stm32: Fix pointer assignement 2020-09-15 03:45:57 +00:00
ti_k3_dsp_remoteproc.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
ti_k3_r5_remoteproc.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00
ti_sci_proc.h remoteproc: k3: Add TI-SCI processor control helper functions 2020-07-28 17:06:43 -07:00
wkup_m3_rproc.c BACKPORT: FROMGIT: remoteproc: add is_iomem to da_to_va 2021-05-07 07:12:41 -07:00