lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZIS28eN1JEuXV2AT@gerhold.net>
Date:   Sat, 10 Jun 2023 19:46:25 +0200
From:   Stephan Gerhold <stephan@...hold.net>
To:     Konrad Dybcio <konrad.dybcio@...aro.org>
Cc:     Andy Gross <agross@...nel.org>,
        Bjorn Andersson <andersson@...nel.org>,
        Michael Turquette <mturquette@...libre.com>,
        Stephen Boyd <sboyd@...nel.org>,
        Georgi Djakov <djakov@...nel.org>,
        Leo Yan <leo.yan@...aro.org>,
        Evan Green <evgreen@...omium.org>,
        Marijn Suijten <marijn.suijten@...ainline.org>,
        linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-clk@...r.kernel.org, linux-pm@...r.kernel.org,
        Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
Subject: Re: [PATCH v2 19/22] interconnect: qcom: icc-rpm: Fix bucket number

On Fri, Jun 09, 2023 at 10:19:24PM +0200, Konrad Dybcio wrote:
> SMD RPM only provides two buckets, one each for the active-only and
> active-sleep RPM contexts. Use the correct constant to allocate and
> operate on them.
> 
> Fixes: dcbce7b0a79c ("interconnect: qcom: icc-rpm: Support multiple buckets")
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> Signed-off-by: Konrad Dybcio <konrad.dybcio@...aro.org>
> ---
>  drivers/interconnect/qcom/icc-rpm.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c
> index 6d40815c5401..3ac47b818afe 100644
> --- a/drivers/interconnect/qcom/icc-rpm.c
> +++ b/drivers/interconnect/qcom/icc-rpm.c
> [...]
> @@ -275,7 +275,7 @@ static int qcom_icc_bw_aggregate(struct icc_node *node, u32 tag, u32 avg_bw,
>  	if (!tag)
>  		tag = QCOM_ICC_TAG_ALWAYS;
>  
> -	for (i = 0; i < QCOM_ICC_NUM_BUCKETS; i++) {
> +	for (i = 0; i < QCOM_SMD_RPM_STATE_NUM; i++) {
>  		if (tag & BIT(i)) {

Hm, I think QCOM_ICC_NUM_BUCKETS is actually intentional here. There is
a hint about this in the description of the commit in your Fixes line:

> This patch studies the implementation from interconnect rpmh driver to
> support multiple buckets.  The rpmh driver provides three buckets for
> AMC, WAKE, and SLEEP; this driver only needs to use WAKE and SLEEP
> buckets, but we keep the same way with rpmh driver, this can allow us
> to reuse the DT binding and avoid to define duplicated data structures.

As far as I understand, the idea was to reuse the definitions in
qcom,icc.h and just ignore the AMC bucket for now. AFAIU AMC (or rather
the lack thereof) is basically caching: Sending requests without AMC bit
set is delayed until the next rpmh_flush() call that happens when
entering a deep idle state. It requires some work but I guess
theoretically one could implement exactly the same for RPM.

What you're actually doing here is not fixing the commit but changing
the bindings. On MSM8909 I defined the ICC path for CPU<->RAM like this:

	interconnects = <&bimc MAS_APPS_PROC QCOM_ICC_TAG_ACTIVE_ONLY
			 &bimc SLV_EBI QCOM_ICC_TAG_ACTIVE_ONLY>;

Per definition in qcom,icc.h:

	QCOM_ICC_TAG_ACTIVE_ONLY = (AMC | WAKE) = (BIT(0) | BIT(1))

Without your patch series this behaves correctly. It results in an
active-only vote.

The change of behavior is in PATCH 17/22 "interconnect: qcom: icc-rpm:
Control bus rpmcc from icc". It silently switches from
QCOM_ICC_BUCKET_WAKE (1) and QCOM_ICC_BUCKET_SLEEP (2) to
QCOM_SMD_RPM_ACTIVE_STATE (0) and QCOM_SMD_RPM_SLEEP_STATE (1).

In other words, QCOM_ICC_TAG_ACTIVE_ONLY (BIT(0) | BIT(1)) now results
in an active+sleep vote, not an active-only one. :)

There doesn't seem to be an upstream user of the ICC tags/buckets for
icc-rpm yet so personally I would be fine with changing it. However,
then qcom,icc.h should get a clear comment that it's rpmh-only and we
should define a new qcom,icc-rpm.h.

Or perhaps we should just drop this patch and continue using
QCOM_ICC_BUCKET_WAKE and QCOM_ICC_BUCKET_SLEEP as before?

Thanks,
Stephan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