Thread (9 messages) 9 messages, 5 authors, 2015-07-07

Re: [PATCH REPOST] gpio: omap: use raw locks for locking

From: Javier Martinez Canillas <javier@dowhile0.org>
Date: 2015-06-19 21:55:00
Also in: linux-omap

On Fri, Jun 19, 2015 at 7:42 PM, santosh shilimkar
[off-list ref] wrote:
On 6/19/2015 10:06 AM, Sebastian Andrzej Siewior wrote:
quoted
This patch converts gpio_bank.lock from a spin_lock into a
raw_spin_lock. The call path is 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()

This fixes the obvious backtrace on -RT. However the locking vs context
is not 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 with
   irqs off.

- 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.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
Should be safe to do it.
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>
Answered on the wrong thread, sorry for the noise.

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

Best regards,
Javier
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help