From owner-freebsd-bugs@FreeBSD.ORG Sat Mar 27 15:20:02 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 037451065678 for ; Sat, 27 Mar 2010 15:20:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id BB9238FC13 for ; Sat, 27 Mar 2010 15:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o2RFK1bk002848 for ; Sat, 27 Mar 2010 15:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o2RFK18Y002847; Sat, 27 Mar 2010 15:20:01 GMT (envelope-from gnats) Resent-Date: Sat, 27 Mar 2010 15:20:01 GMT Resent-Message-Id: <201003271520.o2RFK18Y002847@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Tod McQuillin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0D251065680 for ; Sat, 27 Mar 2010 15:13:29 +0000 (UTC) (envelope-from devin@distalzou.net) Received: from mail.distalzou.net (203.141.139.231.static.zoot.jp [203.141.139.231]) by mx1.freebsd.org (Postfix) with ESMTP id 76F5A8FC0C for ; Sat, 27 Mar 2010 15:13:29 +0000 (UTC) Received: from devin by mail.distalzou.net with local (Exim 4.71 (FreeBSD)) (envelope-from ) id 1NvX9u-0000WH-7a; Sat, 27 Mar 2010 23:38:42 +0900 Message-Id: Date: Sat, 27 Mar 2010 23:38:42 +0900 From: Tod McQuillin Sender: Tod McQuillin To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: mav@FreeBSD.org Subject: kern/145081: dsp.c returning from system call with Giant lock held after r203860 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Tod McQuillin List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Mar 2010 15:20:02 -0000 >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@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: