From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Stephen Boyd <swboyd@chromium.org>,
Ulf Hansson <ulf.hansson@linaro.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-clk@vger.kernel.org, linux-pm@vger.kernel.org,
Rob Clark <robdclark@chromium.org>, Yu Zhao <yuzhao@google.com>,
linux-arm-msm@vger.kernel.org, dianders@chromium.org,
mka@chromium.org, Taniya Das <quic_tdas@quicinc.com>,
Satya Priya <quic_c_skakit@quicinc.com>
Subject: Re: clk: qcom: genpd lockdep warning in gdsc
Date: Thu, 27 Oct 2022 21:13:44 +0300 [thread overview]
Message-ID: <9a696c92-eac2-e8fc-5081-8feb9c6150c1@linaro.org> (raw)
In-Reply-To: <CAE-0n52Bfe-7Fpawct=_3=miLBygR_-YXm1YPnhCWOwxFnjv7g@mail.gmail.com>
On 27/10/2022 01:18, Stephen Boyd wrote:
> Reviving this old thread because this commit has lead to a couple bugs
> now.
>
> Quoting Ulf Hansson (2022-06-22 03:26:52)
>> On Fri, 17 Jun 2022 at 21:58, Stephen Boyd <swboyd@chromium.org> wrote:
>>>
>>> Hi Bjorn and Dmitry,
>>>
>>> Yu reported a lockdep warning coming from the gdsc driver. It looks like
>>> the runtime PM usage in gdsc.c is causing lockdep to see an AA deadlock
>>> possibility with 'genpd->mlock'. I suspect this is because we have
>>> commit 1b771839de05 ("clk: qcom: gdsc: enable optional power domain
>>> support"), and that is now calling runtime PM code from within the genpd
>>> code.
>
> This commit has caused a deadlock at boot for Doug[1] and I see that the
> camera driver on Google CoachZ and Wormdingler devices doesn't work
> after resuming from suspend once this commit is applied. I'm leaning
> towards sending a revert, because it seems to cause 3 issues while
> removing the regulator hack that was in place to enable MMCX. This patch
> is cleaning up the hack, but trading the hack for three more problems.
>
>> I think genpd already has nested lock support, so the only
>>> solution is to not use runtime PM from within genpd code and start
>>> expressing genpd parent relationships in genpd itself?
>>
>> Not sure exactly what you mean here, but yes, expressing the
>> parent/child domain relationship is always needed.
>>
>> Having gdsc_disable() to do runtime PM calls (gdsc_pm_runtime_put())
>> seems awkward to me. Why is that needed, more exactly?
>
> It seems like this is needed so that the gdsc_enable() and
> gdsc_disable() calls can read/write the registers for the genpd, while
> those registers live in some clk controller that needs either a
> different clk (probably some AHB clk) or another genpd to be enabled. It
> looks like for qcom,sm8250-dispcc it relies on MMCX gdsc (which is a
> genpd). From a hardware view, the MDSS_GDSC provided by the display clk
> controller is probably not a sub-domain of MMCX. Instead, we need to
> have MMCX enabled so that we can access the registers for the MDSS GDSC.
Yes, exactly.
>
> My question is if it makes sense to simply describe that the GDSCs
> provided by a device are sub-domains of whatever power domains are
> listed in DT for that device? I think if we did that here for sm8250
> dispcc, we wouldn't need to use runtime PM within the genpd code
> assuming that the MMCX parent genpd is enabled before we attempt to
> read/write the dispcc gdsc registers. Hopefully that is also done, i.e.
> enabling parent domains before enabling child domains if the parent is
> disabled.
I will check this tomorrow. It should be possible to handle the
MMCX/MDSS_GDSC relationship in this way.
> Is this already being done with pm_genpd_add_subdomain() in
> gdsc_register()? I see that we're attaching that to dispcc's struct
> device::pm_domain, but I assume that is different from the MMCX genpd.
No, I think the only domain there is the MMCX domain, so this call s
> Maybe that is the problem here. Dmitry can you further describe the
> problem being solved?
I must admit, I don't remember what caused me to add this call. May be
it was added before me getting the pm_genpd_add_subdomain() call in place.
>
>>
>>> Or maybe genpd
>>> needs to drop locks while calling down into gdsc_disable() and reacquire
>>> them after that?
>>
>> Nope, that doesn't work. This internals of genpd relies on this
>> behaviour, as it allows it to properly deal with power-on|off for
>> parent/child domains, for example.
>
> Ok.
>
> [1] https://lore.kernel.org/r/20220922154354.2486595-1-dianders@chromium.org
--
With best wishes
Dmitry
next prev parent reply other threads:[~2022-10-27 18:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-17 19:58 clk: qcom: genpd lockdep warning in gdsc Stephen Boyd
2022-06-22 10:26 ` Ulf Hansson
2022-10-26 22:18 ` Stephen Boyd
2022-10-27 18:13 ` Dmitry Baryshkov [this message]
2022-11-01 0:43 ` Stephen Boyd
2022-11-01 1:08 ` Dmitry Baryshkov
2022-11-01 5:32 ` 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=9a696c92-eac2-e8fc-5081-8feb9c6150c1@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=dianders@chromium.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mka@chromium.org \
--cc=quic_c_skakit@quicinc.com \
--cc=quic_tdas@quicinc.com \
--cc=robdclark@chromium.org \
--cc=swboyd@chromium.org \
--cc=ulf.hansson@linaro.org \
--cc=yuzhao@google.com \
/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