Commit 36b48be
committed
rqspinlock: Enclose lock/unlock within lock entry acquisitions
There is a tiny window between the fast-path cmpxchg and the grabbing of
the lock entry where an NMI could land, attempt the same lock that was
just acquired, and end up timing out. This is not ideal. Instead, move
the lock entry acquisition from the fast path to before the cmpxchg, and
remove the grabbing of the lock entry in the slow path, assuming it was
already taken by the fast path.
Do something similar for the unlock case, where smp_store_release is
moved to before the WRITE_ONCE on the lock entry. We could have the case
before where if an NMI landed write after the WRITE_ONCE, but before the
unlock, it would miss the AA case.
[ kkd: The movement of the store release is not trivial, see
comments/revisit later. ]
Signed-off-by: Kumar Kartikeya Dwivedi <[email protected]>1 parent 590699d commit 36b48be
2 files changed
+12
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
178 | 186 | | |
179 | | - | |
180 | 187 | | |
181 | 188 | | |
182 | 189 | | |
| |||
192 | 199 | | |
193 | 200 | | |
194 | 201 | | |
| 202 | + | |
195 | 203 | | |
196 | 204 | | |
197 | 205 | | |
| |||
213 | 221 | | |
214 | 222 | | |
215 | 223 | | |
216 | | - | |
217 | 224 | | |
218 | 225 | | |
219 | 226 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | | - | |
| 278 | + | |
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
| 400 | + | |
404 | 401 | | |
405 | 402 | | |
406 | 403 | | |
| |||
448 | 445 | | |
449 | 446 | | |
450 | 447 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
| 448 | + | |
456 | 449 | | |
457 | 450 | | |
458 | 451 | | |
| |||
0 commit comments