Message ID | 20240318143149.2468349-1-claudiu.beznea.uj@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | [v2] pinctrl: renesas: rzg2l: Execute atomically the interrupt configuration | expand |
On Mon, Mar 18, 2024 at 3:31 PM Claudiu <claudiu.beznea@tuxon.dev> wrote: > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > Lockdep detects a possible deadlock as listed below. This is because it > detects the IA55 interrupt controller .irq_eoi() API is called from > interrupt context while configuration-specific API (e.g., .irq_enable()) > could be called from process context on resume path (by calling > rzg2l_gpio_irq_restore()). To avoid this, protect the call of > rzg2l_gpio_irq_enable() with spin_lock_irqsave()/spin_unlock_irqrestore(). > With this the same approach that is available in __setup_irq() is mimicked > to pinctrl IRQ resume function. > > Below is the lockdep report: [...] > Fixes: 254203f9a94c ("pinctrl: renesas: rzg2l: Add suspend/resume support") > Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > --- > > Changes in v2: > - used raw_spin_lock_irqsave()/raw_spin_unlock_irqrestore() Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> i.e. will queue in renesas-pinctrl for v6.10. Gr{oetje,eeting}s, Geert
On Wed, Mar 20, 2024 at 11:12 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote: > On Mon, Mar 18, 2024 at 3:31 PM Claudiu <claudiu.beznea@tuxon.dev> wrote: > > From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > > > Lockdep detects a possible deadlock as listed below. This is because it > > detects the IA55 interrupt controller .irq_eoi() API is called from > > interrupt context while configuration-specific API (e.g., .irq_enable()) > > could be called from process context on resume path (by calling > > rzg2l_gpio_irq_restore()). To avoid this, protect the call of > > rzg2l_gpio_irq_enable() with spin_lock_irqsave()/spin_unlock_irqrestore(). > > With this the same approach that is available in __setup_irq() is mimicked > > to pinctrl IRQ resume function. > > > > Below is the lockdep report: > > [...] > > > Fixes: 254203f9a94c ("pinctrl: renesas: rzg2l: Add suspend/resume support") > > Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com> > > --- > > > > Changes in v2: > > - used raw_spin_lock_irqsave()/raw_spin_unlock_irqrestore() > > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> > i.e. will queue in renesas-pinctrl for v6.10. I have promoted this to a fix for v6.9. Gr{oetje,eeting}s, Geert
diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index eb5a8c654260..93916553bcc7 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -2063,8 +2063,17 @@ static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl) continue; } - if (!irqd_irq_disabled(data)) + if (!irqd_irq_disabled(data)) { + unsigned long flags; + + /* + * This has to be atomically executed to protect against a concurrent + * interrupt. + */ + raw_spin_lock_irqsave(&pctrl->lock.rlock, flags); rzg2l_gpio_irq_enable(data); + raw_spin_unlock_irqrestore(&pctrl->lock.rlock, flags); + } } }