[RFC] [PATCH] powerpc: Fix missing barriers in atomic_exchange_and_add_{acq,rel}

Torvald Riegel triegel@redhat.com
Tue Oct 21 19:54:00 GMT 2014


On powerpc, atomic_exchange_and_add is implemented without any barriers.
However, atomic_exchange_and_add_acq and atomic_exchange_and_add_rel
(which supposedly should have acquire / release barrier semantics) both
fall back to atomic_exchange_and_add if they are not defined (see
include/atomic.h).  I have not reviewed existing code to see whether
this would indeed cause a bug, but this lack of barriers likely is a
(future) fault, and prevents any use of
atomic_exchange_and_add_{acq,rel} that actually rely on the barrier
semantics.  Therefore, this patch defines
atomic_exchange_and_add_{acq,rel} using atomic_read_barrier /
atomic_write_barrier.

I have NOT tested this.  Can somebody who cares about powerpc please
have a look and test this?  Thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: powerpc-exchange.patch
Type: text/x-patch
Size: 1003 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20141021/b48cc121/attachment.bin>


More information about the Libc-alpha mailing list