Skip to content

Commit 91b80d3

Browse files
authored
Move non-normative parts of "A" extensions (atomics) into NOTE block (riscv#1822)
* a-st-ext: mark examples as a note Examples are usually in note blocks already. Make these consistent. The text about compare-and-swap example should probably be improved and moved above the example. Signed-off-by: Radim Krčmář <[email protected]> * a-st-ext: remove manual page breaks We should improve the tooling instead of adding manual page breaks. Also replace "above" with a reference, because "above" is not correct anymore and most importantly, it's not acceptable for a spec. This does not imply any acceptability of the the rest of the sentence, I just didn't want to leave the spec in a worse shape. Signed-off-by: Radim Krčmář <[email protected]> --------- Signed-off-by: Radim Krčmář <[email protected]>
1 parent d7ae73a commit 91b80d3

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/a-st-ext.adoc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ instruction unless the _rl_ bit is also set. LR._rl_ and SC._aq_
227227
instructions are not guaranteed to provide any stronger ordering than
228228
those with both bits clear, but may result in lower performance.
229229

230-
<<<
231-
230+
[NOTE]
231+
====
232232
[[cas]]
233233
[source,asm]
234234
.Sample code for compare-and-swap function using LR/SC.
@@ -250,6 +250,7 @@ those with both bits clear, but may result in lower performance.
250250
LR/SC can be used to construct lock-free data structures. An example
251251
using LR/SC to implement a compare-and-swap function is shown in
252252
<<cas>>. If inlined, compare-and-swap functionality need only take four instructions.
253+
====
253254

254255
[[sec:lrscseq]]
255256
=== Eventual Success of Store-Conditional Instructions
@@ -434,15 +435,15 @@ both imply additional unnecessary ordering as compared to AMOs with the
434435
corresponding _aq_ or _rl_ bit set.
435436
====
436437

438+
[NOTE]
439+
====
437440
An example code sequence for a critical section guarded by a
438441
test-and-test-and-set spinlock is shown in
439442
Example <<critical>>. Note the first AMO is marked _aq_ to
440443
order the lock acquisition before the critical section, and the second
441444
AMO is marked _rl_ to order the critical section before the lock
442445
relinquishment.
443446
444-
<<<
445-
446447
[[critical]]
447448
[source,asm]
448449
.Sample code for mutual exclusion. `a0` contains the address of the lock.
@@ -457,9 +458,7 @@ relinquishment.
457458
# ...
458459
amoswap.w.rl x0, x0, (a0) # Release lock by storing 0.
459460
460-
[NOTE]
461-
====
462-
We recommend the use of the AMO Swap idiom shown above for both lock
461+
We recommend the use of the AMO Swap idiom shown in <<critical>> for both lock
463462
acquire and release to simplify the implementation of speculative lock
464463
elision. cite:[Rajwar:2001:SLE]
465464
====

0 commit comments

Comments
 (0)