Mona the Monad
Mona the Monad

Reputation: 2435

AArch64 memory synchronization operations on multiply-mapped addresses

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...

Upvotes: 1

Views: 408

Answers (1)

Nate Eldredge
Nate Eldredge

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

Related Questions