public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mturquette@linaro.org (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: rockchip: fix deadlock possibility in cpuclk
Date: Sat, 17 Jan 2015 11:23:29 -0800	[thread overview]
Message-ID: <20150117192329.22722.62615@quantum> (raw)
In-Reply-To: <CAD=FV=Xc_yabbrC0c0i-wJS+7eW3gq+pHDa81uxNin55jUciNg@mail.gmail.com>

Quoting Doug Anderson (2015-01-16 09:11:06)
> Heiko,
> 
> On Fri, Jan 16, 2015 at 8:52 AM, Heiko St?bner <heiko@sntech.de> wrote:
> > Lockdep reported a possible deadlock between the cpuclk lock and for example
> > the i2c driver.
> >
> >        CPU0                    CPU1
> >        ----                    ----
> >   lock(clk_lock);
> >                                local_irq_disable();
> >                                lock(&(&i2c->lock)->rlock);
> >                                lock(clk_lock);
> >   <Interrupt>
> >     lock(&(&i2c->lock)->rlock);
> >
> >  *** DEADLOCK ***
> >
> > The generic clock-types of the core ccf already use spin_lock_irqsave when
> > touching clock registers, so do the same for the cpuclk.
> >
> > Signed-off-by: Heiko Stuebner <heiko@sntech.de>
> > ---
> >  drivers/clk/rockchip/clk-cpu.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/clk/rockchip/clk-cpu.c b/drivers/clk/rockchip/clk-cpu.c
> > index 75c8c45..3ecdf7d 100644
> > --- a/drivers/clk/rockchip/clk-cpu.c
> > +++ b/drivers/clk/rockchip/clk-cpu.c
> > @@ -124,10 +124,11 @@ static int rockchip_cpuclk_pre_rate_change(struct rockchip_cpuclk *cpuclk,
> >  {
> >         const struct rockchip_cpuclk_reg_data *reg_data = cpuclk->reg_data;
> >         unsigned long alt_prate, alt_div;
> > +       unsigned long flags = 0;
> 
> nit: I don't often see flags initted to 0 here when using
> spin_lock_irqsave().  I don't think it's needed...
> 
> I doubt it really matters though, and this looks fine to me.
> 
> Reviewed-by: Doug Anderson <dianders@chromium.org>

Applied to clk-fixes and removed flags initialization locally.

Regards,
Mike

> 
> -Doug

      reply	other threads:[~2015-01-17 19:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 16:52 [PATCH] clk: rockchip: fix deadlock possibility in cpuclk Heiko Stübner
2015-01-16 17:11 ` Doug Anderson
2015-01-17 19:23   ` Mike Turquette [this message]

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=20150117192329.22722.62615@quantum \
    --to=mturquette@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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