alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Alan Young <Alan.Young@IEE.org>
To: alsa-devel@alsa-project.org
Subject: Locking/mutex for snd_pcm_update_hw_ptr0() call
Date: Mon, 7 Nov 2016 12:53:08 +0000	[thread overview]
Message-ID: <58207934.8080006@IEE.org> (raw)

As far as I can see, snd_pcm_update_hw_ptr0() is a critical section of 
code that is protected by some form of mutex in all its call paths:

     snd_pcm_period_elapsed() - snd_pcm_stream_lock_irqsave()

     snd_pcm_update_hw_ptr()

         snd_pcm_lib_ioctl_reset() - snd_pcm_stream_lock_irqsave()

         snd_pcm_lib_write1() - snd_pcm_stream_lock_irq()

         snd_pcm_lib_read1() - snd_pcm_stream_lock_irq()

         snd_pcm_status() - snd_pcm_stream_lock_irq()

         snd_pcm_do_pause - I think via the locking in snd_pcm_action()

         snd_pcm_playback_rewind() - snd_pcm_stream_lock_irq()

         snd_pcm_capture_rewind() - snd_pcm_stream_lock_irq()

         snd_pcm_playback_forward() - snd_pcm_stream_lock_irq()

         snd_pcm_capture_forward() - snd_pcm_stream_lock_irq()

         snd_pcm_hwsync() - snd_pcm_stream_lock_irq()

         snd_pcm_delay() - snd_pcm_stream_lock_irq()



However, I am not familiar with how kernel locking mechanisms work. It 
is possible that the DMA interrupt handler (snd_pcm_period_elapsed()), 
could call snd_pcm_update_hw_ptr0() while it is part way through a call 
from snd_pcm_status(), or vice versa?

Alan.

             reply	other threads:[~2016-11-07 12:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 12:53 Alan Young [this message]
2016-11-07 14:15 ` Locking/mutex for snd_pcm_update_hw_ptr0() call Clemens Ladisch
2016-11-07 14:56   ` Alan Young
2016-11-07 15:40     ` Clemens Ladisch

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=58207934.8080006@IEE.org \
    --to=alan.young@iee.org \
    --cc=alsa-devel@alsa-project.org \
    /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;
as well as URLs for NNTP newsgroup(s).