All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: Dong Aisheng <dongas86@gmail.com>
Cc: Shawn Guo <shawnguo@kernel.org>,
	Lucas Stach <l.stach@pengutronix.de>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	linux-kernel@vger.kernel.org, mingo@redhat.com,
	kernel@pengutronix.de, tglx@linutronix.de,
	linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] clk: imx: do not sleep if IRQ's are still disabled
Date: Wed, 27 Apr 2016 00:34:07 -0700	[thread overview]
Message-ID: <bc975a1c9b40ee72b05d6e540ae4f4d8@agner.ch> (raw)
In-Reply-To: <CAA+hA=REqJ8JhmKt5_jCAaRTUy2E14ww_MqWSSLpNBKgnf=U9A@mail.gmail.com>

On 2016-04-26 19:57, Dong Aisheng wrote:
> On Wed, Apr 27, 2016 at 9:58 AM, Shawn Guo <shawnguo@kernel.org> wrote:
>> On Tue, Apr 26, 2016 at 07:27:03PM +0800, Dong Aisheng wrote:
>>> Shawn,
>>> What's your suggestion?
>>
>> I think this needs more discussion, and I just dropped Stefan's patch
>> from my tree.
>>
>> We need to firstly understand why this is happening.  The .prepare hook
>> is defined to be non-atomic context, and so that we call sleep function
>> in there.  We did everything right.  Why are we getting the warning?  If
>> I'm correct, this warning only happens on i.MX7D.  Why is that?
>>
> 
> Why Stefan's patch works (checking irqs_disabled()) is because during kernel
> time init, the irq is still not enabled. It fixes the issue indirectly.
> See:
> asmlinkage __visible void __init start_kernel(void)
> {
>         /*
>          * Set up the scheduler prior starting any interrupts (such as the
>          * timer interrupt). Full topology setup happens at smp_init()
>          * time - but meanwhile we still have a functioning scheduler.
>          */
>         sched_init();
>         .............
>         time_init();
>         ..............
>         WARN(!irqs_disabled(), "Interrupts were enabled early\n");
>         early_boot_irqs_disabled = false;
>         local_irq_enable();
> }
> 
> The issue can only happen when PLL enable causes a schedule during
> imx_clock_init().
> Not all PLL has this issue.
> The issue happens on MX7D pll_audio_main_clk/pll_video_main_clk
> which requires more delay time and cause usleep.
> Because clk framework does not support MX7D clock types (operation requires
> parents on), we simply enable all clocks in imx7d_clocks_init().
> 
> If apply my this patch series:
> https://lkml.org/lkml/2016/4/20/199
> The issue can also be gone.

Oh ok, it does make sense to enable as few clocks as possible.

However, even if we do not enable lots of clocks at that time, and this
helps to avoid the problem for now, it could still be that
someone/something requests a clock early during boot, leading to a PLL
enable... Shouldn't we make sure that those base clocks can be enabled
even during early boot..?

--
Stefan

WARNING: multiple messages have this Message-ID (diff)
From: stefan@agner.ch (Stefan Agner)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] clk: imx: do not sleep if IRQ's are still disabled
Date: Wed, 27 Apr 2016 00:34:07 -0700	[thread overview]
Message-ID: <bc975a1c9b40ee72b05d6e540ae4f4d8@agner.ch> (raw)
In-Reply-To: <CAA+hA=REqJ8JhmKt5_jCAaRTUy2E14ww_MqWSSLpNBKgnf=U9A@mail.gmail.com>

