From: Arnaud POULIQUEN <arnaud.pouliquen@foss.st.com>
To: Chris Lew <quic_clew@quicinc.com>, <bjorn.andersson@linaro.org>,
<mathieu.poirier@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>,
<linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] remoteproc: core: Introduce rproc_del_carveout
Date: Thu, 30 Jun 2022 18:36:45 +0200 [thread overview]
Message-ID: <7881ee36-89f6-3ba9-f4ac-7c4e614728dd@foss.st.com> (raw)
In-Reply-To: <1654888985-3846-2-git-send-email-quic_clew@quicinc.com>
Hi,
On 6/10/22 21:23, Chris Lew wrote:
> To mirror the exported rproc_add_carveout(), add a rproc_del_carveout()
> so memory carveout resources added by devices outside of remoteproc can
> manage the resource lifetime more accurately.
>
> Signed-off-by: Chris Lew <quic_clew@quicinc.com>
> ---
> drivers/remoteproc/remoteproc_core.c | 20 ++++++++++++++++++++
> include/linux/remoteproc.h | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
> index 02a04ab34a23..ee71fccae970 100644
> --- a/drivers/remoteproc/remoteproc_core.c
> +++ b/drivers/remoteproc/remoteproc_core.c
> @@ -1001,6 +1001,26 @@ void rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem)
> EXPORT_SYMBOL(rproc_add_carveout);
>
> /**
> + * rproc_del_carveout() - remove an allocated carveout region
> + * @rproc: rproc handle
> + * @mem: memory entry to register
> + *
> + * This function removes specified memory entry in @rproc carveouts list.
> + */
> +void rproc_del_carveout(struct rproc *rproc, struct rproc_mem_entry *mem)
> +{
> + struct rproc_mem_entry *entry, *tmp;
> +
> + list_for_each_entry_safe(entry, tmp, &rproc->carveouts, node) {
> + if (entry == mem) {
> + list_del(&mem->node);
> + return;
> + }
> + }
> +}
> +EXPORT_SYMBOL(rproc_del_carveout);
This API seems to me quite dangerous because it can be called while carveouts are in use.
At least some checks should be added...
What about using rproc_resource_cleanup instead?
Regards,
Arnaud
> +
> +/**
> * rproc_mem_entry_init() - allocate and initialize rproc_mem_entry struct
> * @dev: pointer on device struct
> * @va: virtual address
> diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
> index 7c943f0a2fc4..43112aa78ffe 100644
> --- a/include/linux/remoteproc.h
> +++ b/include/linux/remoteproc.h
> @@ -658,6 +658,7 @@ struct rproc *devm_rproc_alloc(struct device *dev, const char *name,
> int devm_rproc_add(struct device *dev, struct rproc *rproc);
>
> void rproc_add_carveout(struct rproc *rproc, struct rproc_mem_entry *mem);
> +void rproc_del_carveout(struct rproc *rproc, struct rproc_mem_entry *mem);
>
> struct rproc_mem_entry *
> rproc_mem_entry_init(struct device *dev,
next prev parent reply other threads:[~2022-06-30 16:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-10 19:23 [PATCH 0/2] Introduce helpers for carveout management Chris Lew
2022-06-10 19:23 ` [PATCH 1/2] remoteproc: core: Introduce rproc_del_carveout Chris Lew
2022-06-30 16:36 ` Arnaud POULIQUEN [this message]
2022-07-06 4:57 ` Chris Lew
2022-06-10 19:23 ` [PATCH 2/2] remoteproc: core: Introduce rproc_mem_entry_free Chris Lew
2022-06-30 16:38 ` Arnaud POULIQUEN
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=7881ee36-89f6-3ba9-f4ac-7c4e614728dd@foss.st.com \
--to=arnaud.pouliquen@foss.st.com \
--cc=bjorn.andersson@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=quic_clew@quicinc.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
all inboxes | Powered by JetHome®