Linux Power Management development
 help / color / mirror / Atom feed
From: Georgi Djakov <djakov@kernel.org>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>,
	Bjorn Andersson <andersson@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 03/28] interconnect: qcom: rpmh: make nodes a NULL_terminated array
Date: Fri, 18 Jul 2025 16:38:02 +0300	[thread overview]
Message-ID: <859be3e3-be14-411d-b5ef-07bdad91a878@kernel.org> (raw)
In-Reply-To: <20250704-rework-icc-v2-3-875fac996ef5@oss.qualcomm.com>

Hi Dmitry,

On 7/4/25 7:35 PM, Dmitry Baryshkov wrote:
> Having the .num_nodes as a separate struct field can provoke errors as
> it is easy to omit it or to put an incorrect value into that field. Turn
> .nodes into a NULL-terminated array, removing a need for a separate
> .num_nodes field. 

I am not entirely convinced that an error in the termination is more
unlikely than an error in the num_nodes. Aren't we trading one kind of
error for another? Also if we omit the num_nodes i expect that just the
QoS of a specific path will fail, but if we miss the NULL - worse things
might happen.

[..]
>   27 files changed, 541 insertions(+), 1119 deletions(-)

The negative diffstat is nice.

> 
> diff --git a/drivers/interconnect/qcom/bcm-voter.c b/drivers/interconnect/qcom/bcm-voter.c
> index a2d437a05a11fa7325f944865c81a3ac7dbb203e..4fa960630d28f338f484794d271a5b52f3e698d3 100644
> --- a/drivers/interconnect/qcom/bcm-voter.c
> +++ b/drivers/interconnect/qcom/bcm-voter.c
> @@ -68,7 +68,7 @@ static void bcm_aggregate_mask(struct qcom_icc_bcm *bcm)
>   		bcm->vote_x[bucket] = 0;
>   		bcm->vote_y[bucket] = 0;
>   
> -		for (i = 0; i < bcm->num_nodes; i++) {
> +		for (i = 0; bcm->nodes[i]; i++) {
>   			node = bcm->nodes[i];

I like better the single memory access and the two registers comparison
that we already have, but both are fine as we are not in some critical
section.

[..]
> diff --git a/drivers/interconnect/qcom/icc-rpmh.h b/drivers/interconnect/qcom/icc-rpmh.h
> index bd8d730249b1c9e5b37afbee485b9500a8028c2e..0018aa74187edcac9a0492c737771d957a133cc0 100644
> --- a/drivers/interconnect/qcom/icc-rpmh.h
> +++ b/drivers/interconnect/qcom/icc-rpmh.h
> @@ -126,7 +126,6 @@ struct qcom_icc_node {
>    * communicating with RPMh
>    * @list: used to link to other bcms when compiling lists for commit
>    * @ws_list: used to keep track of bcms that may transition between wake/sleep
> - * @num_nodes: total number of @num_nodes
>    * @nodes: list of qcom_icc_nodes that this BCM encapsulates
>    */
>   struct qcom_icc_bcm {
> @@ -142,7 +141,6 @@ struct qcom_icc_bcm {
>   	struct bcm_db aux_data;
>   	struct list_head list;
>   	struct list_head ws_list;
> -	size_t num_nodes;

So no change in memory footprint, as now instead of the num_nodes, there
will be an additional NULL pointer for termination.

[..]

Well, this approach is also good. The existing one just follows the pattern
used by other frameworks, that seemed more common and thus make the code
easier to read and review.

I don't see a strong argument to switch to a NULL terminated arrays (yet),
as it does not make things any better for performance/memory, so I'm not
sure if it's worth reshuffling the 10k+ LoC in drivers. Is there any other
argument that i miss?

Thanks,
Georgi


  parent reply	other threads:[~2025-07-18 13:38 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04 16:35 [PATCH v2 00/28] interconnect: qcom: icc-rpmh: use NULL-terminated arrays and drop static IDs Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 01/28] interconnect: qcom: sc8280xp: specify num_links for qnm_a1noc_cfg Dmitry Baryshkov
2025-07-08 12:59   ` Konrad Dybcio
2025-07-04 16:35 ` [PATCH v2 02/28] interconnect: qcom: sc8180x: specify num_nodes Dmitry Baryshkov
2025-07-08 13:00   ` Konrad Dybcio
2025-07-04 16:35 ` [PATCH v2 03/28] interconnect: qcom: rpmh: make nodes a NULL_terminated array Dmitry Baryshkov
2025-07-08 16:41   ` Konrad Dybcio
2025-07-18 13:38   ` Georgi Djakov [this message]
2025-07-18 17:26     ` Dmitry Baryshkov
2025-07-18 22:17       ` Konrad Dybcio
2025-07-18 22:44         ` Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 04/28] interconnect: qcom: rpmh: make link_nodes " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 05/28] interconnect: qcom: sc7280: convert to dynamic IDs Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 06/28] interconnect: qcom: sc8180x: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 07/28] interconnect: qcom: sc8280xp: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 08/28] interconnect: qcom: sdm845: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 09/28] interconnect: qcom: sm8250: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 10/28] interconnect: qcom: x1e80100: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 11/28] interconnect: qcom: qcs615: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 12/28] interconnect: qcom: qcs8300: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 13/28] interconnect: qcom: qdu1000: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 14/28] interconnect: qcom: sar2130p: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 15/28] interconnect: qcom: sc7180: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 16/28] interconnect: qcom: sdm670: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 17/28] interconnect: qcom: sdx55: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 18/28] interconnect: qcom: sdx65: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 19/28] interconnect: qcom: sdx75: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 20/28] interconnect: qcom: sm6350: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 21/28] interconnect: qcom: sm7150: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 22/28] interconnect: qcom: sm8150: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 23/28] interconnect: qcom: sm8350: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 24/28] interconnect: qcom: sm8450: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 25/28] interconnect: qcom: sm8550: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 26/28] interconnect: qcom: sm8650: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 27/28] interconnect: qcom: sm8750: " Dmitry Baryshkov
2025-07-04 16:35 ` [PATCH v2 28/28] interconnect: qcom: icc-rpmh: drop support for non-dynamic IDS Dmitry Baryshkov
2025-07-08 16:44   ` Konrad Dybcio
2025-07-16 15:22 ` [PATCH v2 00/28] interconnect: qcom: icc-rpmh: use NULL-terminated arrays and drop static IDs Dmitry Baryshkov

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=859be3e3-be14-411d-b5ef-07bdad91a878@kernel.org \
    --to=djakov@kernel.org \
    --cc=andersson@kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.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