Sun Jul 11 01:58:41 2021 UTC ()
Optimized fast-paths for rw_enter() / rw_tryenter() / rw_exit().


(thorpej)
diff -r1.28 -r1.29 src/sys/arch/alpha/alpha/genassym.cf
diff -r1.4 -r1.5 src/sys/arch/alpha/alpha/lock_stubs.s
diff -r1.373 -r1.374 src/sys/arch/alpha/alpha/machdep.c
diff -r1.5 -r1.6 src/sys/arch/alpha/include/rwlock.h

cvs diff -r1.28 -r1.29 src/sys/arch/alpha/alpha/genassym.cf (expand / switch to unified diff)

--- src/sys/arch/alpha/alpha/genassym.cf 2021/07/11 01:54:42 1.28
+++ src/sys/arch/alpha/alpha/genassym.cf 2021/07/11 01:58:41 1.29
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: genassym.cf,v 1.28 2021/07/11 01:54:42 thorpej Exp $ 1# $NetBSD: genassym.cf,v 1.29 2021/07/11 01:58:41 thorpej Exp $
2 2
3# 3#
4# Copyright (c) 1982, 1990, 1993 4# Copyright (c) 1982, 1990, 1993
5# The Regents of the University of California. All rights reserved. 5# The Regents of the University of California. All rights reserved.
6# 6#
7# Redistribution and use in source and binary forms, with or without 7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions 8# modification, are permitted provided that the following conditions
9# are met: 9# are met:
10# 1. Redistributions of source code must retain the above copyright 10# 1. Redistributions of source code must retain the above copyright
11# notice, this list of conditions and the following disclaimer. 11# notice, this list of conditions and the following disclaimer.
12# 2. Redistributions in binary form must reproduce the above copyright 12# 2. Redistributions in binary form must reproduce the above copyright
13# notice, this list of conditions and the following disclaimer in the 13# notice, this list of conditions and the following disclaimer in the
14# documentation and/or other materials provided with the distribution. 14# documentation and/or other materials provided with the distribution.
@@ -56,32 +56,35 @@ @@ -56,32 +56,35 @@
56# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 56# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
57# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 57# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
58# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 58# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
59# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 59# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
60# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 60# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
61# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
62# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
63# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 63# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
64# SUCH DAMAGE. 64# SUCH DAMAGE.
65# 65#
66# from: @(#)genassym.c 8.3 (Berkeley) 1/4/94 66# from: @(#)genassym.c 8.3 (Berkeley) 1/4/94
67# 67#
68 68
 69quote #define __RWLOCK_PRIVATE
 70
69include <sys/param.h> 71include <sys/param.h>
70include <sys/buf.h> 72include <sys/buf.h>
71include <sys/proc.h> 73include <sys/proc.h>
72include <sys/sched.h> 74include <sys/sched.h>
73include <sys/mbuf.h> 75include <sys/mbuf.h>
74include <sys/msgbuf.h> 76include <sys/msgbuf.h>
 77include <sys/rwlock.h>
75include <sys/syscall.h> 78include <sys/syscall.h>
76 79
77include <machine/cpu.h> 80include <machine/cpu.h>
78include <machine/reg.h> 81include <machine/reg.h>
79include <machine/frame.h> 82include <machine/frame.h>
80include <machine/rpb.h> 83include <machine/rpb.h>
81include <machine/vmparam.h> 84include <machine/vmparam.h>
82 85
83include <uvm/uvm_extern.h> 86include <uvm/uvm_extern.h>
84 87
85# general constants  88# general constants
86define VM_MAX_ADDRESS VM_MAX_ADDRESS 89define VM_MAX_ADDRESS VM_MAX_ADDRESS
87define ALPHA_PGBYTES ALPHA_PGBYTES 90define ALPHA_PGBYTES ALPHA_PGBYTES
@@ -186,13 +189,19 @@ define ALPHA_KENTRY_UNA ALPHA_KENTRY_UNA @@ -186,13 +189,19 @@ define ALPHA_KENTRY_UNA ALPHA_KENTRY_UNA
186define ENAMETOOLONG ENAMETOOLONG 189define ENAMETOOLONG ENAMETOOLONG
187define EFAULT EFAULT 190define EFAULT EFAULT
188 191
189# Syscalls called from sigreturn. 192# Syscalls called from sigreturn.
190define SYS_compat_16___sigreturn14 SYS_compat_16___sigreturn14 193define SYS_compat_16___sigreturn14 SYS_compat_16___sigreturn14
191define SYS_exit SYS_exit 194define SYS_exit SYS_exit
192 195
193# CPU info 196# CPU info
194define CPU_INFO_CURLWP offsetof(struct cpu_info, ci_curlwp) 197define CPU_INFO_CURLWP offsetof(struct cpu_info, ci_curlwp)
195define CPU_INFO_IDLE_LWP offsetof(struct cpu_info, ci_data.cpu_idlelwp) 198define CPU_INFO_IDLE_LWP offsetof(struct cpu_info, ci_data.cpu_idlelwp)
196define CPU_INFO_SSIR offsetof(struct cpu_info, ci_ssir) 199define CPU_INFO_SSIR offsetof(struct cpu_info, ci_ssir)
197define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count) 200define CPU_INFO_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
198define CPU_INFO_SIZEOF sizeof(struct cpu_info) 201define CPU_INFO_SIZEOF sizeof(struct cpu_info)
 202
 203# Bits in lock fields
 204define RW_WRITE_WANTED RW_WRITE_WANTED
 205define RW_WRITE_LOCKED RW_WRITE_LOCKED
 206define RW_READ_INCR RW_READ_INCR
 207define RW_READ_COUNT_SHIFT RW_READ_COUNT_SHIFT

cvs diff -r1.4 -r1.5 src/sys/arch/alpha/alpha/lock_stubs.s (expand / switch to unified diff)

--- src/sys/arch/alpha/alpha/lock_stubs.s 2020/09/04 02:54:56 1.4
+++ src/sys/arch/alpha/alpha/lock_stubs.s 2021/07/11 01:58:41 1.5
@@ -1,21 +1,21 @@ @@ -1,21 +1,21 @@
1/* $NetBSD: lock_stubs.s,v 1.4 2020/09/04 02:54:56 thorpej Exp $ */ 1/* $NetBSD: lock_stubs.s,v 1.5 2021/07/11 01:58:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007, 2021 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Andrew Doran. 8 * by Andrew Doran, and by Jason R. Thorpe.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright 15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the 16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution. 17 * documentation and/or other materials provided with the distribution.
18 * 18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include "opt_lockdebug.h" 32#include "opt_lockdebug.h"
33#include "opt_multiprocessor.h" 33#include "opt_multiprocessor.h"
34 34
35#include <machine/asm.h> 35#include <machine/asm.h>
36 36
37__KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.4 2020/09/04 02:54:56 thorpej Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: lock_stubs.s,v 1.5 2021/07/11 01:58:41 thorpej Exp $");
38 38
39#include "assym.h" 39#include "assym.h"
40 40
41#if defined(MULTIPROCESSOR) 41#if defined(MULTIPROCESSOR)
42#define MB mb 42#define MB mb
43#else 43#else
44#define MB /* nothing */ 44#define MB /* nothing */
45#endif 45#endif
46 46
47/* 47/*
48 * int _lock_cas(uintptr_t *ptr, uintptr_t old, uintptr_t new) 48 * int _lock_cas(uintptr_t *ptr, uintptr_t old, uintptr_t new)
49 */ 49 */
50LEAF(_lock_cas, 3) 50LEAF(_lock_cas, 3)
@@ -53,61 +53,217 @@ LEAF(_lock_cas, 3) @@ -53,61 +53,217 @@ LEAF(_lock_cas, 3)
53 ldq_l t1, 0(a0) 53 ldq_l t1, 0(a0)
54 cmpeq t1, a1, t1 54 cmpeq t1, a1, t1
55 beq t1, 2f 55 beq t1, 2f
56 stq_c v0, 0(a0) 56 stq_c v0, 0(a0)
57 beq v0, 3f 57 beq v0, 3f
58 MB  58 MB
59 RET 59 RET
602: 602:
61 mov zero, v0 61 mov zero, v0
62 MB 62 MB
63 RET 63 RET
643: 643:
65 br 1b 65 br 1b
66END(_lock_cas) 66 END(_lock_cas)
67 67
68#if !defined(LOCKDEBUG) 68#if !defined(LOCKDEBUG)
69 69
70/* 70/*
71 * void mutex_enter(kmutex_t *mtx); 71 * void mutex_enter(kmutex_t *mtx);
72 */ 72 */
73LEAF(mutex_enter, 1) 73LEAF(mutex_enter, 1)
74 LDGP(pv) 74 LDGP(pv)
75 GET_CURLWP 75 GET_CURLWP /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
761: 761:
77 mov v0, t1 77 mov v0, t1
78 ldq_l t2, 0(a0) 78 ldq_l t2, 0(a0)
79 bne t2, 2f 79 bne t2, 2f
80 stq_c t1, 0(a0) 80 stq_c t1, 0(a0)
81 beq t1, 3f 81 beq t1, 3f
82 MB 82 MB
83 RET 83 RET
842: 842:
85 lda t12, mutex_vector_enter 85 lda t12, mutex_vector_enter
86 jmp (t12) 86 jmp (t12)
873: 873:
88 br 1b 88 br 1b
89END(mutex_enter) 89 END(mutex_enter)
90 90
91/* 91/*
92 * void mutex_exit(kmutex_t *mtx); 92 * void mutex_exit(kmutex_t *mtx);
93 */ 93 */
94LEAF(mutex_exit, 1) 94LEAF(mutex_exit, 1)
95 LDGP(pv) 95 LDGP(pv)
96 MB 96 MB
97 GET_CURLWP 97 GET_CURLWP /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
98 mov zero, t3 98 mov zero, t3
991: 991:
100 ldq_l t2, 0(a0) 100 ldq_l t2, 0(a0)
101 cmpeq v0, t2, t2 101 cmpeq v0, t2, t2
102 beq t2, 2f 102 beq t2, 2f
103 stq_c t3, 0(a0) 103 stq_c t3, 0(a0)
104 beq t3, 3f 104 beq t3, 3f
105 RET 105 RET
1062: 1062:
107 lda t12, mutex_vector_exit 107 lda t12, mutex_vector_exit
108 jmp (t12) 108 jmp (t12)
1093: 1093:
110 br 1b 110 br 1b
111END(mutex_exit) 111 END(mutex_exit)
 112
 113/*
 114 * void rw_enter(krwlock_t *rwl, krw_t op);
 115 *
 116 * Acquire one hold on a RW lock.
 117 */
 118LEAF(rw_enter, 2)
 119 LDGP(pv)
 120
 121 /*
 122 * RW_READER == 0 (we have a compile-time assert in machdep.c
 123 * to ensure this).
 124 *
 125 * Acquire for read is the most common case.
 126 */
 127 bne a1, 3f
 128
 129 /* Acquiring for read. */
 1301: ldq_l t0, 0(a0)
 131 and t0, (RW_WRITE_LOCKED|RW_WRITE_WANTED), t1
 132 addq t0, RW_READ_INCR, t2
 133 bne t1, 4f /* contended */
 134 stq_c t2, 0(a0)
 135 beq t2, 2f /* STQ_C failed; retry */
 136 MB
 137 RET
 138
 1392: br 1b
 140
 1413: /* Acquiring for write. */
 142 GET_CURLWP /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
 143 ldq_l t0, 0(a0)
 144 or v0, RW_WRITE_LOCKED, t2
 145 bne t0, 4f /* contended */
 146 stq_c t2, 0(a0)
 147 beq t2, 4f /* STQ_C failed; consider it contended */
 148 MB
 149 RET
 150
 1514: lda pv, rw_vector_enter
 152 jmp (pv)
 153 END(rw_enter)
 154
 155/*
 156 * int rw_tryenter(krwlock_t *rwl, krw_t op);
 157 *
 158 * Try to acquire one hold on a RW lock.
 159 */
 160LEAF(rw_tryenter, 2)
 161 LDGP(pv)
 162
 163 /* See above. */
 164 bne a1, 3f
 165
 166 /* Acquiring for read. */
 1671: ldq_l t0, 0(a0)
 168 and t0, (RW_WRITE_LOCKED|RW_WRITE_WANTED), t1
 169 addq t0, RW_READ_INCR, v0
 170 bne t1, 4f /* contended */
 171 stq_c v0, 0(a0)
 172 beq v0, 2f /* STQ_C failed; retry */
 173 MB
 174 RET /* v0 contains non-zero LOCK_FLAG from STQ_C */
 175
 1762: br 1b
 177
 178 /* Acquiring for write. */
 1793: GET_CURLWP /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
 180 ldq_l t0, 0(a0)
 181 or v0, RW_WRITE_LOCKED, v0
 182 bne t0, 4f /* contended */
 183 stq_c v0, 0(a0)
 184 /*
 185 * v0 now contains the LOCK_FLAG value from STQ_C, which is either
 186 * 0 for failure, or non-zero for success. In either case, v0's
 187 * value is correct. Go ahead and perform the memory barrier even
 188 * in the failure case because we expect it to be rare and it saves
 189 * a branch-not-taken instruction in the success case.
 190 */
 191 MB
 192 RET
 193
 1944: mov zero, v0 /* return 0 (failure) */
 195 RET
 196 END(rw_tryenter)
 197
 198/*
 199 * void rw_exit(krwlock_t *rwl);
 200 *
 201 * Release one hold on a RW lock.
 202 */
 203LEAF(rw_exit, 1)
 204 LDGP(pv)
 205 MB
 206
 207 /*
 208 * Check for write-lock release, and get the owner/count field
 209 * on its own for sanity-checking against expected values.
 210 */
 211 ldq a1, 0(a0)
 212 and a1, RW_WRITE_LOCKED, t1
 213 srl a1, RW_READ_COUNT_SHIFT, a2
 214 bne t1, 3f
 215
 216 /*
 217 * Releasing a read-lock. Make sure the count is non-zero.
 218 * If it is zero, take the slow path where the juicy diagnostic
 219 * checks are located.
 220 */
 221 beq a2, 4f
 222
 223 /*
 224 * We do the following trick to check to see if we're releasing
 225 * the last read-count and there are waiters:
 226 *
 227 * 1. Set v0 to 1.
 228 * 2. Shift the new read count into t1.
 229 * 3. Conditally move t1 to v0 based on low-bit-set of t0
 230 * (RW_HAS_WAITERS). If RW_HAS_WAITERS is not set, then
 231 * the move will not take place, and v0 will remain 1.
 232 * Otherwise, v0 will contain the updated read count.
 233 * 4. Jump to slow path if v0 == 0.
 234 */
 2351: ldq_l t0, 0(a0)
 236 ldiq v0, 1
 237 subq t0, RW_READ_INCR, t2
 238 srl t2, RW_READ_COUNT_SHIFT, t1
 239 cmovlbs t0, t1, v0
 240 beq v0, 4f
 241 stq_c t2, 0(a0)
 242 beq t2, 2f /* STQ_C failed; try again */
 243 RET
 244
 2452: br 1b
 246
 247 /*
 248 * Releasing a write-lock. Make sure the owner field points
 249 * to our LWP. If it does not, take the slow path where the
 250 * juicy diagnostic checks are located. a2 contains the owner
 251 * field shifted down. Shift it back up to compare to curlwp;
 252 * this conveniently discards the bits we don't want to compare.
 253 */
 2543: GET_CURLWP /* Note: GET_CURLWP clobbers v0, t0, t8...t11. */
 255 sll a2, RW_READ_COUNT_SHIFT, a2
 256 mov zero, t2 /* fast-path write-unlock stores NULL */
 257 cmpeq v0, a2, v0 /* v0 = (owner == curlwp) */
 258 ldq_l t0, 0(a0)
 259 beq v0, 4f /* owner field mismatch; need slow path */
 260 blbs t0, 4f /* RW_HAS_WAITERS set; need slow-path */
 261 stq_c t2, 0(a0)
 262 beq t2, 4f /* STQ_C failed; need slow-path */
 263 RET
 264
 2654: lda pv, rw_vector_exit
 266 jmp (pv)
 267 END(rw_exit)
