changeset 13176:f48649d19a4e

6976415 Console commands "reset panic" + sync cause panic dump timeout on M4000 and M5000
author Dave Plauger <Dave.Plauger@Sun.COM>
date Wed, 18 Aug 2010 15:20:51 -0400
parents 9747db92c2e8
children f3dd638d3435
files usr/src/uts/common/os/dumpsubr.c usr/src/uts/sun4/os/startup.c
diffstat 2 files changed, 33 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/os/dumpsubr.c	Wed Aug 18 13:14:20 2010 -0600
+++ b/usr/src/uts/common/os/dumpsubr.c	Wed Aug 18 15:20:51 2010 -0400
@@ -412,7 +412,6 @@
 	char	*maxvm;		/* reserved VM for spare pages */
 	lock_t	helper_lock;	/* protect helper state */
 	char	helpers_wanted;	/* flag to enable parallelism */
-	char	helper_present;	/* at least one helper showed up */
 } dumpcfg_t;
 
 static dumpcfg_t dumpcfg;	/* config vars */
@@ -883,15 +882,10 @@
 	int k;
 
 	/*
-	 * Fall back to doing a serial dump if no helpers showed
-	 * up. It is possible for other CPUs to be stuck in PROM, or
-	 * DRd out. panic("sync initiated") in sync_handler() is one
-	 * case. A parallel dump will hang (dump time out) unless
-	 * there is at least one helper CPU. At this point dumpsys()
-	 * has done some I/O, which means there has been plenty of
-	 * time for helpers to arrive.
+	 * Setting dump_plat_mincpu to 0 at any time forces a serial
+	 * dump.
 	 */
-	if (!cfg->helper_present) {
+	if (dump_plat_mincpu == 0) {
 		cfg->clevel = 0;
 		return;
 	}
@@ -2189,8 +2183,6 @@
 void
 dumpsys_helper()
 {
-	if (!dumpcfg.helper_present)
-		dumpcfg.helper_present = 1;
 	dumpsys_spinlock(&dumpcfg.helper_lock);
 	if (dumpcfg.helpers_wanted) {
 		helper_t *hp, *hpend = &dumpcfg.helper[dumpcfg.nhelper];
@@ -2229,8 +2221,6 @@
 void
 dumpsys_helper_nw()
 {
-	if (!dumpcfg.helper_present)
-		dumpcfg.helper_present = 1;
 	if (dumpcfg.helpers_wanted)
 		dumpsys_helper();
 }
@@ -2295,7 +2285,29 @@
 	cbuf_t *cp;
 	pgcnt_t baseoff, pfnoff;
 	pfn_t base, pfn;
-	int sec;
+	int sec, i, dumpserial;
+
+	/*
+	 * Fall back to serial mode if there are no helpers.
+	 * dump_plat_mincpu can be set to 0 at any time.
+	 * dumpcfg.helpermap must contain at least one member.
+	 */
+	dumpserial = 1;
+
+	if (dump_plat_mincpu != 0 && dumpcfg.clevel != 0) {
+		for (i = 0; i < BT_BITOUL(NCPU); ++i) {
+			if (dumpcfg.helpermap[i] != 0) {
+				dumpserial = 0;
+				break;
+			}
+		}
+	}
+
+	if (dumpserial) {
+		dumpcfg.clevel = 0;
+		if (dumpcfg.helper[0].lzbuf == NULL)
+			dumpcfg.helper[0].lzbuf = dumpcfg.helper[1].page;
+	}
 
 	dump_init_memlist_walker(&mlw);
 
@@ -2430,7 +2442,7 @@
 			 * If there are no helpers the main task does
 			 * non-streams lzjb compress.
 			 */
-			if (dumpcfg.clevel == 0) {
+			if (dumpserial) {
 				dumpsys_lzjb_page(dumpcfg.helper, cp);
 				break;
 			}
--- a/usr/src/uts/sun4/os/startup.c	Wed Aug 18 13:14:20 2010 -0600
+++ b/usr/src/uts/sun4/os/startup.c	Wed Aug 18 15:20:51 2010 -0400
@@ -55,6 +55,7 @@
 #include <sys/cpu_sgnblk_defs.h>
 #include <sys/clock.h>
 #include <sys/cmn_err.h>
+#include <sys/dumphdr.h>
 #include <sys/promif.h>
 #include <sys/prom_debug.h>
 #include <sys/traptrace.h>
@@ -626,6 +627,11 @@
 	}
 
 	/*
+	 * Force a serial dump, since there are no CPUs to help.
+	 */
+	dump_plat_mincpu = 0;
+
+	/*
 	 * We've managed to get here without going through the
 	 * normal panic code path. Try and save some useful
 	 * information.