* [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag @ 2012-11-23 9:22 Laxman Dewangan [not found] ` <1353662559-26515-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Laxman Dewangan @ 2012-11-23 9:22 UTC (permalink / raw) To: broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: swarren-DDmLM1+adcrQT0dZR+AlfA, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-tegra-u79uwXL29TY76Z2rM5mHXA, Laxman Dewangan Spi starts transfer using dma with DMA_CTRL_ACK which is not require becasue spi driver does not use completed dma_desc after transfer done and so it does not ack the dma descriptor. Removing the DMA_CTRL_ACK flag to avoid memory leak in dma driver. Signed-off-by: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- drivers/spi/spi-tegra20-slink.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index 7882b50..5b4c8c8 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -473,7 +473,7 @@ static int tegra_slink_start_tx_dma(struct tegra_slink_data *tspi, int len) INIT_COMPLETION(tspi->tx_dma_complete); tspi->tx_dma_desc = dmaengine_prep_slave_single(tspi->tx_dma_chan, tspi->tx_dma_phys, len, DMA_MEM_TO_DEV, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + DMA_PREP_INTERRUPT); if (!tspi->tx_dma_desc) { dev_err(tspi->dev, "Not able to get desc for Tx\n"); return -EIO; @@ -492,7 +492,7 @@ static int tegra_slink_start_rx_dma(struct tegra_slink_data *tspi, int len) INIT_COMPLETION(tspi->rx_dma_complete); tspi->rx_dma_desc = dmaengine_prep_slave_single(tspi->rx_dma_chan, tspi->rx_dma_phys, len, DMA_DEV_TO_MEM, - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); + DMA_PREP_INTERRUPT); if (!tspi->rx_dma_desc) { dev_err(tspi->dev, "Not able to get desc for Rx\n"); return -EIO; -- 1.7.1.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
[parent not found: <1353662559-26515-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag [not found] ` <1353662559-26515-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2012-11-26 22:03 ` Stephen Warren [not found] ` <50B3E72B.6020003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2013-04-01 13:35 ` Mark Brown 1 sibling, 1 reply; 7+ messages in thread From: Stephen Warren @ 2012-11-26 22:03 UTC (permalink / raw) To: Laxman Dewangan Cc: broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, grant.likely-s3s/WqlpOiPyB63q8FvJNQ, swarren-DDmLM1+adcrQT0dZR+AlfA, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-tegra-u79uwXL29TY76Z2rM5mHXA On 11/23/2012 02:22 AM, Laxman Dewangan wrote: > Spi starts transfer using dma with DMA_CTRL_ACK which is not require > becasue spi driver does not use completed dma_desc after transfer > done and so it does not ack the dma descriptor. Removing the > DMA_CTRL_ACK flag to avoid memory leak in dma driver. I'm not quite sure, but isn't this the opposite of what's wanted. I think that setting this flag in prep() means that the SPI driver need not explicitly ack it later? At least, tegra_dma_desc_get() returns an allocated descriptor if one exists and async_tx_test_ack()==true for it, and it's true when the DMA_CTRL_ACK flag is set, which happens either due to calling async_tx_ack(), or because tegra_dma_prep_slave_sg() was called with DMA_CTRL_ACK in flags. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <50B3E72B.6020003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>]
* Re: [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag [not found] ` <50B3E72B.6020003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> @ 2012-11-26 23:00 ` Laxman Dewangan 0 siblings, 0 replies; 7+ messages in thread From: Laxman Dewangan @ 2012-11-26 23:00 UTC (permalink / raw) To: Stephen Warren Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org, Stephen Warren On Tuesday 27 November 2012 03:33 AM, Stephen Warren wrote: > On 11/23/2012 02:22 AM, Laxman Dewangan wrote: >> Spi starts transfer using dma with DMA_CTRL_ACK which is not require >> becasue spi driver does not use completed dma_desc after transfer >> done and so it does not ack the dma descriptor. Removing the >> DMA_CTRL_ACK flag to avoid memory leak in dma driver. > I'm not quite sure, but isn't this the opposite of what's wanted. I > think that setting this flag in prep() means that the SPI driver need > not explicitly ack it later? > > At least, tegra_dma_desc_get() returns an allocated descriptor if one > exists and async_tx_test_ack()==true for it, and it's true when the > DMA_CTRL_ACK flag is set, which happens either due to calling > async_tx_ack(), or because tegra_dma_prep_slave_sg() was called with > DMA_CTRL_ACK in flags. I think DMA_CTRL_ACK flag is require if we want to free/reuse desc only when client ack it. Although some part of implementation is wrong in the tegra20-apb-dma.c. static struct tegra_dma_desc *tegra_dma_desc_get( struct tegra_dma_channel *tdc) { struct tegra_dma_desc *dma_desc; unsigned long flags; spin_lock_irqsave(&tdc->lock, flags); /* Do not allocate if desc are waiting for ack */ list_for_each_entry(dma_desc, &tdc->free_dma_desc, node) { if (async_tx_test_ack(&dma_desc->txd)) { list_del(&dma_desc->node); ::::::::::::::: } In above it should be if (!async_tx_test_ack()) And when client done with the desc, then it can say as async_tx_clear_ack(). ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag [not found] ` <1353662559-26515-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-11-26 22:03 ` Stephen Warren @ 2013-04-01 13:35 ` Mark Brown [not found] ` <20130401133459.GS18636-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 1 sibling, 1 reply; 7+ messages in thread From: Mark Brown @ 2013-04-01 13:35 UTC (permalink / raw) To: Laxman Dewangan Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ, swarren-DDmLM1+adcrQT0dZR+AlfA, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, linux-tegra-u79uwXL29TY76Z2rM5mHXA [-- Attachment #1: Type: text/plain, Size: 341 bytes --] On Fri, Nov 23, 2012 at 02:52:39PM +0530, Laxman Dewangan wrote: > Spi starts transfer using dma with DMA_CTRL_ACK which is not require > becasue spi driver does not use completed dma_desc after transfer > done and so it does not ack the dma descriptor. Removing the > DMA_CTRL_ACK flag to avoid memory leak in dma driver. Applied, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <20130401133459.GS18636-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>]
* Re: [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag [not found] ` <20130401133459.GS18636-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> @ 2013-04-03 9:31 ` Laxman Dewangan [not found] ` <515BF6ED.2060904-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-04-03 9:31 ` Laxman Dewangan 1 sibling, 1 reply; 7+ messages in thread From: Laxman Dewangan @ 2013-04-03 9:31 UTC (permalink / raw) To: Mark Brown Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, Stephen Warren, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Monday 01 April 2013 07:05 PM, Mark Brown wrote: > * PGP Signed by an unknown key > > On Fri, Nov 23, 2012 at 02:52:39PM +0530, Laxman Dewangan wrote: >> Spi starts transfer using dma with DMA_CTRL_ACK which is not require >> becasue spi driver does not use completed dma_desc after transfer >> done and so it does not ack the dma descriptor. Removing the >> DMA_CTRL_ACK flag to avoid memory leak in dma driver. > Applied, thanks. Mark, There was bug in dma driver about handling of DMA_CTRL_ACK flag which we fixed after Stephen pointed out. This change is no more require. Can you please drop this patch? Let me know if I need to send the revert patch. Sorry for inconvenience. Thanks, Laxan ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <515BF6ED.2060904-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag [not found] ` <515BF6ED.2060904-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> @ 2013-04-03 17:36 ` Mark Brown 0 siblings, 0 replies; 7+ messages in thread From: Mark Brown @ 2013-04-03 17:36 UTC (permalink / raw) To: Laxman Dewangan Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, Stephen Warren, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org [-- Attachment #1: Type: text/plain, Size: 474 bytes --] On Wed, Apr 03, 2013 at 03:01:25PM +0530, Laxman Dewangan wrote: > There was bug in dma driver about handling of DMA_CTRL_ACK flag > which we fixed after Stephen pointed out. > This change is no more require. > Can you please drop this patch? Let me know if I need to send the > revert patch. Someone really should've followed up to this patch then, the last discussion against it was you saying you thought it was OK after Stephen queried it. Anyway, I've reverted now. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag [not found] ` <20130401133459.GS18636-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 2013-04-03 9:31 ` Laxman Dewangan @ 2013-04-03 9:31 ` Laxman Dewangan 1 sibling, 0 replies; 7+ messages in thread From: Laxman Dewangan @ 2013-04-03 9:31 UTC (permalink / raw) To: Mark Brown Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org, Stephen Warren, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org, linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Monday 01 April 2013 07:05 PM, Mark Brown wrote: > * PGP Signed by an unknown key > > On Fri, Nov 23, 2012 at 02:52:39PM +0530, Laxman Dewangan wrote: >> Spi starts transfer using dma with DMA_CTRL_ACK which is not require >> becasue spi driver does not use completed dma_desc after transfer >> done and so it does not ack the dma descriptor. Removing the >> DMA_CTRL_ACK flag to avoid memory leak in dma driver. > Applied, thanks. Mark, There was bug in dma driver about handling of DMA_CTRL_ACK flag which we fixed after Stephen pointed out. This change is no more require. Can you please drop this patch? Let me know if I need to send the revert patch. Sorry for inconvenience. Thanks, Laxan ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-04-03 17:36 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-11-23 9:22 [PATCH] spi: tegra: slink: do not prepare dma transfer with DMA_CTRL_ACK flag Laxman Dewangan [not found] ` <1353662559-26515-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2012-11-26 22:03 ` Stephen Warren [not found] ` <50B3E72B.6020003-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> 2012-11-26 23:00 ` Laxman Dewangan 2013-04-01 13:35 ` Mark Brown [not found] ` <20130401133459.GS18636-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> 2013-04-03 9:31 ` Laxman Dewangan [not found] ` <515BF6ED.2060904-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> 2013-04-03 17:36 ` Mark Brown 2013-04-03 9:31 ` Laxman Dewangan
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).