On 16 October 2015 at 09:56, Savolainen, Petri (Nokia - FI/Espoo) < [email protected]> wrote:
> > > > > *From:* EXT Ola Liljedahl [mailto:[email protected]] > *Sent:* Thursday, October 15, 2015 11:00 PM > *To:* Savolainen, Petri (Nokia - FI/Espoo) > *Cc:* LNG ODP Mailman List > *Subject:* Re: [lng-odp] [API-NEXT PATCH 5/6] api: atomic: added cas > operations > > > > On 15 October 2015 at 10:45, Petri Savolainen <[email protected]> > wrote: > > Added cas operations for 32 and 64 bit atomic variables. These > use relaxed memory order (as all other operations). > > Do you have actual use cases for CAS where *only* relaxed memory order is > required? Or you need CAS with acquire ordering per the other patch? But > you don't need CAS with release ordering? > > > > CAS with relaxed order is for implementing e.g. min / max of a counter. > User inc / dec a count and update atomic variables min/max with CAS. This > is what Barry needed in one of the calls. > I don't know exactly how this is used by Barry but I think we should investigate the need for some new atomic operations. ARMv8.1 introduces atomic min and max operations that might be relevant in this context. It would be good if these could be utilised by the TM implementation (if indeed this is the function we are looking for). http://community.arm.com/groups/processors/blog/2014/12/02/the-armv8-a-architecture-and-its-ongoing-development The atomic instructions can be used as an alternative to Load-exclusive/Store-exclusive instructions, by example to ease the implementation of atomic memory updates in very large systems. This could be in a closely coupled cache, sometimes referred to as *near atomics*, or further out in the memory system as *far atomics*. The instructions provide atomic update of register content with memory for a range of conditions: - Compare and swap of 8-, 16-, 32-, 64- or a pair of 32- or 64-bit registers as a conditional update of a value in memory. - ADD, BitClear, ExclusiveOR, BitSet signed and unsigned MAXimum or MINimum value data processing operations on -8, 16-, 32- or 64-bit values in memory. These can occur with or without copying the original value in memory to a register. - Swap of an 8-, 16-, 32- or 64-bit value between a register and value in memory. - The instructions also include controls associated with influencing the order properties, based on acquire and release semantics. > > > > > I would rather see a generic CAS function with the memory order as a > separate parameter. We are into lock-less territory now, not just using > atomics for simple counters/statistics where we don't have to worry about > memory ordering. > > > > This is still for simple couters. > > > > -Petri > > > > > > >
_______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
