9695 Slow crash dumps, significantly slower than live core
Reviewed by: Dan Fields <dan.fields@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Rick McNeal <rick.mcneal@nexenta.com>
Reviewed by: Sanjay Nadkarni <sanjay.nadkarni@nexenta.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
diff --git a/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c b/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c
index fd8d417..0018a13 100644
--- a/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c
+++ b/usr/src/uts/common/io/mr_sas/mr_sas_tbolt.c
@@ -16,7 +16,7 @@
  */
 
 /*
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.
  * Copyright 2015, 2017 Citrus IT Limited. All rights reserved.
  * Copyright 2015 Garrett D'Amore <garrett@damore.org>
  */
@@ -52,7 +52,7 @@
 extern struct ddi_device_acc_attr endian_attr;
 extern int	debug_level_g;
 extern unsigned int	enable_fp;
-volatile int dump_io_wait_time = 90;
+volatile int dump_io_wait_time = 900;
 extern volatile int  debug_timeout_g;
 extern int	mrsas_issue_pending_cmds(struct mrsas_instance *);
 extern int mrsas_complete_pending_cmds(struct mrsas_instance *instance);
@@ -1108,7 +1108,7 @@
 		if (instance->fw_outstanding <= 2) {
 			break;
 		}
-		drv_usecwait(10*MILLISEC);
+		drv_usecwait(MILLISEC);
 		/* complete commands from reply queue */
 		(void) mr_sas_tbolt_process_outstanding_cmd(instance);
 	}
diff --git a/usr/src/uts/common/io/sata/adapters/ahci/ahci.c b/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
index d9e083a..10e71db 100644
--- a/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
+++ b/usr/src/uts/common/io/sata/adapters/ahci/ahci.c
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
  */
 
 /*
@@ -1143,7 +1143,7 @@
  */
 static int
 ahci_getinfo(dev_info_t *dip, ddi_info_cmd_t infocmd,
-		    void *arg, void **result)
+    void *arg, void **result)
 {
 #ifndef __lock_lint
 	_NOTE(ARGUNUSED(dip))
@@ -1815,15 +1815,19 @@
 		    drv_usectohz((clock_t)spkt->satapkt_time * 1000000);
 
 		while (spkt->satapkt_reason == SATA_PKT_BUSY) {
-			mutex_exit(&ahci_portp->ahciport_mutex);
-
 			/* Simulate the interrupt */
+			mutex_exit(&ahci_portp->ahciport_mutex);
 			ahci_port_intr(ahci_ctlp, ahci_portp, port);
-
-			drv_usecwait(AHCI_10MS_USECS);
-
 			mutex_enter(&ahci_portp->ahciport_mutex);
-			pkt_timeout_ticks -= AHCI_10MS_TICKS;
+
+			if (spkt->satapkt_reason != SATA_PKT_BUSY)
+				break;
+
+			mutex_exit(&ahci_portp->ahciport_mutex);
+			drv_usecwait(AHCI_1MS_USECS);
+			mutex_enter(&ahci_portp->ahciport_mutex);
+
+			pkt_timeout_ticks -= AHCI_1MS_TICKS;
 			if (pkt_timeout_ticks < 0) {
 				cmn_err(CE_WARN, "!ahci%d: ahci_do_sync_start "
 				    "port %d satapkt 0x%p timed out\n",
@@ -1835,6 +1839,7 @@
 				mutex_enter(&ahci_portp->ahciport_mutex);
 			}
 		}
+
 		ahci_portp->ahciport_flags &= ~AHCI_PORT_FLAG_POLLING;
 		return (AHCI_SUCCESS);