4350779 Data_Corruption: ghd driver depends on soft interrupts, does not support panic s
authorzk194757
Thu, 31 Jul 2008 13:48:05 -0700
changeset 7239 3fe36bbefb8f
parent 7238 af0f33320dfb
child 7240 c4957ab6a78e
4350779 Data_Corruption: ghd driver depends on soft interrupts, does not support panic s 6727966 dadk packet callback should not retry IO when panicking 6728416 SPARC ghd framework should not use soft interrupts when panicking
usr/src/uts/intel/io/dktp/dcdev/dadk.c
usr/src/uts/intel/io/dktp/hba/ghd/ghd.c
--- a/usr/src/uts/intel/io/dktp/dcdev/dadk.c	Thu Jul 31 13:35:50 2008 -0700
+++ b/usr/src/uts/intel/io/dktp/dcdev/dadk.c	Thu Jul 31 13:48:05 2008 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -247,7 +247,7 @@
 
 static struct modlmisc modlmisc = {
 	&mod_miscops,	/* Type of module */
-	"Direct Attached Disk %I%"
+	"Direct Attached Disk"
 };
 
 static struct modlinkage modlinkage = {
@@ -1341,6 +1341,14 @@
 	if (action == JUST_RETURN)
 		return;
 
+	/*
+	 * If we are panicking don't retry the command
+	 * just fail it so we can go down completing all
+	 * of the buffers.
+	 */
+	if (ddi_in_panic() && action == QUE_COMMAND)
+		action = COMMAND_DONE_ERROR;
+
 	if (action != COMMAND_DONE) {
 		if ((dadk_ioretry(pktp, action)) == JUST_RETURN)
 			return;
--- a/usr/src/uts/intel/io/dktp/hba/ghd/ghd.c	Thu Jul 31 13:35:50 2008 -0700
+++ b/usr/src/uts/intel/io/dktp/hba/ghd/ghd.c	Thu Jul 31 13:48:05 2008 -0700
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -161,8 +161,17 @@
 	mutex_exit(doneq_mutexp);
 
 	/* trigger software interrupt for the completion callbacks */
-	if (!L2_EMPTY(&cccp->ccc_doneq))
-		ddi_trigger_softintr(cccp->ccc_doneq_softid);
+	if (!L2_EMPTY(&cccp->ccc_doneq)) {
+		/*
+		 * If we are panicking we should just call the completion
+		 * function directly as we can not use soft interrupts
+		 * or timeouts during panic.
+		 */
+		if (!ddi_in_panic())
+			ddi_trigger_softintr(cccp->ccc_doneq_softid);
+		else
+			(void) ghd_doneq_process((caddr_t)cccp);
+	}
 }
 
 
@@ -392,7 +401,7 @@
 	mutex_enter(hba_mutexp);
 
 	GDBG_INTR(("ghd_intr(): cccp=0x%p status=0x%p\n",
-		cccp, intr_status));
+	    cccp, intr_status));
 
 	for (;;) {
 		more = FALSE;
@@ -414,7 +423,7 @@
 			continue;
 		}
 		GDBG_INTR(("ghd_intr(): done cccp=0x%p status=0x%p rc %d\n",
-			cccp, intr_status, rc));
+		    cccp, intr_status, rc));
 		/*
 		 * Release the mutexes in the opposite order that they
 		 * were acquired to prevent requests queued by
@@ -635,7 +644,7 @@
 
 	/* wait for the device to go idle */
 	rc = ghd_poll(cccp, GHD_POLL_DEVICE, ghd_tran_abort_lun_timeout,
-		NULL, gtgtp, intr_status);
+	    NULL, gtgtp, intr_status);
 
 	ghd_doneq_pollmode_exit(cccp);
 
@@ -669,7 +678,7 @@
 
 	/* wait for the device to reset */
 	rc = ghd_poll(cccp, GHD_POLL_DEVICE, ghd_tran_reset_target_timeout,
-		NULL, gtgtp, intr_status);
+	    NULL, gtgtp, intr_status);
 
 	ghd_doneq_pollmode_exit(cccp);
 
@@ -703,7 +712,7 @@
 	 * Wait for all active requests on this HBA to complete
 	 */
 	rc = ghd_poll(cccp, GHD_POLL_ALL, ghd_tran_reset_bus_timeout,
-		NULL, NULL, intr_status);
+	    NULL, NULL, intr_status);
 
 
 	ghd_doneq_pollmode_exit(cccp);
@@ -736,8 +745,8 @@
 		mutex_enter(&cccp->ccc_hba_mutex);
 
 		GDBG_START(("ghd_transport: polled"
-			" cccp 0x%p gdevp 0x%p gtgtp 0x%p gcmdp 0x%p\n",
-				cccp, gdevp, gtgtp, gcmdp));
+		    " cccp 0x%p gdevp 0x%p gtgtp 0x%p gcmdp 0x%p\n",
+		    cccp, gdevp, gtgtp, gcmdp));
 
 		/*
 		 * Lock the doneq so no other thread flushes the Q.
@@ -747,8 +756,8 @@
 #if defined(GHD_DEBUG) || defined(__lint)
 	else {
 		GDBG_START(("ghd_transport: non-polled"
-			" cccp 0x%p gdevp 0x%p gtgtp 0x%p gcmdp 0x%p\n",
-				cccp, gdevp, gtgtp, gcmdp));
+		    " cccp 0x%p gdevp 0x%p gtgtp 0x%p gcmdp 0x%p\n",
+		    cccp, gdevp, gtgtp, gcmdp));
 	}
 #endif
 	/*
@@ -851,7 +860,7 @@
 
 		mutex_enter(&cccp->ccc_reset_notify_mutex);
 		for (rnp = (ghd_reset_notify_list_t *)
-			L2_next(&cccp->ccc_reset_notify_list);
+		    L2_next(&cccp->ccc_reset_notify_list);
 		    rnp != NULL;
 		    rnp = (ghd_reset_notify_list_t *)L2_next(&rnp->l2_link)) {
 			if (rnp->gtgtp == gtgtp &&