kern/145081: dsp.c returning from system call with Giant lock held after r203860

Tod McQuillin devin at spamcop.net
Sat Mar 27 15:20:02 UTC 2010


>Number:         145081
>Category:       kern
>Synopsis:       dsp.c returning from system call with Giant lock held after r203860
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 27 15:20:01 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Tod McQuillin
>Release:        FreeBSD 8.0-STABLE i386
>Organization:
Haphazard
>Environment:
System: FreeBSD reizouko.pun-pun.prv 8.0-STABLE FreeBSD 8.0-STABLE #1 r205666M: Sat Mar 27 23:05:26 JST 2010     devin at reizouko.pun-pun.prv:/usr/obj/usr/src.svn/sys/REIZOUKO  i386

System hardware: IBM Thinkpad X20

>Description:

When unplugging the machine from the AC adaptor, within a few seconds
the system freezes up.  This occurs when GNOME/x11 is running but not in
single user mode.

No messages are logged on the console, but when booting a kernel with
INVARIANTS and WITNESS enabled, the following panic is observed:

System call ioctl returning with the following locks held:
exclusive sleep mutex Giant (Giant) r = 0 (0xc0aafd50) locked @ /usr/src/sys/dev/sound/pcm/dsp.c:1064
panic: witness_warn
KDB: enter: panic
[thread pid 1087 tid 100149 ]
Stopped at      kdb_enter+0x3a: movl    $0,kdb_why

Investigation with KDB shows:
db> where
Tracing pid 1807 tid 100149 td 0xc448c6f0
kdb_enter(c09e9971,c09e9971,c09c08e3,cf840c54,cf840c54,...) at kdb_enter+0x3a
panic(c09c08e3,c099f329,0,0,0,...) at panic_0xd1
witness_warn(2,0,c0a21845,c0a0127d,c2c522a8,...) at witness_warn+0x1e9
syscall(cf840d38) at syscall+0x2d8
Xint0x80_syscall() at Xint0x80_syscall+0x20
--- syscall (0, FreeBSD ELF32, nosys) eip = 0x294c5873, esp = 0xbf9fcd4c, ebp = 0xbf9fcd88 ---
exclusive sleep mutex Giant (Giant) r = 0 (0xc0aafd50) locked @ /usr/src/sys/dev/sound/pcm/dsp.c:1064
db> show pcpu
cpuid        = 0
dynamic pcpu    = 0x58eb00
curthread    = 0xc448c6f0: pid 1807 "gnome-power-manager"
curpcb       = 0xcf840d90
fpcurthread  = none
idlethread   = 0xc286c940: pid 11 "idle"
APIC ID      = 0
currentldt   = 0x50
spin locks held:

>How-To-Repeat:

Run GNOME on FreeBSD 8.0-STABLE (after SVN r203860) with
gnome-power-manager on an IBM Thinkpad X20.  Unplug the AC adaptor.  The
system will lock up within 3-7 seconds.

The problem seems to have been introduced with SVN r203860.

>Fix:

The following patch corrects the problem on my test system:

Index: sys/dev/sound/pcm/dsp.c
===================================================================
--- sys/dev/sound/pcm/dsp.c	(revision 205666)
+++ sys/dev/sound/pcm/dsp.c	(working copy)
@@ -1071,6 +1071,7 @@
 	if (IOCGROUP(cmd) == 'M') {
 		if (cmd == OSS_GETVERSION) {
 			*arg_i = SOUND_VERSION;
+			PCM_GIANT_EXIT(d);
 			return (0);
 		}
 		ret = dsp_ioctl_channel(i_dev, PCM_VOLCH(i_dev), cmd, arg);
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list