diff options
author | Kurt Miller <kurt@cvs.openbsd.org> | 2023-05-25 19:32:35 +0000 |
---|---|---|
committer | Kurt Miller <kurt@cvs.openbsd.org> | 2023-05-25 19:32:35 +0000 |
commit | 387a52cad3078ab991ff6b21c12cb842a92e2f2b (patch) | |
tree | a5398f96d789cc624b45e610e9f5d04d75d00b8c | |
parent | c54adb2f5c93bc00c6dca504f31f3af55c58008e (diff) |
Work around sparc64 WITNESS kernel failing to load by moving large witness
data structures from bss to be allocated in witness_initialize().
Tested on sparc64, amd64, arm64, i386, octeon. okay miod@
-rw-r--r-- | sys/arch/sparc64/conf/GENERIC.MP | 3 | ||||
-rw-r--r-- | sys/kern/subr_witness.c | 16 |
2 files changed, 14 insertions, 5 deletions
diff --git a/sys/arch/sparc64/conf/GENERIC.MP b/sys/arch/sparc64/conf/GENERIC.MP index f3c03f0250b..8bdbd890ab3 100644 --- a/sys/arch/sparc64/conf/GENERIC.MP +++ b/sys/arch/sparc64/conf/GENERIC.MP @@ -1,9 +1,10 @@ -# $OpenBSD: GENERIC.MP,v 1.4 2008/07/12 14:26:07 kettenis Exp $ +# $OpenBSD: GENERIC.MP,v 1.5 2023/05/25 19:32:34 kurt Exp $ include "arch/sparc64/conf/GENERIC" option MULTIPROCESSOR #option MP_LOCKDEBUG +#option WITNESS cpu* at mainbus? cpu* at ssm? diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 0483034d1b2..ea61adb6388 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_witness.c,v 1.48 2022/02/21 14:16:49 jsg Exp $ */ +/* $OpenBSD: subr_witness.c,v 1.49 2023/05/25 19:32:34 kurt Exp $ */ /*- * Copyright (c) 2008 Isilon Systems, Inc. @@ -413,11 +413,11 @@ static int w_free_cnt, w_spin_cnt, w_sleep_cnt; static struct witness *w_data; static uint8_t **w_rmatrix; -static struct lock_list_entry w_locklistdata[LOCK_CHILDCOUNT]; +static struct lock_list_entry *w_locklistdata; static struct witness_hash w_hash; /* The witness hash table. */ /* The lock order data hash */ -static struct witness_lock_order_data w_lodata[WITNESS_LO_DATA_COUNT]; +static struct witness_lock_order_data *w_lodata; static struct witness_lock_order_data *w_lofree = NULL; static struct witness_lock_order_hash w_lohash; static int w_max_used_index = 0; @@ -523,6 +523,11 @@ witness_initialize(void) w_lock_stack_num); } + w_locklistdata = (void *)uvm_pageboot_alloc( + sizeof(struct lock_list_entry) * LOCK_CHILDCOUNT); + memset(w_locklistdata, 0, sizeof(struct lock_list_entry) * + LOCK_CHILDCOUNT); + s = splhigh(); for (i = 0; i < w_lock_stack_num; i++) witness_lock_stack_free(&stacks[i]); @@ -2339,9 +2344,12 @@ witness_init_hash_tables(void) w_hash.wh_count = 0; /* Initialize the lock order data hash. */ + w_lodata = (void *)uvm_pageboot_alloc( + sizeof(struct witness_lock_order_data) * WITNESS_LO_DATA_COUNT); + memset(w_lodata, 0, sizeof(struct witness_lock_order_data) * + WITNESS_LO_DATA_COUNT); w_lofree = NULL; for (i = 0; i < WITNESS_LO_DATA_COUNT; i++) { - memset(&w_lodata[i], 0, sizeof(w_lodata[i])); w_lodata[i].wlod_next = w_lofree; w_lofree = &w_lodata[i]; } |