public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr()
@ 2024-06-07  8:34 Louis Chauvet
  2024-06-07 11:00 ` Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Louis Chauvet @ 2024-06-07  8:34 UTC (permalink / raw)
  To: Lizhi Hou, Brian Xu, Raj Kumar Rampelli, Vinod Koul, Michal Simek
  Cc: dmaengine, linux-arm-kernel, linux-kernel, markus.elfring, stable,
	Louis Chauvet

Requests the vchan lock before using xdma->stop_request.

Fixes: 6a40fb824596 ("dmaengine: xilinx: xdma: Fix synchronization issue")
Cc: stable@vger.kernel.org
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
Changes in v2:
- Apply comments from Markus
- Link to v1: https://lore.kernel.org/r/20240527-xdma-fixes-v1-1-f31434b56842@bootlin.com
---
 drivers/dma/xilinx/xdma.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/xilinx/xdma.c b/drivers/dma/xilinx/xdma.c
index e143a7330816..718842fdaf98 100644
--- a/drivers/dma/xilinx/xdma.c
+++ b/drivers/dma/xilinx/xdma.c
@@ -885,11 +885,11 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id)
 	u32 st;
 	bool repeat_tx;
 
+	spin_lock(&xchan->vchan.lock);
+
 	if (xchan->stop_requested)
 		complete(&xchan->last_interrupt);
 
-	spin_lock(&xchan->vchan.lock);
-
 	/* get submitted request */
 	vd = vchan_next_desc(&xchan->vchan);
 	if (!vd)

---
base-commit: 1613e604df0cd359cf2a7fbd9be7a0bcfacfabd0
change-id: 20240527-xdma-fixes-74bbe2dcbeb8

Best regards,
-- 
Louis Chauvet <louis.chauvet@bootlin.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr()
  2024-06-07  8:34 [PATCH v2] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr() Louis Chauvet
@ 2024-06-07 11:00 ` Markus Elfring
  2024-06-07 12:23 ` Markus Elfring
  2024-06-07 17:47 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2024-06-07 11:00 UTC (permalink / raw)
  To: Louis Chauvet, Lizhi Hou, Brian Xu, Raj Kumar Rampelli,
	Vinod Koul, Michal Simek, dmaengine, linux-arm-kernel
  Cc: linux-kernel, stable

> Requests the vchan lock before using xdma->stop_request.

Better wording alternative?:
  A data synchronisation construct was missing in this function implementation.
  Thus apply the vchan lock before checking the data structure
  member “xchan->stop_requested”.


> ---
>  drivers/dma/xilinx/xdma.c | 4 ++--

How do think about to avoid a duplicate marker line?


…
> +++ b/drivers/dma/xilinx/xdma.c
> @@ -885,11 +885,11 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id)
>  	u32 st;
>  	bool repeat_tx;
>
> +	spin_lock(&xchan->vchan.lock);
> +
>  	if (xchan->stop_requested)
>  		complete(&xchan->last_interrupt);
>
> -	spin_lock(&xchan->vchan.lock);
> -
>  	/* get submitted request */
…

Under which circumstances will development interests grow for the usage of
a statement like “guard(raw_spinlock)(&xchan->vchan.lock);”?
https://elixir.bootlin.com/linux/v6.10-rc2/source/include/linux/cleanup.h#L124

Regards,
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr()
  2024-06-07  8:34 [PATCH v2] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr() Louis Chauvet
  2024-06-07 11:00 ` Markus Elfring
@ 2024-06-07 12:23 ` Markus Elfring
  2024-06-07 17:47 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2024-06-07 12:23 UTC (permalink / raw)
  To: Louis Chauvet, Lizhi Hou, Brian Xu, Raj Kumar Rampelli,
	Vinod Koul, Michal Simek, dmaengine, linux-arm-kernel
  Cc: linux-kernel, stable

…
> +++ b/drivers/dma/xilinx/xdma.c
> @@ -885,11 +885,11 @@ static irqreturn_t xdma_channel_isr(int irq, void *dev_id)
>  	u32 st;
>  	bool repeat_tx;
>
> +	spin_lock(&xchan->vchan.lock);
> +
>  	if (xchan->stop_requested)
>  		complete(&xchan->last_interrupt);
…

Can any lock scope adjustments matter also for another variable definition?
https://elixir.bootlin.com/linux/v6.10-rc2/source/drivers/dma/xilinx/xdma.c#L873

	struct xdma_device *xdev = xchan->xdev_hdl;


Regards,
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr()
  2024-06-07  8:34 [PATCH v2] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr() Louis Chauvet
  2024-06-07 11:00 ` Markus Elfring
  2024-06-07 12:23 ` Markus Elfring
@ 2024-06-07 17:47 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2024-06-07 17:47 UTC (permalink / raw)
  To: Lizhi Hou, Brian Xu, Raj Kumar Rampelli, Michal Simek,
	Louis Chauvet
  Cc: dmaengine, linux-arm-kernel, linux-kernel, markus.elfring, stable


On Fri, 07 Jun 2024 10:34:38 +0200, Louis Chauvet wrote:
> Requests the vchan lock before using xdma->stop_request.
> 
> 

Applied, thanks!

[1/1] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr()
      commit: 462237d2d93fc9e9221d1cf9f773954d27da83c0

Best regards,
-- 
Vinod Koul <vkoul@kernel.org>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-06-07 17:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-07  8:34 [PATCH v2] dmaengine: xilinx: xdma: Fix data synchronisation in xdma_channel_isr() Louis Chauvet
2024-06-07 11:00 ` Markus Elfring
2024-06-07 12:23 ` Markus Elfring
2024-06-07 17:47 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox