mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yonghao Zhang <hyz3367@gmail.com>
To: mathieu.poirier@linaro.org, andersson@kernel.org
Cc: linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yonghao Zhang <hyz3367@gmail.com>
Subject: [PATCH v2 0/4] remoteproc: core: Fix the error unwind paths
Date: Tue, 24 Nov 2026 15:14:05 +0800	[thread overview]
Message-ID: <20261124071409.972-1-hyz3367@gmail.com> (raw)

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@gmail.com

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


             reply	other threads:[~2026-11-24  7:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  7:14 Yonghao Zhang [this message]
2026-11-24  7:14 ` [PATCH v2 1/4] remoteproc: core: Reset freed vring entries to FW_RSC_ADDR_ANY Yonghao Zhang
2026-11-24  7:14 ` [PATCH v2 2/4] remoteproc: core: Guard against a missing stop() in rproc_start() Yonghao Zhang
2026-11-24  7:14 ` [PATCH v2 3/4] remoteproc: core: Guard against a missing stop() in the attach unwind Yonghao Zhang
2026-11-24  7:14 ` [PATCH v2 4/4] remoteproc: core: Clean up after a failed recovery Yonghao Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261124071409.972-1-hyz3367@gmail.com \
    --to=hyz3367@gmail.com \
    --cc=andersson@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-remoteproc@vger.kernel.org \
    --cc=mathieu.poirier@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®