All of lore.kernel.org
 help / color / mirror / Atom feed
From: Javier Martinez Canillas <javier@dowhile0.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Santosh Shilimkar <ssantosh@kernel.org>,
	Kevin Hilman <khilman@deeprootsystems.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Alexandre Courbot <gnurou@gmail.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	Linux GPIO List <linux-gpio@vger.kernel.org>
Subject: Re: [PATCH] gpio: omap: use raw locks for locking
Date: Mon, 16 Feb 2015 09:54:24 +0100	[thread overview]
Message-ID: <CABxcv=mikHw7Tp+9e+=4xbjNqKKAoN=CkszPEzKo0jBWz+wenQ@mail.gmail.com> (raw)
In-Reply-To: <1423757436-18986-1-git-send-email-bigeasy@linutronix.de>

Hello Sebastian,

Thanks a lot for your patch.

On Thu, Feb 12, 2015 at 5:10 PM, Sebastian Andrzej Siewior
<bigeasy@linutronix.de> wrote:
> This patch converts gpio_bank.lock from a spin_lock into a
> raw_spin_lock. The call path to access this lock is always under a
> raw_spin_lock, for instance
> - __setup_irq() holds &desc->lock with irq off
>   + __irq_set_trigger()
>    + omap_gpio_irq_type()
>
> - handle_level_irq() (runs with irqs off therefore raw locks)
>   + mask_ack_irq()
>    + omap_gpio_mask_irq()
>

Agreed that raw_spin_lock should be used instead of spin_lock since
afaiu those are converted to a rt-mutex in PREEMPT_RT and so they
might sleep.

> This fixes the obvious backtrace on -RT. However I noticed two cases
> where it looks wrong and this is not limited to -RT:
> - omap_gpio_irq_type() is called with IRQ off and has an conditional
>   call to pm_runtime_get_sync() which may sleep. Either it may happen or
>   it may not happen but pm_runtime_get_sync() should not be called in an
>   atomic section.
>
> - omap_gpio_debounce() is holding the lock with IRQs off.
>   + omap2_set_gpio_debounce()
>    + clk_prepare_enable()
>     + clk_prepare() this one might sleep.
>   The number of users of gpiod_set_debounce() / gpio_set_debounce()
>   looks low but still this is not good.
>

Right, those are bugs regardless of PREEMPT_RT or not as you said.
I'll add it to my TODO list, thanks for finding those.

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
>  drivers/gpio/gpio-omap.c | 78 ++++++++++++++++++++++++------------------------
>  1 file changed, 39 insertions(+), 39 deletions(-)
>

Acked-by: Javier Martinez Canillas <javier@dowhile0.org>

Best regards,
Javier

  reply	other threads:[~2015-02-16  8:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-12 16:10 [PATCH] gpio: omap: use raw locks for locking Sebastian Andrzej Siewior
2015-02-16  8:54 ` Javier Martinez Canillas [this message]
2015-02-25  9:44   ` Sebastian Andrzej Siewior
2015-06-19 21:52 ` Javier Martinez Canillas
2015-06-30  6:45 ` Linus Walleij
2015-06-30 16:39   ` Sebastian Andrzej Siewior
2015-07-21 16:26 Sebastian Andrzej Siewior
2015-07-27 12:50 ` Linus Walleij
2015-07-27 13:25   ` Sebastian Andrzej Siewior
2015-07-28 12:22     ` Thomas Gleixner

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='CABxcv=mikHw7Tp+9e+=4xbjNqKKAoN=CkszPEzKo0jBWz+wenQ@mail.gmail.com' \
    --to=javier@dowhile0.org \
    --cc=bigeasy@linutronix.de \
    --cc=gnurou@gmail.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=ssantosh@kernel.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 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.