linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH]: Fusion-MPT slowness workaround
@ 2005-11-01 22:08 Moore, Eric Dean
  2005-11-01 22:27 ` Chen, Kenneth W
  0 siblings, 1 reply; 5+ messages in thread
From: Moore, Eric Dean @ 2005-11-01 22:08 UTC (permalink / raw)
  To: Chen, Kenneth W, Martin Devera, bstroesser, rupert; +Cc: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 483 bytes --]

On Tuesday, November 01, 2005 2:39 PM, Chen, Kenneth W wrote:
> > 
> > I've added spin-lock to control domain validation, and 
> > alternate controller bringup which are occuring at the same time,
> > and causing dv to fail.  Thanks to Kenneth Chen and Bodo Stroesser.
> 
> With the patch, Kernel hung at boot (2.6.14 is used).
> 

Try this patch instead.  Use it over 2.6.14, not over the
previous post.

This patch is one that Bodo provided.  Let me know the results.

Eric Moore


[-- Attachment #2: performance-take2.patch --]
[-- Type: application/octet-stream, Size: 2763 bytes --]

diff -uarN b/drivers/message/fusion/mptbase.c a/drivers/message/fusion/mptbase.c
--- b/drivers/message/fusion/mptbase.c	2005-10-27 18:02:08.000000000 -0600
+++ a/drivers/message/fusion/mptbase.c	2005-11-01 15:03:12.000000000 -0700
@@ -118,6 +118,7 @@
 static int	last_drv_idx = -1;
 
 static DECLARE_WAIT_QUEUE_HEAD(mpt_waitq);
+static DECLARE_WAIT_QUEUE_HEAD(mpt_host_bringup_waitq);
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
@@ -1659,6 +1660,7 @@
 						ioc->alt_ioc->name));
 				CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, ~(MPI_HIM_RIM));
 				ioc->alt_ioc->active = 1;
+				wake_up(&mpt_host_bringup_waitq);
 			}
 
 		} else {
@@ -1783,6 +1785,7 @@
 				ioc->alt_ioc->name));
 		CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, ~(MPI_HIM_RIM));
 		ioc->alt_ioc->active = 1;
+		wake_up(&mpt_host_bringup_waitq);
 	}
 
 	/*  Enable MPT base driver management of EventNotification
@@ -1893,6 +1896,15 @@
 	return ret;
 }
 
+int
+mpt_wait_active(MPT_ADAPTER *ioc)
+{
+	if (ioc->active == 0)
+		return wait_event_timeout(mpt_host_bringup_waitq,
+		    ioc->active == 1, HZ*15) <=0;
+	return 0;
+}
+
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
  *	mpt_detect_bound_ports - Search for PCI bus/dev_function
@@ -6299,7 +6311,7 @@
 EXPORT_SYMBOL(mpt_alloc_fw_memory);
 EXPORT_SYMBOL(mpt_free_fw_memory);
 EXPORT_SYMBOL(mptbase_sas_persist_operation);
-
+EXPORT_SYMBOL(mpt_wait_active);
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
diff -uarN b/drivers/message/fusion/mptbase.h a/drivers/message/fusion/mptbase.h
--- b/drivers/message/fusion/mptbase.h	2005-10-27 18:02:08.000000000 -0600
+++ a/drivers/message/fusion/mptbase.h	2005-11-01 14:59:05.000000000 -0700
@@ -966,6 +966,7 @@
 extern int	 mpt_resume(struct pci_dev *pdev);
 #endif
 extern int	 mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass);
+extern int	 mpt_wait_active(MPT_ADAPTER *ioc);
 extern void	 mpt_deregister(int cb_idx);
 extern int	 mpt_event_register(int cb_idx, MPT_EVHANDLER ev_cbfunc);
 extern void	 mpt_event_deregister(int cb_idx);
diff -uarN b/drivers/message/fusion/mptscsih.c a/drivers/message/fusion/mptscsih.c
--- b/drivers/message/fusion/mptscsih.c	2005-10-27 18:02:08.000000000 -0600
+++ a/drivers/message/fusion/mptscsih.c	2005-11-01 15:01:16.000000000 -0700
@@ -3789,6 +3789,12 @@
 		return -EFAULT;
 	}
 
+	if (mpt_wait_active(hd->ioc)) {
+		ddvprintk((MYIOC_s_WARN_FMT "wait_event: no msg frames!\n",
+		    hd->ioc->name));
+		return -EBUSY;
+	}
+
 	/* Get and Populate a free Frame
 	 */
 	if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) {

^ permalink raw reply	[flat|nested] 5+ messages in thread
* [PATCH]: Fusion-MPT slowness workaround
@ 2005-11-01 19:34 Moore, Eric Dean
  2005-11-01 21:39 ` Chen, Kenneth W
  0 siblings, 1 reply; 5+ messages in thread
