Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-22 Thread Vinod Koul
On Mon, Aug 22, 2016 at 09:27:04AM -0400, Sinan Kaya wrote: > > You didn't answer my question! > > > > On error you said you flush, so who does that? > > This is done by the driver in interrupt context when an error > interrupt is received. All transactions are posted and

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-22 Thread Sinan Kaya
On 8/22/2016 2:08 AM, Vinod Koul wrote: > On Fri, Aug 19, 2016 at 01:21:34PM -0400, Sinan Kaya wrote: >> On 8/19/2016 1:02 PM, Vinod Koul wrote: >>> On Fri, Aug 19, 2016 at 07:13:43AM -0400, ok...@codeaurora.org wrote: On 2016-08-19 01:52, Vinod Koul wrote: > On Thu, Aug 18, 2016 at 11:48:

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-21 Thread Vinod Koul
On Fri, Aug 19, 2016 at 01:21:34PM -0400, Sinan Kaya wrote: > On 8/19/2016 1:02 PM, Vinod Koul wrote: > > On Fri, Aug 19, 2016 at 07:13:43AM -0400, ok...@codeaurora.org wrote: > >> On 2016-08-19 01:52, Vinod Koul wrote: > >>> On Thu, Aug 18, 2016 at 11:48:52PM -0400, Sinan Kaya wrote: > On 8/1

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-19 Thread Sinan Kaya
On 8/19/2016 1:02 PM, Vinod Koul wrote: > On Fri, Aug 19, 2016 at 07:13:43AM -0400, ok...@codeaurora.org wrote: >> On 2016-08-19 01:52, Vinod Koul wrote: >>> On Thu, Aug 18, 2016 at 11:48:52PM -0400, Sinan Kaya wrote: On 8/18/2016 11:42 PM, Vinod Koul wrote: > On Thu, Aug 18, 2016 at 11:26

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-19 Thread Vinod Koul
On Fri, Aug 19, 2016 at 07:13:43AM -0400, ok...@codeaurora.org wrote: > On 2016-08-19 01:52, Vinod Koul wrote: > >On Thu, Aug 18, 2016 at 11:48:52PM -0400, Sinan Kaya wrote: > >>On 8/18/2016 11:42 PM, Vinod Koul wrote: > >>> On Thu, Aug 18, 2016 at 11:26:28PM -0400, Sinan Kaya wrote: > On 8/18

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-19 Thread okaya
On 2016-08-19 01:52, Vinod Koul wrote: On Thu, Aug 18, 2016 at 11:48:52PM -0400, Sinan Kaya wrote: On 8/18/2016 11:42 PM, Vinod Koul wrote: > On Thu, Aug 18, 2016 at 11:26:28PM -0400, Sinan Kaya wrote: >> On 8/18/2016 10:48 PM, Vinod Koul wrote: Keep a size limited list with error cookies a

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-18 Thread Vinod Koul
On Thu, Aug 18, 2016 at 11:48:52PM -0400, Sinan Kaya wrote: > On 8/18/2016 11:42 PM, Vinod Koul wrote: > > On Thu, Aug 18, 2016 at 11:26:28PM -0400, Sinan Kaya wrote: > >> On 8/18/2016 10:48 PM, Vinod Koul wrote: > Keep a size limited list with error cookies and flush them in terminate >

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-18 Thread Sinan Kaya
On 8/18/2016 11:42 PM, Vinod Koul wrote: > On Thu, Aug 18, 2016 at 11:26:28PM -0400, Sinan Kaya wrote: >> On 8/18/2016 10:48 PM, Vinod Koul wrote: Keep a size limited list with error cookies and flush them in terminate all? >>> I think so, terminate_all anyway cleans up the channel. Btw

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-18 Thread Sinan Kaya
On 8/18/2016 10:48 PM, Vinod Koul wrote: >> Keep a size limited list with error cookies and flush them in terminate all? > I think so, terminate_all anyway cleans up the channel. Btw what is the > behaviour on error? Do you terminate or somthing else? > On error, I flush all outstanding transacti

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-18 Thread Vinod Koul
On Thu, Aug 18, 2016 at 11:26:28PM -0400, Sinan Kaya wrote: > On 8/18/2016 10:48 PM, Vinod Koul wrote: > >> Keep a size limited list with error cookies and flush them in terminate > >> all? > > I think so, terminate_all anyway cleans up the channel. Btw what is the > > behaviour on error? Do you t

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-18 Thread Vinod Koul
On Wed, Aug 10, 2016 at 01:31:21PM -0400, Sinan Kaya wrote: > On 8/10/2016 1:28 PM, Vinod Koul wrote: > >> That's why, I preferred not to call the callback when I observe an error > >> which I > >> > think it makes more sense. > > That doesnt make sense. A client set a callback, it expect you t

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-10 Thread Sinan Kaya
On 8/10/2016 1:28 PM, Vinod Koul wrote: >> That's why, I preferred not to call the callback when I observe an error >> which I >> > think it makes more sense. > That doesnt make sense. A client set a callback, it expect you to call one. > The result quried maybe txn completed or error. Since you

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-10 Thread Vinod Koul
On Mon, Aug 08, 2016 at 10:45:24AM -0400, Sinan Kaya wrote: > On 8/8/2016 5:02 AM, Vinod Koul wrote: > >> What Vinod is telling me that I need to set the cookie to complete > >> > whether the transaction is successful or not if the request was accepted > >> > by HW. xyz_tx_status is just an indica

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-10 Thread Vinod Koul
On Mon, Aug 08, 2016 at 02:25:28PM +0200, Lars-Peter Clausen wrote: > On 08/08/2016 11:08 AM, Vinod Koul wrote: > > On Thu, Aug 04, 2016 at 05:59:30PM +0200, Lars-Peter Clausen wrote: > >> On 08/04/2016 05:38 PM, Russell King - ARM Linux wrote: > >> [...] > >>> What you instead need to do is to fin

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-08 Thread Sinan Kaya
On 8/8/2016 5:02 AM, Vinod Koul wrote: >> What Vinod is telling me that I need to set the cookie to complete >> > whether the transaction is successful or not if the request was accepted >> > by HW. xyz_tx_status is just an indication that the transaction was >> > accepted >> > by HW. An error ca

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-08 Thread Lars-Peter Clausen
On 08/08/2016 11:08 AM, Vinod Koul wrote: > On Thu, Aug 04, 2016 at 05:59:30PM +0200, Lars-Peter Clausen wrote: >> On 08/04/2016 05:38 PM, Russell King - ARM Linux wrote: >> [...] >>> What you instead need to do is to find some way to record in your >>> driver that transaction 2 failed, and when dm

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-08 Thread okaya
On 2016-08-08 04:51, Vinod Koul wrote: This patch is needed to fix a race condition as the commit message describes. The callback is called before returning the descriptor back to free pool. If the client calls free resources, the descriptor that was not returned to free pool gets lost due

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-08 Thread Vinod Koul
On Thu, Aug 04, 2016 at 05:59:30PM +0200, Lars-Peter Clausen wrote: > On 08/04/2016 05:38 PM, Russell King - ARM Linux wrote: > [...] > > What you instead need to do is to find some way to record in your > > driver that transaction 2 failed, and when dma_cookie_status() says > > that a transaction

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-08 Thread Vinod Koul
On Thu, Aug 04, 2016 at 11:27:46AM -0400, Sinan Kaya wrote: > On 8/4/2016 10:40 AM, Russell King - ARM Linux wrote: > > On Thu, Aug 04, 2016 at 10:17:24AM -0400, Sinan Kaya wrote: > >> On 8/4/2016 8:55 AM, Vinod Koul wrote: > >>> Dmaengine tells transaction is complete. It does not say if the txn i

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-08 Thread Vinod Koul
On Thu, Aug 04, 2016 at 10:17:24AM -0400, Sinan Kaya wrote: > On 8/4/2016 8:55 AM, Vinod Koul wrote: > > Dmaengine tells transaction is complete. It does not say if the txn is > > success or failure. It can transfer data and not say if data was > > correct. A successful transaction implies data int

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-05 Thread Sinan Kaya
On 8/5/2016 4:34 AM, Lars-Peter Clausen wrote: > I believe we need to invest some effort to come up with clear semantics on > what is the expected behavior when transferring a descriptor fails. > Potentially allowing clients to choose the desired behavior, e.g. either > abort all descriptors on err

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-05 Thread Lars-Peter Clausen
On 08/05/2016 08:32 AM, Robert Jarzmik wrote: > Lars-Peter Clausen writes: > >> On 08/04/2016 06:08 PM, Sinan Kaya wrote: >> [...] >>> The other way is I can feed this information to what Dave just introduced >>> as part of the callback mechanism and not touch this. >> >> Use the callback mechani

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Robert Jarzmik
Lars-Peter Clausen writes: > On 08/04/2016 06:08 PM, Sinan Kaya wrote: > [...] >> The other way is I can feed this information to what Dave just introduced >> as part of the callback mechanism and not touch this. > > Use the callback mechanism. It is a lot easier to implement correctly than > the

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Lars-Peter Clausen
On 08/04/2016 06:08 PM, Sinan Kaya wrote: [...] > The other way is I can feed this information to what Dave just introduced > as part of the callback mechanism and not touch this. Use the callback mechanism. It is a lot easier to implement correctly than the tx_status() mechanism. > The main disc

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Sinan Kaya
On 8/4/2016 11:38 AM, Russell King - ARM Linux wrote: > On Thu, Aug 04, 2016 at 11:27:46AM -0400, Sinan Kaya wrote: >> On 8/4/2016 10:40 AM, Russell King - ARM Linux wrote: >>> On Thu, Aug 04, 2016 at 10:17:24AM -0400, Sinan Kaya wrote: Thanks for describing this. I was confused about DMA_SUCC

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Lars-Peter Clausen
On 08/04/2016 05:38 PM, Russell King - ARM Linux wrote: [...] > What you instead need to do is to find some way to record in your > driver that transaction 2 failed, and when dma_cookie_status() says > that a transaction has DMA_COMPLETE status, you need to look up to > see whether it failed. In m

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Sinan Kaya
On 8/4/2016 10:40 AM, Russell King - ARM Linux wrote: > On Thu, Aug 04, 2016 at 10:17:24AM -0400, Sinan Kaya wrote: >> On 8/4/2016 8:55 AM, Vinod Koul wrote: >>> Dmaengine tells transaction is complete. It does not say if the txn is >>> success or failure. It can transfer data and not say if data w

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Russell King - ARM Linux
On Thu, Aug 04, 2016 at 11:27:46AM -0400, Sinan Kaya wrote: > On 8/4/2016 10:40 AM, Russell King - ARM Linux wrote: > > On Thu, Aug 04, 2016 at 10:17:24AM -0400, Sinan Kaya wrote: > >> Thanks for describing this. I was confused about DMA_SUCCESS and > >> DMA_COMPLETE. > >> I now understand that tx

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Russell King - ARM Linux
On Thu, Aug 04, 2016 at 10:17:24AM -0400, Sinan Kaya wrote: > On 8/4/2016 8:55 AM, Vinod Koul wrote: > > Dmaengine tells transaction is complete. It does not say if the txn is > > success or failure. It can transfer data and not say if data was > > correct. A successful transaction implies data int

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Sinan Kaya
On 8/4/2016 8:55 AM, Vinod Koul wrote: > Dmaengine tells transaction is complete. It does not say if the txn is > success or failure. It can transfer data and not say if data was > correct. A successful transaction implies data integrity as well, which > dmaengine can't provide. Thanks for describ

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-08-04 Thread Vinod Koul
On Mon, Jul 25, 2016 at 10:19:44AM -0400, Sinan Kaya wrote: > >> > >> It looks like I introduced a behavioral change while refactoring the code. > >> The previous one would call the callback only if the transfer was > >> successful > >> but it would always call dma_cookie_complete. > >> > >> The n

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-07-25 Thread Sinan Kaya
Hi, On 7/24/2016 2:24 AM, Vinod Koul wrote: > On Fri, Jul 15, 2016 at 09:00:52PM -0400, Sinan Kaya wrote: >> Hi Vinod, >> >> On 7/13/2016 10:57 PM, Sinan Kaya wrote: >>> There is a race condition between data transfer callback and descriptor >>> free code. The callback routine may decide to clear

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-07-23 Thread Vinod Koul
On Fri, Jul 15, 2016 at 09:00:52PM -0400, Sinan Kaya wrote: > Hi Vinod, > > On 7/13/2016 10:57 PM, Sinan Kaya wrote: > > There is a race condition between data transfer callback and descriptor > > free code. The callback routine may decide to clear the resources even > > though the descriptor has

Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback

2016-07-15 Thread Sinan Kaya
Hi Vinod, On 7/13/2016 10:57 PM, Sinan Kaya wrote: > There is a race condition between data transfer callback and descriptor > free code. The callback routine may decide to clear the resources even > though the descriptor has not yet been freed. > > Instead of calling the callback first and then