linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Meng Li <Meng.Li@windriver.com>
To: dinguyen@kernel.org, gregkh@linuxfoundation.org,
	richard.gong@intel.com, atull@kernel.org
Cc: linux-kernel@vger.kernel.org, meng.li@windriver.com
Subject: [PATCH] driver: firmware: stratix10-svc: schedule thread out when there is no data reveived
Date: Tue,  9 Nov 2021 15:46:13 +0800	[thread overview]
Message-ID: <20211109074613.13994-1-Meng.Li@windriver.com> (raw)

From: Meng Li <meng.li@windriver.com>

In thread svc_normal_to_secure_thread(), function kfifo_out_spinlocked()
always return, so this thread can't release cpu even if there is no data
received, and cause cpu is under heave load status. System performance
is poor.

This issue is introduced by commit 7ca5ce896524("firmware: add Intel
Stratix10 service layer driver")

Therefore, schedule this thread out when there is no data reveived, and
wake it up after sending data to it.

Fixes: 7ca5ce896524 ("firmware: add Intel Stratix10 service layer driver")
Cc: stable@vger.kernel.org
Signed-off-by: Meng Li <Meng.Li@windriver.com>
---
 drivers/firmware/stratix10-svc.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
index 2a7687911c09..ddb86d441726 100644
--- a/drivers/firmware/stratix10-svc.c
+++ b/drivers/firmware/stratix10-svc.c
@@ -365,8 +365,10 @@ static int svc_normal_to_secure_thread(void *data)
 						pdata, sizeof(*pdata),
 						&ctrl->svc_fifo_lock);
 
-		if (!ret_fifo)
+		if (!ret_fifo) {
+			schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT);
 			continue;
+		}
 
 		pr_debug("get from FIFO pa=0x%016x, command=%u, size=%u\n",
 			 (unsigned int)pdata->paddr, pdata->command,
@@ -861,6 +863,7 @@ int stratix10_svc_send(struct stratix10_svc_chan *chan, void *msg)
 	ret = kfifo_in_spinlocked(&chan->ctrl->svc_fifo, p_data,
 				  sizeof(*p_data),
 				  &chan->ctrl->svc_fifo_lock);
+	wake_up_process(chan->ctrl->task);
 
 	kfree(p_data);
 
-- 
2.17.1


             reply	other threads:[~2021-11-09  7:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09  7:46 Meng Li [this message]
2021-11-12 19:35 ` [PATCH] driver: firmware: stratix10-svc: schedule thread out when there is no data reveived Dinh Nguyen
2021-11-15  1:45   ` Li, Meng

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=20211109074613.13994-1-Meng.Li@windriver.com \
    --to=meng.li@windriver.com \
    --cc=atull@kernel.org \
    --cc=dinguyen@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richard.gong@intel.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).