Skip to contentSkip to conversation

Fix regression in 5.18 for GPIO

PATCH Applied Mario Limonciello 3 participants 7 messages Apr 22, 2022 – Apr 25, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Fix regression in 5.18 for GPIO

Linus,

This patch is being sent directly to you because there has been a regression in 5.18 that I identified and sent a fix up that has been reviewed/tested/acked for nearly a week but the current subsystem maintainer (Bartosz) hasn't picked it up to send to you.

It's a severe problem; anyone who hits it:
1) Power button doesn't work anymore
2) Can't resume their laptop from S3 or s2idle

Because the original patch was cc stable@, it landed in stable releases and has been breaking people left and right as distros track the stable channels. The patch is well tested. Would you please consider to pick this up directly to fix that regression?

Thanks,

Mario Limonciello (1):
gpio: Request interrupts after IRQ is initialized

 drivers/gpio/gpiolib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v2 1/1 gpio: Request interrupts after IRQ is initialized

commit 5467801f1fcb ("gpio: Restrict usage of GPIO chip irq members before initialization") attempted to fix a race condition that lead to a NULL pointer, but in the process caused a regression for _AEI/_EVT declared GPIOs. This manifests in messages showing deferred probing while trying to allocate IRQs like so:

[    0.688318] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0000 to IRQ, err -517
[    0.688337] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x002C to IRQ, err -517
[    0.688348] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003D to IRQ, err -517
[    0.688359] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003E to IRQ, err -517
[    0.688369] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003A to IRQ, err -517
[    0.688379] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003B to IRQ, err -517
[    0.688389] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0002 to IRQ, err -517
[    0.688399] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0011 to IRQ, err -517
[    0.688410] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0012 to IRQ, err -517
[    0.688420] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0007 to IRQ, err -517

The code for walking _AEI doesn't handle deferred probing and so this leads to non-functional GPIO interrupts.

Fix this issue by moving the call to acpi_gpiochip_request_interrupts to occur after gc->irc.initialized is set.

---
v1->v2:
* Pick up acked-by/reviewed-by/link/tested-by

 drivers/gpio/gpiolib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib.c +2 -2
index 085348e08986..b7694171655c 100644
@@ -1601,8 +1601,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
 
 	gpiochip_set_irq_hooks(gc);
 
