From owner-freebsd-current@FreeBSD.ORG Wed Dec 17 00:14:50 2008 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2FE110656DC; Wed, 17 Dec 2008 00:14:50 +0000 (UTC) (envelope-from onemda@gmail.com) Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.28]) by mx1.freebsd.org (Postfix) with ESMTP id 3BF6F8FC1F; Wed, 17 Dec 2008 00:14:50 +0000 (UTC) (envelope-from onemda@gmail.com) Received: by yx-out-2324.google.com with SMTP id 8so2084847yxb.13 for ; Tue, 16 Dec 2008 16:14:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=mKG0SZOVfxmeHfvkXGkXRX08U2QWOjkcf3HqvL9WJsw=; b=PHzUcbv4mT2XDKGK4+Y4JdA4Rk+fenZs596C9grwylGiNqEifuJT8AlHVUX/UzFURP 57j7g5DHewrTd2bRjTwb1ALKj0+ZP5bBXWlzrYXKqPOnYJd8LcMeTVUjHWKXYxBevzi6 nCt9hmLr86gSKKyo2SUcP3mpfYZfUGEyLan84= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=WbY5kJFjixh/o/CoTWTdIYPjIN7Dqhjzk7TPNqGnCFrBQ4KM3vuFFhd2oKqKmoHe6w 65jUArzupHJZA0voWQKNa37xWphIwg2p2/gbvf2bsgvyBMpyfaylH4tDvQWvq5IKr+3Y m90xLym5CzHjpdVTu3lbr5JME+vkUbkvIt+Ew= Received: by 10.231.18.130 with SMTP id w2mr1071iba.11.1229472888882; Tue, 16 Dec 2008 16:14:48 -0800 (PST) Received: by 10.231.16.202 with HTTP; Tue, 16 Dec 2008 16:14:48 -0800 (PST) Message-ID: <3a142e750812161614u274ef75fibe291e1d1e8b1a56@mail.gmail.com> Date: Wed, 17 Dec 2008 01:14:48 +0100 From: "Paul B. Mahol" To: "Artem Belevich" In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Cc: freebsd-current@freebsd.org, trasz@freebsd.org Subject: Re: panic: _mtx_lock_sleep: recursed on non-recursive mutex sbp @ /usr/src-8-mq/src/sys/cam/cam_periph.h:182 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Dec 2008 00:14:50 -0000 On 12/17/08, Artem Belevich wrote: > Freshly CVSupped -current/amd64 crashes on boot due to a locking issue > in sys/cam. > > The crash may be related to this commit: > > http://svn.freebsd.org/viewvc/base?view=revision&revision=186186 > Author: trasz > Date: Tue Dec 16 17:01:52 2008 UTC (6 hours, 37 minutes ago) > Log Message: Fix locking in periph drivers - don't try to unlock periph > that was already deallocated. > > Reviewed by: scottl > Approved by: rwatson (mentor) > Sponsored by: FreeBSD Foundation > > --Artem > > panic: _mtx_lock_sleep: recursed on non-recursive mutex sbp @ > /usr/src-8-mq/src/sys/cam/cam_periph.h:182 > > cpuid = 0 > KDB: enter: panic > [thread pid 12 tid 100026 ] > Stopped at kdb_enter+0x3d: movq $0,0x487294(%rip) > db> trace > Tracing pid 12 tid 100026 td 0xffffff0004543720 > kdb_enter() at kdb_enter+0x3d > panic() at panic+0x176 > _mtx_lock_flags() at _mtx_lock_flags > _mtx_lock_flags() at _mtx_lock_flags+0xc3 > xpt_remove_periph() at xpt_remove_periph+0x25 > camperiphfree() at camperiphfree+0xbf > cam_periph_release() at cam_periph_release+0x43 > probedone() at probedone+0x459 > camisr_runqueue() at camisr_runqueue+0x1b4 > camisr() at camisr+0xc0 > intr_event_execute_handlers() at intr_event_execute_handlers+0x68 > ithread_loop() at ithread_loop+0xae > fork_exit() at fork_exit+0x12a > fork_trampoline() at fork_trampoline+0xe > --- trap 0, rip = 0, rsp = 0xfffffff8000a2d40, rbp = 0 --- > db> show locks > exclusive sleep mutex sbp (sbp) r = 0 (0xffffff00045a1ec8) locked @ > /usr/src-8-mq/src/sys/cam/cam_xpt.c:7137 +1 In my case, it panics with kldloading cam+atapicd+atapicam: db:0:kdb.enter.panic> run lockinfo db:1:lockinfo> show locks db:1:locks> show alllocks Process 627 (powerd) thread 0xc4131000 (100065) Process 316 (devd) thread 0xc4001d80 (100053) Process 2 (g_event) thread 0xc3cfd000 (100008) Process 11 (intr) thread 0xc3fb16c0 (100076) db:1:alllocks> show lockedvnods Locked vnodes db:0:kdb.enter.panic> show pcpu cpuid = 0 curthread = 0xc3fb16c0: pid 11 "swi2: cambio" curpcb = 0xc3b32d90 fpcurthread = none idlethread = 0xc3cfdb40: pid 10 "idle: cpu0" APIC ID = 0 currentldt = 0x50 spin locks held: db:0:kdb.enter.panic> bt Tracing pid 11 tid 100076 td 0xc3fb16c0 kdb_enter(c0620503,c0620503,c061ef92,c3b32798,0,...) at kdb_enter+0x3a panic(c061ef92,c4406b3f,c436213d,b6,c3f92664,...) at panic+0x131 _mtx_lock_sleep(c3f92664,c3fb16c0,0,c436213d,b6,...) at _mtx_lock_sleep+0x4a _mtx_lock_flags(c3f92664,0,c436213d,b6,c430b168,...) at _mtx_lock_flags+0xeb xpt_remove_periph(c3fe9280,c436238d,0,c3b32888,c0604aca,...) at xpt_remove_periph+0x31 camperiphfree(c3fe3020,c3b32bd8,c4347e55,c3fe9280,c3fe3020,...) at camperiphfree+0xa2 cam_periph_release(c3fe9280,c3fe3020,c3fdec00,c3f4740c,c4348bc7,...) at cam_periph_release+0x34 probedone(c3fe9280,c3fdec00,c4361fb8,c0625d7d,c3fc8b94,...) at probedone+0x4e0 camisr_runqueue(c3f92664,0,c4361fb8,1be1,0,...) at camisr_runqueue+0x16a camisr(0,c3b32cc8,c04b0b0d,c06906c0,c3fc8b38,...) at camisr+0xcd intr_event_execute_handlers(c3cfba90,c3fc8b00,c061c876,4dd,c3fc8b70,...) at intr_event_execute_handlers+0x10f ithread_loop(c3f3d5f0,c3b32d38,c061c5cc,32d,c3cfba90,...) at ithread_loop+0x98 fork_exit(c04a0cbf,c3f3d5f0,c3b32d38) at fork_exit+0xb8 fork_trampoline() at fork_trampoline+0x8 --- trap 0, eip = 0, esp = 0xc3b32d70, ebp = 0 --- acd0: DVDR at ata1-master PIO4 acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00 panic: _mtx_lock_sleep: recursed on non-recursive mutex ATAPICAM lock @ @/cam/cam_periph.h:182 cpuid = 0 KDB: enter: panic exclusive sleep mutex ATAPICAM lock (ATAPICAM lock) r = 0 (0xc3f92664) locked @ /usr/src/sys/modules/ata/atapicam/../../../dev/ata/atapi-cam.c:642 exclusive sx cpufreq lock (cpufreq lock) r = 0 (0xc3e69c00) locked @ /usr/src/sys/kern/kern_cpu.c:252 exclusive sx sysctl lock (sysctl lock) r = 0 (0xc068c7e4) locked @ /usr/src/sys/kern/kern_sysctl.c:1417 exclusive sleep mutex Giant (Giant) r = 0 (0xc068c1b0) locked @ /usr/src/sys/kern/kern_sysctl.c:1355 shared sx filedesc structure (filedesc structure) r = 0 (0xc3faf32c) locked @ /usr/src/sys/kern/sys_generic.c:958 exclusive sx GEOM topology (GEOM topology) r = 0 (0xc068a3c8) locked @ /usr/src/sys/geom/geom_event.c:185 exclusive sleep mutex ATAPICAM lock (ATAPICAM lock) r = 0 (0xc3f92664) locked @ /usr/src/sys/modules/ata/atapicam/../../../dev/ata/atapi-cam.c:642 -- Paul