summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/map/map.h5
-rw-r--r--src/svm/ssvm.h5
-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/mheap.c3
6 files changed, 14 insertions, 8 deletions
diff --git a/src/plugins/map/map.h b/src/plugins/map/map.h
index abafb4e21fe..d96c7b88cb7 100644
--- a/src/plugins/map/map.h
+++ b/src/plugins/map/map.h
@@ -22,6 +22,7 @@
#include <vnet/adj/adj.h>
#include <vnet/dpo/load_balance.h>
#include "lpm.h"
+#include <vppinfra/lock.h>
#define MAP_SKIP_IP6_LOOKUP 1
@@ -501,7 +502,7 @@ map_ip4_reass_get(u32 src, u32 dst, u16 fragment_id,
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)) {}
+#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)
static_always_inline void
@@ -526,7 +527,7 @@ map_ip6_reass_get(ip6_address_t *src, ip6_address_t *dst, u32 fragment_id,
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)) {}
+#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)
int
diff --git a/src/svm/ssvm.h b/src/svm/ssvm.h
index 1c0373f126c..6c679456bff 100644
--- a/src/svm/ssvm.h
+++ b/src/svm/ssvm.h
@@ -37,6 +37,7 @@
#include <vppinfra/heap.h>
#include <vppinfra/pool.h>
#include <vppinfra/format.h>
+#include <vppinfra/lock.h>
#ifndef MMAP_PAGESIZE
#define MMAP_PAGESIZE (clib_mem_get_page_size())
@@ -104,7 +105,7 @@ ssvm_lock (ssvm_shared_header_t * h, u32 my_pid, u32 tag)
}
while (clib_atomic_test_and_set (&h->lock))
- ;
+ CLIB_PAUSE ();
h->owner_pid = my_pid;
h->recursion_count = 1;
@@ -115,7 +116,7 @@ always_inline void
ssvm_lock_non_recursive (ssvm_shared_header_t * h, u32 tag)
{
while (clib_atomic_test_and_set (&h->lock))
- ;
+ CLIB_PAUSE ();
h->tag = tag;
}
diff --git a/src/vnet/classify/vnet_classify.c b/src/vnet/classify/vnet_classify.c
index 90086f0e62f..64549a6e0d5 100755
--- a/src/vnet/classify/vnet_classify.c
+++ b/src/vnet/classify/vnet_classify.c
@@ -18,6 +18,7 @@
#include <vnet/api_errno.h> /* for API error numbers */
#include <vnet/l2/l2_classify.h> /* for L2_INPUT_CLASSIFY_NEXT_xxx */
#include <vnet/fib/fib_table.h>
+#include <vppinfra/lock.h>
vnet_classify_main_t vnet_classify_main;
@@ -447,7 +448,7 @@ vnet_classify_add_del (vnet_classify_table_t * t,
hash >>= t->log2_nbuckets;
while (clib_atomic_test_and_set (t->writer_lock))
- ;
+ CLIB_PAUSE ();
/* First elt in the bucket? */
if (b->offset == 0)
diff --git a/src/vnet/dns/dns.h b/src/vnet/dns/dns.h
index b2e3e9b90cb..19de69cc248 100644
--- a/src/vnet/dns/dns.h
+++ b/src/vnet/dns/dns.h
@@ -23,6 +23,7 @@
#include <vppinfra/hash.h>
#include <vnet/dns/dns_packet.h>
#include <vnet/ip/ip.h>
+#include <vppinfra/lock.h>
typedef struct
{
@@ -196,7 +197,7 @@ dns_cache_lock (dns_main_t * dm)
if (dm->cache_lock)
{
while (clib_atomic_test_and_set (dm->cache_lock))
- ;
+ CLIB_PAUSE ();
}
}
diff --git a/src/vppinfra/elog.c b/src/vppinfra/elog.c
index 12ac3a596e4..489ccf436d9 100644
--- a/src/vppinfra/elog.c
+++ b/src/vppinfra/elog.c
@@ -41,13 +41,14 @@
#include <vppinfra/format.h>
#include <vppinfra/hash.h>
#include <vppinfra/math.h>
+#include <vppinfra/lock.h>
static inline void
elog_lock (elog_main_t * em)
{
if (PREDICT_FALSE (em->lock != 0))
while (clib_atomic_test_and_set (em->lock))
- ;
+ CLIB_PAUSE ();
}
static inline void
diff --git a/src/vppinfra/mheap.c b/src/vppinfra/mheap.c
index ba5bbc9b6e7..2769838d4ba 100644
--- a/src/vppinfra/mheap.c
+++ b/src/vppinfra/mheap.c
@@ -41,6 +41,7 @@
#include <vppinfra/mheap.h>
#include <vppinfra/os.h>
#include <vppinfra/time.h>
+#include <vppinfra/lock.h>
#ifdef CLIB_UNIX
#include <vppinfra/elf_clib.h>
@@ -64,7 +65,7 @@ mheap_maybe_lock (void *v)
}
while (clib_atomic_test_and_set (&h->lock))
- ;
+ CLIB_PAUSE ();
h->owner_cpu = my_cpu;
h->recursion_count = 1;