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.)
This commit is contained in:
mrg 2010-05-18 04:30:16 +00:00
parent 4151797e7b
commit 121098a3ec
2 changed files with 10 additions and 7 deletions

View File

@ -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 @@ cpu_attach(struct device *parent, struct device *dev, void *aux)
#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) {

View File

@ -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 @@ cpu_pmap_prepare(struct cpu_info *ci, bool initial)
}
/*
* 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