summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/map/map.h4
-rw-r--r--src/svm/ssvm.h6
-rwxr-xr-xsrc/vnet/classify/vnet_classify.c3
-rw-r--r--src/vnet/dns/dns.h3
-rw-r--r--src/vppinfra/elog.c3
-rw-r--r--src/vppinfra/lock.h19
-rw-r--r--src/vppinfra/mheap.c3
7 files changed, 14 insertions, 27 deletions
diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h
index d96c7b88cb7..6dc5232bf43 100644
--- a/src/plugins/map/map.h
+++ b/src/plugins/map/map.h
@@ -503,7 +503,7 @@ void
map_ip4_reass_free(map_ip4_reass_t *r, u32 **pi_to_drop);
#define map_ip4_reass_lock() while (clib_atomic_test_and_set (map_main.ip4_reass_lock)) { CLIB_PAUSE (); }
-#define map_ip4_reass_unlock() do {CLIB_MEMORY_BARRIER(); *map_main.ip4_reass_lock = 0;} while(0)
+#define map_ip4_reass_unlock() clib_atomic_release (map_main.ip4_reass_lock)
static_always_inline void
map_ip4_reass_get_fragments(map_ip4_reass_t *r, u32 **pi)
@@ -528,7 +528,7 @@ void
map_ip6_reass_free(map_ip6_reass_t *r, u32 **pi_to_drop);
#define map_ip6_reass_lock() while (clib_atomic_test_and_set (map_main.ip6_reass_lock)) { CLIB_PAUSE (); }
-#define map_ip6_reass_unlock() do {CLIB_MEMORY_BARRIER(); *map_main.ip6_reass_lock = 0;} while(0)
+#define map_ip6_reass_unlock() clib_atomic_release (map_main.ip6_reass_lock)
int
map_ip6_reass_add_fragment(map_ip6_reass_t *r, u32 pi,
diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h
index 6c679456bff..60e0cc61ca4 100644
--- a/src/svm/ssvm.h
+++ b/src/svm/ssvm.h
@@ -128,8 +128,7 @@ ssvm_unlock (ssvm_shared_header_t * h)
{
h->owner_pid = 0;
h->tag = 0;
- CLIB_MEMORY_BARRIER ();
- h->lock = 0;
+ clib_atomic_release (&h->lock);
}
}
@@ -137,8 +136,7 @@ always_inline void
ssvm_unlock_non_recursive (ssvm_shared_header_t * h)
{
h->tag = 0;
- CLIB_MEMORY_BARRIER ();
- h->lock = 0;
+ clib_atomic_release (&h->lock);
}
static inline void *
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c
index 64549a6e0d5..f5e49491b25 100755
--- a/src/vnet/classify/vnet_classify.c
+++ b/src/vnet/classify/vnet_classify.c
@@ -640,8 +640,7 @@ expand_ok:
vnet_classify_entry_free (t, v, old_log2_pages);
unlock:
- CLIB_MEMORY_BARRIER ();
- t->writer_lock[0] = 0;
+ clib_atomic_release (&t->writer_lock[0]);
return rv;
}
diff --git a/src/vnet/dns/dns.h b/src/vnet/dns/dns.h
index 19de69cc248..d5029e521d6 100644
--- a/src/vnet/dns/dns.h
+++ b/src/vnet/dns/dns.h
@@ -206,8 +206,7 @@ dns_cache_unlock (dns_main_t * dm)
{
if (dm->cache_lock)
{
- CLIB_MEMORY_BARRIER ();
- *dm->cache_lock = 0;
+ clib_atomic_release (dm->cache_lock);
}
}
diff --git a/src/vppinfra/elog.c b/src/vppinfra/elog.c
index 489ccf436d9..caddf6f3757 100644
--- a/src/vppinfra/elog.c
+++ b/src/vppinfra/elog.c
@@ -56,8 +56,7 @@ elog_unlock (elog_main_t * em)
{
if (PREDICT_FALSE (em->lock != 0))
{
- CLIB_MEMORY_BARRIER ();
- *em->lock = 0;
+ clib_atomic_release (em->lock);
}
}
diff --git a/src/vppinfra/lock.h b/src/vppinfra/lock.h
index 337c5a3f0ad..59ab0e33c51 100644
--- a/src/vppinfra/lock.h
+++ b/src/vppinfra/lock.h
@@ -89,9 +89,8 @@ static_always_inline void
clib_spinlock_unlock (clib_spinlock_t * p)
{
CLIB_LOCK_DBG_CLEAR (p);
- /* Make sure all writes are complete before releasing the lock */
- CLIB_MEMORY_BARRIER ();
- (*p)->lock = 0;
+ /* Make sure all reads/writes are complete before releasing the lock */
+ clib_atomic_release (&(*p)->lock);
}
static_always_inline void
@@ -147,9 +146,7 @@ clib_rwlock_reader_lock (clib_rwlock_t * p)
while (clib_atomic_test_and_set (&(*p)->writer_lock))
CLIB_PAUSE ();
}
- CLIB_MEMORY_BARRIER ();
- (*p)->n_readers_lock = 0;
-
+ clib_atomic_release (&(*p)->n_readers_lock);
CLIB_LOCK_DBG (p);
}
@@ -165,12 +162,9 @@ clib_rwlock_reader_unlock (clib_rwlock_t * p)
(*p)->n_readers -= 1;
if ((*p)->n_readers == 0)
{
- CLIB_MEMORY_BARRIER ();
- (*p)->writer_lock = 0;
+ clib_atomic_release (&(*p)->writer_lock);
}
-
- CLIB_MEMORY_BARRIER ();
- (*p)->n_readers_lock = 0;
+ clib_atomic_release (&(*p)->n_readers_lock);
}
always_inline void
@@ -185,8 +179,7 @@ always_inline void
clib_rwlock_writer_unlock (clib_rwlock_t * p)
{
CLIB_LOCK_DBG_CLEAR (p);
- CLIB_MEMORY_BARRIER ();
- (*p)->writer_lock = 0;
+ clib_atomic_release (&(*p)->writer_lock);
}
#endif
diff --git a/src/vppinfra/mheap.c b/src/vppinfra/mheap.c
index 2769838d4ba..b5566bd6389 100644
--- a/src/vppinfra/mheap.c
+++ b/src/vppinfra/mheap.c
@@ -82,8 +82,7 @@ mheap_maybe_unlock (void *v)
if (--h->recursion_count == 0)
{
h->owner_cpu = ~0;
- CLIB_MEMORY_BARRIER ();
- h->lock = 0;
+ clib_atomic_release (&h->lock);
}
}
}