linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers
@ 2023-04-03 17:53 William Breathitt Gray
  2023-04-03 17:53 ` [PATCH 1/2] gpio: 104-dio-48e: Enable use_raw_spinlock for dio48e_regmap_config William Breathitt Gray
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: William Breathitt Gray @ 2023-04-03 17:53 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, William Breathitt Gray

The 104-dio-48e and 104-idi-48 drivers leverage regmap-irq to handle
IRQ. The default regmap locking utilizes spinlocks but this can result
in deadlocks for IRQ chips when running -rt kernels [0]. Enable
use_raw_spinlock for the regmap_config of these drivers to prevent such.

[0] https://lore.kernel.org/all/1466065537-82027-1-git-send-email-mika.westerberg@linux.intel.com/

William Breathitt Gray (2):
  gpio: 104-dio-48e: Enable use_raw_spinlock for dio48e_regmap_config
  gpio: 104-idi-48: Enable use_raw_spinlock for idi48_regmap_config

 drivers/gpio/gpio-104-dio-48e.c | 1 +
 drivers/gpio/gpio-104-idi-48.c  | 1 +
 2 files changed, 2 insertions(+)


base-commit: d49765b5f4320a402fbc4ed5edfd73d87640f27c
-- 
2.39.2


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

* [PATCH 1/2] gpio: 104-dio-48e: Enable use_raw_spinlock for dio48e_regmap_config
  2023-04-03 17:53 [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers William Breathitt Gray
@ 2023-04-03 17:53 ` William Breathitt Gray
  2023-04-03 17:53 ` [PATCH 2/2] gpio: 104-idi-48: Enable use_raw_spinlock for idi48_regmap_config William Breathitt Gray
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: William Breathitt Gray @ 2023-04-03 17:53 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, William Breathitt Gray

The dio48e regmap can be used in an interrupt context by regmap-irq. To
prevent a deadlock, enable use_raw_spinlock for dio48e_regmap_config.

Fixes: 2f7e845f512f ("gpio: 104-dio-48e: Migrate to the regmap-irq API")
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
 drivers/gpio/gpio-104-dio-48e.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index a3846faf3780..11c48130bb8f 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -86,6 +86,7 @@ static const struct regmap_config dio48e_regmap_config = {
 	.volatile_table = &dio48e_volatile_table,
 	.precious_table = &dio48e_precious_table,
 	.cache_type = REGCACHE_FLAT,
+	.use_raw_spinlock = true,
 };
 
 /* only bit 3 on each respective Port C supports interrupts */
-- 
2.39.2


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

* [PATCH 2/2] gpio: 104-idi-48: Enable use_raw_spinlock for idi48_regmap_config
  2023-04-03 17:53 [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers William Breathitt Gray
  2023-04-03 17:53 ` [PATCH 1/2] gpio: 104-dio-48e: Enable use_raw_spinlock for dio48e_regmap_config William Breathitt Gray
@ 2023-04-03 17:53 ` William Breathitt Gray
  2023-04-04 14:01 ` [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers Linus Walleij
  2023-04-11 19:08 ` Bartosz Golaszewski
  3 siblings, 0 replies; 5+ messages in thread
From: William Breathitt Gray @ 2023-04-03 17:53 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, William Breathitt Gray

The idi48 regmap can be used in an interrupt context by regmap-irq. To
prevent a deadlock, enable use_raw_spinlock for idi48_regmap_config.

Fixes: e28432a77365 ("gpio: 104-idi-48: Migrate to the regmap-irq API")
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
---
 drivers/gpio/gpio-104-idi-48.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c
index ca2175b84e24..ba73ee9c0c29 100644
--- a/drivers/gpio/gpio-104-idi-48.c
+++ b/drivers/gpio/gpio-104-idi-48.c
@@ -81,6 +81,7 @@ static const struct regmap_config idi48_regmap_config = {
 	.wr_table = &idi_48_wr_table,
 	.rd_table = &idi_48_rd_table,
 	.precious_table = &idi_48_precious_table,
+	.use_raw_spinlock = true,
 };
 
 #define IDI48_NGPIO 48
-- 
2.39.2


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

* Re: [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers
  2023-04-03 17:53 [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers William Breathitt Gray
  2023-04-03 17:53 ` [PATCH 1/2] gpio: 104-dio-48e: Enable use_raw_spinlock for dio48e_regmap_config William Breathitt Gray
  2023-04-03 17:53 ` [PATCH 2/2] gpio: 104-idi-48: Enable use_raw_spinlock for idi48_regmap_config William Breathitt Gray
@ 2023-04-04 14:01 ` Linus Walleij
  2023-04-11 19:08 ` Bartosz Golaszewski
  3 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2023-04-04 14:01 UTC (permalink / raw)
  To: William Breathitt Gray; +Cc: Bartosz Golaszewski, linux-gpio, linux-kernel

On Mon, Apr 3, 2023 at 7:53 PM William Breathitt Gray
<william.gray@linaro.org> wrote:

> The 104-dio-48e and 104-idi-48 drivers leverage regmap-irq to handle
> IRQ. The default regmap locking utilizes spinlocks but this can result
> in deadlocks for IRQ chips when running -rt kernels [0]. Enable
> use_raw_spinlock for the regmap_config of these drivers to prevent such.
>
> [0] https://lore.kernel.org/all/1466065537-82027-1-git-send-email-mika.westerberg@linux.intel.com/

This looks reasonable.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers
  2023-04-03 17:53 [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers William Breathitt Gray
                   ` (2 preceding siblings ...)
  2023-04-04 14:01 ` [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers Linus Walleij
@ 2023-04-11 19:08 ` Bartosz Golaszewski
  3 siblings, 0 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2023-04-11 19:08 UTC (permalink / raw)
  To: William Breathitt Gray; +Cc: Linus Walleij, linux-gpio, linux-kernel

On Mon, Apr 3, 2023 at 7:53 PM William Breathitt Gray
<william.gray@linaro.org> wrote:
>
> The 104-dio-48e and 104-idi-48 drivers leverage regmap-irq to handle
> IRQ. The default regmap locking utilizes spinlocks but this can result
> in deadlocks for IRQ chips when running -rt kernels [0]. Enable
> use_raw_spinlock for the regmap_config of these drivers to prevent such.
>
> [0] https://lore.kernel.org/all/1466065537-82027-1-git-send-email-mika.westerberg@linux.intel.com/
>
> William Breathitt Gray (2):
>   gpio: 104-dio-48e: Enable use_raw_spinlock for dio48e_regmap_config
>   gpio: 104-idi-48: Enable use_raw_spinlock for idi48_regmap_config
>
>  drivers/gpio/gpio-104-dio-48e.c | 1 +
>  drivers/gpio/gpio-104-idi-48.c  | 1 +
>  2 files changed, 2 insertions(+)
>
>
> base-commit: d49765b5f4320a402fbc4ed5edfd73d87640f27c
> --
> 2.39.2
>

Both queued for fixes.

Bart

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

end of thread, other threads:[~2023-04-11 19:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-03 17:53 [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers William Breathitt Gray
2023-04-03 17:53 ` [PATCH 1/2] gpio: 104-dio-48e: Enable use_raw_spinlock for dio48e_regmap_config William Breathitt Gray
2023-04-03 17:53 ` [PATCH 2/2] gpio: 104-idi-48: Enable use_raw_spinlock for idi48_regmap_config William Breathitt Gray
2023-04-04 14:01 ` [PATCH 0/2] Fix possible deadlocks for i8255 GPIO drivers Linus Walleij
2023-04-11 19:08 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).