changeset 12681:2d92cdff89ce

6923628 system panic with genunix:timeout_generic while booting up
author Peter Telford <Peter.Telford@Sun.COM>
date Thu, 24 Jun 2010 01:30:17 -0700
parents 84a6540d6278
children c1fa75665a52
files usr/src/uts/common/os/callout.c usr/src/uts/common/os/kmem.c
diffstat 2 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/os/callout.c	Wed Jun 23 17:20:35 2010 -0700
+++ b/usr/src/uts/common/os/callout.c	Thu Jun 24 01:30:17 2010 -0700
@@ -19,8 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
  */
 
 #include <sys/callo.h>
@@ -37,6 +36,8 @@
 #include <sys/sysmacros.h>
 #include <sys/sdt.h>
 
+int callout_init_done;				/* useful during boot */
+
 /*
  * Callout tables.  See timeout(9F) for details.
  */
@@ -2190,4 +2191,7 @@
 	callout_boot_ct = &callout_table[CALLOUT_TABLE(0, CPU->cpu_seqid)];
 	callout_cpu_online(CPU);
 	mutex_exit(&cpu_lock);
+
+	/* heads-up to boot-time clients that timeouts now available */
+	callout_init_done = 1;
 }
--- a/usr/src/uts/common/os/kmem.c	Wed Jun 23 17:20:35 2010 -0700
+++ b/usr/src/uts/common/os/kmem.c	Thu Jun 24 01:30:17 2010 -0700
@@ -832,6 +832,7 @@
 extern void streams_msg_init(void);
 extern int segkp_fromheap;
 extern void segkp_cache_free(void);
+extern int callout_init_done;
 
 struct kmem_cache_kstat {
 	kstat_named_t	kmc_buf_size;
@@ -3124,7 +3125,12 @@
 static void
 kmem_reap_done(void *flag)
 {
-	(void) timeout(kmem_reap_timeout, flag, kmem_reap_interval);
+	if (!callout_init_done) {
+		/* can't schedule a timeout at this point */
+		kmem_reap_timeout(flag);
+	} else {
+		(void) timeout(kmem_reap_timeout, flag, kmem_reap_interval);
+	}
 }
 
 static void