summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorGeorge Koehler <gkoehler@cvs.openbsd.org>2024-04-03 19:31:00 +0000
committerGeorge Koehler <gkoehler@cvs.openbsd.org>2024-04-03 19:31:00 +0000
commit2418f5dbbba5b18957d9c8fa47e9cbdf63797f55 (patch)
tree0a37960dc25e98f67160d6e071c6509b6a013047 /sys
parent9fd1f73d56fa2dd2d71dcf9e12bdd79071d2351e (diff)
Initialize earlier macppc's and powerpc64's pmap_hash_lock
At boot, the powerpc64 kernel was calling pmap_bootstrap -> pmap_kenter_pa -> mtx_enter(&pmap_hash_lock) before it did pmap_init -> mtx_init(&pmap_hash_lock, IPL_HIGH) Change from mtx_init to MUTEX_INITIALIZER. This allows an option WITNESS kernel to boot without warning of an uninitialized mutex. Also change macppc's pmap_hash_lock from __ppc_lock_init to PPC_LOCK_INITIALIZER, though WITNESS doesn't see this lock. ok mpi@
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/powerpc/include/mplock.h5
-rw-r--r--sys/arch/powerpc/powerpc/lock_machdep.c9
-rw-r--r--sys/arch/powerpc/powerpc/pmap.c9
-rw-r--r--sys/arch/powerpc64/powerpc64/pmap.c9
4 files changed, 8 insertions, 24 deletions
diff --git a/sys/arch/powerpc/include/mplock.h b/sys/arch/powerpc/include/mplock.h
index 962270e7067..4a7c303d8bb 100644
--- a/sys/arch/powerpc/include/mplock.h
+++ b/sys/arch/powerpc/include/mplock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mplock.h,v 1.5 2021/05/21 00:39:35 gkoehler Exp $ */
+/* $OpenBSD: mplock.h,v 1.6 2024/04/03 19:30:59 gkoehler Exp $ */
/*
* Copyright (c) 2004 Niklas Hallqvist. All rights reserved.
@@ -42,7 +42,8 @@ struct __ppc_lock {
#ifndef _LOCORE
-void __ppc_lock_init(struct __ppc_lock *);
+#define PPC_LOCK_INITIALIZER { NULL, 0 }
+
void __ppc_lock(struct __ppc_lock *);
void __ppc_unlock(struct __ppc_lock *);
diff --git a/sys/arch/powerpc/powerpc/lock_machdep.c b/sys/arch/powerpc/powerpc/lock_machdep.c
index de008c5bfcd..7f1462a18c9 100644
--- a/sys/arch/powerpc/powerpc/lock_machdep.c
+++ b/sys/arch/powerpc/powerpc/lock_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock_machdep.c,v 1.11 2023/04/11 00:45:07 jsg Exp $ */
+/* $OpenBSD: lock_machdep.c,v 1.12 2024/04/03 19:30:59 gkoehler Exp $ */
/*
* Copyright (c) 2021 George Koehler <gkoehler@openbsd.org>
@@ -38,13 +38,6 @@
* Released the lock: mpl->mpl_cpu == NULL
*/
-void
-__ppc_lock_init(struct __ppc_lock *lock)
-{
- lock->mpl_cpu = NULL;
- lock->mpl_count = 0;
-}
-
#if defined(MP_LOCKDEBUG)
#ifndef DDB
#error "MP_LOCKDEBUG requires DDB"
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c
index f160e2e7ed8..fa773114fad 100644
--- a/sys/arch/powerpc/powerpc/pmap.c
+++ b/sys/arch/powerpc/powerpc/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.182 2023/02/21 04:49:43 gkoehler Exp $ */
+/* $OpenBSD: pmap.c,v 1.183 2024/04/03 19:30:59 gkoehler Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -186,9 +186,7 @@ int physmem;
int physmaxaddr;
#ifdef MULTIPROCESSOR
-struct __ppc_lock pmap_hash_lock;
-
-#define PMAP_HASH_LOCK_INIT() __ppc_lock_init(&pmap_hash_lock)
+struct __ppc_lock pmap_hash_lock = PPC_LOCK_INITIALIZER;
#define PMAP_HASH_LOCK(s) \
do { \
@@ -224,7 +222,6 @@ do { \
#else /* ! MULTIPROCESSOR */
-#define PMAP_HASH_LOCK_INIT() /* nothing */
#define PMAP_HASH_LOCK(s) (void)s
#define PMAP_HASH_UNLOCK(s) /* nothing */
@@ -2207,8 +2204,6 @@ pmap_init()
"pted", NULL);
pool_setlowat(&pmap_pted_pool, 20);
- PMAP_HASH_LOCK_INIT();
-
pmap_initialized = 1;
}
diff --git a/sys/arch/powerpc64/powerpc64/pmap.c b/sys/arch/powerpc64/powerpc64/pmap.c
index 3e17df7ec4e..53c2badc438 100644
--- a/sys/arch/powerpc64/powerpc64/pmap.c
+++ b/sys/arch/powerpc64/powerpc64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.60 2023/04/13 15:23:22 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.61 2024/04/03 19:30:59 gkoehler Exp $ */
/*
* Copyright (c) 2015 Martin Pieuchot
@@ -67,9 +67,7 @@ extern char _start[], _etext[], _erodata[], _end[];
#ifdef MULTIPROCESSOR
-struct mutex pmap_hash_lock;
-
-#define PMAP_HASH_LOCK_INIT() mtx_init(&pmap_hash_lock, IPL_HIGH)
+struct mutex pmap_hash_lock = MUTEX_INITIALIZER(IPL_HIGH);
#define PMAP_HASH_LOCK(s) \
do { \
@@ -104,7 +102,6 @@ do { \
#else
-#define PMAP_HASH_LOCK_INIT() /* nothing */
#define PMAP_HASH_LOCK(s) (void)s
#define PMAP_HASH_UNLOCK(s) /* nothing */
@@ -1036,8 +1033,6 @@ pmap_init(void)
"slbd", NULL);
pool_setlowat(&pmap_slbd_pool, 5);
- PMAP_HASH_LOCK_INIT();
-
LIST_INIT(&pmap_kernel()->pm_slbd);
for (i = 0; i < nitems(kernel_slb_desc); i++) {
LIST_INSERT_HEAD(&pmap_kernel()->pm_slbd,