All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Vinod Koul <vinod.koul@intel.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"tiwai@suse.de" <tiwai@suse.de>,
	"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	Qiao Zhou <zhouqiao@marvell.com>, Mark Brown <broonie@kernel.org>,
	"zhangfei.gao@gmail.com" <zhangfei.gao@gmail.com>,
	"trinity.qiao.zhou@gmail.com" <trinity.qiao.zhou@gmail.com>,
	Chao Xie <cxie4@marvell.com>
Subject: Re: async between dmaengine_pcm_dma_complete and snd_pcm_release
Date: Thu, 10 Oct 2013 09:46:34 +0200	[thread overview]
Message-ID: <52565B5A.9020504@metafoo.de> (raw)
In-Reply-To: <20131010025408.GV2954@intel.com>

[...]
> 
>>>> On the other hand that last part could get tricky as the
>>>> dmaengine_terminate_all() might be call from within the callback.
>>> It's tricky indeed in case xrun happens. we should avoid possible deadlock.
>>
>> I think we'll eventually need to versions of dmaengine_terminate_all(). A
>> sync version which makes sure that the tasklet has finished and a non-sync
>> version that only makes sure that no new callbacks are started. I think the
>> sync version should be the default with an optional async version which must
>> be used, if it can run from within the callback. So we'd call the async
>> version in the pcm_trigger callback and the sync version in the pcm_close
>> callback.
> Yes this can be done. We can name this disable_callback cmd. The cmd will tell
> dma driver to disable all callback on the channel. This can be invoked from the
> TRIGEGR_STOP and then terminate_all in the free
> 

I think we should make it the default behavior of dmaengine_terminate_all()
to wait for the tasklet to finish. Since this is what almost always want,
except in this case where you might end up calling dmaeinge_terminate_all()
from within the callback. Internally this can be implemented as two separate
commands. So leave the DMA_TERMINATE_ALL as it is and add a new
DMA_SYNC_CALLBACKS (or whatever it will be named) command. This command will
internally call tasklet_kill(). Then we have two new functions
dmaengine_terminate_all_async() which will just issue the DMA_TERMINATE_ALL
command, the other function is dmaengine_sync_callbacks() which will issue
the DMA_SYNC_CALLBACKS command. dmaengine_terminate_all() will then first
call dmaengine_terminate_all_async() and then dmaengine_sync_callbacks().
The ALSA code would have to be updated first to call
dmaengine_terminate_all_async() for TRIGGER_STOP and
dmaengine_sync_callbacks() on the pcm_close path.

- Lars

  parent reply	other threads:[~2013-10-10  7:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-09  7:29 async between dmaengine_pcm_dma_complete and snd_pcm_release Qiao Zhou
2013-10-09  8:19 ` Lars-Peter Clausen
2013-10-09  8:30   ` Lars-Peter Clausen
2013-10-09 10:23     ` Qiao Zhou
2013-10-09 11:00       ` Lars-Peter Clausen
2013-10-10  1:05         ` Qiao Zhou
2013-10-10  2:56           ` Vinod Koul
2013-10-10  5:54             ` Qiao Zhou
2013-10-10  2:54         ` Vinod Koul
2013-10-10  5:50           ` Qiao Zhou
2013-10-10 15:47             ` Vinod Koul
2013-11-05  8:55               ` Qiao Zhou
2013-10-10  7:46           ` Lars-Peter Clausen [this message]
2013-10-10 16:10             ` Vinod Koul
2013-10-10 17:53               ` Lars-Peter Clausen
2013-10-13 15:24                 ` Vinod Koul
2013-10-13 16:57                   ` Lars-Peter Clausen
2013-10-09 10:53     ` Takashi Iwai
2013-10-10  1:08       ` Qiao Zhou

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=52565B5A.9020504@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cxie4@marvell.com \
    --cc=lgirdwood@gmail.com \
    --cc=tiwai@suse.de \
    --cc=trinity.qiao.zhou@gmail.com \
    --cc=vinod.koul@intel.com \
    --cc=zhangfei.gao@gmail.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.