On Wed, Apr 30, 2014 at 6:54 AM, Stefan Kristiansson <[email protected]> wrote: > On Tue, Apr 29, 2014 at 9:56 AM, Stefan Wallentowitz > <[email protected]> wrote: >> Hi Stefan, >> >> nice work. I have some remarks for discussion: >> >> * The parts where you describe atomic_reserve and atomic_address might >> be implementation-specific. I think LL/SC can also be implemented as >> part of the cache (with "linked" cache line flags). Similarly, there >> could be more than one atomic_reserve and atomic_address registers to >> support several LL/SC operations (which I would prefer for a future >> mor1kx implementation). Maybe we can think about a more generic >> description like atomic_reserve[EA] and a note that states, that the >> number of concurrent atomic_reserve is limited or so. I will also think >> about and check other architecture specs. >> > > Good point, I was afraid that my description was a bit to > implementation specific, > but I thought that there wasn't much options how to implement it. > I think your more generic 'atomic_reserve[EA]' might be a better option. > I haven't seen any references to several ll/sc being active at the > same time in any other arch specs, but I might not have looked > carefully enough. > Do you have an example? >
I've updated the instruction descriptions with a more generic approach as follows. "l.lwa rD,I(rA) Description: The offset is sign-extended and added to the contents of general-purpose register rA. The sum represents an effective address. The single word in memory addressed by EA is loaded into the low-order 32 bits of general-purpose register rD. High-order bits of general-purpose register rD are replaced with zero. An atomic reservation is placed on the address formed from EA. In case an MMU is enabled, the physical translation of EA is used. 32-bit Implementation: EA ← exts(Immediate) + rA[31:0] rD[31:0] ← (EA)[31:0] atomic_reserve[to_phys(EA)] ← 1 64-bit Implementation: EA ← exts(Immediate) + rA[63:0] rD[31:0] ← (EA)[31:0] rD[63:32] ← 0 atomic_reserve[to_phys(EA)] ← 1 Exceptions: TLB miss Page fault Bus error Alignment" "l.swa I(rA),rB Description: The offset is sign-extended and added to the contents of general-purpose register rA. The sum represents an effective address. The low-order 32 bits of general-purpose register rB are conditionally stored to memory location addressed by EA. The 'atomic' condition relies on that an atomic reserve to EA is still intact. When the MMU is enabled, the physical translation of EA is used to do the address comparison. 32-bit Implementation: EA ← exts(Immediate) + rA[31:0] if (atomic) (EA)[31:0] ← rB[31:0] SR[F] ← atomic 64-bit Implementation: EA ← exts(Immediate) + rA[63:0] if (atomic) (EA)[31:0] ← rB[31:0] SR[F] ← atomic Exceptions: TLB miss Page fault Bus error Alignment " >> * Finally, I want to bring up the memory model in this context. I think >> the architecture manual lacks proper mentioning of the assumed >> consistency. mor1kx implements sequential consistency I suppose and so >> might some programs. I think it may be better to go with a more relaxed >> consistency model, like total store order in Sparc. Independent of >> whether it is changed, the memory model description may be added in this >> revision, as the l.lwa and l.swa would be synchronization points in a >> relaxed consistency model (as l.msync is then). >> > > Yes, I agree that it needs to be defined better. > Perhaps that is slightly out of the scope of what I'm doing here > though, maybe you are up to defining something more concrete in the > future? > However, the note that l.swa/l.wa acts as memory barriers could be added, > because that's what we want, right? > So, I added the following to the Atomicity chapter: "In implementations that use a weakly-ordered memory model, l.swa and l.lwa will serve as synchronization points, similar to l.msync." Stefan _______________________________________________ OpenRISC mailing list [email protected] http://lists.openrisc.net/listinfo/openrisc
