2026-06-18
Stack Overflow: View Question
Tags: caching, architecture, arm, hardware, arm64
Score: 2 | Views: 122
The asker wants to validate DDR by writing a value then reading it back, mapping the page as Normal Non-Cacheable (Normal_NC) — a "write-combining" attribute commonly used for framebuffers and device memory. Their test code issues a store, a dsb sy, then a load, and they're trying to reason about whether the load is guaranteed to see DRAM (not a merge buffer) and whether the barrier is sufficient.
This question is interesting because Normal_NC sits in a confusing middle ground of the ARM memory model. Unlike Device memory, Normal_NC accesses can be gathered, merged, reordered, and speculatively prefetched — but they are not cached in L1/L2. So intuition from x86 WC memory only partially carries over.
Key technical points:
dsb sy drains the write buffer to the point of coherency/serialization, but the architectural guarantee is that prior memory accesses are complete with respect to the shareability domain — not that they've physically reached the DRAM cell. For most SoCs the memory controller acknowledges the write before the DRAM array commits.Direction for an answer:
dsb sy between the store and load is the correct barrier; adding isb doesn't help (ISB is for context-synchronization, not data ordering).Gotchas: write-combining behavior is implementation-defined within architectural limits, so two different SoCs (even both ARMv8.2) can give different observable results for the same code. And on real hardware, the DDR controller's own write buffer and refresh cycles further blur "did it reach the cell."
