public inbox for dmaengine@vger.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Adrian Larumbe <adrian.martinezlarumbe@imgtec.com>,
	vkoul@kernel.org, dmaengine@vger.kernel.org
Cc: michal.simek@xilinx.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 4/4] dmaengine: xilinx_dma: Add device synchronisation callback
Date: Fri, 23 Apr 2021 08:33:51 +0200	[thread overview]
Message-ID: <4f286de6-ab91-ffd1-1119-cd94e5805aa9@metafoo.de> (raw)
In-Reply-To: <20210423011913.13122-5-adrian.martinezlarumbe@imgtec.com>

On 4/23/21 3:19 AM, Adrian Larumbe wrote:
> This was required as an answer to a very unusual race condition, whereby a
> thread waiting on a completion signaled in a callback triggered by
> dmaengine_desc_callback_invoke might immediately attempt to release the
> DMA channel whilst the channel lock was still free. This would cause the
> remaining descriptors to be deallocated, and xilinx_dma_chan_desc_cleanup
> to perform an invalid memory access when attempting to traverse the rest
> of the channel's done_list.
>
> Now, when releasing a DMA channel, it will wait until the tasklet has
> finished.
>
> Signed-off-by: Adrian Larumbe <adrian.martinezlarumbe@imgtec.com>

Hi,


Patch looks good, but basically the same got already applied a few weeks 
ago.

See 
https://git.kernel.org/pub/scm/linux/kernel/git/vkoul/dmaengine.git/commit/?h=next&id=50db2050faf854cbaf4b6557a7a8ca21bff302ae

- Lars

> ---
>   drivers/dma/xilinx/xilinx_dma.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/drivers/dma/xilinx/xilinx_dma.c b/drivers/dma/xilinx/xilinx_dma.c
> index 40c6cf8bf0e6..d4bad999e7f9 100644
> --- a/drivers/dma/xilinx/xilinx_dma.c
> +++ b/drivers/dma/xilinx/xilinx_dma.c
> @@ -942,6 +942,13 @@ static void xilinx_dma_free_chan_resources(struct dma_chan *dchan)
>   
>   }
>   
> +static void xilinx_dma_synchronize(struct dma_chan *dchan)
> +{
> +	struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
> +
> +	tasklet_kill(&chan->tasklet);
> +}
> +
>   /**
>    * xilinx_dma_get_residue - Compute residue for a given descriptor
>    * @chan: Driver specific dma channel
> @@ -3235,6 +3242,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
>   	xdev->common.device_tx_status = xilinx_dma_tx_status;
>   	xdev->common.device_issue_pending = xilinx_dma_issue_pending;
>   	xdev->common.device_config = xilinx_dma_slave_config;
> +	xdev->common.device_synchronize = xilinx_dma_synchronize;
>   	if (xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
>   		dma_cap_set(DMA_CYCLIC, xdev->common.cap_mask);
>   		xdev->common.device_prep_slave_sg = xilinx_dma_prep_slave_sg;



  reply	other threads:[~2021-04-23  6:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23  1:19 [PATCH 0/4] Expand Xilinx CDMA functions Adrian Larumbe
2021-04-23  1:19 ` [PATCH 1/4] dmaengine: xilinx_dma: Add extended address support in CDMA Adrian Larumbe
2021-04-23  1:19 ` [PATCH 2/4] dmaengine: xilinx_dma: Add channel configuration setting callback Adrian Larumbe
2021-04-23  1:19 ` [PATCH 3/4] dmaengine: xilinx_dma: Add CDMA SG transfer support Adrian Larumbe
2021-04-23  1:19 ` [PATCH 4/4] dmaengine: xilinx_dma: Add device synchronisation callback Adrian Larumbe
2021-04-23  6:33   ` Lars-Peter Clausen [this message]
2021-04-23 11:49     ` [EXTERNAL] " Adrian Larumbe
2021-04-23  9:17 ` [PATCH 0/4] Expand Xilinx CDMA functions Lars-Peter Clausen
2021-04-23 11:38   ` [EXTERNAL] " Adrian Larumbe
2021-04-23 13:24   ` Vinod Koul
2021-04-23 13:51     ` Lars-Peter Clausen
2021-04-23 14:36       ` [EXTERNAL] " Adrian Larumbe
2021-04-23 17:20       ` Vinod Koul
2021-06-01 10:29         ` radhey pandey
2021-07-02 14:23           ` [EXTERNAL] " Adrian Larumbe
2021-07-05  3:53             ` Vinod Koul

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=4f286de6-ab91-ffd1-1119-cd94e5805aa9@metafoo.de \
    --to=lars@metafoo.de \
    --cc=adrian.martinezlarumbe@imgtec.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=michal.simek@xilinx.com \
    --cc=vkoul@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox