| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: KERNEL_LOCK.9,v 1.1 2022/02/15 22:46:29 riastradh Exp $ | | 1 | .\" $NetBSD: KERNEL_LOCK.9,v 1.2 2022/02/15 22:58:25 wiz Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2022 The NetBSD Foundation, Inc. | | 3 | .\" Copyright (c) 2022 The NetBSD Foundation, Inc. |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" | | 14 | .\" |
| @@ -139,27 +139,27 @@ can allow another CPU to run and change | | | @@ -139,27 +139,27 @@ can allow another CPU to run and change |
139 | mutex_enter(...); | | 139 | mutex_enter(...); |
140 | ... | | 140 | ... |
141 | mutex_exit(...); | | 141 | mutex_exit(...); |
142 | KASSERT(x == 42); | | 142 | KASSERT(x == 42); |
143 | KERNEL_UNLOCK_ONE(NULL); | | 143 | KERNEL_UNLOCK_ONE(NULL); |
144 | .Ed | | 144 | .Ed |
145 | .Pp | | 145 | .Pp |
146 | This means simply introducing calls to | | 146 | This means simply introducing calls to |
147 | .Xr mutex_enter 9 | | 147 | .Xr mutex_enter 9 |
148 | and | | 148 | and |
149 | .Xr mutex_exit 9 | | 149 | .Xr mutex_exit 9 |
150 | can break kernel-locked assumptions. | | 150 | can break kernel-locked assumptions. |
151 | Subsystems need to be consistently converted from | | 151 | Subsystems need to be consistently converted from |
152 | .Xr KERNEL_LOCK 9 | | 152 | .Nm |
153 | and | | 153 | and |
154 | .Xr spl 9 | | 154 | .Xr spl 9 |
155 | to | | 155 | to |
156 | .Xr mutex 9 , | | 156 | .Xr mutex 9 , |
157 | .Xr condvar 9 , | | 157 | .Xr condvar 9 , |
158 | etc.; mixing | | 158 | etc.; mixing |
159 | .Xr mutex 9 | | 159 | .Xr mutex 9 |
160 | and | | 160 | and |
161 | .Nm | | 161 | .Nm |
162 | usually doesn't work. | | 162 | usually doesn't work. |
163 | .El | | 163 | .El |
164 | .Pp | | 164 | .Pp |
165 | Holding the kernel lock | | 165 | Holding the kernel lock |
| @@ -227,27 +227,27 @@ To be used only in diagnostic assertions | | | @@ -227,27 +227,27 @@ To be used only in diagnostic assertions |
227 | .El | | 227 | .El |
228 | .Pp | | 228 | .Pp |
229 | The legacy argument | | 229 | The legacy argument |
230 | .Fa l | | 230 | .Fa l |
231 | must be | | 231 | must be |
232 | .Dv NULL | | 232 | .Dv NULL |
233 | or | | 233 | or |
234 | .Dv curlwp , | | 234 | .Dv curlwp , |
235 | which mean the same thing. | | 235 | which mean the same thing. |
236 | .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | | 236 | .\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
237 | .Sh NOTES | | 237 | .Sh NOTES |
238 | Some | | 238 | Some |
239 | .Nx | | 239 | .Nx |
240 | kernel abstractions execute caller-specified funtions with the kernel | | 240 | kernel abstractions execute caller-specified functions with the kernel |
241 | lock held by default, for compatibility with legacy code, but can be | | 241 | lock held by default, for compatibility with legacy code, but can be |
242 | explicitly instructed | | 242 | explicitly instructed |
243 | .Em not | | 243 | .Em not |
244 | to hold the kernel lock by passing an MP-safe flag: | | 244 | to hold the kernel lock by passing an MP-safe flag: |
245 | .Bl -bullet | | 245 | .Bl -bullet |
246 | .It | | 246 | .It |
247 | .Xr callout 9 , | | 247 | .Xr callout 9 , |
248 | .Dv CALLOUT_MPSAFE | | 248 | .Dv CALLOUT_MPSAFE |
249 | .It | | 249 | .It |
250 | .Xr kfilter_register 9 | | 250 | .Xr kfilter_register 9 |
251 | and | | 251 | and |
252 | .Xr knote 9 , | | 252 | .Xr knote 9 , |
253 | .Dv FILTEROPS_MPSAFE | | 253 | .Dv FILTEROPS_MPSAFE |