public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping
@ 2026-01-06  8:52 Bartosz Golaszewski
  2026-01-06  8:55 ` Neil Armstrong
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2026-01-06  8:52 UTC (permalink / raw)
  To: Linus Walleij, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Bartosz Golaszewski
  Cc: linux-gpio, linux-arm-kernel, linux-amlogic, linux-kernel,
	Bartosz Golaszewski, stable

The GPIO controller is configured as non-sleeping but it uses generic
pinctrl helpers which use a mutex for synchronization. This will cause
lockdep splats when used together with shared GPIOs going through the
GPIO shared proxy driver.

Fixes: 6e9be3abb78c ("pinctrl: Add driver support for Amlogic SoCs")
Cc: stable@vger.kernel.org
Reported-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Closes: https://lore.kernel.org/all/CAFBinCAc7CO8gfNQakCu3LfkYXuyTd2iRpMRm8EKXSL0mwOnJw@mail.gmail.com/
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
index d9e3a8d5932a..ded7b218e2ec 100644
--- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
+++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
@@ -893,7 +893,7 @@ static const struct gpio_chip aml_gpio_template = {
 	.direction_input	= aml_gpio_direction_input,
 	.direction_output	= aml_gpio_direction_output,
 	.get_direction		= aml_gpio_get_direction,
-	.can_sleep		= false,
+	.can_sleep		= true,
 };
 
 static void init_bank_register_bit(struct aml_pinctrl *info,
-- 
2.47.3



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping
  2026-01-06  8:52 [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping Bartosz Golaszewski
@ 2026-01-06  8:55 ` Neil Armstrong
  2026-01-06  9:32   ` Xianwei Zhao
  2026-01-06  8:57 ` Martin Blumenstingl
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Neil Armstrong @ 2026-01-06  8:55 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Bartosz Golaszewski
  Cc: linux-gpio, linux-arm-kernel, linux-amlogic, linux-kernel, stable

