Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Vinod Koul <vinod.koul@intel.com>,
	alsa-devel@alsa-project.org,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Shengjiu Wang <shengjiu.wang@freescale.com>,
	Laurent Pinchart <renesas@ideasonboard.com>,
	Dan Williams <dan.j.williams@intel.com>,
	Jonah Petri <jpetri@izotope.com>,
	Matt Campbell <mcampbell@izotope.com>,
	Qiao Zhou <zhouqiao@marvell.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown
Date: Tue, 20 Oct 2015 14:36:21 +0200	[thread overview]
Message-ID: <s5hy4exemyi.wl-tiwai@suse.de> (raw)
In-Reply-To: <56262810.3040201@metafoo.de>

On Tue, 20 Oct 2015 13:40:00 +0200,
Lars-Peter Clausen wrote:
> 
> On 10/20/2015 01:17 PM, Takashi Iwai wrote:
> > On Tue, 20 Oct 2015 11:46:31 +0200,
> > Lars-Peter Clausen wrote:
> >>
> >> Use the new dmaengine_synchronize() function to make sure that all complete
> >> callbacks have finished running before the runtime data, which is accessed
> >> in the completed callback, is freed.
> >>
> >> This fixes a long standing use-after-free race condition that has been
> >> observed on some systems.
> > 
> > What if a substream is restarted immediately after the stop?
> > 
> 
> What can happen is that you get a complete callback and the associated
> snd_pcm_period_elapsed() too early, before the period has actually elapsed,
> but I don't think that this is a problem if the DMA driver properly
> implements residue reporting.
> 
> This fails if we rely on period counting, but that is broken anyway and
> already prone to other race conditions.
> 
> I've tested this series with xrun injection and some modifications to the
> DMA driver to always trigger the race condition when the stream is stopped.
> And I've not seen any issues after the transfer re-started. (There is a
> dead-lock condition though but that does not seem to be related to this series)

OK, then I'm fine with the changes.

I suppose this will go through dmaengine tree?  If so, feel free to
take my ack:
  Reviewed-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi

  reply	other threads:[~2015-10-20 12:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  9:46 [PATCH 0/4] dmaengine: Add transfer termination synchronization support Lars-Peter Clausen
2015-10-20  9:46 ` [PATCH 1/4] " Lars-Peter Clausen
2015-10-29 21:59   ` Andy Shevchenko
2015-10-30 14:16     ` Lars-Peter Clausen
2015-10-20  9:46 ` [PATCH 2/4] dmaengine: virt-dma: Add synchronization helper function Lars-Peter Clausen
2015-10-20  9:46 ` [PATCH 3/4] dmaengine: axi_dmac: Add synchronization support Lars-Peter Clausen
2015-10-20  9:46 ` [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Lars-Peter Clausen
2015-10-20 11:17   ` Takashi Iwai
2015-10-20 11:40     ` Lars-Peter Clausen
2015-10-20 12:36       ` Takashi Iwai [this message]
2015-10-20 13:01       ` Lars-Peter Clausen
2015-10-29  1:26 ` [PATCH 0/4] dmaengine: Add transfer termination synchronization support Vinod Koul

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=s5hy4exemyi.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=jpetri@izotope.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcampbell@izotope.com \
    --cc=renesas@ideasonboard.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=shengjiu.wang@freescale.com \
    --cc=vinod.koul@intel.com \
    --cc=zhouqiao@marvell.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