From: Vinod Koul <vinod.koul@intel.com>
To: Sinan Kaya <okaya@codeaurora.org>
Cc: dmaengine@vger.kernel.org, timur@codeaurora.org,
Christopher Covington <cov@codeaurora.org>,
linux-arm-msm@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback
Date: Mon, 8 Aug 2016 14:21:55 +0530 [thread overview]
Message-ID: <20160808085155.GX9681@localhost> (raw)
In-Reply-To: <71a15611-645f-7523-1c26-14b420aff667@codeaurora.org>
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 integrity as well, which
> > dmaengine can't provide.
>
> Thanks for describing this. I was confused about DMA_SUCCESS and DMA_COMPLETE.
> I now understand that tx_success API just returns information that the request
> was executed whether the result is error or not. This makes sense now.
>
> However, if the txn is failure; then we should never call the client callback
> since DMA engine cannot provide such feedback to the client without Dave's patch.
> You are saying that the calling the callback is optional.
Yes callback is optional, *BUT* not for driver. If a user has set a
callback, you _have_ to invoke it. That is the expectation from user and
you cannot selectively choose!
When I say callback is optional, it means only from caller PoV, not from
dmanegine driver. Caller may not have set it!
> Then, the callback cannot be optional in the error case for old behavior.
>
> How does the client know if memcpy executed or not? The client got its callback
> and tx_status is also DMA_COMPLETE.
So cookie status should be checked after callback. We can also report
DMA_ERROR if you can detect one. Some hardware can do that (not very
common though), but even if you report DMA_COMPLETE, that never implies
success for transaction.
> Is the client supposed to do a memcmp ? (BTW, it doesn't make sense).
If someone really want to check data, then yes. But I don't really see
the point in that. Users would anyone complain the bad data and you fix
the bug :)
>
>
> >> In my opinion, the new behavior is correct. Calling dma_cookie_complete(desc) all the time
> >> > is not. Do you agree?
> >> >
> >> > If yes, I can divide this patch into two. One to correct the ordering. Another one
> >> > for behavioral change.
> > See above..
> >
> > A callback or tx_status will only tell you the txn is completed. That is
> > why we have DMA_COMPLETE and not DMA_SUCCESS.
> >
>
> Still calling the callback and returning DMA_COMPLETE isn't right. There is no indication
> of an actual DMA error. The transaction is complete but data integrity failed.
Yes that is the idea..
You are telling client, a transaction has been completed from controller
side. Is the data transfer and integrity is guaranteed, we cannot know..
Data integrity is a function of many other factors, some of which are
not in control of dmaengine. So it cannot guarantee success.
Even the controllers which can report errors, can do that only from
dmaengine PoV, not really from system PoV.
>
> > So current order seems fine to me!
>
> I posted v2 of this patch without introducing the behavior change leaving the behavior discussion
> out for another patch. The current code will not call the callback if error was observed.
That's not right, as explained above.
> 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
> to race condition.
Hmmm, if you have txn's pending and client wants to free up, shouldn't
the pending txn's be cleaned up? Sound like a different bug to me..
So if I submit 5 txn's and now want to freeup, will you still leak
descriptors? Doesn't sound as right behaviour to me.
> I'll refactor the code after Dave's change for passing the error code while calling the
> callback. That will be a different patch anyhow.
Yes the error reporting is different
--
~Vinod
next prev parent reply other threads:[~2016-08-08 8:44 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 2:57 [PATCH] dmaengine: qcom_hidma: release the descriptor before the callback Sinan Kaya
2016-07-16 1:00 ` Sinan Kaya
2016-07-24 6:24 ` Vinod Koul
2016-07-25 14:19 ` Sinan Kaya
2016-08-04 12:55 ` Vinod Koul
2016-08-04 14:17 ` Sinan Kaya
2016-08-04 14:40 ` Russell King - ARM Linux
2016-08-04 15:27 ` Sinan Kaya
2016-08-04 15:38 ` Russell King - ARM Linux
2016-08-04 15:59 ` Lars-Peter Clausen
2016-08-08 9:08 ` Vinod Koul
2016-08-08 12:25 ` Lars-Peter Clausen
2016-08-10 17:23 ` Vinod Koul
2016-08-04 16:08 ` Sinan Kaya
2016-08-04 16:15 ` Lars-Peter Clausen
2016-08-05 6:32 ` Robert Jarzmik
2016-08-05 8:34 ` Lars-Peter Clausen
2016-08-05 15:17 ` Sinan Kaya
2016-08-08 9:02 ` Vinod Koul
2016-08-08 14:45 ` Sinan Kaya
2016-08-10 17:28 ` Vinod Koul
2016-08-10 17:31 ` Sinan Kaya
2016-08-19 2:48 ` Vinod Koul
2016-08-19 3:26 ` Sinan Kaya
2016-08-19 3:42 ` Vinod Koul
2016-08-19 3:48 ` Sinan Kaya
2016-08-19 5:52 ` Vinod Koul
2016-08-19 11:13 ` okaya
2016-08-19 17:02 ` Vinod Koul
2016-08-19 17:21 ` Sinan Kaya
2016-08-22 6:08 ` Vinod Koul
2016-08-22 13:27 ` Sinan Kaya
2016-08-22 17:00 ` Vinod Koul
2016-08-08 8:51 ` Vinod Koul [this message]
2016-08-08 12:10 ` okaya
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=20160808085155.GX9681@localhost \
--to=vinod.koul@intel.com \
--cc=cov@codeaurora.org \
--cc=dmaengine@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=okaya@codeaurora.org \
--cc=timur@codeaurora.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;
as well as URLs for NNTP newsgroup(s).