LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: Eddie James <eajames@linux.ibm.com>
Cc: Jeremy Kerr <jk@ozlabs.org>,
	Alistair Popple <alistair@popple.id.au>,
	linux-fsi@lists.ozlabs.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] fsi: sbefifo: Use interruptible mutex locking
Date: Fri, 15 Oct 2021 05:31:08 +0000	[thread overview]
Message-ID: <CACPK8XcVDAKxiPGmcrjsyHJ5LUt4xkCm3sJzb5d6xCXr_+dzrg@mail.gmail.com> (raw)
In-Reply-To: <20210803213016.44739-1-eajames@linux.ibm.com>

On Tue, 3 Aug 2021 at 21:30, Eddie James <eajames@linux.ibm.com> wrote:
>
> Some SBE operations have extremely large responses and can require
> several minutes to process the response. During this time, the device
> lock must be held. If another process attempts an operation, it will
> wait for the mutex for longer than the kernel hung task watchdog
> allows. Therefore, use the interruptible function to lock the mutex.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>

I think this is okay. I'm not familiar with the use of
mutex_lock_interruptible, so if anyone else wants to ask questions
please do.

Reviewed-by: Joel Stanley <joel@jms.id.au>

> ---
>  drivers/fsi/fsi-sbefifo.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/fsi/fsi-sbefifo.c b/drivers/fsi/fsi-sbefifo.c
> index 84cb965bfed5..a8d8e47e6fb2 100644
> --- a/drivers/fsi/fsi-sbefifo.c
> +++ b/drivers/fsi/fsi-sbefifo.c
> @@ -740,7 +740,9 @@ int sbefifo_submit(struct device *dev, const __be32 *command, size_t cmd_len,
>          iov_iter_kvec(&resp_iter, WRITE, &resp_iov, 1, rbytes);
>
>         /* Perform the command */
> -       mutex_lock(&sbefifo->lock);
> +       rc = mutex_lock_interruptible(&sbefifo->lock);
> +       if (rc)
> +               return rc;
>         rc = __sbefifo_submit(sbefifo, command, cmd_len, &resp_iter);
>         mutex_unlock(&sbefifo->lock);
>
> @@ -820,7 +822,9 @@ static ssize_t sbefifo_user_read(struct file *file, char __user *buf,
>         iov_iter_init(&resp_iter, WRITE, &resp_iov, 1, len);
>
>         /* Perform the command */
> -       mutex_lock(&sbefifo->lock);
> +       rc = mutex_lock_interruptible(&sbefifo->lock);
> +       if (rc)
> +               goto bail;
>         rc = __sbefifo_submit(sbefifo, user->pending_cmd, cmd_len, &resp_iter);
>         mutex_unlock(&sbefifo->lock);
>         if (rc < 0)
> @@ -875,7 +879,9 @@ static ssize_t sbefifo_user_write(struct file *file, const char __user *buf,
>                 user->pending_len = 0;
>
>                 /* Trigger reset request */
> -               mutex_lock(&sbefifo->lock);
> +               rc = mutex_lock_interruptible(&sbefifo->lock);
> +               if (rc)
> +                       goto bail;
>                 rc = sbefifo_request_reset(user->sbefifo);
>                 mutex_unlock(&sbefifo->lock);
>                 if (rc == 0)
> --
> 2.27.0
>

      reply	other threads:[~2021-10-15  5:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 21:30 Eddie James
2021-10-15  5:31 ` Joel Stanley [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=CACPK8XcVDAKxiPGmcrjsyHJ5LUt4xkCm3sJzb5d6xCXr_+dzrg@mail.gmail.com \
    --to=joel@jms.id.au \
    --cc=alistair@popple.id.au \
    --cc=eajames@linux.ibm.com \
    --cc=jk@ozlabs.org \
    --cc=linux-fsi@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH] fsi: sbefifo: Use interruptible mutex locking' \
    /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

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).