112 268
113#endif /* !LOCKDEBUG */ 269#endif /* !LOCKDEBUG */

cvs diff -r1.373 -r1.374 src/sys/arch/alpha/alpha/machdep.c (expand / switch to unified diff)

--- src/sys/arch/alpha/alpha/machdep.c 2021/07/04 22:42:35 1.373
+++ src/sys/arch/alpha/alpha/machdep.c 2021/07/11 01:58:41 1.374
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: machdep.c,v 1.373 2021/07/04 22:42:35 thorpej Exp $ */ 1/* $NetBSD: machdep.c,v 1.374 2021/07/11 01:58:41 thorpej Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998, 1999, 2000, 2019, 2020 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, 8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center and by Chris G. Demetriou. 9 * NASA Ames Research Center and by Chris G. Demetriou.
10 * 10 *
11 * Redistribution and use in source and binary forms, with or without 11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions 12 * modification, are permitted provided that the following conditions
13 * are met: 13 * are met:
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -55,29 +55,31 @@ @@ -55,29 +55,31 @@
55 * 55 *
56 * any improvements or extensions that they make and grant Carnegie the 56 * any improvements or extensions that they make and grant Carnegie the
57 * rights to redistribute these changes. 57 * rights to redistribute these changes.
58 */ 58 */
59 59
60#include "opt_ddb.h" 60#include "opt_ddb.h"
61#include "opt_kgdb.h" 61#include "opt_kgdb.h"
62#include "opt_modular.h" 62#include "opt_modular.h"
63#include "opt_multiprocessor.h" 63#include "opt_multiprocessor.h"
64#include "opt_dec_3000_300.h" 64#include "opt_dec_3000_300.h"
65#include "opt_dec_3000_500.h" 65#include "opt_dec_3000_500.h"
66#include "opt_execfmt.h" 66#include "opt_execfmt.h"
67 67
 68#define __RWLOCK_PRIVATE
 69
