mbox series

[v3,0/3] ALSA: pcm: add snd_pcm_period_elapsed() variant without acquiring lock of PCM substream

Message ID 20210610031733.56297-1-o-takashi@sakamocchi.jp (mailing list archive)
Headers show
Series ALSA: pcm: add snd_pcm_period_elapsed() variant without acquiring lock of PCM substream | expand

Message

Takashi Sakamoto June 10, 2021, 3:17 a.m. UTC
Hi,

This patchset is revised version of my previous one:
 * https://lore.kernel.org/alsa-devel/20210609143145.146680-1-o-takashi@sakamocchi.jp/

All of drivers in ALSA firewire stack have two chances to process
isochronous packets of any isochronous context; in software IRQ context
for 1394 OHCI, and in process context of ALSA PCM application.

In the process context, callbacks of .pointer and .ack are utilized. The
callbacks are done by ALSA PCM core under acquiring lock of PCM substream,

In design of ALSA PCM core, call of snd_pcm_period_elapsed() is used for
drivers to awaken user processes from waiting for available frames. The
function voluntarily acquires lock of PCM substream, therefore it is not
called in the process context since it causes dead lock. As a workaround
to avoid the dead lock, all of drivers in ALSA firewire stack use workqueue
to delegate the call.

This patchset is my attempt for the issue. A variant of 
'snd_pcm_period_elapsed()' without lock acquisition is going to be added,
named 'snd_pcm_period_elapsed_under_stream_lock()'. The call is available
in callbacks of .pointer and .ack of snd_pcm_ops structure.

Changes from v2:
 * delete context section from kernel API documentation

Takashi Sakamoto (3):
  ALSA: pcm: add snd_pcm_period_elapsed() variant without acquiring lock
    of PCM substream
  ALSA: firewire-lib: operate for period elapse event in process context
  ALSA: firewire-lib: obsolete workqueue for period update

 include/sound/pcm.h           |  1 +
 sound/core/pcm_lib.c          | 64 +++++++++++++++++++++++++++--------
 sound/firewire/amdtp-stream.c | 46 ++++++++-----------------
 sound/firewire/amdtp-stream.h |  1 -
 4 files changed, 64 insertions(+), 48 deletions(-)

Comments

Takashi Iwai June 10, 2021, 7:51 a.m. UTC | #1
On Thu, 10 Jun 2021 05:17:30 +0200,
Takashi Sakamoto wrote:
> 
> Hi,
> 
> This patchset is revised version of my previous one:
>  * https://lore.kernel.org/alsa-devel/20210609143145.146680-1-o-takashi@sakamocchi.jp/
> 
> All of drivers in ALSA firewire stack have two chances to process
> isochronous packets of any isochronous context; in software IRQ context
> for 1394 OHCI, and in process context of ALSA PCM application.
> 
> In the process context, callbacks of .pointer and .ack are utilized. The
> callbacks are done by ALSA PCM core under acquiring lock of PCM substream,
> 
> In design of ALSA PCM core, call of snd_pcm_period_elapsed() is used for
> drivers to awaken user processes from waiting for available frames. The
> function voluntarily acquires lock of PCM substream, therefore it is not
> called in the process context since it causes dead lock. As a workaround
> to avoid the dead lock, all of drivers in ALSA firewire stack use workqueue
> to delegate the call.
> 
> This patchset is my attempt for the issue. A variant of 
> 'snd_pcm_period_elapsed()' without lock acquisition is going to be added,
> named 'snd_pcm_period_elapsed_under_stream_lock()'. The call is available
> in callbacks of .pointer and .ack of snd_pcm_ops structure.
> 
> Changes from v2:
>  * delete context section from kernel API documentation
> 
> Takashi Sakamoto (3):
>   ALSA: pcm: add snd_pcm_period_elapsed() variant without acquiring lock
>     of PCM substream
>   ALSA: firewire-lib: operate for period elapse event in process context
>   ALSA: firewire-lib: obsolete workqueue for period update

Applied all three patches now.  Thanks.


Takashi