From stephane@freebsd-fr.org  Tue Aug 31 11:47:05 2004
Return-Path: <stephane@freebsd-fr.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id E618516A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 31 Aug 2004 11:47:05 +0000 (GMT)
Received: from postfix3-2.free.fr (postfix3-2.free.fr [213.228.0.169])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 05AD843D2F
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 31 Aug 2004 11:47:05 +0000 (GMT)
	(envelope-from stephane@freebsd-fr.org)
Received: from sequoia.mondomaineamoi.megalo (lns-vlq-17f-81-56-170-180.adsl.proxad.net [81.56.170.180])
	by postfix3-2.free.fr (Postfix) with ESMTP id 1488DC32B
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 31 Aug 2004 15:42:33 +0200 (CEST)
Received: from sequoia.mondomaineamoi.megalo (localhost.mondomaineamoi.megalo [127.0.0.1])
	by sequoia.mondomaineamoi.megalo (8.13.1/8.13.1) with ESMTP id i7VBl2TW017236
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 31 Aug 2004 13:47:02 +0200 (CEST)
	(envelope-from stephane@sequoia.mondomaineamoi.megalo)
Received: (from stephane@localhost)
	by sequoia.mondomaineamoi.megalo (8.13.1/8.13.1/Submit) id i7VBl2JJ017235;
	Tue, 31 Aug 2004 13:47:02 +0200 (CEST)
	(envelope-from stephane)
Message-Id: <200408311147.i7VBl2JJ017235@sequoia.mondomaineamoi.megalo>
Date: Tue, 31 Aug 2004 13:47:02 +0200 (CEST)
From: Stephane Legrand <stephane@freebsd.org>
Reply-To: Stephane Legrand <stephane@freebsd.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Kernel panic (trace included) "recursed on non-recursive mutex" with SoundBlaster 32 (ISA port)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         71189
>Category:       kern
>Synopsis:       [sound] [patch] panic: "recursed on non-recursive mutex" with SoundBlaster 32 (ISA port)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sound
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 31 11:50:28 GMT 2004
>Closed-Date:    Thu Sep 16 19:10:24 GMT 2004
>Last-Modified:  Sun Jul  3 00:20:11 GMT 2005
>Originator:     Stephane Legrand
>Release:        FreeBSD 5.3-BETA2 i386
>Organization:
>Environment:

FreeBSD 5.3-BETA2 on i386 with a Creative SoundBlaster 32 Pnp
sound card in one ISA port.

sequoia% uname -a
  FreeBSD sequoia.mondomaineamoi.megalo 5.3-BETA2 FreeBSD 5.3-BETA2 #3: 
  Tue Aug 31 08:23:48 CEST 2004 
  root@:/usr/obj/usr/src/sys/SEQUOIA i386

sequoia% kldstat 
  Id Refs Address    Size     Name
   1   12 0xc0400000 3b3490   kernel
   2    1 0xc07b4000 46a4     snd_sb16.ko
   3    2 0xc07b9000 4d20     snd_sbc.ko
   4   14 0xc07be000 5e6fc    acpi.ko
   5    4 0xc1809000 14000    netgraph.ko
   6    2 0xc181d000 4000     ng_ether.ko
   7    1 0xc1821000 7000     ng_pppoe.ko
   8    1 0xc1828000 5000     ng_socket.ko
   9    1 0xc188a000 b000     ipfw.ko

sequoia% more /boot/loader.conf 
  snd_sb16_load="YES"

From dmesg:
  sbc0: <Creative SB16/SB32> at port 0x388-0x38b,0x330-0x331,0x220-0x22f irq 5 drq 5,1 on isa0
  sbc0: [GIANT-LOCKED]
  pcm0: <SB16 DSP 4.16> on sbc0
  pcm0: [GIANT-LOCKED]

