From: jack21 <jackhuang021@gmail.com>
To: sudeep.holla@arm.com, cristian.marussi@arm.com
Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Huangjie <huangjie1663@phytium.com.cn>
Subject: [PATCH] dirvers: scmi: poll again when transfer reach timeout
Date: Thu, 23 Jan 2025 16:33:24 +0800 [thread overview]
Message-ID: <20250123083323.2363749-1-jackhuang021@gmail.com> (raw)
From: Huangjie <huangjie1663@phytium.com.cn>
spin_until_cond() not really hold a spin lock, possible timeout may occur
in preemption kernel when preempted after spin_until_cond().
We check status again when reach timeout is reached to prevent incorrect
jugement of timeout.
Signed-off-by: Huangjie <huangjie1663@phytium.com.cn>
---
drivers/firmware/arm_scmi/driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
index 1b5fb2c4ce86..10b049fe5fd0 100644
--- a/drivers/firmware/arm_scmi/driver.c
+++ b/drivers/firmware/arm_scmi/driver.c
@@ -1246,7 +1246,8 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
spin_until_cond(scmi_xfer_done_no_timeout(cinfo,
xfer, stop));
- if (ktime_after(ktime_get(), stop)) {
+ if (ktime_after(ktime_get(), stop) &&
+ !info->desc->ops->poll_done(cinfo, xfer)) {
dev_err(dev,
"timed out in resp(caller: %pS) - polling\n",
(void *)_RET_IP_);
--
2.34.1
next reply other threads:[~2025-01-23 8:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-23 8:33 jack21 [this message]
2025-01-23 10:38 ` [PATCH] dirvers: scmi: poll again when transfer reach timeout Dan Carpenter
2025-01-23 19:48 ` Cristian Marussi
2025-02-11 15:37 ` Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250123083323.2363749-1-jackhuang021@gmail.com \
--to=jackhuang021@gmail.com \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=huangjie1663@phytium.com.cn \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).