All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Vinod Koul <vinod.koul@intel.com>, Takashi Iwai <tiwai@suse.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Laurent Pinchart <renesas@ideasonboard.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Qiao Zhou <zhouqiao@marvell.com>,
	Shengjiu Wang <shengjiu.wang@freescale.com>,
	Matt Campbell <mcampbell@izotope.com>,
	Jonah Petri <jpetri@izotope.com>,
	dmaengine@vger.kernel.org, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 0/4] dmaengine: Add transfer termination synchronization support
Date: Tue, 20 Oct 2015 11:46:27 +0200	[thread overview]
Message-ID: <1445334391-12272-1-git-send-email-lars@metafoo.de> (raw)

The DMAengine API has a long standing issue that is inherent to the API
itself. For a client that calls dmaengine_terminate_all() it is not
possible to properly synchronize the completion of any currently running
complete callbacks to the current context. This means it is possible to end
up with a use-after-free race condition if client frees resources that are
accessed in a complete callback before the complete callback has finished
running.

This patch series introduces a new explicit synchronization primitive to
the DMAengine API which allows clients to ensure that all complete
callbacks have finished running. This allows them to safely free any
resources that might be accessed in a complete callback.

The series for now only implements synchronization support for a single
driver and only updates single client to make use of the new API. If there
is agreement on the general approach more will follow.

- Lars

Lars-Peter Clausen (4):
  dmaengine: Add transfer termination synchronization support
  dmaengine: virt-dma: Add synchronization helper function
  dmaengine: axi_dmac: Add synchronization support
  ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown

 Documentation/dmaengine/client.txt   | 38 ++++++++++++++-
 Documentation/dmaengine/provider.txt | 20 +++++++-
 drivers/dma/dma-axi-dmac.c           |  8 ++++
 drivers/dma/dmaengine.c              |  5 +-
 drivers/dma/virt-dma.h               | 13 ++++++
 include/linux/dmaengine.h            | 90 ++++++++++++++++++++++++++++++++++++
 sound/core/pcm_dmaengine.c           |  9 ++--
 7 files changed, 175 insertions(+), 8 deletions(-)

-- 
2.1.4


             reply	other threads:[~2015-10-20  9:46 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20  9:46 Lars-Peter Clausen [this message]
2015-10-20  9:46 ` [PATCH 1/4] dmaengine: Add transfer termination synchronization support Lars-Peter Clausen
2015-10-20  9:46   ` Lars-Peter Clausen
2015-10-29 21:59   ` Andy Shevchenko
2015-10-29 21:59     ` Andy Shevchenko
2015-10-30 14:16     ` Lars-Peter Clausen
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:17     ` Takashi Iwai
2015-10-20 11:40     ` Lars-Peter Clausen
2015-10-20 11:40       ` Lars-Peter Clausen
2015-10-20 12:36       ` Takashi Iwai
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=1445334391-12272-1-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.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=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=tiwai@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.