From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
Boris Brezillon <boris.brezillon@free-electrons.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@codeaurora.org>,
linux-kernel@vger.kernel.org,
Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 04/13] clk: at91: make IRQ optional and register them later
Date: Mon, 25 Jan 2016 23:28:45 +0100 [thread overview]
Message-ID: <20160125222845.GC11740@piout.net> (raw)
In-Reply-To: <20160122154034.GA20020@breakpoint.cc>
Hi,
On 22/01/2016 at 16:40:35 +0100, Sebastian Andrzej Siewior wrote :
> On 2015-12-04 18:03:39 [+0100], Alexandre Belloni wrote:
> > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
> > index 295b17b9c689..296d20a29c6c 100644
> > --- a/drivers/clk/at91/pmc.c
> > +++ b/drivers/clk/at91/pmc.c
> > @@ -20,6 +20,9 @@
> …
> > + pmc->irqdomain = irq_domain_add_linear(pdev->dev.of_node, 32,
> > + &pmc_irq_ops, pmc);
> > + if (!pmc->irqdomain)
> > + return 0;
> >
> > -static void __init of_at91sam9n12_pmc_setup(struct device_node *np)
> > -{
> > - of_at91_pmc_setup(np, &at91sam9n12_caps);
> > -}
> > -CLK_OF_DECLARE(at91sam9n12_clk_pmc, "atmel,at91sam9n12-pmc",
> > - of_at91sam9n12_pmc_setup);
> > + regmap_write(pmc->regmap, AT91_PMC_IDR, 0xffffffff);
> > + ret = request_irq(pmc->virq, pmc_irq_handler,
> > + IRQF_SHARED | IRQF_COND_SUSPEND, "pmc", pmc);
>
> You need IRQF_NOTHREAD here becuase pmc_irq_handler() is demuxing
> interrupts / invoking generic_handle_irq().
> However regmap_read() inside pmc_irq_handler() is taking a sleeping lock
> on -RT so this is not going to fly. So either get rid regmap_read() in
> the handler or use handle_nested_irq() instead.
>
So, using handle_nested_irq() is actually quite impractical because it
has to be called from a threaded irq handler. So we either need to use
IRQF_ONESHOT which is not possible because the IRQ is shared
with the PIT (unless we take Thomas' IRQF_COND_ONESHOT patch).
I think we may as well stay simple and remove the whole irq handling and
only do polling on the status register. As the series is done right now,
this only has an impact during the clocks prepare(). As in that case it
would not be sleeping anymore, we can also transform those prepare() in
enable().
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: alexandre.belloni@free-electrons.com (Alexandre Belloni)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 04/13] clk: at91: make IRQ optional and register them later
Date: Mon, 25 Jan 2016 23:28:45 +0100 [thread overview]
Message-ID: <20160125222845.GC11740@piout.net> (raw)
In-Reply-To: <20160122154034.GA20020@breakpoint.cc>
Hi,
On 22/01/2016 at 16:40:35 +0100, Sebastian Andrzej Siewior wrote :
> On 2015-12-04 18:03:39 [+0100], Alexandre Belloni wrote:
> > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
> > index 295b17b9c689..296d20a29c6c 100644
> > --- a/drivers/clk/at91/pmc.c
> > +++ b/drivers/clk/at91/pmc.c
> > @@ -20,6 +20,9 @@
> ?
> > + pmc->irqdomain = irq_domain_add_linear(pdev->dev.of_node, 32,
> > + &pmc_irq_ops, pmc);
> > + if (!pmc->irqdomain)
> > + return 0;
> >
> > -static void __init of_at91sam9n12_pmc_setup(struct device_node *np)
> > -{
> > - of_at91_pmc_setup(np, &at91sam9n12_caps);
> > -}
> > -CLK_OF_DECLARE(at91sam9n12_clk_pmc, "atmel,at91sam9n12-pmc",
> > - of_at91sam9n12_pmc_setup);
> > + regmap_write(pmc->regmap, AT91_PMC_IDR, 0xffffffff);
> > + ret = request_irq(pmc->virq, pmc_irq_handler,
> > + IRQF_SHARED | IRQF_COND_SUSPEND, "pmc", pmc);
>
> You need IRQF_NOTHREAD here becuase pmc_irq_handler() is demuxing
> interrupts / invoking generic_handle_irq().
> However regmap_read() inside pmc_irq_handler() is taking a sleeping lock
> on -RT so this is not going to fly. So either get rid regmap_read() in
> the handler or use handle_nested_irq() instead.
>
So, using handle_nested_irq() is actually quite impractical because it
has to be called from a threaded irq handler. So we either need to use
IRQF_ONESHOT which is not possible because the IRQ is shared
with the PIT (unless we take Thomas' IRQF_COND_ONESHOT patch).
I think we may as well stay simple and remove the whole irq handling and
only do polling on the status register. As the series is done right now,
this only has an impact during the clocks prepare(). As in that case it
would not be sleeping anymore, we can also transform those prepare() in
enable().
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-01-25 22:28 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 17:03 [PATCH v3 00/13] ARM: at91: PMC driver rework Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2015-12-04 17:03 ` [PATCH v3 01/13] clk: at91: make use of syscon to share PMC registers in several drivers Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2015-12-04 17:03 ` [PATCH v3 02/13] clk: at91: make use of syscon/regmap internally Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2016-01-15 2:10 ` Stephen Boyd
2016-01-15 2:10 ` Stephen Boyd
2015-12-04 17:03 ` [PATCH v3 03/13] clk: at91: clk-main: factorize irq handling Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2016-01-15 2:08 ` Stephen Boyd
2016-01-15 2:08 ` Stephen Boyd
2015-12-04 17:03 ` [PATCH v3 04/13] clk: at91: make IRQ optional and register them later Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2016-01-15 2:02 ` Stephen Boyd
2016-01-15 2:02 ` Stephen Boyd
2016-01-15 9:39 ` Boris Brezillon
2016-01-15 9:39 ` Boris Brezillon
2016-01-15 9:39 ` Boris Brezillon
2016-01-16 1:26 ` Stephen Boyd
2016-01-16 1:26 ` Stephen Boyd
2016-01-16 12:45 ` Boris Brezillon
2016-01-16 12:45 ` Boris Brezillon
2016-01-20 22:04 ` Stephen Boyd
2016-01-20 22:04 ` Stephen Boyd
2016-01-22 15:40 ` Sebastian Andrzej Siewior
2016-01-22 15:40 ` Sebastian Andrzej Siewior
2016-01-22 15:40 ` Sebastian Andrzej Siewior
2016-01-25 22:28 ` Alexandre Belloni [this message]
2016-01-25 22:28 ` Alexandre Belloni
2015-12-04 17:03 ` [PATCH v3 05/13] clk: at91: only disable available IRQs Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2016-01-15 2:05 ` Stephen Boyd
2016-01-15 2:05 ` Stephen Boyd
2015-12-04 17:03 ` [PATCH v3 06/13] clk: at91: pmc: merge at91_pmc_init in atmel_pmc_probe Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2016-01-15 2:04 ` Stephen Boyd
2016-01-15 2:04 ` Stephen Boyd
2015-12-04 17:03 ` [PATCH v3 07/13] clk: at91: pmc: move pmc structures to C file Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2016-01-15 2:04 ` Stephen Boyd
2016-01-15 2:04 ` Stephen Boyd
2015-12-04 17:03 ` [PATCH v3 08/13] ARM: at91: pm: simply call at91_pm_init Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2015-12-04 17:03 ` [PATCH v3 09/13] ARM: at91: pm: find and remap the pmc Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2016-01-15 2:04 ` Stephen Boyd
2016-01-15 2:04 ` Stephen Boyd
2015-12-04 17:03 ` [PATCH v3 10/13] ARM: at91: pm: move idle functions to pm.c Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2015-12-04 17:03 ` [PATCH v3 11/13] ARM: at91: remove useless includes and function prototypes Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2015-12-04 17:03 ` [PATCH v3 12/13] usb: gadget: atmel: access the PMC using regmap Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2015-12-04 17:03 ` [PATCH v3 13/13] clk: at91: pmc: drop at91_pmc_base Alexandre Belloni
2015-12-04 17:03 ` Alexandre Belloni
2016-01-15 2:07 ` Stephen Boyd
2016-01-15 2:07 ` Stephen Boyd
2015-12-10 17:06 ` [PATCH v3 00/13] ARM: at91: PMC driver rework Boris Brezillon
2015-12-10 17:06 ` Boris Brezillon
2015-12-15 9:22 ` Alexandre Belloni
2015-12-15 9:22 ` Alexandre Belloni
2016-01-15 2:07 ` Stephen Boyd
2016-01-15 2:07 ` 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=20160125222845.GC11740@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
--cc=sboyd@codeaurora.org \
--cc=sebastian@breakpoint.cc \
/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.