On 07/10/2015 01:40 PM, Jun Nie wrote:
2015-07-10 19:36 GMT+08:00 Lars-Peter Clausen <lars@xxxxxxxxxx>:
On 07/10/2015 01:32 PM, Lars-Peter Clausen wrote:
On 07/10/2015 12:51 PM, Jun Nie wrote:
Free descriptor when free chan resource as some device,
such as soc soc-generic-dmaengine-pcm.c in audio side,
may not release channel. This cause too much memory is
cached for descriptor is not released.
[...]
@@ -98,13 +98,10 @@ void vchan_dma_desc_free_list(struct virt_dma_chan
*vc, struct list_head *head)
while (!list_empty(head)) {
struct virt_dma_desc *vd = list_first_entry(head,
struct virt_dma_desc, node);
- if (async_tx_test_ack(&vd->tx)) {
- list_move_tail(&vd->node, &vc->desc_allocated);
- } else {
- dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
- list_del(&vd->node);
- vc->desc_free(vd);
- }
+ list_move_tail(&vd->node, &vc->desc_allocated);
+ dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
+ list_del(&vd->node);
+ vc->desc_free(vd);
This is basically a revert of b9855f03d560 ("dmaengine: virt-dma: don't
always free descriptor upon completion"). Which was just introduced, so
this
is probably not what you want.
Furthermore audio DMA uses cyclic DMA, so it doesn't even hit this code
path, so the patch description doesn't really add up to the changes.
Sorry, it does. Looked at the wrong line. Reverting b9855f03d560 is probably
the right thing to do as it breaks the existing semantics in a very bad way
causing descriptors to be not freed when they should be.
I guess my change does not meet video requirement for patch
b9855f03d560, but I do not know detail video usage case related to
that patch. You can either revert the patch or confirm change in this
email is OK for the video case.
To handle the video case something else is needed. The current dmaengine
semantics are that once a descriptor is passed to dma_engine_submit() it is
owned by the DMAengine driver and the client must never ever touch it again.
Commit b9855f03d560 overloaded DMA_CTRL_ACK to mean that the should be
re-usable by the client. But this breaks existing users of DMA_CTRL_ACK
since its a completely new and different meaning to the existing one. For
marking a descriptor as reusable for the client a new flag should probably
be introduced.
- Lars
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html