Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1259519
| From | Lars-Peter Clausen <lars@metafoo.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/4] dmaengine: Add transfer termination synchronization support |
| Date | 2015-10-30 15:20 +0100 |
| Message-ID | <qpiH8-6Pg-9@gated-at.bofh.it> (permalink) |
| References | <qlBIm-8jI-3@gated-at.bofh.it> <qlBIn-8jI-27@gated-at.bofh.it> <qp3yp-5XB-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 10/29/2015 10:59 PM, Andy Shevchenko wrote:
> On Tue, Oct 20, 2015 at 12:46 PM, Lars-Peter Clausen <lars@metafoo.de> wrote:
>> The DMAengine API has a long standing race condition that is inherent to
>> the API itself. Calling dmaengine_terminate_all() is supposed to stop and
>> abort any pending or active transfers that have previously been submitted.
>> Unfortunately it is possible that this operation races against a currently
>> running (or with some drivers also scheduled) completion callback.
>
> []
>
>> +/**
>> + * dmaengine_terminate_sync() - Terminate all active DMA transfers
>> + * @chan: The channel for which to terminate the transfers
>> + *
>> + * Calling this function will terminate all active and pending transfers
>> + * that have previously been submitted to the channel. It is similar to
>> + * dmaengine_terminate_async() but guarantees that the DMA transfer has actually
>> + * stopped and that all complete callbacks have finished running when the
>> + * function returns.
>> + *
>> + * This function must only be called from non-atomic context and must not be
>> + * called from within a complete callback of a descriptor submitted on the same
>> + * channel.
>> + */
>> +static inline int dmaengine_terminate_sync(struct dma_chan *chan)
>> +{
>> + int ret;
>
> Might be a good idea to add might_sleep(); here.
Sound like a good idea, thanks, I'll add it (in dmaengine_synchronize() though).
>
>> +
>> + ret = dmaengine_terminate_async(chan);
>> + if (ret)
>> + return ret;
>> +
>> + dmaengine_synchronize(chan);
>> +
>> + return 0;
>> +}
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] dmaengine: Add transfer termination synchronization support Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
[PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Takashi Iwai <tiwai@suse.de> - 2015-10-20 13:20 +0200
Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 13:50 +0200
Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Takashi Iwai <tiwai@suse.de> - 2015-10-20 14:40 +0200
Re: [PATCH 4/4] ALSA: pcm_dmaengine: Properly synchronize DMA on shutdown Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 15:10 +0200
[PATCH 2/4] dmaengine: virt-dma: Add synchronization helper function Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
[PATCH 1/4] dmaengine: Add transfer termination synchronization support Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
Re: [PATCH 1/4] dmaengine: Add transfer termination synchronization support Andy Shevchenko <andy.shevchenko@gmail.com> - 2015-10-29 23:10 +0100
Re: [PATCH 1/4] dmaengine: Add transfer termination synchronization support Lars-Peter Clausen <lars@metafoo.de> - 2015-10-30 15:20 +0100
[PATCH 3/4] dmaengine: axi_dmac: Add synchronization support Lars-Peter Clausen <lars@metafoo.de> - 2015-10-20 11:50 +0200
Re: [PATCH 0/4] dmaengine: Add transfer termination synchronization support Vinod Koul <vinod.koul@intel.com> - 2015-10-29 02:30 +0100
csiph-web