7.5 DMB
DMB (Data Memory Barrier) orders memory effects. It does not wait for anything to complete, does not stall unrelated instructions, and does not synchronize context. A DMB says: “the accesses of type T before me are observed by every observer before the accesses of type T′ after me.” The access-type field of the instruction is what selects T and T′. The domain field once mattered too, but under the current definition it no longer has any functional effect (see below).
Encoding and options
DMB <option> encodes the option in CRm. The domain is in CRm[3:2] and the access types are in CRm[1:0]. The “Domain” column gives the historical meaning, which is now deprecated for DMB:
| CRm | Option | Domain | Orders (before → after) |
|---|---|---|---|
0b1111 | SY | Full system | R/W → R/W |
0b1110 | ST | Full system | W → W |
0b1101 | LD | Full system | R → R/W |
0b1011 | ISH | Inner Shareable | R/W → R/W |
0b1010 | ISHST | Inner Shareable | W → W |
0b1001 | ISHLD | Inner Shareable | R → R/W |
0b0111 | NSH | Non-shareable | R/W → R/W |
0b0110 | NSHST | Non-shareable | W → W |
0b0101 | NSHLD | Non-shareable | R → R/W |
0b0011 | OSH | Outer Shareable | R/W → R/W |
0b0010 | OSHST | Outer Shareable | W → W |
0b0001 | OSHLD | Outer Shareable | R → R/W |
The LD forms are new in Armv8. ARMv7 had only full and ST forms. Other CRm values are reserved. DDI0487 says that unsupported and reserved options execute as a full system barrier, but that software must not rely on this. Do not confuse DMB with DSB, which uses the same option names and some of whose CRm values mean SSBB/PSSBB (7.6).
What “ordering” means precisely
In the axiomatic model (7.3) a DMB contributes these Barrier-ordered-before edges:
po; [dmb.full]; po (* every access before → every access after *)
[R]; po; [dmb.ld]; po (* every read before → every access after *)
[W]; po; [dmb.st]; po; [W] (* every write before → every write after *)
These edges join with Observed-by edges into ob, and ob must be acyclic. Operationally: if access A precedes the DMB and B follows it, with matching types, then no observer can observe B and afterwards observe a state that does not yet include A.
Because the model is other-multi-copy atomic (7.2), the edges compose with other PEs’ writes that this PE has read. If P1 reads P0’s write and then executes DMB ISH and its own store, every observer that sees P1’s store also sees P0’s write (rfe; bob). This is the property older text calls cumulativity. In Armv8 you do not have to request it.
What a DMB does not do:
- It does not make anything complete. A store before a
DMBmay still be in a buffer long after the DMB has retired. Only its order relative to later stores is fixed. - It does not order instruction fetch, translation table walks, or the effect of a system-register write. Those need DSB and/or ISB (7.8).
- It does not wait for
TLBIorICcompletion. It does order data cache maintenance by VA (DC CVAC,DC CIVAC…) against explicit accesses (using a barrier whose access types include both loads and stores), but it does not wait for that maintenance to finish (8.5). - It does not stop non-memory instructions after it from executing early.
The domain argument: what it meant, and what it means now
The domain field (NSH/ISH/OSH/SY) is where most of the folklore about DMB lives. Its status has changed recently, so read older code and older text with that in mind.
The classical reading. Until recently, DDI0487 defined a DMB’s guarantee as holding for “the observers in the required shareability domain”. The guidance that followed was to choose the domain by asking who must see these accesses in this order. The usual answers were: ISH for other PEs sharing Inner Shareable Write-Back memory, and OSH for a DMA master reading Normal Non-cacheable buffers or for Device memory, because NC and Device memory are treated as Outer Shareable whatever SH says (6.4). That is why Linux defines dma_wmb() as DMB OSHST on arm64 (Appendix C), and why a lot of firmware review comments say “ISHST is not enough before a DMA doorbell”.
The current position. Arm has since recognised that, in an other-multi-copy-atomic model (7.2), a domain-limited ordering guarantee has no observable meaning. Once a write is observed by any other observer, it is observed by all of them. The DDI0487 Known Issues entry AARCH-24234 (raised against issue M.a) therefore redefines the DMB shareability argument as having no functional effect and deprecates it. DMB NSH, DMB ISH, DMB OSH and DMB SY give the same ordering, and likewise for the LD and ST forms. Arm’s barrier guide (102336, v1.1) says the same: “barriers with this argument behave the same as if the shareability option is not given”. herdtools7 adopted this in March 2026 and now flags Shareability-argument-for-DMB-is-deprecated instead of assuming a common Inner Shareable domain.
Arm presents this as a consequence of the model that has applied since Armv8.0, not as a new hardware requirement. In practice:
| Question | Answer under the current model |
|---|---|
Is existing DMB ISH / DMB ISHST code wrong? | No. It gives full or W→W ordering, which is what it always had to give in an MCA system |
Is DMB ISHST before a DMA doorbell now sufficient for ordering? | Yes. The access type (ST) is what matters |
| Should new code drop the qualifier? | Spell it DMB SY/DMB ST/DMB LD (or follow your codebase’s convention). Do not churn working code just for spelling |
| Does the domain still matter anywhere? | For DSB, yes: it is now called the maintenance scope and governs TLBI and IC completion (7.6) |
What the change does not remove is the coherency question. A DMB orders this PE’s accesses. It cannot make a non-coherent DMA master see data that is still in this PE’s cache. That needs the right memory type, or cache maintenance to the Point of Coherency (8.7). Many of the “ISH vs OSH” bugs in older bring-up war stories were really missing-CMO bugs, which a stronger barrier on a particular core happened to hide.
Bring-up note: Older code may contain domain choices justified as “OSH because the GPU is outside the Inner Shareable domain”. When you review it, check the access type and the memory attributes rather than the domain. If a port of such a routine fails on a new chiplet design, look for missing cache maintenance or a wrong memory type, not for the wrong DMB domain. Also check whether the target’s documentation pins an older DDI0487 issue: this book follows the AARCH-24234 position, so cite it when you justify a change.
The LD and ST variants
ST and LD are partial barriers. They are cheaper on some cores, but they are not interchangeable with the full form:
DMB ST: W→W only. It is enough for the writer side of MP (payload, then flag). It is not enough as a release: a critical section’s loads may still be satisfied after the unlocking store. This lock release is broken:
// critical section: loads and stores to shared data
ldr w2, [x_shared]
dmb ishst // WRONG: W->W only
str wzr, [x_lock] // unlock
Another PE can take the lock, write x_shared, and this PE’s ldr can still return the new value. That is an R→W reordering across the unlock. Use STLR wzr, [x_lock] or DMB ISH.
-
DMB LD: R→R/W. After reading a flag, it orders every later access after that read, which makes it an acquire fence. It is enough for the reader side of MP and for the readers in WRC/IRIW. It does nothing for earlier stores. -
DMB LD+DMB ST≠DMBfull. Together they give R→R, R→W and W→W, but never W→R. Store buffering (SB) and any “publish my flag, then check yours” handshake need the full barrier, orSTLRfollowed byLDAR(7.3).
| Need | Minimal DMB |
|---|---|
| Payload stores before flag store | DMB ISHST (ST in any spelling, device or PE consumer alike) |
| Flag load before payload loads | DMB ISHLD, or a dependency/LDAR |
| Critical-section accesses before unlock store | DMB ISH (or STLR) |
| My store before my load of another location | DMB ISH (full) |
Cost
DDI0487 imposes no cost model. In the 6.1 picture, a DMB is often implemented by tagging the store buffer and the load queue so that later accesses of the ordered type cannot perform before the earlier ones. Independent arithmetic keeps flowing. A full DMB that must order a buffered store before a later load does stall that load until the store is observed by other observers. That is the W→R case, and why SB fixes are expensive. Measure the cost on your target with PMU cycle counts rather than assuming one. 7.6 compares DMB with DSB.
Validation note: Use herd7 (7.11) to check access-type choices (LD, ST or full). It treats every domain the same and flags deprecated qualifiers. On hardware, test DMA-facing protocols with a real non-PE observer, for example a DMA engine that copies the ring and checks a sequence number in each descriptor. Stale descriptors seen by the device, but never by another core, almost always mean missing cache maintenance or a cacheable mapping, not a barrier-domain problem. Confirm with the device’s own error or status counters and, where available, interconnect PMU read counts against the ring address.
Checkpoint
Q7.5.1 Firmware fills a DMA descriptor in a Normal Non-cacheable ring, then writes a Device doorbell register with DMB ISHST between the two stores. A reviewer, citing “NC and Device are Outer Shareable”, insists on DMB OSHST. Under the current DDI0487 position (Known Issues entry AARCH-24234), which statement is right?
- A. The reviewer is right, because the DMA master is outside the Inner Shareable domain, so
ISHSTgives it no ordering - B. Both give the same ordering. The DMB shareability argument has no functional effect in an other-multi-copy-atomic model, and what matters is the
STaccess type - C. Neither is enough. A
DSB OSHSTis required, because the doorbell is Device memory - D.
DMB ISHSTis enough only if the descriptor was also cleaned to the Point of Coherency
Answer
B. AARCH-24234 deprecates the DMB shareability argument and redefines it as having no functional meaning, so ISHST, OSHST and ST give the same W→W ordering. A is the classical reasoning that the Known Issue retires. C confuses ordering with completion: the device only needs the descriptor write to be observed before the doorbell write, which is an ordering requirement. D adds a CMO that an NC ring does not need. A CMO would be needed if the ring were cacheable and the master non-coherent, and it would then be a separate requirement, not a barrier-domain one.
Read more: Arm ARM (DDI0487), DMB; DDI0487 Known Issues, AARCH-24234; Arm “Learn the architecture: Memory Systems, Ordering, and Barriers” (102336)
Q7.5.2 A spinlock release is coded as DMB ISHST; STR wzr, [lock]. What can go wrong?
- A. Nothing, because the critical section’s stores are ordered before the unlock
- B. The unlock store may never become visible without a DSB
- C. Stores from the critical section may become visible after the unlock
- D. Loads in the critical section may be satisfied after the unlock is observed, and so return data another lock holder has already written
Answer
D. DMB ST orders W→W only, so a critical-section load can be reordered after the unlock store. C is exactly what DMB ST does prevent. B confuses ordering with completion: the store becomes visible eventually without any barrier. The fix is STLR or a full DMB ISH.
Read more: Arm ARM (DDI0487), DMB (access types); B2 “Barrier-ordered-before”
Q7.5.3 A developer replaces a full DMB ISH with DMB ISHLD followed by DMB ISHST, reasoning that this covers loads and stores. Which ordering is lost?
- A. A load before the barriers, against a later store
- B. A store before the barriers, against a later store
- C. A store before the barriers, against a later load
- D. A load before the barriers, against a later load
Answer
C. LD gives R→R/W and ST gives W→W, so no combination gives W→R. Any store-buffering (SB) protocol breaks. A and D are covered by DMB ISHLD, and B by DMB ISHST.
Read more: Arm ARM (DDI0487), DMB; Arm ARM “Barrier Litmus Tests” appendix (SB)