On 2016-04-26 19:57, Dong Aisheng wrote:
> On Wed, Apr 27, 2016 at 9:58 AM, Shawn Guo <shawnguo@kernel.org> wrote:
>> On Tue, Apr 26, 2016 at 07:27:03PM +0800, Dong Aisheng wrote:
>>> Shawn,
>>> What's your suggestion?
>>
>> I think this needs more discussion, and I just dropped Stefan's patch
>> from my tree.
>>
>> We need to firstly understand why this is happening.  The .prepare hook
>> is defined to be non-atomic context, and so that we call sleep function
>> in there.  We did everything right.  Why are we getting the warning?  If
>> I'm correct, this warning only happens on i.MX7D.  Why is that?
>>
> 
> Why Stefan's patch works (checking irqs_disabled()) is because during kernel
> time init, the irq is still not enabled. It fixes the issue indirectly.
> See:
> asmlinkage __visible void __init start_kernel(void)
> {
>         /*
>          * Set up the scheduler prior starting any interrupts (such as the
>          * timer interrupt). Full topology setup happens at smp_init()
>          * time - but meanwhile we still have a functioning scheduler.
>          */
>         sched_init();
>         .............
>         time_init();
>         ..............
>         WARN(!irqs_disabled(), "Interrupts were enabled early\n");
>         early_boot_irqs_disabled = false;
>         local_irq_enable();
> }
> 
> The issue can only happen when PLL enable causes a schedule during
> imx_clock_init().
> Not all PLL has this issue.
> The issue happens on MX7D pll_audio_main_clk/pll_video_main_clk
> which requires more delay time and cause usleep.
> Because clk framework does not support MX7D clock types (operation requires
> parents on), we simply enable all clocks in imx7d_clocks_init().
> 
> If apply my this patch series:
> https://lkml.org/lkml/2016/4/20/199
> The issue can also be gone.

Oh ok, it does make sense to enable as few clocks as possible.

However, even if we do not enable lots of clocks at that time, and this
helps to avoid the problem for now, it could still be that
someone/something requests a clock early during boot, leading to a PLL
enable... Shouldn't we make sure that those base clocks can be enabled
even during early boot..?

