Suppose I have two pages that map to the same physical memory. Would an acquire operation (or fence) on a virtual address in one page properly synchronize with a release operation (or fence) on a virtual address in the other? Secondly, would cache maintenance operations (dc, ic), too, work with such multiply-mapped memory?
In other words...
- ...would a
stlr(ordmb ishstif fence) on one core to one page properly synchronize withldar(ordmb ishldif fence) on another core to the other page? - ...would a
dc whateveron one virtual address have the same effect as adc whateveron the other?
As to memory ordering, yes, this is fine. The ARMv8 memory model is defined in terms of reads and writes of a Location, which is defined as "a byte that is associated with an address in the physical address space". See B2.3.1 in the Architecture Reference Manual, version H.a. (Older versions left out the "physical" part so it seems someone noticed that this was ambiguous.)
Likewise, an exclusive load
ldxrsays in the manual that it marks the physical address as an exclusive access.Note that if this weren't the case, then on typical OSes, shared memory between processes (e.g.
shmget,mmap(MAP_SHARED), etc) would be unusable, as the shared mappings are normally at different virtual addresses in the different processes.I can't answer the part about cache right now.