Skip to contentSkip to conversation

FAILED: patch "[PATCH] pinctrl: amd: Don't save/restore interrupt status and wake" failed to apply to 5.10-stable tree

PATCH [email protected] 2 participants 6 messages Aug 22, 2022 – Aug 24, 2022

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From b8c824a869f220c6b46df724f85794349bafbf23 Mon Sep 17 00:00:00 2001
From: Basavaraj Natikar <[email protected]>
Date: Mon, 13 Jun 2022 12:11:26 +0530
Subject: [PATCH] pinctrl: amd: Don't save/restore interrupt status and wake
status bits

Saving/restoring interrupt and wake status bits across suspend can cause the suspend to fail if an IRQ is serviced across the suspend cycle.

Fixes 79d2c8bede2c ("pinctrl/amd: save pin registers over suspend/resume")
drivers/pinctrl/pinctrl-amd.c +9 -2
index e497df89a4a7..9ec97c6db5e9 100644
@@ -918,6 +918,7 @@ static int amd_gpio_suspend(struct device *dev)
 {
 	struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
 	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
+	unsigned long flags;
 	int i;
 
 	for (i = 0; i < desc->npins; i++) {
@@ -926,7 +927,9 @@ static int amd_gpio_suspend(struct device *dev)
 		if (!amd_gpio_should_save(gpio_dev, pin))
 			continue;
 
-		gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin*4);
+		raw_spin_lock_irqsave(&gpio_dev->lock, flags);
+		gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin * 4) & ~PIN_IRQ_PENDING;
+		raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
 	}
 
 	return 0;
