From: Mathieu Poirier <mathieu.poirier@linaro.org>
To: Arnaud POULIQUEN <arnaud.pouliquen@st.com>
Cc: "ohad@wizery.com" <ohad@wizery.com>,
"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
"linux-remoteproc@vger.kernel.org"
<linux-remoteproc@vger.kernel.org>
Subject: Re: [PATCH v2 07/14] remoteproc: Introduce function __rproc_detach()
Date: Thu, 19 Nov 2020 16:27:51 -0700 [thread overview]
Message-ID: <20201119232751.GB4137289@xps15> (raw)
In-Reply-To: <f9d421b6-ffb3-20f2-c0b1-fa4976a3a29e@st.com>
On Fri, Nov 06, 2020 at 06:43:05PM +0100, Arnaud POULIQUEN wrote:
>
>
> On 10/30/20 8:57 PM, Mathieu Poirier wrote:
> > Introduce function __rproc_detach() to perform the same kind of
> > operation as rproc_stop(), but instead of switching off the
> > remote processor using rproc->ops->stop(), it uses
> > rproc->ops->detach(). That way it is possible for the core
> > to release the resources associated with a remote processor while
> > the latter is kept operating.
> >
> > Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > Reviewed-by: Peng Fan <peng.fan@nxp.com>
> > ---
> > drivers/remoteproc/remoteproc_core.c | 31 ++++++++++++++++++++++++++++
> > 1 file changed, 31 insertions(+)
> >
> > diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> > index ed1f9ca4248b..62e88ff65009 100644
> > --- a/drivers/remoteproc/remoteproc_core.c
> > +++ b/drivers/remoteproc/remoteproc_core.c
> > @@ -1664,6 +1664,37 @@ static int rproc_stop(struct rproc *rproc, bool crashed)
> > return 0;
> > }
> >
> > +/*
> > + * __rproc_detach(): Does the opposite of rproc_attach()
> > + */
> > +static int __maybe_unused __rproc_detach(struct rproc *rproc)
> > +{
> > + struct device *dev = &rproc->dev;
> > + int ret;
> > +
> > + /* No need to continue if a detach() operation has not been provided */
> > + if (!rproc->ops->detach)
> > + return -EINVAL;
> > +
> > + /* Stop any subdevices for the remote processor */
> > + rproc_stop_subdevices(rproc, false);
>
> How to determine whether a subdevice should be stopped or detached?
> For instance, in ST, we have a resource manager subdev which maintains clocks and regulators
> for peripherals used by the remote processor.
> In case of detachment we would need to maintain clock and regulators.
>
> > +
> > + /* Tell the remote processor the core isn't available anymore */
> > + ret = rproc->ops->detach(rproc);
> > + if (ret) {
> > + dev_err(dev, "can't detach from rproc: %d\n", ret);
> > + rproc_start_subdevices(rproc);
> > + return ret;
> > + }
> > +
> > + rproc_unprepare_subdevices(rproc);
>
> Same here, is prepare/unprepare can depend on the operation?
>
> Seems that adding rproc_attach_subdevices/rproc_detach_subdevices could be not sufficient
> to address prepare/unprepare.
> Alternative could be:
> - extra parameter for the subdev ops to indicate attach/detach action...?
> - intermediate rproc state : ATTACHING, DETACHING
> - other?
These are really good points. I did not think about that kind of scenario and
the best solution isn't obvious to me either.
>
> That's said, I don't think that it is blocking for the ST resource manager.
> In this particular case, regulators and clocks can be permanently activated
> as a back-up solution (always-on).
>
> So, if no other company has a problem with that, we can keep this implementation for now.
As I wrote above the path forward isn't clear to me and as such will opt to
address this in another patchset... But it has to be fixed.
>
> Regards,
> Arnaud
>
> > +
> > + rproc->state = RPROC_DETACHED;
> > +
> > + dev_info(dev, "detached remote processor %s\n", rproc->name);
> > +
> > + return 0;
> > +}
> >
> > /**
> > * rproc_trigger_recovery() - recover a remoteproc
> >
next prev parent reply other threads:[~2020-11-19 23:27 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-30 19:56 [PATCH v2 00/14] remoteproc: Add support for detaching from rproc Mathieu Poirier
2020-10-30 19:57 ` [PATCH v2 01/14] remoteproc: Re-check state in rproc_shutdown() Mathieu Poirier
2020-11-09 9:40 ` Arnaud POULIQUEN
2020-10-30 19:57 ` [PATCH v2 02/14] remoteproc: Remove useless check in rproc_del() Mathieu Poirier
2020-11-09 9:40 ` Arnaud POULIQUEN
2020-10-30 19:57 ` [PATCH v2 03/14] remoteproc: Add new RPROC_ATTACHED state Mathieu Poirier
2020-11-09 9:41 ` Arnaud POULIQUEN
2020-10-30 19:57 ` [PATCH v2 04/14] remoteproc: Properly represent the attached state Mathieu Poirier
2020-11-09 9:41 ` Arnaud POULIQUEN
2020-10-30 19:57 ` [PATCH v2 05/14] remoteproc: Properly deal with a kernel panic when attached Mathieu Poirier
2020-11-09 9:41 ` Arnaud POULIQUEN
2020-10-30 19:57 ` [PATCH v2 06/14] remoteproc: Add new detach() remoteproc operation Mathieu Poirier
2020-11-06 17:31 ` Arnaud POULIQUEN
2020-11-19 23:06 ` Mathieu Poirier
2020-10-30 19:57 ` [PATCH v2 07/14] remoteproc: Introduce function __rproc_detach() Mathieu Poirier
2020-11-06 17:43 ` Arnaud POULIQUEN
2020-11-19 23:27 ` Mathieu Poirier [this message]
2020-10-30 19:57 ` [PATCH v2 08/14] remoteproc: Introduce function rproc_detach() Mathieu Poirier
2020-11-09 9:05 ` Arnaud POULIQUEN
2020-11-19 23:40 ` Mathieu Poirier
2020-10-30 19:57 ` [PATCH v2 09/14] remoteproc: Rename function rproc_actuate() Mathieu Poirier
2020-11-09 9:41 ` Arnaud POULIQUEN
2020-10-30 19:57 ` [PATCH v2 10/14] remoteproc: Add return value to function rproc_shutdown() Mathieu Poirier
2020-11-09 9:14 ` Arnaud POULIQUEN
2020-11-19 23:46 ` Mathieu Poirier
2020-10-30 19:57 ` [PATCH v2 11/14] remoteproc: Properly deal with a stop request when attached Mathieu Poirier
2020-11-09 9:42 ` Arnaud POULIQUEN
2020-11-12 17:36 ` Arnaud POULIQUEN
2020-10-30 19:57 ` [PATCH v2 12/14] remoteproc: Properly deal with detach request Mathieu Poirier
2020-10-30 19:57 ` [RFC v2 13/14] remoteproc: Add automation flags Mathieu Poirier
2020-11-06 14:38 ` Arnaud POULIQUEN
2020-11-06 17:20 ` Mathieu Poirier
2020-11-12 13:56 ` Arnaud POULIQUEN
2020-11-13 21:27 ` Mathieu Poirier
2020-11-16 10:21 ` Arnaud POULIQUEN
2020-11-20 20:40 ` Mathieu Poirier
2020-10-30 19:57 ` [RFC v2 14/14] remoteproc: Refactor rproc delete and cdev release path Mathieu Poirier
2020-11-12 18:20 ` [PATCH v2 00/14] remoteproc: Add support for detaching from rproc Arnaud POULIQUEN
2020-11-12 18:41 ` Mathieu Poirier
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=20201119232751.GB4137289@xps15 \
--to=mathieu.poirier@linaro.org \
--cc=arnaud.pouliquen@st.com \
--cc=bjorn.andersson@linaro.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=ohad@wizery.com \
/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