From: Jeremy Hall <jhall@maoz.com>
To: Jaroslav Kysela <perex@suse.cz>
Cc: Jeremy Hall <jhall@maoz.com>,
"paul@linuxaudiosystems.com" <paul@linuxaudiosystems.com>,
"alsa-devel@lists.sourceforge.net"
<alsa-devel@lists.sourceforge.net>
Subject: Re: rme9652: possible deadlock
Date: Tue, 22 Apr 2003 18:04:01 -0400 (EDT) [thread overview]
Message-ID: <200304222204.h3MM41Mb026010@sith.maoz.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0304222136461.1351-100000@pnote.perex-int.cz> from Jaroslav Kysela at "Apr 22, 2003 09:42:52 pm"
If both cards try to run snd_pcm_stop() at the same time, one on one CPU
one on the other, how can disabling local interrupts help? The code takes
great care to not try to acquire its own substream->runtime->lock because
the calling process has already acquired this lock. But if both are
trying to run snd_pcm_stop at the same time, CPU0 will try to acquire
CPU1's lock, and CPU1 will try to acquire CPU0's. Since neither will give
up his lock, deadlock will occur.
Since the only solution I can see at the moment is to only allow one card
to process at a time, I find that repulsive and therefore would like to
see a different solution.
Therefore I would like to see a mechanism brought down through the calling
hierarchy so that alsa knows that all four substreams are linked and
therefore should only be governed by a single lock and further more that
if one card XRUNs and the other doesn't, the offensive card should put
silence in his buffer to maintain sample-sync.
Both cards are indeed running from the same clock, but sometimes we can't
get around to servicing an interrupt so we XRUN--things are going too fast
for even the slightest gitter.
Consider the case where left channel data is on one card, right is on the
other. If sample-synch is broekn, the channels will drift out of phase,
permanently, and the application has no idea it has happened. I think a
better solution than pot luck needs to happen, although it may indeed be
happening--I just don't understand the alsa code very well. In a
professional environment, a XRUN isn't a good thing, but a partial XRUN is
a desaster.
Please understand I am not upset at you, I am not upset at all, I simply
want to make my views known and to let you know this is something I feel
quite strongly about.
_J
In the new year, Jaroslav Kysela wrote:
> On Tue, 22 Apr 2003, Jeremy Hall wrote:
>
> > I wrote up a fix in the rme9652 code that fixes this and allows both cards
> > to run, preferrably one on one cpu and one on the other. The only
> > remaining corner case is if both cards try to run snd_pcm_stop() at the
> > exact same time. This still doesn't work if you disable interrupts on the
> > local CPU and it is not acceptable for me to have to lock a spin_lock and
> > serialize the cards, allowing only one to run at a time. In theory if you
>
> Sorry, but spinlocking of the arbiter code in interrupt has nothing to do
> with the sample DMA transfers thus stream throughput. The streaming is not
> stopped with disabling interrupts for local CPU.
>
> Jaroslav
>
> -----
> Jaroslav Kysela <perex@suse.cz>
> Linux Kernel Sound Maintainer
> ALSA Project, SuSE Labs
>
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
next prev parent reply other threads:[~2003-04-22 22:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-14 18:47 rme9652: possible deadlock Jeremy Hall
2003-04-22 14:16 ` Jaroslav Kysela
2003-04-22 19:22 ` Jeremy Hall
2003-04-22 19:42 ` Jaroslav Kysela
2003-04-22 22:04 ` Jeremy Hall [this message]
2003-04-23 9:51 ` Jaroslav Kysela
2003-04-23 15:06 ` Jeremy Hall
2003-04-23 19:19 ` Jaroslav Kysela
2003-04-24 10:03 ` Abramo Bagnara
2003-04-28 8:23 ` Jeremy Hall
2003-04-28 8:58 ` Abramo Bagnara
2003-04-28 9:58 ` Jaroslav Kysela
2003-04-28 10:11 ` Abramo Bagnara
2003-04-28 12:27 ` Jaroslav Kysela
2003-04-28 12:47 ` Abramo Bagnara
2003-04-28 18:16 ` Jaroslav Kysela
2003-04-28 19:15 ` Abramo Bagnara
2003-04-28 8:25 ` Jeremy Hall
2003-04-28 8:44 ` Jeremy Hall
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=200304222204.h3MM41Mb026010@sith.maoz.com \
--to=jhall@maoz.com \
--cc=alsa-devel@lists.sourceforge.net \
--cc=paul@linuxaudiosystems.com \
--cc=perex@suse.cz \
/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.