dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: xilinx: xdma: Fixes possible threading issue
@ 2024-05-27 16:29 Louis Chauvet
  2024-05-27 18:32 ` Markus Elfring
  0 siblings, 1 reply; 3+ messages in thread
From: Louis Chauvet @ 2024-05-27 16:29 UTC (permalink / raw)
  To: Lizhi Hou, Brian Xu, Raj Kumar Rampelli, Vinod Koul, Michal Simek
  Cc: dmaengine, linux-arm-kernel, linux-kernel, Louis Chauvet

The current interrupt handler in xdma.c was using xdma->stop_request
before locking the vchan lock.

Fixes: 6a40fb824596 ("dmaengine: xilinx: xdma: Fix synchronization issue")
Signed-off-by: Louis Chauvet <louis.chauvet@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] 3+ messages in thread

* Re: [PATCH] dmaengine: xilinx: xdma: Fixes possible threading issue
  2024-05-27 16:29 [PATCH] dmaengine: xilinx: xdma: Fixes possible threading issue Louis Chauvet
@ 2024-05-27 18:32 ` Markus Elfring
  2024-06-07  8:34   ` Louis Chauvet
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2024-05-27 18:32 UTC (permalink / raw)
  To: Louis Chauvet, dmaengine, linux-arm-kernel, Brian Xu, Lizhi Hou,
	Michal Simek, Raj Kumar Rampelli, Vinod Koul
  Cc: LKML

> The current interrupt handler in xdma.c was using xdma->stop_request
> before locking the vchan lock.

1. Will an additional imperative wording become helpful here?
   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc1#n94

2. How do you think about to use the summary phrase “Fix data synchronisation in xdma_channel_isr()”?

3. Will development interests grow for the usage of a statement like “guard(spin)(&xchan->vchan.lock);”?
   https://elixir.bootlin.com/linux/v6.10-rc1/source/include/linux/cleanup.h#L124


Regards,
Markus

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

* Re: [PATCH] dmaengine: xilinx: xdma: Fixes possible threading issue
  2024-05-27 18:32 ` Markus Elfring
@ 2024-06-07  8:34   ` Louis Chauvet
  0 siblings, 0 replies; 3+ messages in thread
From: Louis Chauvet @ 2024-06-07  8:34 UTC (permalink / raw)
  To: Markus Elfring
  Cc: dmaengine, linux-arm-kernel, Brian Xu, Lizhi Hou, Michal Simek,
	Raj Kumar Rampelli, Vinod Koul, LKML

Le 27/05/24 - 20:32, Markus Elfring a écrit :
> > The current interrupt handler in xdma.c was using xdma->stop_request
> > before locking the vchan lock.
> 
> 1. Will an additional imperative wording become helpful here?
>    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.10-rc1#n94
> 
> 2. How do you think about to use the summary phrase “Fix data synchronisation in xdma_channel_isr()”?

I changed the commit message and summary in the v2.
 
> 3. Will development interests grow for the usage of a statement like “guard(spin)(&xchan->vchan.lock);”?
>    https://elixir.bootlin.com/linux/v6.10-rc1/source/include/linux/cleanup.h#L124

I don't feel comfortable switching `guard` as the rest of the driver is 
not using it yet. Since this is a fix, I prefer to maintain consistency 
with the style of the rest of the driver.

Thanks,
Louis Chauvet

> 
> Regards,
> Markus
> 

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 16:29 [PATCH] dmaengine: xilinx: xdma: Fixes possible threading issue Louis Chauvet
2024-05-27 18:32 ` Markus Elfring
2024-06-07  8:34   ` Louis Chauvet

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