Skip to content

Commit

Permalink
LoongArch: Document that byte and short atomics are implemented with …
Browse files Browse the repository at this point in the history
…LL/SC

Based on the LoongArch Reference Manual:

https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Section 2.2.7 "Atomic Memory Access Instructions" only lists atomic
operations for 32-bit and 64-bit integers. As detailed in Section
2.2.7.1, LL/SC instructions operating on 32-bit and 64-bit integers are
also available. Those are used by the compiler to support atomics on
byte and short types.

This means atomics on 32-bit and 64-bit types have stronger forward
progress guarantees than those operating on 8-bit and 16-bit types.

Link: #11 (comment)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I01569b718f7300a46d984c34065c0bbfbd2f7cc6
  • Loading branch information
compudj committed Sep 6, 2023
1 parent 7ec5062 commit df8a910
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/urcu/uatomic/loongarch.h
Expand Up @@ -32,6 +32,11 @@
extern "C" {
#endif

/*
* LoongArch implements byte and short atomics with LL/SC instructions,
* which retry if the cache line is modified concurrently between LL and
* SC.
*/
#define UATOMIC_HAS_ATOMIC_BYTE
#define UATOMIC_HAS_ATOMIC_SHORT

Expand Down

0 comments on commit df8a910

Please sign in to comment.