From owner-freebsd-scsi@FreeBSD.ORG Mon Mar 6 16:11:12 2006 Return-Path: X-Original-To: freebsd-scsi@freebsd.org Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C06EE16A422; Mon, 6 Mar 2006 16:11:12 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id C4EB843D5F; Mon, 6 Mar 2006 16:11:10 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.11] (junior.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.4/8.13.4) with ESMTP id k26GB6Rq004703; Mon, 6 Mar 2006 09:11:09 -0700 (MST) (envelope-from scottl@samsco.org) Message-ID: <440C5F25.1000401@samsco.org> Date: Mon, 06 Mar 2006 09:11:17 -0700 From: Scott Long User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20051230 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Oleg Sharoiko References: <20060215102749.D58480@brain.cc.rsu.ru> <200602281205.43592.jhb@freebsd.org> <20060303153838.Q772@brain.cc.rsu.ru> <200603031112.45211.jhb@freebsd.org> <20060304224419.N1270@wolf.os.rsu.ru> <1141653998.1502.23.camel@brain.cc.rsu.ru> In-Reply-To: <1141653998.1502.23.camel@brain.cc.rsu.ru> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on pooker.samsco.org Cc: freebsd-scsi@freebsd.org, Andrey Beresovsky , John Baldwin Subject: Re: Boot hangs on ips0: resetting adapter, this may take up to 5 minutes X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2006 16:11:12 -0000 Oleg Sharoiko wrote: > On Sat, 2006-03-04 at 23:07 +0300, Oleg Sharoiko wrote: > > >>ips0: mem >>0xd0300000-0xd0300fff,0xd4000000-0xd7ffffff irq 11 at device 1.0 on pci3 >>ips0: Reserved 0x1000 bytes for rid 0x10 type 3 at 0xd0300000 >>ips0: irq allocation failed >>panic: Assertion mtx_unowned(m) failed at >>/usr/src-HEAD-20060228-223000UTC/sys/kern/kern_mutex.c:885 >>cpuid = 0 >>KDB: enter: panic >>[thread pid 0 tid 0 ] >>Stopped at kdb_enter+0x31: leave >>db> > > > There seems to be a small bug in the ips driver. I doesn't relate to the > hang at all, but as I suppose it needs to be fixed anyway. > > ips_pci_attach() from dev/ips/ips_pci.c does "goto error;" to make a > cleanup when something goes wrong. There we have > > error: > ips_pci_free(sc); > return (ENXIO); > > ips_pci_free() always calls > > mtx_destroy(&sc->queue_mtx); > sema_destroy(&sc->cmd_sema); > > but ips_pci_attach may jump to error: event before queue_mtx gets > initialized. Unfortunately I'm not sure how to fix this in the most > proper way. I suppose it would be nice to check in ips_pci_free() if the > mutex is initialized or not, but I don't know how to implement this > check. Another possible solution is to move initializition before first > "goto error"; So I'm leaving this for the one who knows better. > > By the way, shouldn't sc->queue also be freed in ips_pci_free ? > I'll look at this, thanks. Scott