Module Name:    src
Committed By:   mrg
Date:           Tue May 18 04:30:16 UTC 2010

Modified Files:
        src/sys/arch/sparc64/sparc64: cpu.c pmap.c

Log Message:
move the mutex_init() for ci_ctx_lock inside cpu_attach() so that
we don't try to mutex_init() before lockdebug is available.

fixes LOCKDEBUG crashes at startup (for USII systems.)


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/sparc64/sparc64/cpu.c
cvs rdiff -u -r1.263 -r1.264 src/sys/arch/sparc64/sparc64/pmap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/sparc64/sparc64/cpu.c
diff -u src/sys/arch/sparc64/sparc64/cpu.c:1.94 src/sys/arch/sparc64/sparc64/cpu.c:1.95
--- src/sys/arch/sparc64/sparc64/cpu.c:1.94	Sat Mar 13 15:01:53 2010
+++ src/sys/arch/sparc64/sparc64/cpu.c	Tue May 18 04:30:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.94 2010/03/13 15:01:53 nakayama Exp $ */
+/*	$NetBSD: cpu.c,v 1.95 2010/05/18 04:30:16 mrg Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.94 2010/03/13 15:01:53 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.95 2010/05/18 04:30:16 mrg Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -281,6 +281,7 @@
 #endif
 	evcnt_attach_dynamic(&ci->ci_tick_evcnt, EVCNT_TYPE_INTR, NULL,
 			     device_xname(dev), "timer");
+	mutex_init(&ci->ci_ctx_lock, MUTEX_SPIN, IPL_VM);
 
 	clk = prom_getpropint(node, "clock-frequency", 0);
 	if (clk == 0) {

Index: src/sys/arch/sparc64/sparc64/pmap.c
diff -u src/sys/arch/sparc64/sparc64/pmap.c:1.263 src/sys/arch/sparc64/sparc64/pmap.c:1.264
--- src/sys/arch/sparc64/sparc64/pmap.c:1.263	Tue Mar 30 01:50:03 2010
+++ src/sys/arch/sparc64/sparc64/pmap.c	Tue May 18 04:30:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.263 2010/03/30 01:50:03 mrg Exp $	*/
+/*	$NetBSD: pmap.c,v 1.264 2010/05/18 04:30:16 mrg Exp $	*/
 /*
  *
  * Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.263 2010/03/30 01:50:03 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.264 2010/05/18 04:30:16 mrg Exp $");
 
 #undef	NO_VCACHE /* Don't forget the locked TLB in dostart */
 #define	HWREF
@@ -1217,15 +1217,17 @@
 }
 
 /*
- * Initialize the per CPU parts for the cpu running this code (despite the
- * passed cpuinfo).
+ * Initialize the per CPU parts for the cpu running this code.
  */
 void
 cpu_pmap_init(struct cpu_info *ci)
 {
 	size_t ctxsize;
 
-	mutex_init(&ci->ci_ctx_lock, MUTEX_SPIN, IPL_VM);
+	/*
+	 * We delay initialising ci_ctx_lock here as LOCKDEBUG isn't
+	 * running for cpu0 yet..
+	 */
 	ci->ci_pmap_next_ctx = 1;
 #ifdef SUN4V
 #error find out if we have 16 or 13 bit context ids

Reply via email to