From: Johan Hovold <johan@kernel.org>
To: Gabor Juhos <j4g8y7@gmail.com>
Cc: Georgi Djakov <djakov@kernel.org>,
Raviteja Laggyshetty <quic_rlaggysh@quicinc.com>,
Johan Hovold <johan+linaro@kernel.org>,
Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
linux-pm@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] interconnect: avoid memory allocation when 'icc_bw_lock' is held
Date: Wed, 25 Jun 2025 16:02:09 +0200 [thread overview]
Message-ID: <aFwBYRF0wJwVDdeX@hovoldconsulting.com> (raw)
In-Reply-To: <84b94649-a248-46b0-a401-772aeb8777a2@gmail.com>
On Wed, Jun 25, 2025 at 03:15:53PM +0200, Gabor Juhos wrote:
> 2025. 06. 25. 14:41 keltezéssel, Johan Hovold írta:
> > On Wed, Jun 25, 2025 at 02:30:15PM +0200, Johan Hovold wrote:
> >> On Wed, Jun 25, 2025 at 01:25:04PM +0200, Gabor Juhos wrote:
> >
> >>> @@ -276,13 +276,17 @@ int qcom_icc_rpmh_probe(struct platform_device *pdev)
> >>> qcom_icc_bcm_init(qp->bcms[i], dev);
> >>>
> >>> for (i = 0; i < num_nodes; i++) {
> >>> + bool is_dyn_node = false;
> >>> +
> >>> qn = qnodes[i];
> >>> if (!qn)
> >>> continue;
> >>>
> >>> if (desc->alloc_dyn_id) {
> >>> - if (!qn->node)
> >>> + if (!qn->node) {
> >>
> >> AFAICS, qn->node will currently never be set here and I'm not sure why
> >> commit 7f9560a3bebe ("interconnect: qcom: icc-rpmh: Add dynamic icc node
> >> id support") added this check, or even the node field to struct
> >> qcom_icc_desc for that matter.
> >>
> >> But if there's some future use case for this, then you may or may not
> >> need to make sure that a name is allocated also in that case.
> >
> > Ok, I see what's going on. The qn->node may have been (pre-) allocated
> > in icc_link_nodes() dynamically, which means you need to make sure to
> > generate a name also in that case.
> >
> >> And that could be done by simply checking if node->id >=
> >> ICC_DYN_ID_START instead of using a boolean flag below. That may be
> >> preferred either way.
> >
> > So you should probably use node->id to determine this.
>
> You are right. The problem is that ICC_DYN_ID_START is only visible from the
> core code. Either we have to move that into the 'interconnect-provider.h' header
> or we have to add an icc_node_is_dynamic() helper or something similar.
>
> Which is the preferred solution?
I think adding a helper like icc_node_is_dynamic() in a separate
preparatory patch is best here.
If it wasn't for nodes now being created also in icc_link_nodes() we
could otherwise perhaps just as well have moved the name generation into
icc_node_create_dyn(). Now it seems we'd need a new helper to set the
name (or add error handling for every icc_node_add()), but we've already
spent way too much time trying to clean up this mess...
Johan
next prev parent reply other threads:[~2025-06-25 14:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 11:25 [PATCH v3] interconnect: avoid memory allocation when 'icc_bw_lock' is held Gabor Juhos
2025-06-25 12:30 ` Johan Hovold
2025-06-25 12:41 ` Johan Hovold
2025-06-25 13:15 ` Gabor Juhos
2025-06-25 14:02 ` Johan Hovold [this message]
2025-06-25 15:35 ` Gabor Juhos
2025-06-26 9:30 ` Johan Hovold
2025-06-26 15:00 ` Gabor Juhos
2025-06-27 7:11 ` Johan Hovold
2025-06-27 9:36 ` Gabor Juhos
2025-06-27 9:43 ` Johan Hovold
2025-06-27 12:23 ` Gabor Juhos
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=aFwBYRF0wJwVDdeX@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=djakov@kernel.org \
--cc=j4g8y7@gmail.com \
--cc=johan+linaro@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=quic_rlaggysh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.