linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Andersson <bjorn.andersson@linaro.org>
To: Shawn Guo <shawn.guo@linaro.org>
Cc: Stephan Gerhold <stephan@gerhold.net>,
	Stephen Boyd <sboyd@kernel.org>,
	Loic Poulain <loic.poulain@linaro.org>,
	linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] clk: qcom: smd-rpm: Report enable state to framework
Date: Wed, 10 Nov 2021 05:48:10 -0800	[thread overview]
Message-ID: <YYvNmrSeJNCE4BEC@ripper> (raw)
In-Reply-To: <20211110131507.GJ7231@dragon>

On Wed 10 Nov 05:15 PST 2021, Shawn Guo wrote:

> Hi Stephan,
> 
> On Tue, Nov 09, 2021 at 11:26:21AM +0100, Stephan Gerhold wrote:
> > Hi Shawn,
> > 
> > On Tue, Nov 09, 2021 at 10:25:55AM +0800, Shawn Guo wrote:
> > > Currently the enable state of smd-rpm clocks are not properly reported
> > > back to framework due to missing .is_enabled and .is_prepared hooks.
> > > This causes a couple of issues.
> > > 
> > > - All those unused clocks are not voted for off, because framework has
> > >   no knowledge that they are unused.  It becomes a problem for vlow
> > >   power mode support, as we do not have every single RPM clock claimed
> > >   and voted for off by client devices, and rely on clock framework to
> > >   disable those unused RPM clocks.
> > > 
> > 
> > I posted a similar patch a bit more than a year ago [1].
> 
> Ouch, that's unfortunate!  If your patch landed, I wouldn't have had to
> spend such a long time to figure out why my platform fails to reach vlow
> power mode :(
> 
> > Back then one
> > of the concerns was that we might disable critical clocks just because
> > they have no driver using it actively. For example, not all of the
> > platforms using clk-smd-rpm already have an interconnect driver.
> > Disabling the interconnect related clocks will almost certainly make the
> > device lock up completely. (I tried it back then, it definitely does...)
> > 
> > I proposed adding CLK_IGNORE_UNUSED for the interconnect related clocks
> > back then [2] which would allow disabling most of the clocks at least.
> > Stephen Boyd had an alternative proposal to instead move the
> > interconnect related clocks completely out of clk-smd-rpm [3].
> > But I'm still unsure how this would work in a backwards compatible way. [4]
> > 
> > Since your patches are more or less identical I'm afraid the same
> > concerns still need to be solved somehow. :)
> 
> I do not really understand why smd-rpm clock driver needs to be a special
> case.  This is a very common issue, mostly in device early support phase
> where not all clock consumer drivers are ready.  Flag CLK_IGNORE_UNUSED
> and kernel cmdline 'clk_ignore_unused' are created just for that.  Those
> "broken" platforms should be booted with 'clk_ignore_unused' until they
> have related consumer drivers in place.

Afaict we still have the problem that if the interconnect driver is
compiled as a module, or for other reasons doesn't probe until after
late_initcall() clk-smd-rpm will turn off these clocks and we never will
get a chance to probe the interconnect provider.

I believe the way to handle that is to rely on sync_state, but there
seems to be a lot of corner cases here.

But with that in place, I agree that we should handle this temporarily
during bringup by the use of clk_ignore_unused.

> IMHO, properly reporting enable state to framework is definitely the
> right thing to do, and should have been done from day one.
> 

I always thought is_enabled() should reflect the hardware state - in
particular for clk_summary. The particular concern being that by
initializing the is_enabled() state to either true or false, we're
making an assumption about the hardware state. And if something where to
do if (enabled) disable (or if (disabled) enable), we might skip a
critical operation just because we tricked the logic.

So, do you need it for anything other than clk_disable_unused()?

I have a clock in the MDP with similar issue, where we don't have
is_enabled() but I need it to be disabled by clk_disable_unused(),
because the next iteration turns off the parent and locks up the still
"active" rcg.
So far I've not received any feedback on this though...
https://lore.kernel.org/all/20210707043859.195870-1-bjorn.andersson@linaro.org/

With this approach we don't make any assumptions about the hardware
state, beyond the fact that we will issue a disable in
clk_disable_unused() if no one has yet enabled the clock - which at
worst turns off a clock that's already is off.

Regards,
Bjorn

> Shawn
> 
> > [1]: https://lore.kernel.org/linux-arm-msm/20200817140908.185976-1-stephan@gerhold.net/
> > [2]: https://lore.kernel.org/linux-arm-msm/20200818080738.GA46574@gerhold.net/
> > [3]: https://lore.kernel.org/linux-arm-msm/159796605593.334488.8355244657387381953@swboyd.mtv.corp.google.com/
> > [4]: https://lore.kernel.org/linux-arm-msm/20200821064857.GA905@gerhold.net/

  reply	other threads:[~2021-11-10 13:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09  2:25 [PATCH 0/3] clk: qcom: smd-rpm: Report enable state to framework Shawn Guo
2021-11-09  2:25 ` [PATCH 1/3] clk: qcom: smd-rpm: Mark clock enabled in clk_smd_rpm_handoff() Shawn Guo
2021-11-09  2:25 ` [PATCH 2/3] clk: qcom: smd-rpm: Add .is_enabled hook Shawn Guo
2021-11-09  2:25 ` [PATCH 3/3] clk: qcom: smd-rpm: Add .is_prepared hook Shawn Guo
2021-11-09 10:26 ` [PATCH 0/3] clk: qcom: smd-rpm: Report enable state to framework Stephan Gerhold
2021-11-09 15:56   ` Bjorn Andersson
2021-11-10 13:15   ` Shawn Guo
2021-11-10 13:48     ` Bjorn Andersson [this message]
2021-11-11  9:39       ` Shawn Guo
2021-12-06 15:42         ` Bjorn Andersson
2021-11-10 14:09     ` Stephan Gerhold
2021-11-10 14:58       ` Bjorn Andersson
2021-12-09  9:10   ` Stephen Boyd

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=YYvNmrSeJNCE4BEC@ripper \
    --to=bjorn.andersson@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=sboyd@kernel.org \
    --cc=shawn.guo@linaro.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;
as well as URLs for NNTP newsgroup(s).