[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE-0n51Wuc6gVmsTOu4Nf4yx+6Wp-Oi3XZy06syhCMVmePWPEw@mail.gmail.com>
Date: Wed, 2 Nov 2022 09:53:49 -0700
From: Stephen Boyd <swboyd@...omium.org>
To: Johan Hovold <johan@...nel.org>
Cc: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>, linux-kernel@...r.kernel.org,
linux-clk@...r.kernel.org, patches@...ts.linux.dev,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...ainline.org>,
linux-arm-msm@...r.kernel.org,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>,
Johan Hovold <johan+linaro@...nel.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Taniya Das <quic_tdas@...cinc.com>,
Satya Priya <quic_c_skakit@...cinc.com>,
Douglas Anderson <dianders@...omium.org>,
Matthias Kaehlcke <mka@...omium.org>
Subject: Re: [PATCH] clk: qcom: gdsc: Remove direct runtime PM calls
Quoting Johan Hovold (2022-11-02 03:52:39)
> On Tue, Nov 01, 2022 at 04:34:21PM -0700, Stephen Boyd wrote:
> > We shouldn't be calling runtime PM APIs from within the genpd
> > enable/disable path for a couple reasons.
> >
> > First, this causes an AA lockdep splat because genpd can call into genpd
> > code again while holding the genpd lock.
> >
> > WARNING: possible recursive locking detected
> > 5.19.0-rc2-lockdep+ #7 Not tainted
> > --------------------------------------------
> > kworker/2:1/49 is trying to acquire lock:
> > ffffffeea0370788 (&genpd->mlock){+.+.}-{3:3}, at: genpd_lock_mtx+0x24/0x30
> >
> > but task is already holding lock:
> > ffffffeea03710a8 (&genpd->mlock){+.+.}-{3:3}, at: genpd_lock_mtx+0x24/0x30
> >
> > other info that might help us debug this:
> > Possible unsafe locking scenario:
> >
> > CPU0
> > ----
> > lock(&genpd->mlock);
> > lock(&genpd->mlock);
> >
> > *** DEADLOCK ***
> >
> > May be due to missing lock nesting notation
>
> I've seen this splat on sc8280xp as well but haven't had time to look
> into it yet.
Ok. This patch should fix you.
>
> > Cc: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> > Cc: Johan Hovold <johan+linaro@...nel.org>
> > Cc: Ulf Hansson <ulf.hansson@...aro.org>
> > Cc: Taniya Das <quic_tdas@...cinc.com>
> > Cc: Satya Priya <quic_c_skakit@...cinc.com>
> > Cc: Douglas Anderson <dianders@...omium.org>
> > Cc: Matthias Kaehlcke <mka@...omium.org>
> > Reported-by: Stephen Boyd <swboyd@...omium.org>
>
> We typically don't add Reported-by tags for bugs we find and fix
> ourselves.
Heh, I didn't see anything like that in Documentation/ so it seems fine.
I debugged my problem and reported it.
>
> > Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support")
> > Signed-off-by: Stephen Boyd <swboyd@...omium.org>
> > ---
> > drivers/clk/qcom/gdsc.c | 64 ++++++-----------------------------------
> > 1 file changed, 8 insertions(+), 56 deletions(-)
> >
> > diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
> > index 7cf5e130e92f..a775ce1b7d8a 100644
> > --- a/drivers/clk/qcom/gdsc.c
> > +++ b/drivers/clk/qcom/gdsc.c
>
> > @@ -495,14 +451,11 @@ static int gdsc_init(struct gdsc *sc)
> > sc->pd.power_on = gdsc_enable;
> >
> > ret = pm_genpd_init(&sc->pd, NULL, !on);
> > - if (ret)
> > - goto err_put_rpm;
> > + if (!ret)
> > + goto err_disable_supply;
>
> The logic should not be inverted here (and only happens to work
> currently when you have no regulator or the gdsc was off).
Ooh good catch! I was waffling on this line to shorten it a bit. I'll
resend.
Powered by blists - more mailing lists