Skip to content

Commit

Permalink
a-st-ext: mark examples as a note
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
radimkrcmar committed Jan 24, 2025
1 parent d7ae73a commit 0f21952
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/a-st-ext.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ those with both bits clear, but may result in lower performance.

<<<

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

[[sec:lrscseq]]
=== Eventual Success of Store-Conditional Instructions
Expand Down Expand Up @@ -434,6 +437,8 @@ both imply additional unnecessary ordering as compared to AMOs with the
corresponding _aq_ or _rl_ bit set.
====

[NOTE]
====
An example code sequence for a critical section guarded by a
test-and-test-and-set spinlock is shown in
Example <<critical>>. Note the first AMO is marked _aq_ to
Expand All @@ -457,8 +462,6 @@ relinquishment.
# ...
amoswap.w.rl x0, x0, (a0) # Release lock by storing 0.
[NOTE]
====
We recommend the use of the AMO Swap idiom shown above for both lock
acquire and release to simplify the implementation of speculative lock
elision. cite:[Rajwar:2001:SLE]
Expand Down

0 comments on commit 0f21952

Please sign in to comment.