Linux Remote Processor Subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/3] remoteproc: Improve removal of remoteproc drivers
@ 2026-07-23  3:52 Bjorn Andersson
  2026-07-23  3:52 ` [PATCH 1/3] remoteproc: Allow shutdown of crashed processors Bjorn Andersson
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Bjorn Andersson @ 2026-07-23  3:52 UTC (permalink / raw)
  To: Bjorn Andersson, Mathieu Poirier, Shengjiu Wang,
	Fernando Guzman Lugo, Ohad Ben-Cohen
  Cc: linux-arm-msm, linux-remoteproc, linux-kernel, Bjorn Andersson

Stopping a remoteproc that has entered a crash loop can be problematic,
as shutdown is only allowed while the instance is in its running state.

One effect of this is that a remoteproc which has entered a crash state,
with `recovery_disabled` can not be stopped, without first attempting
the recovery.

This becomes of particular interest if the user rmmod a remoteproc
driver in such state, since the return value of rproc_shutdown() and
rproc_del() are ignored, which means that the remoteproc is left running
while the remoteproc driver will unmap memory and shut down critical
resources under its feet.

Another variant of this issue comes from the lack of synchronization
between rproc_del() and the crash handler worker, which might be
scheduled concurrently with the removal. Mutual exclusion does ensure
that concurrent progress isn't made, but nothing prevent rproc_del()
from returning to the remoteproc driver and have all the resources
freed/unmapped while the worker is still running.

Lastly, another way to trigger this faulty state is to bump the refcount
for the remoteproc, in which case rproc_shutdown() becomes a nop,
again leaving the remoteproc running while the remoteproc driver removes
critical resources.

There's certainly more work needed in these code paths, but this settles
a few obvious issues.

Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
---
Bjorn Andersson (3):
      remoteproc: Allow shutdown of crashed processors
      remoteproc: Prevent crash handling to race with rproc_del()
      remoteproc: Force shutdown during device removal

 drivers/remoteproc/remoteproc_core.c  | 104 ++++++++++++++++++++++------------
 drivers/remoteproc/remoteproc_sysfs.c |   1 -
 include/linux/remoteproc.h            |  13 +++--
 3 files changed, 76 insertions(+), 42 deletions(-)
---
base-commit: 290aaf24a551d5a0dce037e3fab30820f9113a10
change-id: 20260723-rproc-rmmod-not-crashing-d92388aa47aa

Best regards,
--  
Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-07-23 22:29 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-23  3:52 [PATCH 0/3] remoteproc: Improve removal of remoteproc drivers Bjorn Andersson
2026-07-23  3:52 ` [PATCH 1/3] remoteproc: Allow shutdown of crashed processors Bjorn Andersson
2026-07-23  9:34   ` Konrad Dybcio
2026-07-23 10:00   ` Mukesh Ojha
2026-07-23  3:52 ` [PATCH 2/3] remoteproc: Prevent crash handling to race with rproc_del() Bjorn Andersson
2026-07-23 10:09   ` Konrad Dybcio
2026-07-23 15:16     ` Mukesh Ojha
2026-07-23 22:29     ` Bjorn Andersson
2026-07-23 14:47   ` Mukesh Ojha
2026-07-23 15:19     ` Mukesh Ojha
2026-07-23  3:52 ` [PATCH 3/3] remoteproc: Force shutdown during device removal Bjorn Andersson
2026-07-23  9:59   ` Konrad Dybcio
2026-07-23 10:54   ` Konrad Dybcio
2026-07-23 16:12     ` Mukesh Ojha
2026-07-23 22:16     ` Bjorn Andersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox