public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Benjamin Bara - SKIDATA <Benjamin.Bara@skidata.com>
To: Lars-Peter Clausen <lars@metafoo.de>, Robin Gong <yibin.gong@nxp.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"timur@kernel.org" <timur@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"nicoleotsuka@gmail.com" <nicoleotsuka@gmail.com>,
	"vkoul@kernel.org" <vkoul@kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>,
	"kernel@pengutronix.de" <kernel@pengutronix.de>,
	"dmaengine@vger.kernel.org" <dmaengine@vger.kernel.org>,
	"dan.j.williams@intel.com" <dan.j.williams@intel.com>,
	"shawnguo@kernel.org" <shawnguo@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Richard Leitner - SKIDATA <Richard.Leitner@skidata.com>
Subject: RE: pcm|dmaengine|imx-sdma race condition on i.MX6
Date: Wed, 19 Aug 2020 14:25:43 +0000	[thread overview]
Message-ID: <6b5799a567d14cfb9ce34d278a33017d@skidata.com> (raw)
In-Reply-To: <16942794-1e03-6da0-b8e5-c82332a217a5@metafoo.de>

> -----Original Message-----
> From: Lars-Peter Clausen <lars@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 does, so this should be sufficient:
Putting the descriptors to free in an extra termination list and ensuring
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@vger.kernel.org?

Best regards and thank you all!
Benjamin
Richard


  parent reply	other threads:[~2020-08-19 14:26 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-13 11:22 pcm|dmaengine|imx-sdma race condition on i.MX6 Richard Leitner
2020-08-14  8:45 ` Robin Gong
     [not found]   ` <7f98cd6d30404e4d9d621f57f45ae441@skidata.com>
2020-08-17  5:38     ` Richard Leitner
2020-08-17  7:28   ` Benjamin Bara - SKIDATA
2020-08-17  9:22     ` Robin Gong
2020-08-17 11:38       ` Benjamin Bara - SKIDATA
2020-08-18 10:41         ` Robin Gong
2020-08-19 11:08     ` Lars-Peter Clausen
2020-08-19 11:16       ` Lars-Peter Clausen
2020-08-19 14:15       ` Benjamin Bara - SKIDATA
2020-08-19 14:25       ` Benjamin Bara - SKIDATA [this message]
2020-08-20 15:01         ` Robin Gong
2020-08-21  4:34           ` Richard Leitner
2020-08-21  9:21             ` Robin Gong
2020-08-21  9:54               ` Richard Leitner
2020-08-20  6:52       ` Sascha Hauer
2020-08-21  9:52         ` Robin Gong
2020-08-25  6:12           ` Sascha Hauer

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=6b5799a567d14cfb9ce34d278a33017d@skidata.com \
    --to=benjamin.bara@skidata.com \
    --cc=Richard.Leitner@skidata.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=lars@metafoo.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nicoleotsuka@gmail.com \
    --cc=shawnguo@kernel.org \
    --cc=timur@kernel.org \
    --cc=vkoul@kernel.org \
    --cc=yibin.gong@nxp.com \
    /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