-	acpi_gpiochip_request_interrupts(gc);
-
 	/*
 	 * Using barrier() here to prevent compiler from reordering
 	 * gc->irq.initialized before initialization of above
@@ -1612,6 +1610,8 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
 
 	gc->irq.initialized = true;
 
+	acpi_gpiochip_request_interrupts(gc);
+
 	return 0;
 }
 
Signature · 1 line
2.34.1
author Reviewed-by Takashi Iwai Tested-by Takashi Iwai on v2 1/1
#2 lore raw

Re: [PATCH v2 1/1] gpio: Request interrupts after IRQ is initialized

Quoted 23 lines · Mario Limonciello

commit 5467801f1fcb ("gpio: Restrict usage of GPIO chip irq members before initialization") attempted to fix a race condition that lead to a NULL pointer, but in the process caused a regression for _AEI/_EVT declared GPIOs. This manifests in messages showing deferred probing while trying to allocate IRQs like so:

[    0.688318] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0000 to IRQ, err -517
[    0.688337] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x002C to IRQ, err -517
[    0.688348] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003D to IRQ, err -517
[    0.688359] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003E to IRQ, err -517
[    0.688369] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003A to IRQ, err -517
[    0.688379] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x003B to IRQ, err -517
[    0.688389] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0002 to IRQ, err -517
[    0.688399] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0011 to IRQ, err -517
[    0.688410] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0012 to IRQ, err -517
[    0.688420] amd_gpio AMDI0030:00: Failed to translate GPIO pin 0x0007 to IRQ, err -517

The code for walking _AEI doesn't handle deferred probing and so this leads to non-functional GPIO interrupts.

Fix this issue by moving the call to acpi_gpiochip_request_interrupts to occur after gc->irc.initialized is set.

Quoted 14 lines

Takashi hit this as well recently and provided a few more tags.

Quoted 29 lines

---
v1->v2:
* Pick up acked-by/reviewed-by/link/tested-by

  drivers/gpio/gpiolib.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpio/gpiolib.c +2 -2
index 085348e08986..b7694171655c 100644
@@ -1601,8 +1601,6 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
 
  	gpiochip_set_irq_hooks(gc);
 
-	acpi_gpiochip_request_interrupts(gc);
-
  	/*
  	 * Using barrier() here to prevent compiler from reordering
  	 * gc->irq.initialized before initialization of above
@@ -1612,6 +1610,8 @@ static int gpiochip_add_irqchip(struct gpio_chip *gc,
 
  	gc->irq.initialized = true;
 
+	acpi_gpiochip_request_interrupts(gc);
+
  	return 0;
  }
 
#3 lore raw
In reply to Mario Limonciello
Quoted 5 lines · Mario Limonciello

This patch is being sent directly to you because there has been a regression in 5.18 that I identified and sent a fix up that has been reviewed/tested/acked for nearly a week but the current subsystem maintainer (Bartosz) hasn't picked it up to send to you.

Applied.

I'm not sure the "cc: stable" makes much sense since the bug was introduced in this release, but I assume you added it because the problem commit was also marked for stable.

The "Fixes:" tag should take care of it, but I left that cc:stable alone.

Linus

#4 lore raw
In reply to Mario Limonciello
Quoted 8 lines · Mario Limonciello

Linus,

This patch is being sent directly to you because there has been a regression in 5.18 that I identified and sent a fix up that has been reviewed/tested/acked for nearly a week but the current subsystem maintainer (Bartosz) hasn't picked it up to send to you.

Hi Mario!

I don't have any previous submission in my inbox. Are you sure to have used my current address ([email protected])?

Bart

Quoted 20 lines

It's a severe problem; anyone who hits it:
1) Power button doesn't work anymore
2) Can't resume their laptop from S3 or s2idle

Because the original patch was cc stable@, it landed in stable releases and has been breaking people left and right as distros track the stable channels. The patch is well tested. Would you please consider to pick this up directly to fix that regression?

Thanks,

Mario Limonciello (1):
gpio: Request interrupts after IRQ is initialized

 drivers/gpio/gpiolib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.34.1

#5 lore raw
Quoted 12 lines · Bartosz Golaszewski
Quoted 8 lines · Mario Limonciello

Linus,

This patch is being sent directly to you because there has been a regression in 5.18 that I identified and sent a fix up that has been reviewed/tested/acked for nearly a week but the current subsystem maintainer (Bartosz) hasn't picked it up to send to you.

Quoted 5 lines

Hi Mario!

I don't have any previous submission in my inbox. Are you sure to have used my current address ([email protected])?

Nevermind, found it in spam. Sorry, this sometimes happens in gmail.

Anyway - it's only been 3 days and I've been travelling. Sometimes reviews take a couple days.

Bart

Quoted 22 lines

Bart

Quoted 20 lines

It's a severe problem; anyone who hits it:
1) Power button doesn't work anymore
2) Can't resume their laptop from S3 or s2idle

Because the original patch was cc stable@, it landed in stable releases and has been breaking people left and right as distros track the stable channels. The patch is well tested. Would you please consider to pick this up directly to fix that regression?

Thanks,

Mario Limonciello (1):
gpio: Request interrupts after IRQ is initialized

 drivers/gpio/gpiolib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.34.1

#6 lore raw

[Public]

Quoted 28 lines

-----Original Message-----
From: Bartosz Golaszewski <[email protected]>
Sent: Monday, April 25, 2022 13:43
To: Limonciello, Mario <[email protected]>
Cc: Linus Torvalds <[email protected]>; Natikar, Basavaraj <[email protected]>; Gong, Richard <[email protected]>; [email protected]; Thorsten Leemhuis <[email protected]>; Greg KH <[email protected]>; stable <[email protected]>; Linus Walleij <[email protected]>; Shreeya Patel <[email protected]>; Andy Shevchenko <[email protected]>; open list:GPIO SUBSYSTEM <linux- [email protected]>; open list <[email protected]>
Subject: Re: [PATCH v2 0/1] Fix regression in 5.18 for GPIO

Quoted 12 lines · Bartosz Golaszewski
Quoted 8 lines · Mario Limonciello

Linus,

This patch is being sent directly to you because there has been a regression in 5.18 that I identified and sent a fix up that has been reviewed/tested/acked for nearly a week but the current subsystem maintainer (Bartosz) hasn't picked it up to send to you.

Quoted 7 lines
Quoted 5 lines

Hi Mario!

I don't have any previous submission in my inbox. Are you sure to have used my current address ([email protected])?

Nevermind, found it in spam. Sorry, this sometimes happens in gmail.

OK glad you found it.

Quoted 3 lines

Anyway - it's only been 3 days and I've been travelling. Sometimes reviews take a couple days.

If it was just in the normal development release in an RC I'd agree there wasn't a lot of urgency, but stable picked it up and caused severe regressions. There wasn't an obvious willingness to revert the problematic commit in stable is why Thorsten was making noise about it and suggested me to send it directly to Linus.

Anyway - I'm glad it's sorted now.

Quoted 25 lines

Bart

Quoted 22 lines

Bart

Quoted 20 lines

It's a severe problem; anyone who hits it:
1) Power button doesn't work anymore
2) Can't resume their laptop from S3 or s2idle

Because the original patch was cc stable@, it landed in stable releases and has been breaking people left and right as distros track the stable channels. The patch is well tested. Would you please consider to pick this up directly to fix that regression?

Thanks,

Mario Limonciello (1):
gpio: Request interrupts after IRQ is initialized

 drivers/gpio/gpiolib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--
2.34.1