mpt driver issue?

Scott Long scottl at samsco.org
Mon Nov 7 08:25:31 UTC 2016


> On Nov 7, 2016, at 1:21 AM, Michael Tuexen <tuexen at FreeBSD.org> wrote:
> 
>> On 6 Nov 2016, at 23:46, Scott Long <scottl at samsco.org> wrote:
>> 
>> 
>>> On Nov 6, 2016, at 1:57 PM, Michael Tuexen <tuexen at FreeBSD.org> wrote:
>>> 
>>>> On 6 Nov 2016, at 20:41, Sean Bruno <sbruno at freebsd.org> wrote:
>>>> 
>>>> 
>>>> 
>>>> On 11/06/16 10:54, Michael Tuexen wrote:
>>>>> Dear all,
>>>>> 
>>>>> it was suggested on current@ to forward this to freebsd-scsi@
>>>>> 
>>>>> The problem shows up since r308268 and it looks like an issue
>>>>> in the mpt driver...
>>>>> 
>>>>> Best regards
>>>>> Michael
>>>> 
>>>> 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).
>> 
>> Any info on where the panic was?
> After learning how to add a serial console to a VM und Fusion:
> 
>> 

Thanks.  I have a fix, but I seem to not be able to access the svn server over ssh right now so I can’t commit it.  Here’s the patch:

--- mpt.c	(revision 308358)
+++ mpt.c	(working copy)
@@ -2695,7 +2695,11 @@
 	 */
 	mpt->max_cam_seg_cnt = min(mpt->max_seg_cnt, (MAXPHYS / PAGE_SIZE) + 1);
 
+	/* XXX Lame Locking! */
+	MPT_UNLOCK(mpt);
 	error = mpt_dma_buf_alloc(mpt);
+	MPT_LOCK(mpt);
+
 	if (error != 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 = mpt->ioc_facts.FWImageSize;
 		error = 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 != 0) {
 			mpt_prt(mpt, "cannot create firmware dma tag\n");
+			MPT_LOCK(mpt);
 			return (ENOMEM);
 		}
 		error = bus_dmamem_alloc(mpt->fw_dmat,
@@ -2760,6 +2766,7 @@
 		if (error != 0) {
 			mpt_prt(mpt, "cannot allocate firmware memory\n");
 			bus_dma_tag_destroy(mpt->fw_dmat);
+			MPT_LOCK(mpt);
 			return (ENOMEM);
 		}
 		mi.mpt = mpt;
@@ -2768,6 +2775,7 @@
 		    mpt->fw_image, mpt->fw_image_size, mpt_map_rquest, &mi, 0);
 		mpt->fw_phys = mi.phys;
 
+		MPT_LOCK(mpt);
 		error = mpt_upload_fw(mpt);
 		if (error != 0) {
 			mpt_prt(mpt, "firmware upload failed.\n");



More information about the freebsd-scsi mailing list