public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.-test10: bad "__might_sleep" in ALSA sound drivers
@ 2003-11-25  0:02 Torrey Hoffman
  2003-11-25  2:00 ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Torrey Hoffman @ 2003-11-25  0:02 UTC (permalink / raw)
  To: Linux-Kernel List, alsa-devel

I get this every time I boot 2.6.0-test10.  I think this problem has
been around for a while.

Debug: sleeping function called from invalid context at
include/asm/semaphore.h:119
in_atomic():1, irqs_disabled():0
Call Trace:
 [<c01229d0>] __might_sleep+0xab/0xc9
 [<fcff57bd>] ap_cs8427_sendbytes+0x38/0xd2 [snd_ice1712]
 [<fcfa825a>] snd_i2c_sendbytes+0x22/0x26 [snd_i2c]
 [<fcfaf15e>] snd_cs8427_reg_read+0x2c/0x8c [snd_cs8427]
 [<fcfaf414>] snd_cs8427_create+0xa4/0x347 [snd_cs8427]
 [<c02dc4b0>] snd_device_new+0x20/0x6a
 [<fcff151a>] snd_ice1712_init_cs8427+0x2f/0x6f [snd_ice1712]
 [<fcff6153>] snd_ice1712_delta_init+0x230/0x2b9 [snd_ice1712]
 [<fcff5227>] snd_ice1712_probe+0x323/0x34c [snd_ice1712]
 [<c017360f>] dput+0x24/0x25f
 [<c020c833>] pci_device_probe_static+0x4d/0x5e
 [<c020c87c>] __pci_device_probe+0x38/0x4b
 [<c020c8bb>] pci_device_probe+0x2c/0x48
 [<c0272efd>] bus_match+0x3d/0x65
 [<c0273016>] driver_attach+0x59/0x83
 [<c02732df>] bus_add_driver+0x9e/0xb1
 [<c020ca82>] pci_register_driver+0x6b/0x90
 [<fcfa2015>] alsa_card_ice1712_init+0x15/0x4e [snd_ice1712]
 [<c013cbc5>] sys_init_module+0x14f/0x233
 [<c010b3e5>] sysenter_past_esp+0x52/0x71

The system is a P4 with HT, kernel has SMP & preempt enabled. 
There are two sound cards. Here are all the snd_ drivers mentioned in
the output of lsmod:

snd_ice1712            55428  -
snd_ice17xx_ak4xxx      2880  -
snd_cs8427              8224  -
snd_i2c                 4512  -
snd_ak4xxx_adda         4832  -
snd_intel8x0           28612  -
snd_ac97_codec         50660  -
snd_pcm                88352  -
snd_timer              22052  -
snd_page_alloc          8772  -
snd_mpu401_uart         6016  -
snd_rawmidi            20192  -
snd_seq_device          6440  -


-- 
Torrey Hoffman <thoffman@arnor.net>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2.6.-test10: bad "__might_sleep" in ALSA sound drivers
  2003-11-25  0:02 2.6.-test10: bad "__might_sleep" in ALSA sound drivers Torrey Hoffman
@ 2003-11-25  2:00 ` Andrew Morton
  2003-11-25 10:33   ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2003-11-25  2:00 UTC (permalink / raw)
  To: Torrey Hoffman; +Cc: linux-kernel, alsa-devel

Torrey Hoffman <thoffman@arnor.net> wrote:
>
> I get this every time I boot 2.6.0-test10.  I think this problem has
> been around for a while.
> 
> Debug: sleeping function called from invalid context at
> include/asm/semaphore.h:119
> in_atomic():1, irqs_disabled():0
> Call Trace:
>  [<c01229d0>] __might_sleep+0xab/0xc9
>  [<fcff57bd>] ap_cs8427_sendbytes+0x38/0xd2 [snd_ice1712]
>  [<fcfa825a>] snd_i2c_sendbytes+0x22/0x26 [snd_i2c]
>  [<fcfaf15e>] snd_cs8427_reg_read+0x2c/0x8c [snd_cs8427]
>  [<fcfaf414>] snd_cs8427_create+0xa4/0x347 [snd_cs8427]
>  [<c02dc4b0>] snd_device_new+0x20/0x6a
>  [<fcff151a>] snd_ice1712_init_cs8427+0x2f/0x6f [snd_ice1712]
>  [<fcff6153>] snd_ice1712_delta_init+0x230/0x2b9 [snd_ice1712]
>  [<fcff5227>] snd_ice1712_probe+0x323/0x34c [snd_ice1712]

snd_cs8427_create() does:

	snd_i2c_lock(bus);
	if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) != CS8427_VER8427A) {

the first statement takes a spinlock.  snd_cs8427_reg_read() then calls
ap_cs8427_sendbytes() which downs a semaphore.


It might be more appropriate to use a semaphore for ice1712_t.gpio_mutex?



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2.6.-test10: bad "__might_sleep" in ALSA sound drivers
  2003-11-25  2:00 ` Andrew Morton
