[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260205120433.iKQIknOA@linutronix.de>
Date: Thu, 5 Feb 2026 13:04:33 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@...esas.com>
Cc: Geert Uytterhoeven <geert+renesas@...der.be>,
Linus Walleij <linusw@...nel.org>,
Clark Williams <clrkwllms@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Bartosz Golaszewski <brgl@...nel.org>,
linux-renesas-soc@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-rt-devel@...ts.linux.dev
Subject: Re: [PATCH v2] pinctrl: renesas: rzt2h: fix invalid wait context
On 2026-02-05 12:39:30 [+0200], Cosmin Tanislav wrote:
> The rzt2h_gpio_get_direction() function is called from
> gpiod_get_direction(), which ends up being used within the __setup_irq()
> call stack when requesting an interrupt.
>
> __setup_irq() holds a raw_spinlock_t with IRQs disabled, which creates
> an atomic context. spinlock_t cannot be used within atomic context
> when PREEMPT_RT is enabled, since it may become a sleeping lock.
>
> An "[ BUG: Invalid wait context ]" splat is observed when running with
> CONFIG_PROVE_LOCKING enabled, describing exactly the aforementioned call
> stack.
>
> __setup_irq() needs to hold a raw_spinlock_t with IRQs disabled to
> serialize access against a concurrent hard interrupt.
>
> Switch to raw_spinlock_t to fix this.
I don't like the reasoning here because it looks like "lockdep
complained lets switch the locks and everything is fine now".
It is required to make the suggested change because the lock is used
in hardirq context and only while accessing the HW's register.
I just don't want that a lockdep splat becomes a green card for these
kind of changes without understanding the consequences.
> Fixes: 829dde3369a9 ("pinctrl: renesas: rzt2h: Add GPIO IRQ chip to handle interrupts")
> Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@...esas.com>
Sebastian
Powered by blists - more mailing lists