Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Part 7: The memory ordering model

Prerequisites: 6.1 A hardware mental model, 6.2 Normal and Device memory, 6.4 Shareability; 3.2 Entry and return for 7.8.

If you already know: if you can derive MP/SB/WRC/IRIW outcomes from aarch64.cat without looking, skim 7.1–7.3 and start at 7.4. Do not skip 7.5 and 7.6 even if barriers are familiar: they cover the recent redefinition of the barrier domain argument. If you already know C11 atomics, 7.7 mostly gives you the mapping table.

Why this matters for bring-up/validation: most “works on the model, fails on silicon” firmware bugs, and many silicon interconnect bugs, are ordering bugs, and you can only tell which kind you have if you can state what the architecture allows.

This part replaces “add barriers until it works” with the reasoning DDI0487 uses. It starts with the vocabulary: observers, observed, complete (7.1). Then it covers the two kinds of atomicity, including the 2017 move to an other-multi-copy-atomic model that makes older texts misleading (7.2). With those, the five canonical litmus tests can be decided by looking for a cycle in the “ordered-before” relation (7.3). The following sections take each source of ordering in turn, cheapest first: dependencies, DMB, DSB, acquire/release, and context synchronization with ISB (7.4–7.8). Each one says exactly what it orders, what it waits for, and what it does not do.

The last three sections apply the model. 7.9 covers Device memory and the eternal question “does the DSB mean the peripheral saw it?”. 7.10 gives the bare-metal patterns: doorbells, descriptor rings, cross-chiplet mailboxes and seqlocks. 7.11 takes litmus tests from herd7 to litmus7 on QEMU, FVP and silicon. There you learn to tell an allowed-but-unobserved outcome from a forbidden-but-observed one, which may be a silicon bug or a test bug. The Linux barrier API mapping is in Appendix C.