@ 2003-11-25 10:33   ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2003-11-25 10:33 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Torrey Hoffman, linux-kernel, alsa-devel

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

Hi,

At Mon, 24 Nov 2003 18:00:17 -0800,
Andrew Morton wrote:
> 
> Torrey Hoffman <thoffman@arnor.net> wrote:
> >
> > I get this every time I boot 2.6.0-test10.  I think this problem has
> > been around for a while.
> > 
> > Debug: sleeping function called from invalid context at
> > include/asm/semaphore.h:119
> > in_atomic():1, irqs_disabled():0
> > Call Trace:
> >  [<c01229d0>] __might_sleep+0xab/0xc9
> >  [<fcff57bd>] ap_cs8427_sendbytes+0x38/0xd2 [snd_ice1712]
> >  [<fcfa825a>] snd_i2c_sendbytes+0x22/0x26 [snd_i2c]
> >  [<fcfaf15e>] snd_cs8427_reg_read+0x2c/0x8c [snd_cs8427]
> >  [<fcfaf414>] snd_cs8427_create+0xa4/0x347 [snd_cs8427]
> >  [<c02dc4b0>] snd_device_new+0x20/0x6a
> >  [<fcff151a>] snd_ice1712_init_cs8427+0x2f/0x6f [snd_ice1712]
> >  [<fcff6153>] snd_ice1712_delta_init+0x230/0x2b9 [snd_ice1712]
> >  [<fcff5227>] snd_ice1712_probe+0x323/0x34c [snd_ice1712]
> 
> snd_cs8427_create() does:
> 
> 	snd_i2c_lock(bus);
> 	if ((err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER)) != CS8427_VER8427A) {
> 
> the first statement takes a spinlock.  snd_cs8427_reg_read() then calls
> ap_cs8427_sendbytes() which downs a semaphore.
> 
> 
> It might be more appropriate to use a semaphore for ice1712_t.gpio_mutex?

the attached patch fixes this, simply replacing spinlock with mutex.
it's already in ALSA 1.0.0pre release.

--
Takashi Iwai <tiwai@suse.de>		ALSA Developer - www.alsa-project.org

[-- Attachment #2: Type: text/plain, Size: 1432 bytes --]

diff -ru linux/include/sound linux/include/sound
--- linux/include/sound/i2c.h	23 Apr 2002 13:20:58 -0000	1.3
+++ linux/include/sound/i2c.h	13 Nov 2003 11:18:12 -0000	1.4
@@ -58,7 +58,7 @@
 	snd_card_t *card;	/* card which I2C belongs to */
 	char name[32];		/* some useful label */
 
-	spinlock_t lock;
+	struct semaphore lock_mutex;
 
 	snd_i2c_bus_t *master;	/* master bus when SCK/SCL is shared */
 	struct list_head buses;	/* master: slave buses sharing SCK/SCL, slave: link list */
@@ -84,15 +84,15 @@
 
 static inline void snd_i2c_lock(snd_i2c_bus_t *bus) {
 	if (bus->master)
-		spin_lock(&bus->master->lock);
+		down(&bus->master->lock_mutex);
 	else
-		spin_lock(&bus->lock);
+		down(&bus->lock_mutex);
 }
 static inline void snd_i2c_unlock(snd_i2c_bus_t *bus) {
 	if (bus->master)
-		spin_unlock(&bus->master->lock);
+		up(&bus->master->lock_mutex);
 	else
-		spin_unlock(&bus->lock);
+		up(&bus->lock_mutex);
 }
 
 int snd_i2c_sendbytes(snd_i2c_device_t *device, unsigned char *bytes, int count);
diff -ru linux/sound linux/sound
--- linux/sound/i2c/i2c.c	2 Jun 2003 10:04:44 -0000	1.7
+++ linux/sound/i2c/i2c.c	13 Nov 2003 11:18:25 -0000	1.8
@@ -84,7 +84,7 @@
 	bus = (snd_i2c_bus_t *)snd_magic_kcalloc(snd_i2c_bus_t, 0, GFP_KERNEL);
 	if (bus == NULL)
 		return -ENOMEM;
-	spin_lock_init(&bus->lock);
+	init_MUTEX(&bus->lock_mutex);
 	INIT_LIST_HEAD(&bus->devices);
 	INIT_LIST_HEAD(&bus->buses);
 	bus->card = card;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-11-25 10:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-25  0:02 2.6.-test10: bad "__might_sleep" in ALSA sound drivers Torrey Hoffman
2003-11-25  2:00 ` Andrew Morton
2003-11-25 10:33   ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox