On 04/21/2015 01:31 PM, Ola Liljedahl wrote: > On 17 April 2015 at 10:46, Nicolas Morey-Chaisemartin <nmo...@kalray.eu > <mailto:nmo...@kalray.eu>> wrote: > > Hello every one, > > I am currently working on porting the linux-generic implementation of > DPDK on Kalray architecture and slightly pulling my hair out with all the > atomics. > > Surely you mean ODP and not DPDK?
Yes sorry. I was looking at the ODP-DPDK sources too and got mixed up. > > > By going through the code I noticed that there are a *lot* of functions > for atomics that do almost the same thing but not exactly. > > The differences are quite important here... > The public odp/atomic.h uses a relaxed memory model so only suitable for > things like statistics and shared sequence numbers etc. > The internal atomics support supports a memory ordering parameter which make > these functions usable for designing lock-less multithreaded data structures > (and the implementation of the locks themselves). As it is not supposed that > the user will design their own lock-less data structures, this API is > internal to linux-generic (and thus may not exist on all platforms). OK > > > Fox example in include/odp/atomic.h, all the load/store/add/sub function > are defined using GCC builtins, but almost the same functions (adding the > memory model as a parameters) are also defined in odp_atomic_internal.h > Wouldn't it make sense to reuse these internals functions in atomic.h so > there is only one place where we rely on "external" atomic features? > > Yes I agree. The internal functions have their names prepended with an "_" so > it should be obvious to the user that those are not part of the public API. > odp_atomic_inteŕnal.h must then become part of the ODP release (for > linux-generic). Patch? I am not sure where the odp_atomic_internal should be moved (I'm still learning where things are supposed to be and why), but with some guidelines, I'd be happy to propose a patch for this. Thanks for the info Nicolas
_______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp