mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dinh Nguyen <dinguyen@kernel.org>
To: kah.jing.lee@intel.com
Cc: linux-kernel@vger.kernel.org, tien.sung.ang@intel.com
Subject: Re: [PATCH] firmware: stratix10-rsu: prevent io block when sending RSU messages
Date: Mon, 10 Jul 2023 18:15:54 -0500	[thread overview]
Message-ID: <91153e4d-d10f-75f6-64d8-7bd4ef75420e@kernel.org> (raw)
In-Reply-To: <20230705021846.1536829-1-kah.jing.lee@intel.com>



On 7/4/23 21:18, kah.jing.lee@intel.com wrote:
> From: Kah Jing Lee <kah.jing.lee@intel.com>
> 
> Fix the issue for preventing recursive rsu mutex lock
> issue in RSU update command.

This message is a bit confusing. What "issue" is preventing a lock issue?

> 
> Signed-off-by: Kah Jing Lee <kah.jing.lee@intel.com>
> ---
>   drivers/firmware/stratix10-rsu.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firmware/stratix10-rsu.c b/drivers/firmware/stratix10-rsu.c
> index e51c95f8d445..0a7542e9bb6f 100644
> --- a/drivers/firmware/stratix10-rsu.c
> +++ b/drivers/firmware/stratix10-rsu.c
> @@ -280,7 +280,9 @@ static int rsu_send_msg(struct stratix10_rsu_priv *priv,
>   	struct stratix10_svc_client_msg msg;
>   	int ret;
>   
> -	mutex_lock(&priv->lock);
> +	if (!mutex_trylock(&priv->lock))
> +		return -EAGAIN;
> +
>   	reinit_completion(&priv->completion);
>   	priv->client.receive_cb = callback;
>   
> @@ -525,7 +527,9 @@ static ssize_t reboot_image_store(struct device *dev,
>   
>   	ret = rsu_send_msg(priv, COMMAND_RSU_UPDATE,
>   			   address, rsu_command_callback);
> -	if (ret) {
> +	if (ret == -EAGAIN)
> +		return 0;
> +	else if (ret) {
>   		dev_err(dev, "Error, RSU update returned %i\n", ret);
>   		return ret;
>   	}

      reply	other threads:[~2023-07-10 23:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-05  2:18 kah.jing.lee
2023-07-10 23:15 ` Dinh Nguyen [this message]

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=91153e4d-d10f-75f6-64d8-7bd4ef75420e@kernel.org \
    --to=dinguyen@kernel.org \
    --cc=kah.jing.lee@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tien.sung.ang@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

all inboxes | Powered by JetHome®