]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - rpmsg/rpmsg.git/commitdiff
remoteproc: Fix multiple back-to-back error recoveries
authorSuman Anna <s-anna@ti.com>
Mon, 14 Feb 2022 19:24:43 +0000 (11:24 -0800)
committerSuman Anna <s-anna@ti.com>
Wed, 23 Feb 2022 13:40:38 +0000 (07:40 -0600)
The remoteproc core uses a dedicated work item per remote processor
to perform an error recovery of that processor. This work item is
always scheduled upon notification of an error at the moment. The
error recovery process itself is performed when the workqueue gets
scheduled and executes the work function, but an error recovery
needs to be performed only once if there are multiple notifications
while an existing error recovery is in progress. Fix this by adding
a check to make sure the remote processor error recovery work item
is not already running or scheduled.

This fixes an issue with error recovery upon MMU Faults on OMAP
IPU remote processors. An MMU fault on OMAP IPU sends two error
notifications - one a direct interrupt from the MMU, and the second
a mailbox-based crash notification after the remote processor has
collected some backtrace. The mailbox based interrupt mechanism,
added in commit 232ba6ca007c ("remoteproc/omap: Report device
exceptions and trigger recovery"), is used for Attribute MMU (AMMU)
faults and other internal exceptions on the IPU. The backtrace
collection on the IPU remote processor is triggered by the same
interrupt which cannot be differentiated between an MMU fault and
an AMMU fault. The remoteproc core changes in 4.9 kernel around the
boot sequences has now caused the second notification to trigger a
secondary error recovery, which was avoided in previous kernels due
to the event detection in the work-function itself. The newer code
sequences changes the timing w.r.t previous kernels where the
recovery process was performed a bit later due to the asynchronous
firmware loading.

Signed-off-by: Suman Anna <s-anna@ti.com>
drivers/remoteproc/remoteproc_core.c

index fee36bef77ac41a8bc1c3f3a45ae50fd526ef592..1a2375ee8c029ec1acbeb0f325113ade6cfecd66 100644 (file)
@@ -2960,8 +2960,9 @@ void rproc_report_crash(struct rproc *rproc, enum rproc_crash_type type)
        dev_err(&rproc->dev, "crash detected in %s: type %s\n",
                rproc->name, rproc_crash_to_string(type));
 
-       /* create a new task to handle the error */
-       schedule_work(&rproc->crash_handler);
+       /* create a new task to handle the error if not scheduled already */
+       if (!work_busy(&rproc->crash_handler))
+               schedule_work(&rproc->crash_handler);
 }
 EXPORT_SYMBOL(rproc_report_crash);