public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Konrad Dybcio <konrad.dybcio@linaro.org>,
	Stephan Gerhold <stephan@gerhold.net>
Cc: Andy Gross <agross@kernel.org>,
	Bjorn Andersson <andersson@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH RFT v2 01/14] dt-bindings: clock: qcom,rpmcc: Add a way to enable unused clock cleanup
Date: Mon, 17 Apr 2023 17:19:44 -0700	[thread overview]
Message-ID: <d63d4896afe8a1a901470f88862ce608.sboyd@kernel.org> (raw)
In-Reply-To: <ZD2YYrOdQMD3pi7u@gerhold.net>

Quoting Stephan Gerhold (2023-04-17 12:05:06)
> On Wed, Mar 08, 2023 at 10:35:17PM +0100, Konrad Dybcio wrote:
> > Disabling RPMCC clocks can be a bit touchy. If we can't guarantee all
> > (or at least most) of the oneline peripherals ask the interconnect
> > framework to keep their buses online and guarantee enough bandwidth,
> > we're relying on bootloader defaults to keep the said buses alive through
> > RPM requests and rate setting on RPM clocks.
> > 
> > Without that in place, the RPM clocks are never enabled in the CCF, which
> > qualifies them to be cleaned up, since - as far as Linux is concerned -
> > nobody's using them and they're just wasting power. Doing so will end
> > tragically, as within miliseconds we'll get *some* access attempt on an
> > unlocked bus which will cause a platform crash.
> > 
> > On the other hand, if we want to save power and put well-supported
> > platforms to sleep, we should be shutting off at least some of these
> > clocks (this time with a clear distinction of which ones are *actually*
> > not in use, coming from the interconnect driver).
> > 
> > To differentiate between these two cases while not breaking older DTs,
> > introduce an opt-in property to correctly mark RPM clocks as enabled
> > after handoff (the initial max freq vote) and hence qualify them for the
> > common unused clock cleanup.
> > 
> > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
> > ---
> >  Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml
> > index 2a95bf8664f9..386153f61971 100644
> > --- a/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml
> > +++ b/Documentation/devicetree/bindings/clock/qcom,rpmcc.yaml
> > @@ -58,6 +58,12 @@ properties:
> >      minItems: 1
> >      maxItems: 2
> >  
> > +  qcom,clk-disable-unused:
> > +    type: boolean
> > +    description:
> > +      Indicates whether unused RPM clocks can be shut down with the common
> > +      unused clock cleanup. Requires a functional interconnect driver.
> > +
> 
> I'm surprised that Stephen Boyd did not bring up his usual "rant" here
> of moving the interconnect clock voting out of rpmcc into the
> interconnect drivers (see [1], [2]). :-)

:) I was hoping to get a fix for disabling unused clks during late init
at the same time. Shucks!

> 
> I was a bit "cautious" about it back then but at this point I think it
> kind of makes sense. Make sure to read Stephen's detailed explanation in
> https://lore.kernel.org/linux-arm-msm/159796605593.334488.8355244657387381953@swboyd.mtv.corp.google.com/
> 
> We keep looking for workarounds to prevent the CCF from "messing" with
> interconnect-related clocks. But the CCF cannot mess with "clocks" it
> does not manage. The RPM interconnect drivers already talk directly to
> the RPM in drivers/interconnect/qcom/smd-rpm.c. I think it should be
> quite easy to move the QCOM_SMD_RPM_BUS_CLK relates defines over there
> and just bypass the CCF entirely.

Please do it!

> 
> For backwards compatibility (for platforms without interconnect drivers)
> one could either assume that the bootloader bandwidth votes will be
> sufficient and just leave those clocks completely alone. Or the
> "icc_smd_rpm" platform device could initially make max votes similar to
> the rpmcc device. By coincidence the "icc_smd_rpm" platform device is
> always created, no matter how the device tree looks or if the platform
> actually has an interconnect driver.
> 

