diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2016-01-20 11:19:32 +0200 |
---|---|---|
committer | Maxim Uvarov <maxim.uvarov@linaro.org> | 2016-02-08 20:45:24 +0300 |
commit | a12e4ce2e94638a07b23f083d79661e1ba627a44 (patch) | |
tree | 954a27bb684971f5cf3512996a1da7f72e150524 /platform/linux-generic | |
parent | 7bd0eab46d20563801255fb4cec6796beefa7a0d (diff) |
linux-generic: barrier: use API memory barrier
Use full memory barrier from API instead of the internal
function.
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform/linux-generic')
-rw-r--r-- | platform/linux-generic/include/odp_atomic_internal.h | 6 | ||||
-rw-r--r-- | platform/linux-generic/odp_barrier.c | 8 |
2 files changed, 4 insertions, 10 deletions
diff --git a/platform/linux-generic/include/odp_atomic_internal.h b/platform/linux-generic/include/odp_atomic_internal.h index ce62368e1..ff3813f73 100644 --- a/platform/linux-generic/include/odp_atomic_internal.h +++ b/platform/linux-generic/include/odp_atomic_internal.h @@ -64,12 +64,6 @@ typedef enum { _ODP_MEMMODEL_SC = __ATOMIC_SEQ_CST } _odp_memmodel_t; -/** - * Insert a full memory barrier (fence) in the compiler and instruction - * sequence. - */ -#define _ODP_FULL_BARRIER() __atomic_thread_fence(__ATOMIC_SEQ_CST) - /***************************************************************************** * Operations on 32-bit atomics * _odp_atomic_u32_load_mm - return current value diff --git a/platform/linux-generic/odp_barrier.c b/platform/linux-generic/odp_barrier.c index 0bfc0f042..f3525e209 100644 --- a/platform/linux-generic/odp_barrier.c +++ b/platform/linux-generic/odp_barrier.c @@ -7,7 +7,7 @@ #include <odp/barrier.h> #include <odp/sync.h> #include <odp/cpu.h> -#include <odp_atomic_internal.h> +#include <odp/atomic.h> void odp_barrier_init(odp_barrier_t *barrier, int count) { @@ -27,13 +27,13 @@ void odp_barrier_init(odp_barrier_t *barrier, int count) * the cycle the barrier was in upon entry. Exit is when the * barrier crosses to the other half of the cycle. */ - void odp_barrier_wait(odp_barrier_t *barrier) { uint32_t count; int wasless; - _ODP_FULL_BARRIER(); + odp_mb_full(); + count = odp_atomic_fetch_inc_u32(&barrier->bar); wasless = count < barrier->count; @@ -46,5 +46,5 @@ void odp_barrier_wait(odp_barrier_t *barrier) odp_cpu_pause(); } - _ODP_FULL_BARRIER(); + odp_mb_full(); } |