sequoia% cat /dev/sndstat 
  FreeBSD Audio Driver (newpcm)
  Installed devices:
  pcm0: <SB16 DSP 4.16> at io 0x220 irq 5 drq 1:5 bufsz 4096d 
        kld snd_sb16 (1p/1r/0v channels duplex default)
    [pcm0:record:0]: spd 0, fmt 0x00000000/0x00000008, flags 0x00000000, 0x00000000
     interrupts 0, overruns 0, hfree 4096, sfree 0
     {hardware} -> feeder_root(0x00000000) -> {userland}
    [pcm0:play:0]: spd 0, fmt 0x00000000/0x00000008, flags 0x00000000, 0x00000000
     interrupts 0, underruns 0, ready 0
     {userland} -> feeder_root(0x00000000) -> {hardware}

  File Versions:
  $FreeBSD: src/sys/dev/sound/pcm/vchan.c,v 1.16 2004/01/28 08:02:15 truckman Exp $
  $FreeBSD: src/sys/dev/sound/pcm/sound.c,v 1.92 2004/07/16 03:59:09 tanimura Exp $
  $FreeBSD: src/sys/dev/sound/pcm/sndstat.c,v 1.17 2004/06/16 09:46:57 phk Exp $
  $FreeBSD: src/sys/dev/sound/pcm/mixer.c,v 1.40 2004/06/25 16:34:33 josef Exp $
  $FreeBSD: src/sys/dev/sound/pcm/feeder_rate.c,v 1.10 2003/04/20 17:08:56 orion Exp $
  $FreeBSD: src/sys/dev/sound/isa/sb16.c,v 1.87 2004/07/16 03:59:54 tanimura Exp $
  $FreeBSD: src/sys/dev/sound/isa/sbc.c,v 1.42 2004/07/16 03:59:54 tanimura Exp $
  $FreeBSD: src/sys/dev/sound/pcm/feeder_fmt.c,v 1.13 2003/09/07 16:28:03 cg Exp $
  $FreeBSD: src/sys/dev/sound/pcm/feeder.c,v 1.32 2003/09/07 16:28:03 cg Exp $
  $FreeBSD: src/sys/dev/sound/pcm/fake.c,v 1.13 2003/09/07 16:28:03 cg Exp $
  $FreeBSD: src/sys/dev/sound/pcm/dsp.c,v 1.77 2004/07/02 15:31:44 netchild Exp $
  $FreeBSD: src/sys/dev/sound/pcm/channel.c,v 1.97 2004/02/28 19:47:02 truckman Exp $
  $FreeBSD: src/sys/dev/sound/pcm/buffer.c,v 1.23 2004/04/29 02:51:59 green Exp $
  $FreeBSD: src/sys/dev/sound/pcm/ac97_patch.c,v 1.2 2003/08/21 15:44:55 orion Exp $
  $FreeBSD: src/sys/dev/sound/pcm/ac97.c,v 1.51 2004/05/08 03:41:40 sanpei Exp $
  $FreeBSD: src/sys/dev/sound/isa/sndbuf_dma.c,v 1.2 2003/09/07 16:28:02 cg Exp $

>Description:

For instance, if i try to play a MP3 file with mplayer, i immediately
get a kernel panic. This also happens with xmms. Note that this
card worked without any problem on FreeBSD 4.x including 4.10.

The kernel configuration file has the "device sound" line. The panic
happens with or without the WITNESS option.

The kernel panic trace: 
...
Video: no video
Starting playback...
panic: _mtx_lock_sleep: recursed on non-recursive mutex sbc0 
  @ /usr/src/sys/modules/sound/driver/sbc/../../../../dev/sound/isa/sbc.c: 131
KDB: enter: panic
[thread 100081]
Stopped at kbd_enter + 0x30: leave
db> trace
  kbd_enter(c06927e9,c06e9e00,c0691bf4,d23c8a30,100) at kbd_enter + 0x30
  panic(c0691bf4,c1662530,c07bb6a8,83,c1667100) at panic + 0xd5
  _mtx_lock_sleep(c1667100,c1aa4580,0,c07bb6a8,83) at _mtx_lock_sleep + 0x47
  _mtx_lock_flags(c1667100,0,c07bb6a8,83,d23c8a94) at _mtx_lock_flags + 0xbf
  sbc_lock(c1644d00,d23c8ab0,c07b56ee,c1644b00,d23c8ab0) at sbc_lock + 0x2c
  sb_lock(c1644d00,d23c8ab0,c1644b2c,c1644b00,3ff) at sb_lock + 0x1c
  sb_cmd2(c1644d00,30,3ff,c1644b00,0) at sb_cmd2 + 0x1e
  sb_setup(c1644d00,c1674410,1,d23c8b08,c048897a) at sb_setup + 0x2fa
  sb16chan_trigger(c1674410,c1644b2c,1,465,c1644980) at sb16chan_trigger + 0x35
  chn_trigger(c1644980,1,c068ae8b,207,0) at chn_trigger + 0xaa
  chn_start(c1644980,0,10000,14f,c1676800) at chn_start + 0x107
  chn_write(c1644980,d23c8c80,d23c8b74,20000000,0) at chn_write + 0x26e
  dsp_write(c1645400,d23c8c80,50001,d23c8bc0,10000) at dsp_write + 0xa5
  spec_write(d23c8c0c,d23c8c58,c0558352,d23c8c0c,20002) at spec_write + 0x1f0
  spec_vnoperate(d23c8c0c,20002,c1aa4580,246,d23c8c80) at spec_vnoperate + 0x18
  vn_write(c1766550,d23c8c80,c1ad6280,0,c1aa4580) at vn_write + 0x242
  dofilewrite(c1aa4580,c1766550,6,8795000,10000) at dofilewrite + 0xcb
  write(c1aa4580,d23c8d14,c,437,3) at write + 0x69
  syscall(2f,bfbf002f,d23c002f,85a8000,e84a5b61) at syscall + 0x2a0
  Xint0x80_syscall() at Xint0x80_syscall + 0x1f
  --- syscall (4,FreeBSD ELF32,write), eip = 0x28bc1dbb, esp = 0xbfbfd55c, ebp = 0xbfbfd578 ---

>How-To-Repeat:
Plug a Creative SoundBlaster 32 Pnp in one ISA port and try to use
it with mplayer or xmms.
  
>Fix:
The only one i was able to find: never use the sound card :)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-sound 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Tue Aug 31 18:55:55 GMT 2004 
Responsible-Changed-Why:  
Assign to maintainers. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71189 
Responsible-Changed-From-To: freebsd-sound->sound 
Responsible-Changed-By: ceri 
Responsible-Changed-When: Tue Aug 31 18:56:53 GMT 2004 
Responsible-Changed-Why:  
Correct responsible. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71189 

From: Tim Robbins <tjr@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: kern/71189: [panic] "recursed on non-recursive mutex" with SoundBlaster 32 (ISA port) (trace included)
Date: Sun, 5 Sep 2004 12:21:33 +1000

 Following up to note that kern/71382 was closed as a duplicate of this PR.

From: Stephane Legrand <stephane@FreeBSD.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/71189: Kernel panic (trace included) "recursed on non-recursive mutex" with SoundBlaster 32 (ISA port)
Date: Sun, 5 Sep 2004 22:32:33 +0200

 After looking at revision 1.84 of the sb16.c file (which corrected
 a similar problem), i wrote and tried the patch below. It fixes the
 problem, i can now play music with xmms or mplayer.
 
 --- sb16.c.original	Sat Sep  4 23:47:39 2004
 +++ sb16.c	Sun Sep  5 22:24:52 2004
 @@ -209,7 +209,7 @@
  #if 0
      	printf("sb_cmd2: %x, %x\n", cmd, val);
  #endif
 -	sb_lock(sb);
 +	sb_lockassert(sb);
  	r = 0;
      	if (sb_dspwr(sb, cmd)) {
  		if (sb_dspwr(sb, val & 0xff)) {
 @@ -218,7 +218,6 @@
  			}
  		}
      	}
 -	sb_unlock(sb);
  
  	return r;
  }
 @@ -243,12 +242,11 @@
  {
      	int val;
  
 -	sb_lock(sb);
 +    	sb_lockassert(sb);
      	sb_wr(sb, SB_MIX_ADDR, (u_char) (port & 0xff)); /* Select register */
      	DELAY(10);
      	val = sb_rd(sb, SB_MIX_DATA);
      	DELAY(10);
 -	sb_unlock(sb);
  
      	return val;
  }

From: Rory Arms <rorya@TrueStep.com>
To: stephane@freebsd.org, freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: kern/71189: [sound] [patch] panic: "recursed on non-recursive mutex" with SoundBlaster 32 (ISA port)
Date: Tue, 14 Sep 2004 04:38:23 -0400

 I also was having the same problem on a dual 333Mhz, Tyan S1836 
 motherboard with onboard ISA SB Vibra16 sound.
 
 I just tried this patch on my 5.3-BETA4 (with WITNESS & INVARIANTS & 
 SCHED_ULE turned on) system and it fixed the problem. Although I had to 
 apply the patch by hand, I guess the version of sb16.c (v1.87) in 
 RELENG_5 was newer than what was used for the patch, provided.
 
State-Changed-From-To: open->closed 
State-Changed-By: truckman 
State-Changed-When: Thu Sep 16 19:03:53 GMT 2004 
State-Changed-Why:  
Patch committed: 
2004-09-12 sys/dev/sound/isa/sb16.c 1.88     - HEAD 
2004-09-16 sys/dev/sound/isa/sb16.c 1.87.2.1 - RELENG_5 

http://www.freebsd.org/cgi/query-pr.cgi?pr=71189 

From: Stephane Legrand <stephane@FreeBSD.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/71189: Kernel panic (trace included) "recursed on
	non-recursive mutex" with SoundBlaster 32 (ISA port)
Date: Sun, 5 Sep 2004 22:32:33 +0200

 After looking at revision 1.84 of the sb16.c file (which corrected
 a similar problem), i wrote and tried the patch below. It fixes the
 problem, i can now play music with xmms or mplayer.
 
 --- sb16.c.original	Sat Sep  4 23:47:39 2004
 +++ sb16.c	Sun Sep  5 22:24:52 2004
 @@ -209,7 +209,7 @@
  #if 0
      	printf("sb_cmd2: %x, %x\n", cmd, val);
  #endif
 -	sb_lock(sb);
 +	sb_lockassert(sb);
  	r = 0;
      	if (sb_dspwr(sb, cmd)) {
  		if (sb_dspwr(sb, val & 0xff)) {
 @@ -218,7 +218,6 @@
  			}
  		}
      	}
 -	sb_unlock(sb);
  
  	return r;
  }
 @@ -243,12 +242,11 @@
  {
      	int val;
  
 -	sb_lock(sb);
 +    	sb_lockassert(sb);
      	sb_wr(sb, SB_MIX_ADDR, (u_char) (port & 0xff)); /* Select register */
      	DELAY(10);
      	val = sb_rd(sb, SB_MIX_DATA);
      	DELAY(10);
 -	sb_unlock(sb);
  
      	return val;
  }
 _______________________________________________
 freebsd-bugs@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-bugs
 To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
 
>Unformatted:
