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: Mon, 28 Apr 2003 14:47:00 +0200	[thread overview]
Message-ID: <3EAD22C4.70309@libero.it> (raw)
In-Reply-To: <Pine.LNX.4.44.0304281418140.1603-100000@pnote.perex-int.cz>

Jaroslav Kysela ha scritto:
>>CPU1:
>>
>>read_lock(link_manager);	read_lock(link_manager);
>>spin_lock(s1);			spin_lock(s2);
>>if (stream_in_group)		if (stream_in_group)
>>	spin_lock(group);		spin_lock(group); /* Waiting */
>>spin_lock(s2); /* BOOM! */
>>
>>I guess that 3rd version will be the one I propose ;-)
> 
> 
> Yep, it is in CVS now ;-) Except I don't use trylock...
> 
> read_lock(link_manager);
> spin_lock(stream);
> ....
> if (stream_in_group) {
>     spin_lock(group);
>     spin_unlock(stream);
> }
> ....
> link_for_each(s) {	/* note that streams are locked in defined order now */
>     if (stream_in_group)
>         spin_lock(s);
> }
> ....
> list_for_each(s) {
>     if (stream_in_group)
>         spin_unlock(s);
> }
> ....
> if (stream_in_group) {
>     spin_lock(stream);
>     spin_unlock(group);
> }
> ....
> spin_unlock(stream);
> read_unlock(link_manager);

CPU1:				CPU2:
read_lock(link_manager);	read_lock(link_manager);
spin_lock(s1);			spin_lock(s2);
spin_lock(group);		spin_lock(group); // waiting
spin_unlock(s1);
//inside list_for_each
spin_lock(s1);
spin_lock(s2); // BOOM!

I fear you cannot avoid trylock ;-)

-- 
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-28 12:47 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
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 [this message]
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=3EAD22C4.70309@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.