68#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 70#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
69 71
70__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.373 2021/07/04 22:42:35 thorpej Exp $"); 72__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.374 2021/07/11 01:58:41 thorpej Exp $");
71 73
72#include <sys/param.h> 74#include <sys/param.h>
73#include <sys/systm.h> 75#include <sys/systm.h>
74#include <sys/signalvar.h> 76#include <sys/signalvar.h>
75#include <sys/kernel.h> 77#include <sys/kernel.h>
76#include <sys/cpu.h> 78#include <sys/cpu.h>
77#include <sys/proc.h> 79#include <sys/proc.h>
78#include <sys/ras.h> 80#include <sys/ras.h>
79#include <sys/sched.h> 81#include <sys/sched.h>
80#include <sys/reboot.h> 82#include <sys/reboot.h>
81#include <sys/device.h> 83#include <sys/device.h>
82#include <sys/module.h> 84#include <sys/module.h>
83#include <sys/mman.h> 85#include <sys/mman.h>
@@ -85,26 +87,27 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v  @@ -85,26 +87,27 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v
85#include <sys/ioctl.h> 87#include <sys/ioctl.h>
86#include <sys/tty.h> 88#include <sys/tty.h>
87#include <sys/exec.h> 89#include <sys/exec.h>
88#include <sys/exec_aout.h> /* for MID_* */ 90#include <sys/exec_aout.h> /* for MID_* */
89#include <sys/exec_ecoff.h> 91#include <sys/exec_ecoff.h>
90#include <sys/core.h> 92#include <sys/core.h>
91#include <sys/kcore.h> 93#include <sys/kcore.h>
92#include <sys/ucontext.h> 94#include <sys/ucontext.h>
93#include <sys/conf.h> 95#include <sys/conf.h>
94#include <sys/ksyms.h> 96#include <sys/ksyms.h>
95#include <sys/kauth.h> 97#include <sys/kauth.h>
96#include <sys/atomic.h> 98#include <sys/atomic.h>
97#include <sys/cpu.h> 99#include <sys/cpu.h>
 100#include <sys/rwlock.h>