--
Stefan

  parent reply	other threads:[~2016-04-27  7:37 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 22:49 [PATCH 1/2] clk: imx: do not sleep if IRQ's are still disabled Stefan Agner
2016-01-29 22:49 ` Stefan Agner
2016-01-29 22:49 ` [PATCH 2/2] clk: imx: return correct frequency for Ethernet PLL Stefan Agner
2016-01-29 22:49   ` Stefan Agner
2016-01-29 23:35 ` [PATCH 1/2] clk: imx: do not sleep if IRQ's are still disabled Joshua Clayton
2016-01-29 23:35   ` Joshua Clayton
2016-01-30  1:16 ` Stephen Boyd
2016-01-30  1:16   ` Stephen Boyd
2016-04-26 17:04   ` Stefan Agner
2016-04-26 17:04     ` Stefan Agner
2016-04-16  1:00 ` Stephen Boyd
2016-04-16  1:00   ` Stephen Boyd
2016-04-18  1:58   ` Shawn Guo
2016-04-18  1:58     ` Shawn Guo
2016-04-21  3:45 ` Dong Aisheng
2016-04-21  3:45   ` Dong Aisheng
2016-04-26  1:23   ` Shawn Guo
2016-04-26  1:23     ` Shawn Guo
2016-04-26  5:51     ` Dong Aisheng
2016-04-26  5:51       ` Dong Aisheng
2016-04-26  5:51       ` Dong Aisheng
2016-04-26  9:24       ` Shawn Guo
2016-04-26  9:24         ` Shawn Guo
2016-04-26  9:24         ` Shawn Guo
2016-04-26  9:31       ` Lucas Stach
2016-04-26  9:31         ` Lucas Stach
2016-04-26  9:31         ` Lucas Stach
2016-04-26 11:16         ` Dong Aisheng
2016-04-26 11:16           ` Dong Aisheng
2016-04-26 11:16           ` Dong Aisheng
2016-04-26 11:27           ` Dong Aisheng
2016-04-26 11:27             ` Dong Aisheng
2016-04-26 11:27             ` Dong Aisheng
2016-04-27  1:58             ` Shawn Guo
2016-04-27  1:58               ` Shawn Guo
2016-04-27  1:58               ` Shawn Guo
2016-04-27  2:45               ` Dong Aisheng
2016-04-27  2:45                 ` Dong Aisheng
2016-04-27  2:45                 ` Dong Aisheng
2016-04-27  2:56                 ` Fabio Estevam
2016-04-27  2:56                   ` Fabio Estevam
2016-04-27  2:56                   ` Fabio Estevam
2016-04-27  7:28                   ` Stefan Agner
2016-04-27  7:28                     ` Stefan Agner
2016-04-27  8:53                     ` Dong Aisheng
2016-04-27  8:53                       ` Dong Aisheng
2016-04-27  8:53                       ` Dong Aisheng
2016-04-27  2:57               ` Dong Aisheng
2016-04-27  2:57                 ` Dong Aisheng
2016-04-27  2:57                 ` Dong Aisheng
2016-04-27  7:24                 ` Shawn Guo
2016-04-27  7:24                   ` Shawn Guo
2016-04-27  7:24                   ` Shawn Guo
2016-04-27  7:26                   ` Stefan Agner
2016-04-27  7:26                     ` Stefan Agner
2016-04-27  8:48                   ` Dong Aisheng
2016-04-27  8:48                     ` Dong Aisheng
2016-04-27  8:48                     ` Dong Aisheng
2016-04-27  7:34                 ` Stefan Agner [this message]
2016-04-27  7:34                   ` Stefan Agner
2016-04-27  8:57                   ` Dong Aisheng
2016-04-27  8:57                     ` Dong Aisheng
2016-04-27  8:57                     ` Dong Aisheng
2016-04-27 10:15                 ` Thomas Gleixner
2016-04-27 10:15                   ` Thomas Gleixner
2016-04-27 10:15                   ` Thomas Gleixner
2016-04-29  9:45                   ` [RFC PATCH 1/1] clk: imx7d: move clk setting out of imx7d_clocks_init Dong Aisheng
2016-04-29  9:45                     ` Dong Aisheng
2016-04-29  9:55                     ` Dong Aisheng
2016-04-29  9:55                       ` Dong Aisheng
2016-04-29 12:31                       ` Lucas Stach
2016-04-29 12:31                         ` Lucas Stach
2016-04-29 12:31                         ` Lucas Stach
2016-04-30  2:04                     ` Stefan Agner
2016-04-30  2:04                       ` Stefan Agner
2016-06-02 15:19                       ` Dong Aisheng
2016-06-02 15:19                         ` Dong Aisheng
2016-05-25 21:54                   ` [PATCH 1/2] clk: imx: do not sleep if IRQ's are still disabled Stefan Agner
2016-05-25 21:54                     ` Stefan Agner
2016-06-02 14:59                   ` Dong Aisheng
2016-06-02 14:59                     ` Dong Aisheng
2016-06-02 14:59                     ` Dong Aisheng
2016-06-06 13:20                     ` Thomas Gleixner
2016-06-06 13:20                       ` Thomas Gleixner
2016-06-06 13:20                       ` Thomas Gleixner
2016-06-07  7:04                       ` Dong Aisheng
2016-06-07  7:04                         ` Dong Aisheng
2016-06-07  7:04                         ` Dong Aisheng
2016-06-09 20:08                         ` Thomas Gleixner
2016-06-09 20:08                           ` Thomas Gleixner
2016-06-09 20:08                           ` Thomas Gleixner
2016-06-09 22:14                           ` Stefan Agner
2016-06-09 22:14                             ` Stefan Agner
2016-06-09 22:55                             ` Thomas Gleixner
2016-06-09 22:55                               ` Thomas Gleixner
2016-06-12 12:24                           ` Dong Aisheng
2016-06-12 12:24                             ` Dong Aisheng
2016-06-12 12:24                             ` Dong Aisheng

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=bc975a1c9b40ee72b05d6e540ae4f4d8@agner.ch \
    --to=stefan@agner.ch \
    --cc=dongas86@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    --cc=shawnguo@kernel.org \
    --cc=tglx@linutronix.de \
    /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.