In ARM CHI spec, what is the difference between using ReadShared with exclusive access vs ReadUnique?

ReadShared with exclusive access is used to read a location with the intention of updating the location. The same thing can be done using ReadUnique which ensures that the requester gets a unique copy that can then be modified. What is the difference between the two and when would one be used compared to the other?

Parents
  • I think there is a misunderstanding regarding the use of the term "exclusive". In Arm and AMBA CHI, exclusive refers to load-exclusive/store-exclusive sequences which are used to perform atomic read/modify/write operations (the LSE atomics are usually better though). This is equivalent to LL/SC (load-linked/store-conditional) as used by other RISC architectures. The AMBA CHI state which corresponds to MESI exclusive state is called unique. A requester node (e.g. processor) must get a line in unique state in order to modify it. This can be done using the ReadUnique transaction (there are also other transactions that provide or materialise the line in unique state). A prefetch-for-store (PRFM PST) instruction can be used to get a line in unique state, preparing for a later update even if there are reads which precede the write. Those reads would otherwise have fetched the line in shared state (if line not already present in cache).

    I suspect the ReadShared with exclusive access (note not unique) is used by load-exclusive (e.g. LDXR) to start an exclusives sequence. The processor gets the line in shared state but informs the Home Node that an exclusives sequence is in progress. The Home Node can use this information if other processors also start exclusive sequences for the same location or cache line. When the processor executes the store-exclusive instruction (e.g. STXR), it must get the line in unique state so that it can be updated. But if the line has been invalidated (since load-exclusive), store-exclusive will fail and software will have to handle the situation (usually by retrying the exclusives sequence).

Reply
  • I think there is a misunderstanding regarding the use of the term "exclusive". In Arm and AMBA CHI, exclusive refers to load-exclusive/store-exclusive sequences which are used to perform atomic read/modify/write operations (the LSE atomics are usually better though). This is equivalent to LL/SC (load-linked/store-conditional) as used by other RISC architectures. The AMBA CHI state which corresponds to MESI exclusive state is called unique. A requester node (e.g. processor) must get a line in unique state in order to modify it. This can be done using the ReadUnique transaction (there are also other transactions that provide or materialise the line in unique state). A prefetch-for-store (PRFM PST) instruction can be used to get a line in unique state, preparing for a later update even if there are reads which precede the write. Those reads would otherwise have fetched the line in shared state (if line not already present in cache).

    I suspect the ReadShared with exclusive access (note not unique) is used by load-exclusive (e.g. LDXR) to start an exclusives sequence. The processor gets the line in shared state but informs the Home Node that an exclusives sequence is in progress. The Home Node can use this information if other processors also start exclusive sequences for the same location or cache line. When the processor executes the store-exclusive instruction (e.g. STXR), it must get the line in unique state so that it can be updated. But if the line has been invalidated (since load-exclusive), store-exclusive will fail and software will have to handle the situation (usually by retrying the exclusives sequence).

Children
No data