@@ -936,6 +939,7 @@ static int amd_gpio_resume(struct device *dev)
 {
 	struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
 	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
+	unsigned long flags;
 	int i;
 
 	for (i = 0; i < desc->npins; i++) {
@@ -944,7 +948,10 @@ static int amd_gpio_resume(struct device *dev)
 		if (!amd_gpio_should_save(gpio_dev, pin))
 			continue;
 
-		writel(gpio_dev->saved_regs[i], gpio_dev->base + pin*4);
+		raw_spin_lock_irqsave(&gpio_dev->lock, flags);
+		gpio_dev->saved_regs[i] |= readl(gpio_dev->base + pin * 4) & PIN_IRQ_PENDING;
+		writel(gpio_dev->saved_regs[i], gpio_dev->base + pin * 4);
+		raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
 	}
 
 	return 0;
#1 lore raw

[Public]

Quoted 10 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, August 22, 2022 03:42
To: Natikar, Basavaraj <[email protected]>; [email protected]; Limonciello, Mario <[email protected]>
Cc: [email protected]
Subject: FAILED: patch "[PATCH] pinctrl: amd: Don't save/restore interrupt status and wake" failed to apply to 5.10-stable tree

Quoted 4 lines

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

I had a look at this and the other ones that failed to apply. I tried to apply this commit ( commit b8c824a869f220c6b46df724f85794349bafbf23 ) to all of them and then built it.

5.10.y: success
5.4.y: success
4.19.y: success
4.14.y: success
4.9.y: failed

So I'm not sure why the automated stuff failed for you for 4.14.y through 5.10.y.

Considering it worked for me and built successfully can you have a try with it again at least on 4.14.y +?

Thanks,

Quoted 77 lines

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From b8c824a869f220c6b46df724f85794349bafbf23 Mon Sep 17 00:00:00 2001
From: Basavaraj Natikar <[email protected]>
Date: Mon, 13 Jun 2022 12:11:26 +0530
Subject: [PATCH] pinctrl: amd: Don't save/restore interrupt status and wake
status bits

Saving/restoring interrupt and wake status bits across suspend can cause the suspend to fail if an IRQ is serviced across the suspend cycle.

Fixes 79d2c8bede2c ("pinctrl/amd: save pin registers over

suspend/resume")
Link:
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.
kernel.org%2Fr%2F20220613064127.220416-3- Basavaraj.Natikar%40amd.com&amp;data=05%7C01%7Cmario.limonciello%4 0amd.com%7C19c619f81b23432a6eb608da841a3772%7C3dd8961fe4884e608e 11a82d994e183d%7C0%7C0%7C637967545388890457%7CUnknown%7CTWFp bGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVC I6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=Fz3iik5pd2tlwxvCBiA9BNA5gJ2s U66y0NqNrrRkpM4%3D&amp;reserved=0

drivers/pinctrl/pinctrl-amd.c +4 -1
index e497df89a4a7..9ec97c6db5e9 100644
@@ -918,6 +918,7 @@ static int amd_gpio_suspend(struct device *dev)
 {
 	struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
 	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
+	unsigned long flags;
 	int i;
 
 	for (i = 0; i < desc->npins; i++) {
@@ -926,7 +927,9 @@ static int amd_gpio_suspend(struct device *dev)
 		if (!amd_gpio_should_save(gpio_dev, pin))
 			continue;
 
-		gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin*4);
+		raw_spin_lock_irqsave(&gpio_dev->lock, flags);
+		gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin * 4) &
 ~PIN_IRQ_PENDING;
+		raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
 	}
 
drivers/pinctrl/pinctrl-amd.c +5 -1
 	return 0;
@@ -936,6 +939,7 @@ static int amd_gpio_resume(struct device *dev)
 {
 	struct amd_gpio *gpio_dev = dev_get_drvdata(dev);
 	struct pinctrl_desc *desc = gpio_dev->pctrl->desc;
+	unsigned long flags;
 	int i;
 
 	for (i = 0; i < desc->npins; i++) {
@@ -944,7 +948,10 @@ static int amd_gpio_resume(struct device *dev)
 		if (!amd_gpio_should_save(gpio_dev, pin))
 			continue;
 
-		writel(gpio_dev->saved_regs[i], gpio_dev->base + pin*4);
+		raw_spin_lock_irqsave(&gpio_dev->lock, flags);
+		gpio_dev->saved_regs[i] |= readl(gpio_dev->base + pin * 4)
 & PIN_IRQ_PENDING;
+		writel(gpio_dev->saved_regs[i], gpio_dev->base + pin * 4);
+		raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
 	}
 

return 0;

author maintainer
#2 lore raw
Quoted 17 lines · Mario

[Public]

Quoted 10 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, August 22, 2022 03:42
To: Natikar, Basavaraj <[email protected]>; [email protected]; Limonciello, Mario <[email protected]>
Cc: [email protected]
Subject: FAILED: patch "[PATCH] pinctrl: amd: Don't save/restore interrupt status and wake" failed to apply to 5.10-stable tree

Quoted 4 lines

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 4 lines

I had a look at this and the other ones that failed to apply. I tried to apply this commit ( commit b8c824a869f220c6b46df724f85794349bafbf23 ) to all of them and then built it.

5.10.y: success

$ patch -p1 < ../pinctrl-amd-don-t-save-restore-interrupt-status-and-wake-status-bits.patch
patching file drivers/pinctrl/pinctrl-amd.c
Hunk #1 succeeded at 833 (offset -85 lines).
Hunk #2 FAILED at 927.
Hunk #3 FAILED at 937.
Hunk #4 succeeded at 842 (offset -103 lines).
2 out of 4 hunks FAILED -- saving rejects to file drivers/pinctrl/pinctrl-amd.c.rej

Doesn't work for me, how did you apply it?

thanks,

greg k-h

#3 lore raw
Quoted 31 lines · On 8/24/22 01:54, [email protected] wrote:
Quoted 17 lines · Mario

[Public]

Quoted 10 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, August 22, 2022 03:42
To: Natikar, Basavaraj <[email protected]>; [email protected]; Limonciello, Mario <[email protected]>
Cc: [email protected]
Subject: FAILED: patch "[PATCH] pinctrl: amd: Don't save/restore interrupt status and wake" failed to apply to 5.10-stable tree

Quoted 4 lines

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 4 lines

I had a look at this and the other ones that failed to apply. I tried to apply this commit ( commit b8c824a869f220c6b46df724f85794349bafbf23 ) to all of them and then built it.

5.10.y: success

$ patch -p1 < ../pinctrl-amd-don-t-save-restore-interrupt-status-and-wake-status-bits.patch
patching file drivers/pinctrl/pinctrl-amd.c
Hunk #1 succeeded at 833 (offset -85 lines).
Hunk #2 FAILED at 927.
Hunk #3 FAILED at 937.
Hunk #4 succeeded at 842 (offset -103 lines).
2 out of 4 hunks FAILED -- saving rejects to file drivers/pinctrl/pinctrl-amd.c.rej
Quoted 1 line

Doesn't work for me, how did you apply it?

I checked out the different branches mentioned and did "git cherry-pick -x b8c824a869f220c6b46df724f85794349bafbf23" followed by building.

Quoted 4 lines

thanks,

greg k-h

author maintainer
#4 lore raw
Quoted 32 lines · Mario Limonciello
Quoted 31 lines · On 8/24/22 01:54, [email protected] wrote:
Quoted 17 lines · Mario

[Public]

Quoted 10 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, August 22, 2022 03:42
To: Natikar, Basavaraj <[email protected]>; [email protected]; Limonciello, Mario <[email protected]>
Cc: [email protected]
Subject: FAILED: patch "[PATCH] pinctrl: amd: Don't save/restore interrupt status and wake" failed to apply to 5.10-stable tree

Quoted 4 lines

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 4 lines

I had a look at this and the other ones that failed to apply. I tried to apply this commit ( commit b8c824a869f220c6b46df724f85794349bafbf23 ) to all of them and then built it.

5.10.y: success

$ patch -p1 < ../pinctrl-amd-don-t-save-restore-interrupt-status-and-wake-status-bits.patch
patching file drivers/pinctrl/pinctrl-amd.c
Hunk #1 succeeded at 833 (offset -85 lines).
Hunk #2 FAILED at 927.
Hunk #3 FAILED at 937.
Hunk #4 succeeded at 842 (offset -103 lines).
2 out of 4 hunks FAILED -- saving rejects to file drivers/pinctrl/pinctrl-amd.c.rej
Quoted 4 lines
Quoted 1 line

Doesn't work for me, how did you apply it?

I checked out the different branches mentioned and did "git cherry-pick -x b8c824a869f220c6b46df724f85794349bafbf23" followed by building.

That's great, can you send me that patch? We don't use git for the stable queue as it does not work at all for our development workflow. We export the commits as patches and then apply them using quilt. git must be doing some "magic fuzzing" here that patch can not detect.

thanks,

greg k-h

author maintainer
#5 lore raw
Quoted 35 lines · On Wed, Aug 24, 2022 at 02:14:24PM +0200, [email protected] wrote:
Quoted 34 lines · Mario Limonciello
Quoted 32 lines · On 8/24/22 01:54, [email protected] wrote:
Quoted 17 lines · Mario

[Public]

Quoted 10 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, August 22, 2022 03:42
To: Natikar, Basavaraj <[email protected]>; [email protected]; Limonciello, Mario <[email protected]>
Cc: [email protected]
Subject: FAILED: patch "[PATCH] pinctrl: amd: Don't save/restore interrupt status and wake" failed to apply to 5.10-stable tree

Quoted 4 lines

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

Quoted 4 lines

I had a look at this and the other ones that failed to apply. I tried to apply this commit ( commit b8c824a869f220c6b46df724f85794349bafbf23 ) to all of them and then built it.

5.10.y: success

$ patch -p1 < ../pinctrl-amd-don-t-save-restore-interrupt-status-and-wake-status-bits.patch
patching file drivers/pinctrl/pinctrl-amd.c
Hunk #1 succeeded at 833 (offset -85 lines).
Hunk #2 FAILED at 927.
Hunk #3 FAILED at 937.
Hunk #4 succeeded at 842 (offset -103 lines).
2 out of 4 hunks FAILED -- saving rejects to file drivers/pinctrl/pinctrl-amd.c.rej

Doesn't work for me, how did you apply it?

Quoted 7 lines
Quoted 2 lines

I checked out the different branches mentioned and did "git cherry-pick -x b8c824a869f220c6b46df724f85794349bafbf23" followed by building.

That's great, can you send me that patch? We don't use git for the stable queue as it does not work at all for our development workflow. We export the commits as patches and then apply them using quilt. git must be doing some "magic fuzzing" here that patch can not detect.

Nevermind, I did that, and it worked, odd that patch is confused, the fuzz is fine, just the line numbers are off. I'll queue this up after this round of kernels is released.

thanks,

greg k-h