changeset 12814:a8452a8c20f8

6943714 sparc fast reboot should not kmem_alloc(...KM_SLEEP) when single-threaded
author Justin Frank <Justin.Frank@Sun.COM>
date Fri, 09 Jul 2010 08:57:07 -0700
parents 68042e79fb9c
children f5ee6337750c
files usr/src/uts/sun4u/os/mach_cpu_states.c
diffstat 1 files changed, 17 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/sun4u/os/mach_cpu_states.c	Thu Jul 08 19:44:07 2010 -0600
+++ b/usr/src/uts/sun4u/os/mach_cpu_states.c	Fri Jul 09 08:57:07 2010 -0700
@@ -163,19 +163,25 @@
 			} else {
 				dllen = prom_getproplen(onode, "diag-level");
 				if (dllen != -1) {
-					int newstrlen;
 					char *newstr = kmem_alloc(strlen(
-					    bootstr) + dllen + 5, KM_SLEEP);
-					(void) strcpy(newstr, bootstr);
-					(void) strcat(newstr, " -f ");
-					newstrlen = strlen(bootstr) + 4;
-					(void) prom_getprop(onode, "diag-level",
-					    (caddr_t)&(newstr[newstrlen]));
-					newstr[newstrlen + dllen] = '\0';
-					bootstr = newstr;
+					    bootstr) + dllen + 5, KM_NOSLEEP);
+					if (newstr != NULL) {
+						int newstrlen;
+						(void) strcpy(newstr, bootstr);
+						(void) strcat(newstr, " -f ");
+						newstrlen = strlen(bootstr) + 4;
+						(void) prom_getprop(onode,
+						    "diag-level",
+						    (caddr_t)
+						    &(newstr[newstrlen]));
+						newstr[newstrlen + dllen] =
+						    '\0';
+						bootstr = newstr;
+						(void) prom_setprop(onode,
+						    "diag-level",
+						    "off", 4);
+					}
 				}
-				(void) prom_setprop(onode, "diag-level",
-				    "off", 4);
 			}
 		}
 		reboot_machine(bootstr);