Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc64/sparc64 move the mutex_init() for ci_ctx_lo...



details:   https://anonhg.NetBSD.org/src/rev/e862c0936390
branches:  trunk
changeset: 754963:e862c0936390
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue May 18 04:30:16 2010 +0000

description:
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.)

diffstat:

 sys/arch/sparc64/sparc64/cpu.c  |   5 +++--
 sys/arch/sparc64/sparc64/pmap.c |  12 +++++++-----
 2 files changed, 10 insertions(+), 7 deletions(-)

diffs (65 lines):

diff -r a7780702d482 -r e862c0936390 sys/arch/sparc64/sparc64/cpu.c
--- a/sys/arch/sparc64/sparc64/cpu.c    Mon May 17 23:09:52 2010 +0000
+++ b/sys/arch/sparc64/sparc64/cpu.c    Tue May 18 04:30:16 2010 +0000
@@ -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) {
diff -r a7780702d482 -r e862c0936390 sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c   Mon May 17 23:09:52 2010 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c   Tue May 18 04:30:16 2010 +0000
@@ -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



Home | Main Index | Thread Index | Old Index