All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Mark Brown <broonie@kernel.org>, <linux-spi@vger.kernel.org>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Ryan Wanner <ryan.wanner@microchip.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	stable@vger.kernel.org, Ronald Wahl <ronald.wahl@raritan.com>
Subject: [PATCH 1/2] spi: atmel: Do not cancel a transfer upon any signal
Date: Mon, 27 Nov 2023 10:58:41 +0100	[thread overview]
Message-ID: <20231127095842.389631-1-miquel.raynal@bootlin.com> (raw)

The intended move from wait_for_completion_*() to
wait_for_completion_interruptible_*() was to allow (very) long spi memory
transfers to be stopped upon user request instead of freezing the
machine forever as the timeout value could now be significantly bigger.

However, depending on the user logic, applications can receive many
signals for their own "internal" purpose and have nothing to do with the
requested kernel operations, hence interrupting spi transfers upon any
signal is probably not a wise choice. Instead, let's switch to
wait_for_completion_killable_*() to only catch the "important"
signals. This was likely the intended behavior anyway.

Fixes: e0205d6203c2 ("spi: atmel: Prevent false timeouts on long transfers")
Cc: stable@vger.kernel.org
Reported-by: Ronald Wahl <ronald.wahl@raritan.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Hello Ronald, this is only compile tested, please let me know if that
fixes your use case or if you still suffer from interrupted transfers.
Thanks!
---
 drivers/spi/spi-atmel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c
index 6aa8adbe4170..2e8860865af9 100644
--- a/drivers/spi/spi-atmel.c
+++ b/drivers/spi/spi-atmel.c
@@ -1336,8 +1336,8 @@ static int atmel_spi_one_transfer(struct spi_controller *host,
 		}
 
 		dma_timeout = msecs_to_jiffies(spi_controller_xfer_timeout(host, xfer));
-		ret_timeout = wait_for_completion_interruptible_timeout(&as->xfer_completion,
-									dma_timeout);
+		ret_timeout = wait_for_completion_killable_timeout(&as->xfer_completion,
+								   dma_timeout);
 		if (ret_timeout <= 0) {
 			dev_err(&spi->dev, "spi transfer %s\n",
 				!ret_timeout ? "timeout" : "canceled");
-- 
2.34.1


             reply	other threads:[~2023-11-27  9:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27  9:58 Miquel Raynal [this message]
2023-11-27  9:58 ` [PATCH 2/2] spi: atmel: Drop unused defines Miquel Raynal
2023-11-27 15:10 ` [PATCH 1/2] spi: atmel: Do not cancel a transfer upon any signal Ronald Wahl
2023-11-27 17:54   ` Ronald Wahl
2023-11-29  8:49     ` Miquel Raynal
2023-11-29 11:05       ` Ronald Wahl
2023-11-30 12:46       ` Richard Weinberger
2023-11-30 18:26         ` Richard Weinberger
2023-11-30 18:36           ` Ronald Wahl
2023-11-30 20:15           ` Miquel Raynal
2023-11-30 20:43             ` Ronald Wahl
2023-11-30 20:58               ` Richard Weinberger
2023-12-01 11:13               ` David Laight
2023-12-01 13:38                 ` Ronald Wahl
2023-12-04 11:54                   ` Ronald Wahl
2023-12-04 12:26                     ` Mark Brown
2023-12-04 12:39                       ` Ronald Wahl
2023-12-04 12:19                   ` David Laight
2023-12-05  7:49               ` Miquel Raynal
2023-11-27 16:48 ` Mark Brown
2023-12-01 14:16 ` Mark Brown
2023-12-04 15:47 ` Mark Brown

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=20231127095842.389631-1-miquel.raynal@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=ronald.wahl@raritan.com \
    --cc=ryan.wanner@microchip.com \
    --cc=stable@vger.kernel.org \
    --cc=thomas.petazzoni@bootlin.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.