Yeah that's a good plan. Suspend will be broken or burn a lot of power,
but presumably the new DTB will be used fairly quickly. Or you can
implement something like clkdev for interconnects that lets you hack up
an association between interconnects and consumers for existing DTs and
then drop those lookups months later.

  reply	other threads:[~2023-04-18  0:19 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 21:35 [PATCH RFT v2 00/14] SMD RPMCC sleep preparations Konrad Dybcio
2023-03-08 21:35 ` [PATCH RFT v2 01/14] dt-bindings: clock: qcom,rpmcc: Add a way to enable unused clock cleanup Konrad Dybcio
2023-03-16 22:58   ` Rob Herring
2023-03-17  0:31     ` Konrad Dybcio
2023-03-17 18:20       ` Stephen Boyd
2023-04-06 14:44         ` Konrad Dybcio
2023-04-07 20:17           ` Konrad Dybcio
2023-04-11 21:34             ` Konrad Dybcio
2023-03-22  3:23   ` Bjorn Andersson
2023-04-17 19:05   ` Stephan Gerhold
2023-04-18  0:19     ` Stephen Boyd [this message]
2023-04-18 10:33       ` Konrad Dybcio
2023-04-19 11:31         ` Konrad Dybcio
2023-04-19 14:00           ` Stephan Gerhold
2023-04-19 21:08             ` Konrad Dybcio
2023-04-20  8:28   ` Manivannan Sadhasivam
2023-03-08 21:35 ` [PATCH RFT v2 02/14] clk: qcom: smd-rpm: Add .is_enabled hook Konrad Dybcio
2023-03-09  0:47   ` Dmitry Baryshkov
2023-03-22  3:02   ` Bjorn Andersson
2023-04-06 14:43     ` Konrad Dybcio
2023-03-08 21:35 ` [PATCH RFT v2 03/14] clk: qcom: smd-rpm: Add .is_prepared hook Konrad Dybcio
2023-03-09  0:48   ` Dmitry Baryshkov
2023-03-08 21:35 ` [PATCH RFT v2 04/14] clk: qcom: smd-rpm_ Make __DEFINE_CLK_SMD_RPM_BRANCH_PREFIX accept flags Konrad Dybcio
2023-03-09  0:48   ` Dmitry Baryshkov
2023-03-08 21:35 ` [PATCH RFT v2 05/14] clk: qcom: smd-rpm: Make DEFINE_CLK_SMD_RPM_BRANCH_A " Konrad Dybcio
2023-03-09  0:49   ` Dmitry Baryshkov
2023-03-08 21:35 ` [PATCH RFT v2 06/14] clk: qcom: smd-rpm: Make BI_TCXO_AO critical Konrad Dybcio
2023-03-09  0:49   ` Dmitry Baryshkov
2023-03-08 21:35 ` [PATCH RFT v2 07/14] clk: qcom: smd-rpm: Make __DEFINE_CLK_SMD_RPM_PREFIX accept flags Konrad Dybcio
2023-03-09  0:50   ` Dmitry Baryshkov
2023-03-08 21:35 ` [PATCH RFT v2 08/14] clk: qcom: smd-rpm: Separate out a macro for defining an AO clock Konrad Dybcio
2023-03-09  0:50   ` Dmitry Baryshkov
2023-03-08 21:35 ` [PATCH RFT v2 09/14] clk: qcom: smd-rpm: Add support for keepalive votes Konrad Dybcio
2023-03-09  0:54   ` Dmitry Baryshkov
2023-03-09  1:22     ` Konrad Dybcio
2023-03-08 21:35 ` [PATCH RFT v2 10/14] clk: qcom: smd-rpm: Introduce DEFINE_CLK_SMD_RPM_BUS_KEEPALIVE Konrad Dybcio
2023-03-09  1:25   ` Dmitry Baryshkov
2023-03-08 21:35 ` [PATCH RFT v2 11/14] clk: qcom: smd-rpm: Hook up PCNoC_0 keep_alive Konrad Dybcio
2023-03-09  1:25   ` Dmitry Baryshkov
2023-03-22  3:19   ` Bjorn Andersson
2023-03-22  8:05     ` Konrad Dybcio
2023-03-08 21:35 ` [PATCH RFT v2 12/14] clk: qcom: smd-rpm: Hook up CNoC_1 and SNoC_2 keep_alive Konrad Dybcio
2023-03-09  1:25   ` Dmitry Baryshkov
2023-03-08 21:35 ` [PATCH RFT v2 13/14] clk: qcom: smd-rpm: Mark clock enabled in clk_smd_rpm_handoff() Konrad Dybcio
2023-03-08 21:35 ` [PATCH RFT v2 14/14] arm64: dts: qcom: msm8996: Enable rpmcc unused clk disablement Konrad Dybcio
2023-04-20  1:50 ` [PATCH RFT v2 00/14] SMD RPMCC sleep preparations Konrad Dybcio
2023-04-20  7:56   ` Stephan Gerhold
2023-04-20  9:36     ` Konrad Dybcio
2023-04-20 10:04       ` Stephan Gerhold
2023-04-20 10:20         ` Konrad Dybcio
2023-04-20 15:57 ` Konrad Dybcio
2023-04-25 19:35   ` Stephen Boyd
2023-04-26  9:40     ` 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=d63d4896afe8a1a901470f88862ce608.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=agross@kernel.org \
    --cc=andersson@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=konrad.dybcio@linaro.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=stephan@gerhold.net \
    /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