Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] firmware: arm_scmi: Fix timeout checks on polling path" failed to apply to 6.6-stable tree
@ 2025-05-09  8:53 gregkh
  2025-05-09 11:44 ` [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference Cristian Marussi
  0 siblings, 1 reply; 5+ messages in thread
From: gregkh @ 2025-05-09  8:53 UTC (permalink / raw)
  To: cristian.marussi, huangjie1663, sudeep.holla; +Cc: stable


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 <stable@vger.kernel.org>.

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 '<stable@vger.kernel.org>' --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 <cristian.marussi@arm.com>
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")
Reported-by: Huangjie <huangjie1663@phytium.com.cn>
Closes: https://lore.kernel.org/arm-scmi/20250123083323.2363749-1-jackhuang021@gmail.com/
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Cc: stable@vger.kernel.org # 5.18.x
Message-Id: <20250310175800.1444293-1-cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 1c75a4c9c371..0390d5ff195e 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -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_);


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

* [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference
  2025-05-09  8:53 FAILED: patch "[PATCH] firmware: arm_scmi: Fix timeout checks on polling path" failed to apply to 6.6-stable tree gregkh
@ 2025-05-09 11:44 ` Cristian Marussi
  2025-05-09 13:45   ` Greg KH
  2025-05-12 18:04   ` Sasha Levin
  0 siblings, 2 replies; 5+ messages in thread
From: Cristian Marussi @ 2025-05-09 11:44 UTC (permalink / raw)
  To: stable; +Cc: Cristian Marussi

Add the missing definition that caused a build break.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 drivers/firmware/arm_scmi/driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 609fbf4563ff..3f3701ed196e 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -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();
-- 
2.39.5


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

* Re: [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference
  2025-05-09 11:44 ` [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference Cristian Marussi
@ 2025-05-09 13:45   ` Greg KH
  2025-05-09 14:22     ` Cristian Marussi
  2025-05-12 18:04   ` Sasha Levin
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2025-05-09 13:45 UTC (permalink / raw)
  To: Cristian Marussi; +Cc: stable

On Fri, May 09, 2025 at 12:44:22PM +0100, Cristian Marussi wrote:
> Add the missing definition that caused a build break.
> 
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> ---
>  drivers/firmware/arm_scmi/driver.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index 609fbf4563ff..3f3701ed196e 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c
> @@ -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();
> -- 
> 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>

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

* Re: [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference
  2025-05-09 13:45   ` Greg KH
@ 2025-05-09 14:22     ` Cristian Marussi
  0 siblings, 0 replies; 5+ messages in thread
From: Cristian Marussi @ 2025-05-09 14:22 UTC (permalink / raw)
  To: Greg KH; +Cc: Cristian Marussi, stable

On Fri, May 09, 2025 at 03:45:26PM +0200, Greg KH wrote:
> On Fri, May 09, 2025 at 12:44:22PM +0100, Cristian Marussi wrote:
> > Add the missing definition that caused a build break.
> > 
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > ---
> >  drivers/firmware/arm_scmi/driver.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> > index 609fbf4563ff..3f3701ed196e 100644
> > --- a/drivers/firmware/arm_scmi/driver.c
> > +++ b/drivers/firmware/arm_scmi/driver.c
> > @@ -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();
> > -- 
> > 2.39.5
> > 

Hi Greg,

> > 
> 
> <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 <stable@vger.kernel.org>.

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 '<stable@vger.kernel.org>' --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

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

* Re: [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference
  2025-05-09 11:44 ` [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference Cristian Marussi
  2025-05-09 13:45   ` Greg KH
@ 2025-05-12 18:04   ` Sasha Levin
  1 sibling, 0 replies; 5+ messages in thread
From: Sasha Levin @ 2025-05-12 18:04 UTC (permalink / raw)
  To: stable, cristian.marussi; +Cc: Sasha Levin

[ 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   |

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

end of thread, other threads:[~2025-05-12 18:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-09  8:53 FAILED: patch "[PATCH] firmware: arm_scmi: Fix timeout checks on polling path" failed to apply to 6.6-stable tree gregkh
2025-05-09 11:44 ` [PATCH 6.6.y] firmware: arm_scmi: Add missing definition of info reference Cristian Marussi
2025-05-09 13:45   ` Greg KH
2025-05-09 14:22     ` Cristian Marussi
2025-05-12 18:04   ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox