Re: BUG: possible deadlock detected! (sound) [Was: 2.6.17-rc5-mm1]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Arjan van de Ven napsal(a):
> On Tue, 2006-05-30 at 14:44 +0200, Takashi Iwai wrote:
>> This ops is a unique object assigned to a different "id" string.
>>
>> The first snd_seq_device_register_driver() called from emu10k1_synth.c
>> is the registration for the id "snd-synth-emu10k1".
>> Then in init_device(), the corresponding devices are initialized, and
>> one callback registers again another device for OSS sequencer with a
>> different id "snd-seq-oss" via snd_seq_device_new() inside the lock.
>> Now it hits the lock-detector but the lock should belong to a
>> different ops object in practice.
>>
>> This nested lock may happen only in two drivers, emu10k1-synth and
>> opl3, and only together with OSS emulation.  Since the OSS emulation
>> layer don't do active registration from itself, no deadlock should
>> happen (in theory -- I may oversee something :)
> 
> ok fair enough
> 
> Jiri, can you test the patch below? (I don't have this hardware)
Sure, but the day after tomorrow, I am going away from that machine now.
> 
> The ops structure has complex locking rules, where not all ops are
> equal, some are subordinate on others for some complex sound cards. This
> requires for lockdep checking that each individual reg_mutex is
> considered in separation for its locking rules.
> 
> Signed-off-by: Arjan van de Ven <[email protected]>
> 
> ---
>  sound/core/seq/seq_device.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6.17-rc4-mm3-lockdep/sound/core/seq/seq_device.c
> ===================================================================
> --- linux-2.6.17-rc4-mm3-lockdep.orig/sound/core/seq/seq_device.c
> +++ linux-2.6.17-rc4-mm3-lockdep/sound/core/seq/seq_device.c
> @@ -46,6 +46,7 @@
>  #include <linux/kmod.h>
>  #include <linux/slab.h>
>  #include <linux/mutex.h>
> +#include <linux/lockdep.h>
>  
>  MODULE_AUTHOR("Takashi Iwai <[email protected]>");
>  MODULE_DESCRIPTION("ALSA sequencer device management");
> @@ -73,6 +74,8 @@ struct ops_list {
>  	struct mutex reg_mutex;
>  
>  	struct list_head list;	/* next driver */
> +
> +	struct lockdep_type_key reg_mutex_key;
>  };
>  
>  
> @@ -379,7 +382,7 @@ static struct ops_list * create_driver(c
>  
>  	/* set up driver entry */
>  	strlcpy(ops->id, id, sizeof(ops->id));
> -	mutex_init(&ops->reg_mutex);
> +	mutex_init_key(&ops->reg_mutex, id, &ops->reg_mutex_key);
>  	ops->driver = DRIVER_EMPTY;
>  	INIT_LIST_HEAD(&ops->dev_list);
>  	/* lock this instance */
> 
> 


- --
Jiri Slaby         www.fi.muni.cz/~xslaby
\_.-^-._   [email protected]   _.-^-._/
B67499670407CE62ACC8 22A032CC55C339D47A7E
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFEfEQAMsxVwznUen4RAkp4AJwOMUsBK4kvE54X/oxcdcIWad8oGACghO2a
mZLtPAHamNSDsiNa1gOfgoE=
=CaIp
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux