From owner-freebsd-scsi@freebsd.org Mon Nov 7 08:25:31 2016 Return-Path: Delivered-To: freebsd-scsi@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94D82C342E2 for ; Mon, 7 Nov 2016 08:25:31 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from mail.samsco.org (suzi.samsco.org [96.84.242.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78BF51E12; Mon, 7 Nov 2016 08:25:30 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from localhost (localhost [192.168.254.3]) by mail.samsco.org (Postfix) with ESMTP id D4C7015C18682; Mon, 7 Nov 2016 08:25:29 +0000 (UTC) Received: from mail.samsco.org ([192.168.254.3]) by localhost (mail.samsco.org [192.168.254.3]) (maiad, port 10024) with ESMTP id 68184-03; Mon, 7 Nov 2016 08:25:29 +0000 (UTC) Received: from [192.168.254.199] (unknown [192.168.254.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: scottl@samsco.org) by mail.samsco.org (Postfix) with ESMTPSA id B022015C18680; Mon, 7 Nov 2016 08:25:29 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.1 \(3251\)) Subject: Re: mpt driver issue? From: Scott Long In-Reply-To: <1909C322-A218-4463-9A86-8E859B4715E6@freebsd.org> Date: Mon, 7 Nov 2016 01:25:29 -0700 Cc: Sean Bruno , freebsd-scsi Content-Transfer-Encoding: quoted-printable Message-Id: <1E584A39-B268-4253-A588-7A5CA5D46C97@samsco.org> References: <4398FA07-AABF-441E-A412-42BABCD59444@freebsd.org> <1909C322-A218-4463-9A86-8E859B4715E6@freebsd.org> To: Michael Tuexen X-Mailer: Apple Mail (2.3251) X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Nov 2016 08:25:31 -0000 > On Nov 7, 2016, at 1:21 AM, Michael Tuexen wrote: >=20 >> On 6 Nov 2016, at 23:46, Scott Long wrote: >>=20 >>=20 >>> On Nov 6, 2016, at 1:57 PM, Michael Tuexen = wrote: >>>=20 >>>> On 6 Nov 2016, at 20:41, Sean Bruno wrote: >>>>=20 >>>>=20 >>>>=20 >>>> On 11/06/16 10:54, Michael Tuexen wrote: >>>>> Dear all, >>>>>=20 >>>>> it was suggested on current@ to forward this to freebsd-scsi@ >>>>>=20 >>>>> The problem shows up since r308268 and it looks like an issue >>>>> in the mpt driver... >>>>>=20 >>>>> Best regards >>>>> Michael >>>>=20 >>>> I don't see any *obvious* reason that we should hold the mpt lock = here. >>>> It looks ok to just drop it. >>> I tried that and the system (with WITNESS) panic'ed... >>> Can't write a core (not a surprise). >>=20 >> Any info on where the panic was? > After learning how to add a serial console to a VM und Fusion: >=20 >>=20 Thanks. I have a fix, but I seem to not be able to access the svn = server over ssh right now so I can=E2=80=99t commit it. Here=E2=80=99s = the patch: --- mpt.c (revision 308358) +++ mpt.c (working copy) @@ -2695,7 +2695,11 @@ */ mpt->max_cam_seg_cnt =3D min(mpt->max_seg_cnt, (MAXPHYS / = PAGE_SIZE) + 1); =20 + /* XXX Lame Locking! */ + MPT_UNLOCK(mpt); error =3D mpt_dma_buf_alloc(mpt); + MPT_LOCK(mpt); + if (error !=3D 0) { mpt_prt(mpt, "mpt_dma_buf_alloc() failed!\n"); return (EIO); @@ -2745,6 +2749,7 @@ * retrieved, we are responsible for re-downloading * the firmware after any hard-reset. */ + MPT_UNLOCK(mpt); mpt->fw_image_size =3D mpt->ioc_facts.FWImageSize; error =3D mpt_dma_tag_create(mpt, mpt->parent_dmat, 1, = 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, = NULL, @@ -2752,6 +2757,7 @@ &mpt->fw_dmat); if (error !=3D 0) { mpt_prt(mpt, "cannot create firmware dma = tag\n"); + MPT_LOCK(mpt); return (ENOMEM); } error =3D bus_dmamem_alloc(mpt->fw_dmat, @@ -2760,6 +2766,7 @@ if (error !=3D 0) { mpt_prt(mpt, "cannot allocate firmware = memory\n"); bus_dma_tag_destroy(mpt->fw_dmat); + MPT_LOCK(mpt); return (ENOMEM); } mi.mpt =3D mpt; @@ -2768,6 +2775,7 @@ mpt->fw_image, mpt->fw_image_size, mpt_map_rquest, = &mi, 0); mpt->fw_phys =3D mi.phys; =20 + MPT_LOCK(mpt); error =3D mpt_upload_fw(mpt); if (error !=3D 0) { mpt_prt(mpt, "firmware upload failed.\n");