From owner-freebsd-current@FreeBSD.ORG Wed Oct 24 19:22:30 2007 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 DBE2A16A420 for ; Wed, 24 Oct 2007 19:22:30 +0000 (UTC) (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 8503813C4A6 for ; Wed, 24 Oct 2007 19:22:30 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.samsco.home (phobos.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.8/8.13.8) with ESMTP id l9OJLx9H055869; Wed, 24 Oct 2007 13:22:00 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <471F9B41.5080100@samsco.org> Date: Wed, 24 Oct 2007 13:21:37 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 MIME-Version: 1.0 To: Steven Brown , Ed Maste References: <47091FDE.4060808@stellablue.org> In-Reply-To: <47091FDE.4060808@stellablue.org> Content-Type: multipart/mixed; boundary="------------080705090103080101060807" X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (pooker.samsco.org [168.103.85.57]); Wed, 24 Oct 2007 13:22:00 -0600 (MDT) X-Spam-Status: No, score=-1.4 required=5.5 tests=ALL_TRUSTED autolearn=failed version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: "Leubner, Achim" , freebsd-current@freebsd.org Subject: Re: Panic: mutex Giant not owned cam_xpt.c :4799 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, 24 Oct 2007 19:22:30 -0000 This is a multi-part message in MIME format. --------------080705090103080101060807 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Please try the attached patch. I'm having a hard time reproducing the problem to validate that it's fixed, but it should be. Scott Steven Brown wrote: > Just decided to try out the 0907 snapshot of -CURRENT (amd64) and it > won't boot off the install CD > > Thought I would post as much info as I could for interested parties. I > have to copy by hand, so I will try to include as much as I can. > > panic: mutex Giant not owned at /usr/src/sys/cam/cam_xpt.c :4799 > > This error occurs right after "md0: Preloaded image .... > > The motherboard is an Asus P5M2-R, with dual bge ethernets (on mb), a > Adaptec 3405 SATA/SAS RAID PCI-e card (aac driver), and has an Intel > Q6600 quad core. 4GB of RAM. You will soon see why I included the > information on the Adaptec card. > > This hardware works fine using 6.2-RELEASE p8 -- well, at least i386 > does. This system has a modified src/sys/dev/aac which includes the > vendor ID info for the 3405/3805 cards and has no problems booting (and > running), detecting Adaptec card, etc. > > I also have a CD with the same snapshot (CURRENT, 0907) in an i386 > version (not AMD64) which appears to produce the same error. > > Upon the panic, the system entered the debugger and I typed "trace" to > get the following from AMD64 snapshot: > > Tracing pid 26 tid 100026 td 0xffffff0002245680 > kdb_enter() at kdb_enter+0x31 > panic() at panic+0x173 > _mtx_assert() at _mtx_assert+0xd6 > xpt_release_simq() at xpt_release_simq()+0x27 > aac_alloc_commands() at aac_alloc_commands()+0x156 > aac_command_thread() at aac_command_thread()+0xe5 > fork_exit() at fork_exit+0x12a > fork_trampoline() at fork_trampoline()+0xe > --- trap 0, rip = 0, rsp = 0xffffffffac6fdd30, rbp = 0 --- > > > Hope this helps someone, > > Steve > _______________________________________________ > freebsd-current@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" --------------080705090103080101060807 Content-Type: text/plain; x-mac-type="0"; x-mac-creator="0"; name="aacp_mpsafe.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="aacp_mpsafe.diff" Index: aac_cam.c =================================================================== RCS file: /usr/ncvs/src/sys/dev/aac/aac_cam.c,v retrieving revision 1.28 diff -u -r1.28 aac_cam.c --- aac_cam.c 17 Jun 2007 05:55:45 -0000 1.28 +++ aac_cam.c 24 Oct 2007 19:20:13 -0000 @@ -131,19 +131,19 @@ static int aac_cam_detach(device_t dev) { + struct aac_softc *sc; struct aac_cam *camsc; debug_called(2); camsc = (struct aac_cam *)device_get_softc(dev); + sc = camsc->inf->aac_sc; - mtx_lock(&Giant); - + mtx_lock(&sc->aac_io_lock); xpt_async(AC_LOST_DEVICE, camsc->path, NULL); xpt_free_path(camsc->path); xpt_bus_deregister(cam_sim_path(camsc->sim)); cam_sim_free(camsc->sim, /*free_devq*/TRUE); - - mtx_unlock(&Giant); + mtx_unlock(&sc->aac_io_lock); return (0); } @@ -171,15 +171,17 @@ return (EIO); sim = cam_sim_alloc(aac_cam_action, aac_cam_poll, "aacp", camsc, - device_get_unit(dev), &Giant, 1, 1, devq); + device_get_unit(dev), &inf->aac_sc->aac_io_lock, 1, 1, devq); if (sim == NULL) { cam_simq_free(devq); return (EIO); } /* Since every bus has it's own sim, every bus 'appears' as bus 0 */ + mtx_lock(&inf->aac_sc->aac_io_lock); if (xpt_bus_register(sim, dev, 0) != CAM_SUCCESS) { cam_sim_free(sim, TRUE); + mtx_unlock(&inf->aac_sc->aac_io_lock); return (EIO); } @@ -187,11 +189,14 @@ CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_bus_deregister(cam_sim_path(sim)); cam_sim_free(sim, TRUE); + mtx_unlock(&inf->aac_sc->aac_io_lock); return (EIO); } + mtx_unlock(&inf->aac_sc->aac_io_lock); camsc->sim = sim; camsc->path = path; + camsc->devq = devq; return (0); } @@ -321,7 +326,6 @@ /* Async ops that require communcation with the controller */ - mtx_lock(&sc->aac_io_lock); if (aac_alloc_command(sc, &cm)) { struct aac_event *event; @@ -333,15 +337,12 @@ if (event == NULL) { device_printf(sc->aac_dev, "Warning, out of memory for event\n"); - /* XXX Yuck, what to do here? */ - mtx_unlock(&sc->aac_io_lock); return; } event->ev_callback = aac_cam_event; event->ev_arg = camsc; event->ev_type = AAC_EVENT_CMFREE; aac_add_event(sc, event); - mtx_unlock(&sc->aac_io_lock); return; } @@ -429,7 +430,6 @@ } else { ccb->ccb_h.status = CAM_REQ_CMP; xpt_done(ccb); - mtx_unlock(&sc->aac_io_lock); return; } default: @@ -460,8 +460,6 @@ aac_enqueue_ready(cm); aac_startio(cm->cm_sc); - mtx_unlock(&sc->aac_io_lock); - return; } @@ -565,7 +563,6 @@ return (CAM_REQ_ABORTED); } - mtx_lock(&sc->aac_io_lock); aac_alloc_sync_fib(sc, &fib); vmi = (struct aac_vmioctl *)&fib->data[0]; @@ -586,12 +583,10 @@ device_printf(sc->aac_dev,"Error %d sending ResetBus command\n", e); aac_release_sync_fib(sc); - mtx_unlock(&sc->aac_io_lock); return (CAM_REQ_ABORTED); } aac_release_sync_fib(sc); - mtx_unlock(&sc->aac_io_lock); return (CAM_REQ_CMP); } --------------080705090103080101060807--