7.2 Single-copy and multi-copy atomicity
“Atomic” has two independent meanings in DDI0487, and loose speech mixes them up:
- Single-copy atomicity is about tearing: is one access seen as a whole by every observer, or can someone see half of it?
- Multi-copy atomicity is about propagation: when a write becomes visible to one other observer, does it become visible to all of them?
Neither one is “atomic read-modify-write”. That is exclusives and LSE (10.1, 10.2).
Single-copy atomicity: the definition
DDI0487 defines a read or write as single-copy atomic when both of these hold:
- Stores: if two single-copy atomic stores overlap, then for every overlapping byte, all the writes of one store come before all the writes of the other in that byte’s Coherence order. Bytes from the two stores are never interleaved.
- Loads: if a single-copy atomic load overlaps a single-copy atomic store, then for the overlapping bytes the load returns either all of that store’s data or none of it. It cannot take some bytes from that store and some from a coherence-earlier write.
Note what this does not say. It says nothing about when the access becomes visible, and nothing about ordering with other locations.
Which accesses are single-copy atomic (Armv8.0 baseline)
| Access | Single-copy atomicity |
|---|---|
LDRB/STRB, and any access at byte granularity | Byte |
LDRH/STRH, LDR/STR (W or X) aligned to the access size | Whole access (16, 32 or 64 bits) |
| Unaligned scalar access (where permitted) | Each byte only, before FEAT_LSE2 |
LDP/STP of W registers aligned to 4 | Two separate 32-bit single-copy atomic accesses |
LDP/STP of X registers aligned to 8 | Two separate 64-bit single-copy atomic accesses, not one 128-bit access (before FEAT_LSE2) |
| SIMD&FP load/store of ≤64 bits aligned to its size | Whole access |
SIMD&FP 128-bit (LDR q0) aligned to 8 | A pair of 64-bit single-copy atomic accesses |
LD1/ST1 and other element/structure forms | Each element, if aligned to the element size |
LDXP/STXP of X registers | 128-bit single-copy atomic only when the STXP succeeds |
LSE atomics, CAS, SWP, LDADD… aligned | Whole access (CASP, from v8.1, covers 128 bits) |
| Translation table walk descriptor reads | 64-bit for the VMSAv8-64 descriptor format |
The wider and unaligned cases are the subject of 10.3. These are: FEAT_LSE2 (v8.4), which makes 16-byte-aligned LDP/STP single-copy atomic and gives atomicity to unaligned accesses that do not cross a 16-byte boundary; FEAT_LSE128 (v9.4); FEAT_LRCPC3 (v8.9); 128-bit descriptors with FEAT_D128; and 64-byte LD64B/ST64B (FEAT_LS64). This page uses only the baseline.
Why firmware cares
- Descriptor writes. A 64-bit translation table descriptor must be written with a single aligned
STR Xn, never as twoSTR Wnhalves. The walker reads 64 bits single-copy atomically. If you write two halves, the walker can read a descriptor with the new low half (valid bit set) and the stale high half (old UXN/PXN, old output address bits). In C that means avolatile uint64_tstore or the project’sWRITE_ONCE. A plain assignment lets the compiler split or merge the store. - 128-bit values without LSE2. A 16-byte mailbox written with
STP x0, x1can be torn for a reader that doesLDP x2, x3: the reader can see the new first doubleword and the old second one. Either useLDXP/STXPorCASP, or arrange for one 64-bit field (a sequence number or a valid flag) to carry the protocol, and order the rest against it (7.10). - MMU off. With the MMU off, data accesses are Device-nGnRnE (6.5), and unaligned accesses fault. That is one reason TF-A builds with
-mstrict-align. Single-copy atomicity is then a non-issue only because the unaligned case cannot happen at all.
Multi-copy atomicity: three strengths
Take one write W to location x by observer P0:
| Property | Definition | Example architectures |
|---|---|---|
| Multi-copy atomic | W becomes visible to all observers, including P0, at the same moment | Sequential consistency; no mainstream CPU architecture |
| Other-multi-copy atomic | If W is observed by any observer other than P0, it is observed by all other observers. P0 may see W early (forwarding) | Armv8-A and Armv9-A; x86-TSO is also other-MCA, because of its store buffer |
| Non-multi-copy atomic | Different observers may see W at different times, and may disagree on the order of writes to different locations | IBM POWER, ARMv7, and the original Armv8 text |
All three include coherence: every observer agrees on the per-location Coherence order. That never weakens. What changes is whether observers can disagree across locations about when writes became visible.
In DDI0487 terms, the Arm memory model is other-multi-copy atomic. In the axiomatic model this property is what lets obs = rfe | coe | fre (external edges only) go straight into the single global “ordered-before” relation, with no extra propagation relation. Same-PE reads-from (rfi) is deliberately left out of obs. That gap is exactly the “other” in the name.
The 2017 revision, and why older material is weaker
The first Armv8 issues of DDI0487 described the memory model in prose inherited from ARMv7. That text was non-multi-copy atomic, like POWER: it allowed a write to reach some PEs before others. In 2017 Arm revised the Armv8 model and replaced the prose with an axiomatic definition that is other-multi-copy atomic. The revision was applied to Armv8.0 itself, not as a new feature. Arm’s position was that no Armv8 implementation had exhibited non-MCA behaviour, so the stronger model constrained no shipping core. The formalisation, and its proof of equivalence to an operational model, is Pulte, Flur, Deacon, French, Sarkar and Sewell, “Simplifying ARM Concurrency”, POPL 2018. The aarch64.cat file in herdtools7 is the executable form you will use in 7.11.
You will meet the older, weaker model in:
- the ARMv7-A/R ARM, and AArch32-era application notes, including the original “Barrier Litmus Tests and Cookbook”;
- early Armv8 training material written before 2017;
- Linux’s
memory-barriers.txt, which deliberately targets the weakest supported architecture (historically including non-MCA machines) and therefore insists on barrier cumulativity and on “transitivity” cases that Armv8 gives for free; - academic papers that discuss “ARM” as if it were POWER-like (the Flowing and POP models).
The practical difference is in tests like WRC and IRIW. Under a non-MCA model, WRC with address dependencies on both reading threads is allowed. A cumulative barrier on the middle thread is needed to forbid it. Under the revised Armv8 model, WRC+addrs and IRIW+addrs are forbidden. 7.3 derives this.
Security note: Code reviewed against the old model is not wrong under the new one, since the new model is strictly stronger. But “we can drop this barrier because Armv8 is MCA” is a valid argument only for the Armv8 profile. Shared code that also runs on AArch32 ARMv7 cores (some system control processors, or older companion cores), or that is ported to other non-MCA architectures, keeps the old requirement.
Multi-copy atomicity is not sequential consistency
Other-MCA forbids observers from disagreeing about the visibility order of writes. It does not stop a PE from reading its own write early, and it does not stop reordering of independent accesses within a PE. Store buffering (SB) is still allowed, as are reordered loads (MP without barriers) and load buffering (LB). Those need dependencies, barriers or acquire/release (7.4–7.7).
Multi-chiplet and system scale
Other-multi-copy atomicity is a promise the whole system must keep for every observer the model covers, not just the core. A coherent interconnect breaks it if, for example, it lets a write become readable by PEs on the local chiplet while a remote chiplet can still return the old value for the same line after it has already observed some later write. A typical cause is a broken invalidation handshake between a local snoop filter and a remote home node. Only the interaction between the two shows the bug. Neither chiplet is wrong on its own.
Validation note: Run
IRIW+addrsandWRC+addrs(7.11) with the writer and reader threads pinned to different clusters and chiplets. Any observation of the forbidden outcome is a coherence or interconnect bug, not a software bug, provided the test is correct. Same-cluster runs rarely stress the path, because the shared L2/L3 serialises everything. While the test runs, interconnect PMU snoop and retry counters (CMN or CCIX/CXL link counters) show whether the cross-chiplet path is actually being exercised.
Checkpoint
Q7.2.1 On a core without FEAT_LSE2, EL3 writes a 16-byte shared structure with STP x0, x1, [x2] (x2 16-byte aligned). Another PE reads it with LDP x3, x4, [x2]. What may the reader observe?
- A. Only the old 16 bytes or the new 16 bytes, because the STP address is 16-byte aligned
- B. A mix such as new x3 with old x4, because each half is a separate 64-bit single-copy atomic access
- C. A mix at byte granularity within each doubleword, because LDP is never single-copy atomic
- D. Only the new value, because other-multi-copy atomicity makes the whole STP visible at once
Answer
B. Without LSE2, an X-register LDP/STP aligned to 8 is two 64-bit single-copy atomic accesses, so it can tear between the doublewords but not inside one. Option A describes FEAT_LSE2 behaviour. Option D confuses multi-copy atomicity, which is per write, with single-copy atomicity across the two halves.
Read more: Arm ARM (DDI0487), B2 “Single-copy atomicity”
Q7.2.2 A 2014 training deck says that on Armv8, WRC (P0 writes x; P1 reads x then writes y; P2 reads y then x) with address dependencies on P1 and P2 can still show P2 reading x == 0. What is the best explanation?
- A. The deck is right, because address dependencies never order a load before a later store
- B. The deck is right for Inner Shareable memory but wrong for Outer Shareable memory
- C. The deck is wrong in every version, because WRC is forbidden even without dependencies
- D. The deck predates the 2017 revision to other-multi-copy atomicity, under which
WRC+addrsis forbidden
Answer
D. The earlier, non-MCA text allowed a write to propagate to P1 before P2, which permits this outcome without a cumulative barrier. The revised model forbids it. Option C overreaches: WRC with no dependencies is still allowed, because P1’s and P2’s accesses can be reordered.
Read more: Arm ARM (DDI0487), B2 “Multi-copy atomicity”; Pulte et al., POPL 2018
Q7.2.3 Why must firmware update a valid 64-bit stage 1 descriptor with a single STR Xn rather than two STR Wn?
- A. The walker reads the descriptor 64-bit single-copy atomically and can see a mix of new and old halves if the store is split
- B. Two W stores are not ordered with respect to each other without a DMB
- C. Two W stores to the same doubleword are always merged into one by the store buffer
- D. Descriptors must be written with Device memory attributes
Answer
A. A split store gives the walker a window in which half of the descriptor is old and half is new. Even with perfect ordering of the two halves (B), the intermediate state is still observable. Merging (C) is permitted but never guaranteed, so you cannot rely on it. In any case, changing a valid descriptor needs break-before-make (9.2).
Read more: Arm ARM (DDI0487), B2 “Single-copy atomicity”; the AArch64 VMSA chapter, translation table descriptor atomicity