From: Moore, Eric Dean @ 2005-11-01 19:34 UTC (permalink / raw)
  To: Martin Devera, bstroesser, rupert, kenneth.w.chen; +Cc: linux-scsi

[-- Attachment #1: Type: text/plain, Size: 698 bytes --]

On Tuesday, November 01, 2005 11:12 AM, Martin Devera wrote: 
> > NACK. Disabling DV is not the solution.
> > 
> > I have a fix I will post sometime this week.
> 
> excellent. Just to make it clear, I posted this one as quick 
> workaround not
> as final solution attempt.
> Please consider CCing me when the patch will be available - 
> I'll be pleased
> to test it :-)
> 

Here is a patch I would like to have tested to address the
performance issue many have posted to the forum.

I've added spin-lock to control domain validation, and 
alternate controller bringup which are occuring at the same time,
and causing dv to fail.  Thanks to Kenneth Chen and Bodo Stroesser.

Eric Moore
LSI Logic



[-- Attachment #2: performance.patch --]
[-- Type: application/octet-stream, Size: 4194 bytes --]

diff -uarN b/drivers/message/fusion/mptbase.c a/drivers/message/fusion/mptbase.c
--- b/drivers/message/fusion/mptbase.c	2005-10-27 18:02:08.000000000 -0600
+++ a/drivers/message/fusion/mptbase.c	2005-11-01 12:25:35.000000000 -0700
@@ -1121,6 +1121,38 @@
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
+ *	mpt_bringup_adapter - This is a wrapper function for mpt_do_ioc_recovery
+ *	@ioc: Pointer to MPT adapter structure
+ *	@sleepFlag: Use schedule if CAN_SLEEP else use udelay.
+ *
+ *	This routine performs all the steps necessary to bring the IOC
+ *	to a OPERATIONAL state.
+ *
+ *      Special Note: This function was added with spin lock's so as to allow
+ *      the dv(domain validation) work thread to succeed on the other channel
+ *      that maybe occuring at the same time when this function is called.
+ *      Without this lock, the dv would fail when message frames were
+ *      requested during hba bringup on the alternate ioc.
+ */
+static int
+mpt_bringup_adapter(MPT_ADAPTER *ioc, int sleepFlag)
+{
+int r;
+
+	if(ioc->alt_ioc)
+		spin_lock(&ioc->alt_ioc->initializing_hba_lock);
+
+	r = mpt_do_ioc_recovery(ioc, MPT_HOSTEVENT_IOC_BRINGUP,
+	    CAN_SLEEP);
+
+	if(ioc->alt_ioc)
+		spin_unlock(&ioc->alt_ioc->initializing_hba_lock);
+
+return r;
+}
+
+/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+/*
  *	mpt_attach - Install a PCI intelligent MPT adapter.
  *	@pdev: Pointer to pci_dev structure
  *
@@ -1187,6 +1219,7 @@
 	ioc->pcidev = pdev;
 	ioc->diagPending = 0;
 	spin_lock_init(&ioc->diagLock);
+	spin_lock_init(&ioc->initializing_hba_lock);
 
 	/* Initialize the event logging.
 	 */
@@ -1409,8 +1442,7 @@
 	 */
 	mpt_detect_bound_ports(ioc, pdev);
 
-	if ((r = mpt_do_ioc_recovery(ioc,
-	  MPT_HOSTEVENT_IOC_BRINGUP, CAN_SLEEP)) != 0) {
+	if ((r = mpt_bringup_adapter(ioc, CAN_SLEEP)) != 0){
 		printk(KERN_WARNING MYNAM
 		  ": WARNING - %s did not initialize properly! (%d)\n",
 		  ioc->name, r);
@@ -6300,7 +6332,6 @@
 EXPORT_SYMBOL(mpt_free_fw_memory);
 EXPORT_SYMBOL(mptbase_sas_persist_operation);
 
-
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
  *	fusion_init - Fusion MPT base driver initialization routine.
diff -uarN b/drivers/message/fusion/mptbase.h a/drivers/message/fusion/mptbase.h
--- b/drivers/message/fusion/mptbase.h	2005-10-27 18:02:08.000000000 -0600
+++ a/drivers/message/fusion/mptbase.h	2005-11-01 12:08:50.000000000 -0700
@@ -601,6 +601,7 @@
 	int			 DoneCtx;
 	int			 TaskCtx;
 	int			 InternalCtx;
+	spinlock_t		 initializing_hba_lock;
 	struct list_head	 list;
 	struct net_device	*netdev;
 	struct list_head	 sas_topology;
diff -uarN b/drivers/message/fusion/mptscsih.c a/drivers/message/fusion/mptscsih.c
--- b/drivers/message/fusion/mptscsih.c	2005-10-27 18:02:08.000000000 -0600
+++ a/drivers/message/fusion/mptscsih.c	2005-11-01 12:24:27.000000000 -0700
@@ -3549,6 +3549,9 @@
 
 	ddvprintk((MYIOC_s_WARN_FMT "Timer Expired! Cmd %p\n", hd->ioc->name, hd->cmdPtr));
 
+	if(spin_is_locked(&hd->ioc->initializing_hba_lock))
+		spin_unlock(&hd->ioc->initializing_hba_lock);
+
 	if (hd->cmdPtr) {
 		MPIHeader_t *cmd = (MPIHeader_t *)hd->cmdPtr;
 
@@ -3690,7 +3693,7 @@
 	in_isr = in_interrupt();
 	if (in_isr) {
 		dprintk((MYIOC_s_WARN_FMT "Internal SCSI IO request not allowed in ISR context!\n",
-       				hd->ioc->name));
+				hd->ioc->name));
 		return -EPERM;
 	}
 
@@ -3789,11 +3792,14 @@
 		return -EFAULT;
 	}
 
+	spin_lock(&hd->ioc->initializing_hba_lock);
+
 	/* Get and Populate a free Frame
 	 */
 	if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) {
 		ddvprintk((MYIOC_s_WARN_FMT "No msg frames!\n",
 					hd->ioc->name));
+		spin_unlock(&hd->ioc->initializing_hba_lock);
 		return -EBUSY;
 	}
 
@@ -3883,6 +3889,7 @@
 	add_timer(&hd->timer);
 	mpt_put_msg_frame(hd->ioc->InternalCtx, hd->ioc, mf);
 	wait_event(hd->scandv_waitq, hd->scandv_wait_done);
+	spin_unlock(&hd->ioc->initializing_hba_lock);
 
 	if (hd->pLocal) {
 		rc = hd->pLocal->completion;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-11-02 10:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-01 22:08 [PATCH]: Fusion-MPT slowness workaround Moore, Eric Dean
2005-11-01 22:27 ` Chen, Kenneth W
2005-11-02 10:18   ` Martin Devera
  -- strict thread matches above, loose matches on Subject: below --
2005-11-01 19:34 Moore, Eric Dean
2005-11-01 21:39 ` Chen, Kenneth W

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).