A.1-4RVWMO Explained: Litmus Notation & the Axioms at Work

Part I Linux boot: recommended Vol. I (Unprivileged) pp. 601–607 · ~4 min read

  • multi-copy atomicity
  • rf/co/fr edges

Appendix A is the spec’s own commentary on ch. 18 — informal, example-driven, explicitly non-normative (ch. 18 wins any disagreement). For a hardware designer it’s the most valuable prose in Volume I: it explains why each rule has the shape it has, usually in terms of the microarchitecture it’s protecting.

A.1 Why weak?

Weak models buy implementation freedom (performance, power, scalability, verification simplicity of the hardware); strong models buy simpler programming. RVWMO — a release-consistency variant — sits deliberately between. The compatibility arithmetic every designer should know: RVWMO code runs correctly on Ztso hardware (its fences become fetch-only no-ops); TSO-assuming code is NOT correct on RVWMO hardware — and most RVWMO implementations should simply refuse RVTSO-only binaries.

A.2 Litmus notation

Conventions: s0,s1,s2 hold disjoint 8-byte-aligned addresses x, y, z; everything else starts zero. Execution diagrams use the standard edge vocabulary :

Litmus diagram edge key (Table 76)
Meaning
rfReads From — store → loads returning its value (cross-hart rf constrains the global order; intra-hart rf is informative only)
coCoherence — the total order of stores to each address
frFrom-Reads — load → stores that are co-successors of its source store
ppo / fence / addr / ctrl / dataPreserved program order and its causes
Dotted-underlined cells have explanations — click one.

A suite of 7000+ machine-checked tests lives at github.com/litmus-tests/litmus-tests-riscv — run them against your RTL.

A.3.1–A.3.2 “Performing”, and why forwarding shapes the axiom

A load performs when its return value is determined; a store performs when globally visible — not when it executes in the pipeline. The global memory order is the order of performing. That’s why a younger load can perform before an older same-address load yet return a newer value: forwarding from the store buffer.

The canonical demonstration — both harts see their own store early:

SB + store-buffer forwarding (Table 77)Initially: x = 0, y = 0

Hart 0

  1. li t1, 1
  2. (a) sw t1,0(s0)
  3. (b) lw a0,0(s0)
  4. (c) fence r,r
  5. (d) lw a1,0(s1)

Hart 1

  1. li t1, 1
  2. (e) sw t1,0(s1)
  3. (f) lw a2,0(s1)
  4. (g) fence r,r
  5. (h) lw a3,0(s0)
a0=1, a1=0, a2=1, a3=0ALLOWEDStore buffers make this real. A hypothetical PPO rule ordering store→same-address-load ("Rule X") would make this global order cyclic — outlawing store buffers. Hence forwarding lives in the Load Value Axiom, not PPO.

The PPOCA variant goes further: a control-dependent store may forward to a later load speculatively, before the branch resolves — permitted, because the speculation is confirmed before anything becomes architecturally visible.

A.3.3 Atomicity, decoupled from ordering

RISC-V atomics impose no ordering by default — that’s what aq/rl are for. The atomicity axiom is purely about exclusivity: no other hart’s store to a byte the LR read may sit between that byte’s source store and the SC’s write. Explicitly allowed between an LR/SC pair: loads from anywhere, stores from the same hart, stores to non-overlapping bytes. Table 79’s four snippets (same-hart stores next to the reserved word) may all succeed — deliberately, so cache-line-granularity reservation tracking never fails SCs on false sharing. Conceptual split: AMOs perform “in memory”; LR/SC bring the value up under a reservation.

A.3.4 Progress, minimally

Stores become visible in finite time; spinloops eventually observe unlocks. Nothing more — no fairness, no latency, no QoS (that’s platform territory). Any standard coherence protocol satisfies it for free.

Hardware Designer Notes

Read the axioms as the interface of your LSU: performing = global visibility, forwarding = the sanctioned exception, atomicity = exclusivity only, progress = drains and snoops can’t stall forever. The next pages turn each PPO rule into its microarchitectural rationale.

Minimal Linux-boot hart MUST

  • Enforce multi-copy atomicity: never forward one hart's buffered store to another hart
  • Track LR/SC atomicity per the axiom — but feel free to track reservations at cache-line granularity
  • Run the public litmus suite against RTL — it is the executable form of this appendix

MAY simplify / trap-and-emulate

  • Forward buffered stores to your own younger loads (the axiom clause exists for you)
  • Let control-dependent stores forward speculatively to later loads (PPOCA) if recovery is airtight
  • Refuse TSO-only binaries rather than pretend

Check yourself — axioms in practice

1.Can a Ztso (TSO-by-default) core run binaries compiled for RVWMO? And vice versa?

2.Why would adding 'store before later same-address load' to PPO (the appendix's hypothetical Rule X) be catastrophic?

3.An ordinary store from the same hart sits between an LR and its SC, hitting the same cache line but not the reserved word. May the SC succeed?

4.What exactly does the progress axiom promise a spinlock?

4 questions