From: Stephan Gerhold <stephan@gerhold.net>
To: Konrad Dybcio <konrad.dybcio@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Georgi Djakov <djakov@kernel.org>,
Marijn Suijten <marijn.suijten@somainline.org>,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] interconnect: qcom: icc-rpm: Add AB/IB calculations coefficients
Date: Wed, 26 Jul 2023 19:16:42 +0200 [thread overview]
Message-ID: <ZMFU-hFSOHLr3hFP@gerhold.net> (raw)
In-Reply-To: <20230726-topic-icc_coeff-v1-1-31616960818c@linaro.org>
On Wed, Jul 26, 2023 at 06:25:43PM +0200, Konrad Dybcio wrote:
> Presumably due to the hardware being so complex, some nodes (or busses)
> have different (usually higher) requirements for bandwidth than what
> the usual calculations would suggest.
>
Weird. I just hope this was never abused to workaround other broken
configuration. A nice round ib_percent = 200 has mostly the same effect as
- Doubling the requested peek bandwidth in the consumer driver (perhaps
they were too lazy to fix the driver in downstream at some point)
- Halving the node buswidth
It's probably hard to say for sure...
> Looking at the available downstream files, it seems like AB values are
> adjusted per-bus and IB values are adjusted per-node.
> With that in mind, introduce percentage-based coefficient struct members
> and use them in the calculations.
>
> One thing to note is that downstream does (X%)*AB and IB/(Y%) which
> feels a bit backwards, especially given that the divisors for IB turn
> out to always be 25, 50, 200 making this a convenient conversion to 4x,
> 2x, 0.5x.. This commit uses the more sane, non-inverse approach.
>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> ---
> drivers/interconnect/qcom/icc-rpm.c | 10 +++++++++-
> drivers/interconnect/qcom/icc-rpm.h | 5 +++++
> 2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c
> index 2c16917ba1fd..2de0e1dfe225 100644
> --- a/drivers/interconnect/qcom/icc-rpm.c
> +++ b/drivers/interconnect/qcom/icc-rpm.c
> @@ -298,9 +298,11 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
> */
> static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_rate)
> {
> - u64 agg_avg_rate, agg_rate;
> + struct qcom_icc_provider *qp = to_qcom_provider(provider);
> + u64 agg_avg_rate, agg_peak_rate, agg_rate;
> struct qcom_icc_node *qn;
> struct icc_node *node;
> + u16 percent;
> int i;
>
> /*
> @@ -315,6 +317,12 @@ static void qcom_icc_bus_aggregate(struct icc_provider *provider, u64 *agg_clk_r
> else
> agg_avg_rate = qn->sum_avg[i];
>
> + percent = qp->ab_percent ? qp->ab_percent : 100;
> + agg_avg_rate = mult_frac(percent, agg_avg_rate, 100);
if (qp->ab_percent)
agg_avg_rate = mult_frac(qp->ab_percent, agg_avg_rate, 100);
Would be likely more efficient (no calculation if unspecified) and not
much harder to read.
> +
> + percent = qn->ib_percent ? qn->ib_percent : 100;
> + agg_peak_rate = mult_frac(percent, qn->max_peak[i], 100);
> +
agg_peak_rate doesn't seem to be used anywhere else? 🤔
Thanks,
Stephan
next prev parent reply other threads:[~2023-07-26 17:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-26 16:25 [PATCH 0/4] Fix up icc clock rate calculation on some platforms Konrad Dybcio
2023-07-26 16:25 ` [PATCH 1/4] interconnect: qcom: icc-rpm: Add AB/IB calculations coefficients Konrad Dybcio
2023-07-26 17:16 ` Stephan Gerhold [this message]
2023-07-26 17:19 ` Konrad Dybcio
2023-07-29 9:25 ` kernel test robot
2023-07-26 16:25 ` [PATCH 2/4] interconnect: qcom: qcm2290: Set AB coefficients Konrad Dybcio
2023-07-26 17:18 ` Stephan Gerhold
2023-07-26 17:20 ` Konrad Dybcio
2023-07-26 17:26 ` Stephan Gerhold
2023-07-26 17:46 ` Konrad Dybcio
2023-07-26 17:52 ` Konrad Dybcio
2023-07-26 16:25 ` [PATCH 3/4] interconnect: qcom: sdm660: Set AB/IB coefficients Konrad Dybcio
2023-07-26 16:25 ` [PATCH 4/4] interconnect: qcom: msm8996: " Konrad Dybcio
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=ZMFU-hFSOHLr3hFP@gerhold.net \
--to=stephan@gerhold.net \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=djakov@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=marijn.suijten@somainline.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;
as well as URLs for NNTP newsgroup(s).