All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Joachim Eastwood <manabian@gmail.com>
Cc: Mike Turquette <mturquette@linaro.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	Vladimir Zapolskiy <vz@mleia.com>
Subject: Re: clk-lpc18xx-creg - scheduling while atomic
Date: Fri, 6 May 2016 10:17:48 -0700	[thread overview]
Message-ID: <20160506171748.GS3492@codeaurora.org> (raw)
In-Reply-To: <CAGhQ9VyBcyRZSRowzpiAWnUBywiu_fDMEYWOXYEykDgLWnU0mA@mail.gmail.com>

On 05/05, Joachim Eastwood wrote:
> Hi Stephen,
> 
> On 5 May 2016 at 17:11, Vladimir Zapolskiy <vz@mleia.com> wrote:
> > Hi Joachim,
> >
> > On 05.05.2016 14:53, Joachim Eastwood wrote:
> >> Hi,
> >>
> >> I just tried next/master on my lpc18xx platform and got a 'scheduling
> >> while atomic' on the msleep in clk_creg_32k_prepare. This does not
> >> occur on 4.6-rc1. See below for backtrace.
> >>
> >> According to Documentation/clk.txt, Part 6 - Locking, sleeping is
> >> allowed in prepare functions. Changing the msleep to an mdelay makes
> >> the problem go away.
> >>
> >> So any ideas to what is going on?
> >>
> >
> > the bug description resembles a recent problem on iMX7, you may find
> > details from "clk: imx: do not sleep if IRQ's are still disabled"
> > thread, the same sleeping clk_core_prepare() from time_init(), while
> > sleeping is not allowed until the timer is ready.
> 
> Thanks alot, Vladimir!
> That sheed more light on the problem.
> 
> Doing a partial revert of 32b9b10961860 ("clk: Allow clocks to be
> marked as CRITICAL") also fixes the problem. 32b9b10961860 makes it
> possible to call clk prepare, which is allowed to sleep, when clocks
> are first created from of_clk_init(). of_clk_init() is called very
> early where it's not allow to sleep at all[1].
> 
> What do you suggest, Stephen?
> Calling prepare() from __clk_core_init() doesn't seem like a good idea
> to me. I think the core clk handing of critical clocks needs to change
> here.

Yeah we need to figure out something for people who are using
critical clks in of_clk_init() path because that's just not going
to work if they sleep in their prepare callbacks.

Regardless, is your driver using critical clks? It seems more
like we need to apply this patch so that the flags member of
clk_init_data isn't full of junk that might match against the
critical flag?

---8<----
diff --git a/drivers/clk/nxp/clk-lpc18xx-creg.c b/drivers/clk/nxp/clk-lpc18xx-creg.c
index d44b61afa2dc..9e35749dafdf 100644
--- a/drivers/clk/nxp/clk-lpc18xx-creg.c
+++ b/drivers/clk/nxp/clk-lpc18xx-creg.c
@@ -147,6 +147,7 @@ static struct clk *clk_register_creg_clk(struct device *dev,
 	init.name = creg_clk->name;
 	init.parent_names = parent_name;
 	init.num_parents = 1;
+	init.flags = 0;
 
 	creg_clk->reg = syscon;
 	creg_clk->hw.init = &init;
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2016-05-06 17:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 11:53 clk-lpc18xx-creg - scheduling while atomic Joachim Eastwood
2016-05-05 15:11 ` Vladimir Zapolskiy
2016-05-05 16:00   ` Joachim Eastwood
2016-05-06 17:17     ` Stephen Boyd [this message]
2016-05-06 17:28       ` Joachim Eastwood
2016-05-06 17: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=20160506171748.GS3492@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=manabian@gmail.com \
    --cc=mturquette@linaro.org \
    --cc=vz@mleia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.