All of lore.kernel.org
 help / color / mirror / Atom feed
From: Abramo Bagnara <abramo.bagnara@libero.it>
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: Thu, 24 Apr 2003 12:03:00 +0200	[thread overview]
Message-ID: <3EA7B654.2090108@libero.it> (raw)
In-Reply-To: <Pine.LNX.4.44.0304232101560.18005-100000@pnote.perex-int.cz>

Jaroslav Kysela ha scritto:
> 
> 
> Bingo, I got it. You mean this scenario (linked two streams):
> 
> CPU0: stream1 interrupt: stream1 locked -> snd_pcm_stop()
> CPU1: stream2 interrupt: stream2 locked -> snd_pcm_stop()
> CPU0: try to lock stream2 (in ACTION macro)
> CPU1: try to lock stream1 (in ACTION macro)
> 
> Yes, this is next deadlock issue.
> 
> I have probably only one solution in my brain: Separate snd_pcm_stop() to 
> two steps:
> 
> 1) stop only the locked stream and unlock it
> 2) stop all other linked streams

My proposal is to have a per "linked PCM group" lock and to use it for 
proper locking (with also some side benefits substituting some use of 
snd_pcm_link_lock).

This mean also we need to change the linked list struct from

struct _snd_pcm_substream {
	...
         /* -- linked substreams -- */
         snd_pcm_substream_t *link_next;
         snd_pcm_substream_t *link_prev;

to
	struct list_head link_list;
	snd_pcm_link_t *link;	/* 0 for non linked stream */

typedef struct _snd_pcm_link {
	spinlock_t lock;
	struct list_head substreams;
};

Of course creation and destruction of a snd_pcm_link_t need to be 
protected by snd_pcm_link_lock.


-- 
Abramo Bagnara                       mailto:abramo.bagnara@libero.it

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

  reply	other threads:[~2003-04-24 10:03 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
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 [this message]
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=3EA7B654.2090108@libero.it \
    --to=abramo.bagnara@libero.it \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=jhall@maoz.com \
    --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.