Skip to contentSkip to conversation

FAILED: patch "[PATCH] ice: reintroduce retry mechanism for indirect AQ" failed to apply to 6.1-stable tree

PATCH In review [email protected] 4 participants 9 messages Mar 17 – Mar 20

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.1-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]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 326256c0a72d4877cec1d4df85357da106233128
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026031701-reapprove-dollar-1839@gregkh' --subject-prefix 'PATCH 6.1.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

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

From 326256c0a72d4877cec1d4df85357da106233128 Mon Sep 17 00:00:00 2001
From: Jakub Staniszewski <[email protected]>
Date: Tue, 13 Jan 2026 20:38:16 +0100
Subject: [PATCH] ice: reintroduce retry mechanism for indirect AQ

Add retry mechanism for indirect Admin Queue (AQ) commands. To do so we need to keep the command buffer.

This technically reverts commit 43a630e37e25
("ice: remove unused buffer copy code in ice_sq_send_cmd_retry()"), but combines it with a fix in the logic by using a kmemdup() call, making it more robust and less likely to break in the future due to programmer error.

drivers/net/ethernet/intel/ice/ice_common.c +9 -3
index 74fe74225277..fd32c318d3f5 100644
@@ -1841,6 +1841,7 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 {
 	struct libie_aq_desc desc_cpy;
 	bool is_cmd_for_retry;
+	u8 *buf_cpy = NULL;
 	u8 idx = 0;
 	u16 opcode;
 	int status;
@@ -1850,8 +1851,11 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	memset(&desc_cpy, 0, sizeof(desc_cpy));
 
 	if (is_cmd_for_retry) {
-		/* All retryable cmds are direct, without buf. */
-		WARN_ON(buf);
+		if (buf) {
+			buf_cpy = kmemdup(buf, buf_size, GFP_KERNEL);
+			if (!buf_cpy)
+				return -ENOMEM;
+		}
 
 		memcpy(&desc_cpy, desc, sizeof(desc_cpy));
 	}
@@ -1863,12 +1867,14 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 		    hw->adminq.sq_last_status != LIBIE_AQ_RC_EBUSY)
 			break;
 
+		if (buf_cpy)
+			memcpy(buf, buf_cpy, buf_size);
 		memcpy(desc, &desc_cpy, sizeof(desc_cpy));
-
 		msleep(ICE_SQ_SEND_DELAY_TIME_MS);
 
 	} while (++idx < ICE_SQ_SEND_MAX_EXECUTE);
 
+	kfree(buf_cpy);
 	return status;
 }
 
maintainer
#1 lore raw

PATCH 1/3 ice: remove unused buffer copy code in ice_sq_send_cmd_retry()

From: Michal Schmidt <[email protected]>

[ Upstream commit 43a630e37e259fee83ab3fd769c42e2fed97ca81 ]

The 'buf_cpy'-related code in ice_sq_send_cmd_retry() looks broken. 'buf' is nowhere copied into 'buf_cpy'.

The reason this does not cause problems is that all commands for which 'is_cmd_for_retry' is true go with a NULL buf.

Let's remove 'buf_cpy'. Add a WARN_ON in case the assumption no longer holds in the future.

Stable-dep-of: 326256c0a72d ("ice: reintroduce retry mechanism for indirect AQ")

---
 drivers/net/ethernet/intel/ice/ice_common.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +2 -11
index 419052ebc3ae7..55a08fa1bf348 100644
@@ -1595,7 +1595,6 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 {
 	struct ice_aq_desc desc_cpy;
 	bool is_cmd_for_retry;
-	u8 *buf_cpy = NULL;
 	u8 idx = 0;
 	u16 opcode;
 	int status;
@@ -1605,11 +1604,8 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	memset(&desc_cpy, 0, sizeof(desc_cpy));
 
 	if (is_cmd_for_retry) {
-		if (buf) {
-			buf_cpy = kzalloc(buf_size, GFP_KERNEL);
-			if (!buf_cpy)
-				return -ENOMEM;
-		}
+		/* All retryable cmds are direct, without buf. */
+		WARN_ON(buf);
 
 		memcpy(&desc_cpy, desc, sizeof(desc_cpy));
 	}
@@ -1621,17 +1617,12 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 		    hw->adminq.sq_last_status != ICE_AQ_RC_EBUSY)
 			break;
 
-		if (buf_cpy)
-			memcpy(buf, buf_cpy, buf_size);
-
 		memcpy(desc, &desc_cpy, sizeof(desc_cpy));
 
 		mdelay(ICE_SQ_SEND_DELAY_TIME_MS);
 
 	} while (++idx < ICE_SQ_SEND_MAX_EXECUTE);
 
-	kfree(buf_cpy);
-
 	return status;
 }
 
Signature · 1 line
2.51.0
maintainer
#2 lore raw

PATCH 2/3 ice: sleep, don't busy-wait, in the SQ send retry loop

From: Michal Schmidt <[email protected]>

[ Upstream commit b488ae52ef9f74155ab358f8c68e74327b45e0e1 ]

10 ms is a lot of time to spend busy-waiting. Sleeping is clearly allowed here, because we have just returned from ice_sq_send_cmd(), which takes a mutex.

On kernels with HZ=100, this msleep may be twice as long, but I don't think it matters.
I did not actually observe any retries happening here.

Stable-dep-of: 326256c0a72d ("ice: reintroduce retry mechanism for indirect AQ")

---
 drivers/net/ethernet/intel/ice/ice_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/intel/ice/ice_common.c +1 -1
index 55a08fa1bf348..780c847cd1ffb 100644
@@ -1619,7 +1619,7 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 
 		memcpy(desc, &desc_cpy, sizeof(desc_cpy));
 
-		mdelay(ICE_SQ_SEND_DELAY_TIME_MS);
+		msleep(ICE_SQ_SEND_DELAY_TIME_MS);
 
 	} while (++idx < ICE_SQ_SEND_MAX_EXECUTE);
 
Signature · 1 line
2.51.0
maintainer
#3 lore raw

PATCH 3/3 ice: reintroduce retry mechanism for indirect AQ

In reply to Sasha Levin

From: Jakub Staniszewski <[email protected]>

[ Upstream commit 326256c0a72d4877cec1d4df85357da106233128 ]

Add retry mechanism for indirect Admin Queue (AQ) commands. To do so we need to keep the command buffer.

This technically reverts commit 43a630e37e25
("ice: remove unused buffer copy code in ice_sq_send_cmd_retry()"), but combines it with a fix in the logic by using a kmemdup() call, making it more robust and less likely to break in the future due to programmer error.

---
 drivers/net/ethernet/intel/ice/ice_common.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +9 -3
index 780c847cd1ffb..7bce89ba0a6fc 100644
@@ -1595,6 +1595,7 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 {
 	struct ice_aq_desc desc_cpy;
 	bool is_cmd_for_retry;
+	u8 *buf_cpy = NULL;
 	u8 idx = 0;
 	u16 opcode;
 	int status;
@@ -1604,8 +1605,11 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 	memset(&desc_cpy, 0, sizeof(desc_cpy));
 
 	if (is_cmd_for_retry) {
-		/* All retryable cmds are direct, without buf. */
-		WARN_ON(buf);
+		if (buf) {
+			buf_cpy = kmemdup(buf, buf_size, GFP_KERNEL);
+			if (!buf_cpy)
+				return -ENOMEM;
+		}
 
 		memcpy(&desc_cpy, desc, sizeof(desc_cpy));
 	}
@@ -1617,12 +1621,14 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
 		    hw->adminq.sq_last_status != ICE_AQ_RC_EBUSY)
 			break;
 
+		if (buf_cpy)
+			memcpy(buf, buf_cpy, buf_size);
 		memcpy(desc, &desc_cpy, sizeof(desc_cpy));
-
 		msleep(ICE_SQ_SEND_DELAY_TIME_MS);
 
 	} while (++idx < ICE_SQ_SEND_MAX_EXECUTE);
 
+	kfree(buf_cpy);
 	return status;
 }
 
Signature · 1 line
2.51.0
#4 lore raw

Re: [PATCH 6.1.y 3/3] ice: reintroduce retry mechanism for indirect AQ

Quoted 13 lines · Sasha Levin

From: Jakub Staniszewski <[email protected]>

[ Upstream commit 326256c0a72d4877cec1d4df85357da106233128 ]

Add retry mechanism for indirect Admin Queue (AQ) commands. To do so we need to keep the command buffer.

This technically reverts commit 43a630e37e25
("ice: remove unused buffer copy code in ice_sq_send_cmd_retry()"), but combines it with a fix in the logic by using a kmemdup() call, making it more robust and less likely to break in the future due to programmer error.

Quoted 12 lines

Hey Sasha,

Thank you for trying to reapply this patch. Unfortunately for 6.1.167-rc1 this will not work, we tried this with my colleague Jakub Staniszewski and got the following output:

# git am sasha_levin_ice_6_1_y.mbox
Applying: ice: reintroduce retry mechanism for indirect AQ
error: patch failed: drivers/net/ethernet/intel/ice/ice_common.c:1595
error: drivers/net/ethernet/intel/ice/ice_common.c: patch does not apply
Patch failed at 0001 ice: reintroduce retry mechanism for indirect AQ
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Quoted 17 lines
---
  drivers/net/ethernet/intel/ice/ice_common.c | 12 +++++++++---
  1 file changed, 9 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/ice/ice_common.c +1 -0
index 780c847cd1ffb..7bce89ba0a6fc 100644
@@ -1595,6 +1595,7 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
  {
  	struct ice_aq_desc desc_cpy;
  	bool is_cmd_for_retry;
+	u8 *buf_cpy = NULL;
  	u8 idx = 0;
  	u16 opcode;
  	int status;

drivers/net/ethernet/intel/ice/ice_common.c ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq, · line 1608

Quoted 5 lines
drivers/net/ethernet/intel/ice/ice_common.c +0 -2
@@ -1604,8 +1605,11 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
  	memset(&desc_cpy, 0, sizeof(desc_cpy));
 
  	if (is_cmd_for_retry) {
-		/* All retryable cmds are direct, without buf. */
-		WARN_ON(buf);

The above two lines do not exist in 6.1.y source, that's why the patch didn't apply in the first place.

For this change to be applicable you can take the modified / trimmed patch you sent for 5.15.y ("[PATCH 5.15.y 2/2] ice: reintroduce retry mechanism for indirect AQ") and apply the following diff to said patch:

drivers/net/ethernet/intel/ice/ice_common.c +1 -1
index a4d31e139..19d652d78 100644
@@ -1425,7 +1425,7 @@ ice_sq_send_cmd_retry(struct ice_hw *hw, struct ice_ctl_q_info *cq,
                if (buf) {
                        buf_cpy = kzalloc(buf_size, GFP_KERNEL);
                        if (!buf_cpy)
-                               return ICE_ERR_NO_MEMORY;
+                               return -ENOMEM;
                }
 
                memcpy(&desc_cpy, desc, sizeof(desc_cpy));

Do you want me to resend with this change applied or can you apply it yourself and resend?

Best regards
Dawid

maintainer
#5 lore raw

Re: [PATCH 6.1.y 3/3] ice: reintroduce retry mechanism for indirect AQ

Quoted 27 lines · Dawid Osuchowski
Quoted 13 lines · Sasha Levin

From: Jakub Staniszewski <[email protected]>

[ Upstream commit 326256c0a72d4877cec1d4df85357da106233128 ]

Add retry mechanism for indirect Admin Queue (AQ) commands. To do so we need to keep the command buffer.

This technically reverts commit 43a630e37e25
("ice: remove unused buffer copy code in ice_sq_send_cmd_retry()"), but combines it with a fix in the logic by using a kmemdup() call, making it more robust and less likely to break in the future due to programmer error.

Quoted 12 lines
Quoted 6 lines

Hey Sasha,

Thank you for trying to reapply this patch. Unfortunately for 6.1.167-rc1 this will not work, we tried this with my colleague Jakub Staniszewski and got the following output:

# git am sasha_levin_ice_6_1_y.mbox
Applying: ice: reintroduce retry mechanism for indirect AQ

I think that your mbox is missing the first two patches in this series :)

Signature · 2 lines
Thanks,
Sasha
#6 lore raw

Re: [PATCH 6.1.y 3/3] ice: reintroduce retry mechanism for indirect AQ

Quoted 4 lines · Sasha Levin
Quoted 3 lines · Dawid Osuchowski
Quoted 1 line · Sasha Levin
Quoted 8 lines
Quoted 6 lines

Hey Sasha,

Thank you for trying to reapply this patch. Unfortunately for 6.1.167- rc1 this will not work, we tried this with my colleague Jakub Staniszewski and got the following output:

# git am sasha_levin_ice_6_1_y.mbox
Applying: ice: reintroduce retry mechanism for indirect AQ

I think that your mbox is missing the first two patches in this series :)

Yep... I saw the [PATCH 6.1.y 3/3], but didn't realize the first two patches are backports of the prerequisites for this to apply cleanly... I thought it was some other unrelated patches ^^

You live you learn I guess. This is the first time where any patches I am involved with failed to apply cleanly to the stable trees, so I hope you will forgive my ignorance on this, heh.

I will try to do better next time :)

Thanks
~Dawid

Tested-by on v1 3/3
#7 lore raw

Re: [PATCH 6.1.y 3/3] ice: reintroduce retry mechanism for indirect AQ

In reply to Sasha Levin
Quoted 13 lines · Sasha Levin

From: Jakub Staniszewski <[email protected]>

[ Upstream commit 326256c0a72d4877cec1d4df85357da106233128 ]

Add retry mechanism for indirect Admin Queue (AQ) commands. To do so we need to keep the command buffer.

This technically reverts commit 43a630e37e25
("ice: remove unused buffer copy code in ice_sq_send_cmd_retry()"), but combines it with a fix in the logic by using a kmemdup() call, making it more robust and less likely to break in the future due to programmer error.

Quoted 12 lines

Regression tested on real hardware (E810-C for SFP) on top of
kernel version: 6.1.167-rc1. No errors/warnings in dmesg, ethtool -m works correctly.

Done after applying all the patches in this series, recompiling and reloading the ice module.

Thanks
~Dawid :)

Tested-by on v1 3/3
#8 lore raw

Re: [PATCH 6.1.y 3/3] ice: reintroduce retry mechanism for indirect AQ

In reply to Sasha Levin

W dniu 18.03.2026 o 01:09, Sasha Levin pisze:

Quoted 13 lines

From: Jakub Staniszewski <[email protected]>

[ Upstream commit 326256c0a72d4877cec1d4df85357da106233128 ]

Add retry mechanism for indirect Admin Queue (AQ) commands. To do so we need to keep the command buffer.

This technically reverts commit 43a630e37e25
("ice: remove unused buffer copy code in ice_sq_send_cmd_retry()"), but combines it with a fix in the logic by using a kmemdup() call, making it more robust and less likely to break in the future due to programmer error.

Quoted 12 lines

Compile-tested, runtime tested (regression only, to see if ethtool -m still works and if there are no errors in dmesg).