openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] gpio: nuvoton: Fix sgpio irq handle error
@ 2024-04-29  7:05 Jim Liu
  2024-05-03  8:36 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jim Liu @ 2024-04-29  7:05 UTC (permalink / raw)
  To: JJLIU0, KWLIU, jim.t90615, linus.walleij, brgl, dan.carpenter
  Cc: linux-gpio, openbmc, linux-kernel

The generic_handle_domain_irq() function calls irq_resolve_mapping()
so calling irq_find_mapping() is duplicative and will lead to a stack
trace and an RCU stall.


Fixes: c4f8457d17ce ("gpio: nuvoton: Add Nuvoton NPCM sgpio driver")
Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
---
Changes for v3:
   - remove unused variable
Changes for v2:
   - add more description
---
 drivers/gpio/gpio-npcm-sgpio.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpio/gpio-npcm-sgpio.c b/drivers/gpio/gpio-npcm-sgpio.c
index d31788b43abc..260570614543 100644
--- a/drivers/gpio/gpio-npcm-sgpio.c
+++ b/drivers/gpio/gpio-npcm-sgpio.c
@@ -434,7 +434,7 @@ static void npcm_sgpio_irq_handler(struct irq_desc *desc)
 	struct gpio_chip *gc = irq_desc_get_handler_data(desc);
 	struct irq_chip *ic = irq_desc_get_chip(desc);
 	struct npcm_sgpio *gpio = gpiochip_get_data(gc);
-	unsigned int i, j, girq;
+	unsigned int i, j;
 	unsigned long reg;
 
 	chained_irq_enter(ic, desc);
@@ -443,11 +443,9 @@ static void npcm_sgpio_irq_handler(struct irq_desc *desc)
 		const struct npcm_sgpio_bank *bank = &npcm_sgpio_banks[i];
 
 		reg = ioread8(bank_reg(gpio, bank, EVENT_STS));
-		for_each_set_bit(j, &reg, 8) {
-			girq = irq_find_mapping(gc->irq.domain,
-						i * 8 + gpio->nout_sgpio + j);
-			generic_handle_domain_irq(gc->irq.domain, girq);
-		}
+		for_each_set_bit(j, &reg, 8)
+			generic_handle_domain_irq(gc->irq.domain,
+						  i * 8 + gpio->nout_sgpio + j);
 	}
 
 	chained_irq_exit(ic, desc);
-- 
2.34.1


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

* Re: [PATCH v3] gpio: nuvoton: Fix sgpio irq handle error
  2024-04-29  7:05 [PATCH v3] gpio: nuvoton: Fix sgpio irq handle error Jim Liu
@ 2024-05-03  8:36 ` Linus Walleij
  2024-05-03 11:56 ` Dan Carpenter
  2024-05-03 16:30 ` Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2024-05-03  8:36 UTC (permalink / raw)
  To: Jim Liu
  Cc: KWLIU, brgl, JJLIU0, linux-kernel, linux-gpio, openbmc, dan.carpenter

On Mon, Apr 29, 2024 at 9:05 AM Jim Liu <jim.t90615@gmail.com> wrote:

> The generic_handle_domain_irq() function calls irq_resolve_mapping()
> so calling irq_find_mapping() is duplicative and will lead to a stack
> trace and an RCU stall.
>
>
> Fixes: c4f8457d17ce ("gpio: nuvoton: Add Nuvoton NPCM sgpio driver")
> Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>

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

Yours,
Linus Walleij

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

* Re: [PATCH v3] gpio: nuvoton: Fix sgpio irq handle error
  2024-04-29  7:05 [PATCH v3] gpio: nuvoton: Fix sgpio irq handle error Jim Liu
  2024-05-03  8:36 ` Linus Walleij
@ 2024-05-03 11:56 ` Dan Carpenter
  2024-05-03 16:30 ` Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2024-05-03 11:56 UTC (permalink / raw)
  To: Jim Liu
  Cc: KWLIU, linus.walleij, JJLIU0, linux-kernel, openbmc, linux-gpio, brgl

On Mon, Apr 29, 2024 at 03:05:23PM +0800, Jim Liu wrote:
> The generic_handle_domain_irq() function calls irq_resolve_mapping()
> so calling irq_find_mapping() is duplicative and will lead to a stack
> trace and an RCU stall.
> 
> 
> Fixes: c4f8457d17ce ("gpio: nuvoton: Add Nuvoton NPCM sgpio driver")
> Signed-off-by: Jim Liu <JJLIU0@nuvoton.com>
> ---
> Changes for v3:
>    - remove unused variable
> Changes for v2:
>    - add more description

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


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

* Re: [PATCH v3] gpio: nuvoton: Fix sgpio irq handle error
  2024-04-29  7:05 [PATCH v3] gpio: nuvoton: Fix sgpio irq handle error Jim Liu
  2024-05-03  8:36 ` Linus Walleij
  2024-05-03 11:56 ` Dan Carpenter
@ 2024-05-03 16:30 ` Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2024-05-03 16:30 UTC (permalink / raw)
  To: Jim Liu, openbmc, linux-gpio, kernel-janitors,
	Bartosz Golaszewski, Dan Carpenter, Linus Walleij
  Cc: KWLIU, Jim Liu, LKML

> The generic_handle_domain_irq() function calls irq_resolve_mapping()
> so calling irq_find_mapping() is duplicative and will lead to a stack
> trace and an RCU stall.

Can a wording approach (like the following) be a bit nicer?

   The generic_handle_domain_irq() function calls irq_resolve_mapping().
   Thus delete a duplicative irq_find_mapping() call
   so that a stack trace and an RCU stall will be avoided.


Regards,
Markus

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

end of thread, other threads:[~2024-05-03 16:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-29  7:05 [PATCH v3] gpio: nuvoton: Fix sgpio irq handle error Jim Liu
2024-05-03  8:36 ` Linus Walleij
2024-05-03 11:56 ` Dan Carpenter
2024-05-03 16:30 ` Markus Elfring

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