98 101
99#include <machine/kcore.h> 102#include <machine/kcore.h>
100#include <machine/fpu.h> 103#include <machine/fpu.h>
101 104
102#include <sys/mount.h> 105#include <sys/mount.h>
103#include <sys/syscallargs.h> 106#include <sys/syscallargs.h>
104 107
105#include <uvm/uvm.h> 108#include <uvm/uvm.h>
106#include <sys/sysctl.h> 109#include <sys/sysctl.h>
107 110
108#include <dev/cons.h> 111#include <dev/cons.h>
109#include <dev/mm.h> 112#include <dev/mm.h>
110 113
@@ -123,26 +126,30 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v  @@ -123,26 +126,30 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v
123#include <ddb/db_interface.h> 126#include <ddb/db_interface.h>
124#endif 127#endif
125 128
126#ifdef KGDB 129#ifdef KGDB
127#include <sys/kgdb.h> 130#include <sys/kgdb.h>
128#endif 131#endif
129 132
130#ifdef DEBUG 133#ifdef DEBUG
131#include <machine/sigdebug.h> 134#include <machine/sigdebug.h>
132int sigdebug = 0x0; 135int sigdebug = 0x0;
133int sigpid = 0; 136int sigpid = 0;
134#endif 137#endif
135 138
 139/* Assert some assumptions made in lock_stubs.s */
 140__CTASSERT(RW_READER == 0);
 141__CTASSERT(RW_HAS_WAITERS == 1);
 142
136#include <machine/alpha.h> 143#include <machine/alpha.h>
137 144
138#include "ksyms.h" 145#include "ksyms.h"
139 146
140struct vm_map *phys_map = NULL; 147struct vm_map *phys_map = NULL;
141 148
142void *msgbufaddr; 149void *msgbufaddr;
143 150
144int maxmem; /* max memory per process */ 151int maxmem; /* max memory per process */
145 152
146int totalphysmem; /* total amount of physical memory in system */ 153int totalphysmem; /* total amount of physical memory in system */
147int resvmem; /* amount of memory reserved for PROM */ 154int resvmem; /* amount of memory reserved for PROM */
148int unusedmem; /* amount of memory for OS that we don't use */ 155int unusedmem; /* amount of memory for OS that we don't use */

cvs diff -r1.5 -r1.6 src/sys/arch/alpha/include/rwlock.h (expand / switch to unified diff)

--- src/sys/arch/alpha/include/rwlock.h 2019/11/29 20:04:52 1.5
+++ src/sys/arch/alpha/include/rwlock.h 2021/07/11 01:58:41 1.6