From: Vinod Koul <vinod.koul@intel.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Dan Williams <djbw@fb.com>,
Jassi Brar <jaswinder.singh@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH resend] dma: pl330: Fix handling of TERMINATE_ALL while processing completed descriptors
Date: Wed, 28 Aug 2013 11:27:38 +0530 [thread overview]
Message-ID: <20130828055738.GB11414@intel.com> (raw)
In-Reply-To: <1377628445-16231-1-git-send-email-lars@metafoo.de>
On Tue, Aug 27, 2013 at 08:34:05PM +0200, Lars-Peter Clausen wrote:
> The pl330 DMA driver is broken in regard to handling a terminate all request
> while it is processing the list of completed descriptors. This is most visible
> when calling dmaengine_terminate_all() from within the descriptors callback for
> cyclic transfers. In this case the TERMINATE_ALL transfer will clear the
> work_list and stop the transfer. But after all callbacks for all completed
> descriptors have been handled the descriptors will be re-enqueued into the (now
> empty) work_list. So the next time dma_async_issue_pending() is called for the
> channel these descriptors will be transferred again which will cause data
> corruption. Similar issues can occur if dmaengine_terminate_all() is not called
> from within the descriptor callback but runs on a different CPU at the same time
> as the completed descriptor list is processed.
>
> This patch introduces a new per channel list which will hold the completed
> descriptors. While processing the list the channel's lock will be held to avoid
> racing against dmaengine_terminate_all(). The lock will be released when calling
> the descriptors callback though. Since the list of completed descriptors might
> be modified (e.g. by calling dmaengine_terminate_all() from the callback) we can
> not use the normal list iterator macros. Instead we'll need to check for each
> loop iteration again if there are still items in the list. The drivers
> TERMINATE_ALL implementation is updated to move descriptors from both the
> work_list as well the new completed_list back to the descriptor pool. This makes
> sure that none of the descripts finds its way back into the work list and also
> that we do not call any futher complete callbacks after
> dmaengine_terminate_all() has been called.
Applied, thanks
~Vinod
prev parent reply other threads:[~2013-08-28 6:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-27 18:34 Lars-Peter Clausen
2013-08-28 5:57 ` Vinod Koul [this message]
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=20130828055738.GB11414@intel.com \
--to=vinod.koul@intel.com \
--cc=djbw@fb.com \
--cc=jaswinder.singh@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®