pcm|dmaengine|imx-sdma race condition on i.MX6

Benjamin Bara - SKIDATA Benjamin.Bara at skidata.com
Wed Aug 19 16:15:17 CEST 2020


> -----Original Message-----
> From: Lars-Peter Clausen <lars at metafoo.de>
> Sent: Mittwoch, 19. August 2020 13:08
> I think this might be an sdma specific problem after all.
> dmaengine_terminate_async() will issue a request to stop the DMA. But it
> is still safe to issue the next transfer, even without calling
> dmaengine_synchronize(). The DMA should start the new transfer at its
> earliest convenience in that case.
>
> dmaegine_synchronize() is so that the consumer has a guarantee that the
> DMA is finished using the resources (e.g. the memory buffers) associated
> with the DMA transfer so it can safely free them.

Thank you for the clarifications!

> I don't know how feasible this is to implement in the SDMA dmaengine
> driver. But I think what is should do is to have some flag to indicate
> if a terminate is in progress. If a new transfer is issued while
> terminate is in progress the transfer should go on a list. Once
> terminate finishes it should check the list and start the transfer if
> there are any on the list.

IMHO that's nearly what Robin's patches do, so it should be sufficient to
put the descriptors to free in an extra termination list and ensure
that a new transfer is handled after the last termination is done.


@Robin:
Is it possible to tag the commits for the stable-tree
Cc: stable at vger.kernel.org?

Best regards and thank you!
Benjamin
Richard



More information about the Alsa-devel mailing list