[Gc] Re[3]: [libatomic_ops] On Linux, ARMv5tel does not have all functions available (#3)

Ivan Maidanski ivmai at mail.ru
Sun Mar 4 02:18:02 PST 2012


Hi,

Just to refine:

03 03 2012, 20:39 Ivan Maidanski <ivmai at mail.ru>:
> Hi Niels,
> 
> Thank you for pointing us to this patch but IMHO this is a logically incorrect patch.
> By libatomic_ops contract:
> 1. if some operation is not available then AO_HAVE_x just not defined;
> 2. for CAS ops, if we strictly need it then we should define AO_REQUIRE_CAS causing automatic fall-back on demand.
> 3. fetch_and_add is derived from CAS in the worth case, so you should define AO_REQUIRE_CAS as well if you need atomic inc (this seems to be not explicitly specified in the docs but should be).

AO_REQUIRE_CAS is somewhat similar to GC_THREADS from the client side:

// client app
#ifndef GC_THREADS
# define GC_THREADS /* the client uses MT features of GC */
#endif
#include "gc.h"

#ifdef PARALLEL_MARK
# define AO_REQUIRE_CAS /* the client requires CAS and atomic inc/dec ops */
#endif
#include "atomic_ops.h"

> 
> Looking into arm.h (of master branch), the deference between, roughly speaking, ARMv5 and ARMv6 is in presence of CAS.
> 
> Please point me at if I misunderstand something of your post.
> 
> Regards.
> 
> 03 03 2012, 19:02 Niels de Vos <reply+i-3489920-a6264862991435ec2c55a219c5150534b26c055f-460469 at reply.github.com>:
> > It seems that libatomic_ops provides an optimized implementation for ARMv6 and newer architectures. Unfortunately there are no asm functions for ARMv5, which should fallback automatically to the pthread implementation.
> >
> > This [proposed patch](http://pkgs.fedoraproject.org/gitweb/?p=gc.git;a=blob;f=gc-7.2alpha6-libatomic_ops_arm5.patch;h=84e9bba6287093d106ecfbbdc083e0e320af5be1;hb=73b5e99c72ab0dd1248cc8326139893cfd20408d) is already available in the Fedora package. This change should provide the pthread implementation when atomic_ops.h is included on ARMv5 and earlier architectures.
> >
> > Please review and include this in the next release if it make sense. Thanks!
> >
> > ---
> > Reply to this email directly or view it on GitHub:
> > https://github.com/ivmai/libatomic_ops/issues/3
> > 



More information about the Gc mailing list