Skip to contentSkip to conversation

FAILED: patch "[PATCH] firmware: arm_scmi: Fix timeout checks on polling path" failed to apply to 6.6-stable tree

PATCH In review [email protected] 3 participants 5 messages May 9, 2025 – May 12, 2025

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.6-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.6.y
git checkout FETCH_HEAD
git cherry-pick -x c23c03bf1faa1e76be1eba35bad6da6a2a7c95ee
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025050930-scuba-spending-0eb9@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..

Possible dependencies:

thanks,

greg k-h

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

From c23c03bf1faa1e76be1eba35bad6da6a2a7c95ee Mon Sep 17 00:00:00 2001
From: Cristian Marussi <[email protected]>
Date: Mon, 10 Mar 2025 17:58:00 +0000
Subject: [PATCH] firmware: arm_scmi: Fix timeout checks on polling path

Polling mode transactions wait for a reply busy-looping without holding a spinlock, but currently the timeout checks are based only on elapsed time:
as a result we could hit a false positive whenever our busy-looping thread is pre-empted and scheduled out for a time greater than the polling timeout.

Change the checks at the end of the busy-loop to make sure that the polling wasn't indeed successful or an out-of-order reply caused the polling to be forcibly terminated.

Fixes 31d2f803c19c ("firmware: arm_scmi: Add sync_cmds_completed_on_ret transport flag")
Cc [email protected] # 5.18.x

Message-Id: <[email protected]>

drivers/firmware/arm_scmi/driver.c +8 -5
index 1c75a4c9c371..0390d5ff195e 100644
@@ -1248,7 +1248,8 @@ static void xfer_put(const struct scmi_protocol_handle *ph,
 }
 
 static bool scmi_xfer_done_no_timeout(struct scmi_chan_info *cinfo,
-				      struct scmi_xfer *xfer, ktime_t stop)
+				      struct scmi_xfer *xfer, ktime_t stop,
+				      bool *ooo)
 {
 	struct scmi_info *info = handle_to_scmi_info(cinfo->handle);
 
@@ -1257,7 +1258,7 @@ static bool scmi_xfer_done_no_timeout(struct scmi_chan_info *cinfo,
 	 * in case of out-of-order receptions of delayed responses
 	 */
 	return info->desc->ops->poll_done(cinfo, xfer) ||
-	       try_wait_for_completion(&xfer->done) ||
+	       (*ooo = try_wait_for_completion(&xfer->done)) ||
 	       ktime_after(ktime_get(), stop);
 }
 
@@ -1274,15 +1275,17 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
 		 * itself to support synchronous commands replies.
 		 */
 		if (!desc->sync_cmds_completed_on_ret) {
+			bool ooo = false;
+
 			/*
 			 * Poll on xfer using transport provided .poll_done();
 			 * assumes no completion interrupt was available.
 			 */
 			ktime_t stop = ktime_add_ms(ktime_get(), timeout_ms);
 
-			spin_until_cond(scmi_xfer_done_no_timeout(cinfo,
-								  xfer, stop));
-			if (ktime_after(ktime_get(), stop)) {
+			spin_until_cond(scmi_xfer_done_no_timeout(cinfo, xfer,
+								  stop, &ooo));
+			if (!ooo && !info->desc->ops->poll_done(cinfo, xfer)) {
 				dev_err(dev,
 					"timed out in resp(caller: %pS) - polling\n",
 					(void *)_RET_IP_);
#1 lore raw

PATCH 1/1 firmware: arm_scmi: Add missing definition of info reference

Add the missing definition that caused a build break.

---
 drivers/firmware/arm_scmi/driver.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/arm_scmi/driver.c +2 -0
index 609fbf4563ff..3f3701ed196e 100644
@@ -1044,6 +1044,8 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
 		 */
 		if (!desc->sync_cmds_completed_on_ret) {
 			bool ooo = false;
+			struct scmi_info *info =
+				handle_to_scmi_info(cinfo->handle);
 
 			/*
 			 * Poll on xfer using transport provided .poll_done();
Signature · 1 line
2.39.5
author maintainer
#2 lore raw

Re: [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference

Quoted 24 lines · Cristian Marussi

Add the missing definition that caused a build break.

---
 drivers/firmware/arm_scmi/driver.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/arm_scmi/driver.c +2 -0
index 609fbf4563ff..3f3701ed196e 100644
@@ -1044,6 +1044,8 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
 		 */
 		if (!desc->sync_cmds_completed_on_ret) {
 			bool ooo = false;
+			struct scmi_info *info =
+				handle_to_scmi_info(cinfo->handle);
 
 			/*
 			 * Poll on xfer using transport provided .poll_done();
Signature · 1 line
2.39.5

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

#3 lore raw

Re: [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference

Quoted 19 lines · Greg KH
Quoted 18 lines · Cristian Marussi

Add the missing definition that caused a build break.

---
 drivers/firmware/arm_scmi/driver.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/firmware/arm_scmi/driver.c +2 -0
index 609fbf4563ff..3f3701ed196e 100644
@@ -1044,6 +1044,8 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
 		 */
 		if (!desc->sync_cmds_completed_on_ret) {
 			bool ooo = false;
+			struct scmi_info *info =
+				handle_to_scmi_info(cinfo->handle);
 
Quoted 5 lines
Quoted 5 lines
drivers/firmware/arm_scmi/driver.c +0 -0
 			/*
 			 * Poll on xfer using transport provided .poll_done();
Signature · 1 line
2.39.5

Hi Greg,

Quoted 8 lines
Quoted 1 line

<formletter>

This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

..oh...I know...but from the FAILED report that I received related to the fact that the patch did not apply cleanly...

https://lore.kernel.org/all/2025050930-scuba-spending-0eb9@gregkh/

---
The patch below does not apply to the 6.6-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.6.y
git checkout FETCH_HEAD
git cherry-pick -x c23c03bf1faa1e76be1eba35bad6da6a2a7c95ee
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2025050930-scuba-spending-0eb9@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..

Possible dependencies:
----

...my (mis-)understanding was that you wanted some sort of diff on top of that the bad non-applying patch ('git commit -s') instead of fresh new poeprly backported patch....thing which, indeed, seemed weird :P

I'll resend following the proper procedure.

Sorry for the noise.

Thanks,
Cristian

maintainer
#4 lore raw

Re: [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference

In reply to Cristian Marussi

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
⚠️ Could not find matching upstream commit

No upstream commit was identified. Using temporary commit for testing.

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |