[PATCH v2 0/4] remoteproc: core: Fix the error unwind paths
From: Yonghao Zhang
Date: Tue Nov 24 2026 - 02:14:42 EST
This series fixes four problems in the error unwind paths of the
remoteproc core.
The most visible change in v2 is 3/4. It no longer reworks the attach
unwind to prefer detach() over stop(): without the STM32 review that
behaviour change required, it could not be justified. The patch now
only guards the unconditional ops->stop() call against an
implementation that does not provide it, exactly as 2/4 does in
rproc_start(). Implementations that provide stop() keep the existing
unwind, so the STM32 detach() path is not affected. The detach()-first
semantics can be revisited separately with the platform maintainers.
The patches:
- 1/4 resets a freed vring entry to FW_RSC_ADDR_ANY instead of 0.
0 is a valid device address, so a remote processor that reads the
entry while it is still running could mistake it for a real vring.
The sentence in the comment above the reset that is no longer true
is dropped at the same time.
- 2/4 skips the stop() rollback in rproc_start() when the
implementation does not provide it, instead of dereferencing NULL.
- 3/4 adds the same guard to the attach unwind in __rproc_attach().
- 4/4 releases the resources of a boot that a failed recovery was
trying to restore, following the cleanup sequence of
rproc_shutdown(), and voids the power references when the failure
leaves the processor offline or detached.
Testing: on an Allwinner T153 (sun8iw22) with an E907 remote core,
driven by an out-of-tree platform driver. The vring reset of 1/4 and
the recovery failure of 4/4 were exercised on this hardware. The
guards in 2/4 and 3/4 cover configurations that the in-tree drivers do
not exercise today.
---
Changes in v2:
- 1/4: Keep the existing comment and drop only the sentence that
became obsolete; trim the changelog (Mathieu).
- 2/4: Select between stop_rproc and unprepare_subdevices at the
rproc_start_subdevices() error path instead of branching in the
shared unwind path (Mathieu).
- 3/4: Replace the detach()-first rework with a guard against a
missing stop(), so no existing driver changes behaviour. The
STM32 detach() path is not affected anymore.
- 4/4: Describe the code as applied, follow the __rproc_shutdown()
cleanup sequence, and check for RPROC_OFFLINE/RPROC_DETACHED
explicitly; trim the changelog (Mathieu).
v1: https://lore.kernel.org/all/20260929075453.2324597-1-hyz3367@xxxxxxxxx
Yonghao Zhang (4):
remoteproc: core: Reset freed vring entries to FW_RSC_ADDR_ANY
remoteproc: core: Guard against a missing stop() in rproc_start()
remoteproc: core: Guard against a missing stop() in the attach unwind
remoteproc: core: Clean up after a failed recovery
drivers/remoteproc/remoteproc_core.c | 47 +++++++++++++++++++++++-----
1 file changed, 40 insertions(+), 7 deletions(-)
base-commit: f39ba58941efa63e6c7d10d53d183d6077524bdb
--
2.34.1