On 1/6/26 09:52, Bartosz Golaszewski wrote:
> The GPIO controller is configured as non-sleeping but it uses generic
> pinctrl helpers which use a mutex for synchronization. This will cause
> lockdep splats when used together with shared GPIOs going through the
> GPIO shared proxy driver.
> 
> Fixes: 6e9be3abb78c ("pinctrl: Add driver support for Amlogic SoCs")
> Cc: stable@vger.kernel.org
> Reported-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Closes: https://lore.kernel.org/all/CAFBinCAc7CO8gfNQakCu3LfkYXuyTd2iRpMRm8EKXSL0mwOnJw@mail.gmail.com/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
>   drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> index d9e3a8d5932a..ded7b218e2ec 100644
> --- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> +++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> @@ -893,7 +893,7 @@ static const struct gpio_chip aml_gpio_template = {
>   	.direction_input	= aml_gpio_direction_input,
>   	.direction_output	= aml_gpio_direction_output,
>   	.get_direction		= aml_gpio_get_direction,
> -	.can_sleep		= false,
> +	.can_sleep		= true,
>   };
>   
>   static void init_bank_register_bit(struct aml_pinctrl *info,

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

Thanks,
Neil


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping
  2026-01-06  8:52 [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping Bartosz Golaszewski
  2026-01-06  8:55 ` Neil Armstrong
@ 2026-01-06  8:57 ` Martin Blumenstingl
  2026-01-09  9:33 ` Linus Walleij
  2026-01-09  9:35 ` Linus Walleij
  3 siblings, 0 replies; 8+ messages in thread
From: Martin Blumenstingl @ 2026-01-06  8:57 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Linus Walleij, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Bartosz Golaszewski, linux-gpio, linux-arm-kernel, linux-amlogic,
	linux-kernel, stable

On Tue, Jan 6, 2026 at 9:53 AM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:
>
> The GPIO controller is configured as non-sleeping but it uses generic
> pinctrl helpers which use a mutex for synchronization. This will cause
> lockdep splats when used together with shared GPIOs going through the
> GPIO shared proxy driver.
>
> Fixes: 6e9be3abb78c ("pinctrl: Add driver support for Amlogic SoCs")
> Cc: stable@vger.kernel.org
> Reported-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Closes: https://lore.kernel.org/all/CAFBinCAc7CO8gfNQakCu3LfkYXuyTd2iRpMRm8EKXSL0mwOnJw@mail.gmail.com/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping
  2026-01-06  8:55 ` Neil Armstrong
@ 2026-01-06  9:32   ` Xianwei Zhao
  2026-01-06 10:40     ` Bartosz Golaszewski
  0 siblings, 1 reply; 8+ messages in thread
From: Xianwei Zhao @ 2026-01-06  9:32 UTC (permalink / raw)
  To: Neil Armstrong, Bartosz Golaszewski, Linus Walleij, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Bartosz Golaszewski
  Cc: linux-gpio, linux-arm-kernel, linux-amlogic, linux-kernel, stable

Hi Bartosz,
    Could you explain the reproduction method for this problem ?

On 2026/1/6 16:55, Neil Armstrong wrote:
> The GPIO controller is configured as non-sleeping but it uses generic
> pinctrl helpers which use a mutex for synchronization. This will cause
> lockdep splats when used together with shared GPIOs going through the
> GPIO shared proxy driver.
> 
> Fixes: 6e9be3abb78c ("pinctrl: Add driver support for Amlogic SoCs")
> Cc: stable@vger.kernel.org
> Reported-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Closes: 
> https://lore.kernel.org/all/CAFBinCAc7CO8gfNQakCu3LfkYXuyTd2iRpMRm8EKXSL0mwOnJw@mail.gmail.com/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
> ---
>    drivers/pinctrl/meson/pinctrl-amlogic-a4.c | 2 +-
>    1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c 
> b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> index d9e3a8d5932a..ded7b218e2ec 100644
> --- a/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> +++ b/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
> @@ -893,7 +893,7 @@ static const struct gpio_chip aml_gpio_template = {
>        .direction_input        = aml_gpio_direction_input,
>        .direction_output       = aml_gpio_direction_output,
>        .get_direction          = aml_gpio_get_direction,
> -     .can_sleep              = false,
> +     .can_sleep              = true,
>    };
> 
>    static void init_bank_register_bit(struct aml_pinctrl *info,


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping
  2026-01-06  9:32   ` Xianwei Zhao
@ 2026-01-06 10:40     ` Bartosz Golaszewski
  0 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2026-01-06 10:40 UTC (permalink / raw)
  To: Xianwei Zhao
  Cc: Neil Armstrong, Bartosz Golaszewski, Linus Walleij, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, linux-gpio, linux-arm-kernel,
	linux-amlogic, linux-kernel, stable

On Tue, Jan 6, 2026 at 10:32 AM Xianwei Zhao <xianwei.zhao@amlogic.com> wrote:
>
> Hi Bartosz,
>     Could you explain the reproduction method for this problem ?
>

Please don't top-post on the mailing list.

If you have a pin shared by multiple devices in device-tree, it will
now go through a dedicated gpio-shared-proxy driver. It will use a
locking mechanism depending on the can_sleep flag of the GPIO
controller device - spinlock or mutex. If the flag is wrong - like is
the case here - it may happen that we take a spinlock and then descend
into pinctrl where a mutex is taken resulting in a lockdep splat.

Bart


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping
  2026-01-06  8:52 [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping Bartosz Golaszewski
  2026-01-06  8:55 ` Neil Armstrong
  2026-01-06  8:57 ` Martin Blumenstingl
@ 2026-01-09  9:33 ` Linus Walleij
  2026-01-09  9:35 ` Linus Walleij
  3 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2026-01-09  9:33 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Bartosz Golaszewski, linux-gpio, linux-arm-kernel, linux-amlogic,
	linux-kernel, stable

On Tue, Jan 6, 2026 at 9:53 AM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:

> The GPIO controller is configured as non-sleeping but it uses generic
> pinctrl helpers which use a mutex for synchronization. This will cause
> lockdep splats when used together with shared GPIOs going through the
> GPIO shared proxy driver.
>
> Fixes: 6e9be3abb78c ("pinctrl: Add driver support for Amlogic SoCs")
> Cc: stable@vger.kernel.org
> Reported-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Closes: https://lore.kernel.org/all/CAFBinCAc7CO8gfNQakCu3LfkYXuyTd2iRpMRm8EKXSL0mwOnJw@mail.gmail.com/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

Patch applied for fixes!

Yours,
Linus Walleij


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping
  2026-01-06  8:52 [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping Bartosz Golaszewski
                   ` (2 preceding siblings ...)
  2026-01-09  9:33 ` Linus Walleij
@ 2026-01-09  9:35 ` Linus Walleij
  2026-01-09  9:36   ` Bartosz Golaszewski
  3 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2026-01-09  9:35 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl,
	Bartosz Golaszewski, linux-gpio, linux-arm-kernel, linux-amlogic,
	linux-kernel, stable

On Tue, Jan 6, 2026 at 9:53 AM Bartosz Golaszewski
<bartosz.golaszewski@oss.qualcomm.com> wrote:

> The GPIO controller is configured as non-sleeping but it uses generic
> pinctrl helpers which use a mutex for synchronization. This will cause
> lockdep splats when used together with shared GPIOs going through the
> GPIO shared proxy driver.

BTW it is a very *welcome* side-effect of the new shared GPIO rework
that it just happens to find these old bugs, I'm very pleased with this :)

Yours,
Linus Walleij


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping
  2026-01-09  9:35 ` Linus Walleij
@ 2026-01-09  9:36   ` Bartosz Golaszewski
  0 siblings, 0 replies; 8+ messages in thread
From: Bartosz Golaszewski @ 2026-01-09  9:36 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Bartosz Golaszewski, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, linux-gpio, linux-arm-kernel, linux-amlogic,
	linux-kernel, stable

On Fri, Jan 9, 2026 at 10:35 AM Linus Walleij <linusw@kernel.org> wrote:
>
> On Tue, Jan 6, 2026 at 9:53 AM Bartosz Golaszewski
> <bartosz.golaszewski@oss.qualcomm.com> wrote:
>
> > The GPIO controller is configured as non-sleeping but it uses generic
> > pinctrl helpers which use a mutex for synchronization. This will cause
> > lockdep splats when used together with shared GPIOs going through the
> > GPIO shared proxy driver.
>
> BTW it is a very *welcome* side-effect of the new shared GPIO rework
> that it just happens to find these old bugs, I'm very pleased with this :)
>

Actually, I was surprised I was getting so many bug reports and then
it turned out, there was a bug that caused a lot of false-positives to
turn up when scanning the devicetree for shared pins. I just queued a
fix for that so it should slow down now.

Bart


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-01-09  9:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-06  8:52 [PATCH] pinctrl: meson: amlogic-a4: mark the GPIO controller as sleeping Bartosz Golaszewski
2026-01-06  8:55 ` Neil Armstrong
2026-01-06  9:32   ` Xianwei Zhao
2026-01-06 10:40     ` Bartosz Golaszewski
2026-01-06  8:57 ` Martin Blumenstingl
2026-01-09  9:33 ` Linus Walleij
2026-01-09  9:35 ` Linus Walleij
2026-01-09  9:36   ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox