Skip to content

Commit

Permalink
fsi: sbefifo: Use interruptible mutex locking
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Joel Stanley <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Joel Stanley <[email protected]>
  • Loading branch information
Eddie James authored and shenki committed Oct 21, 2021
1 parent 8262803 commit 7cc2f34
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/fsi/fsi-sbefifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,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);

Expand Down Expand Up @@ -832,7 +834,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)
Expand Down Expand Up @@ -887,7 +891,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)
Expand Down

0 comments on commit 7cc2f34

Please sign in to comment.