Reputation: 2435
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...
stlr
(or dmb ishst
if fence) on one core to one page properly synchronize with ldar
(or dmb ishld
if fence) on another core to the other page?dc whatever
on one virtual address have the same effect as a dc whatever
on the other?Upvotes: 1
Views: 408
Reputation: 57922
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 ldxr
says 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.
Upvotes: 2