summaryrefslogtreecommitdiffstats
path: root/src/vlib/threads.c
diff options
context:
space:
mode:
authorDave Barach <dave@barachs.net>2017-03-08 19:08:56 -0500
committerOle Trøan <otroan@employees.org>2017-03-09 19:07:17 +0000
commit80f54e20270ed0628ee725e3e3c515731a0188f2 (patch)
treefa06d939942af6f5126ee645c38cb787814bfb6f /src/vlib/threads.c
parentb3b2de71ceea0cc7ce18f89cc8180ed4a42e355d (diff)
vlib_mains == 0 special cases be gone
Clean up spurious binary API client link dependency on libvlib.so, which managed to hide behind vlib_mains == 0 checks reached by VLIB_xxx_FUNCTION macros. Change-Id: I5df1f8ab07dca1944250e643ccf06e60a8462325 Signed-off-by: Dave Barach <dave@barachs.net>
Diffstat (limited to 'src/vlib/threads.c')
-rw-r--r--src/vlib/threads.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index e3ea3c9cb47..4676be97412 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -570,9 +570,13 @@ start_workers (vlib_main_t * vm)
if (n_vlib_mains > 1)
{
- vec_validate (vlib_mains, tm->n_vlib_mains - 1);
+ /* Replace hand-crafted length-1 vector with a real vector */
+ vlib_mains = 0;
+
+ vec_validate_aligned (vlib_mains, tm->n_vlib_mains - 1,
+ CLIB_CACHE_LINE_BYTES);
_vec_len (vlib_mains) = 0;
- vec_add1 (vlib_mains, vm);
+ vec_add1_aligned (vlib_mains, vm, CLIB_CACHE_LINE_BYTES);
vlib_worker_threads->wait_at_barrier =
clib_mem_alloc_aligned (sizeof (u32), CLIB_CACHE_LINE_BYTES);
@@ -685,7 +689,7 @@ start_workers (vlib_main_t * vm)
/* Packet trace buffers are guaranteed to be empty, nothing to do here */
clib_mem_set_heap (oldheap);
- vec_add1 (vlib_mains, vm_clone);
+ vec_add1_aligned (vlib_mains, vm_clone, CLIB_CACHE_LINE_BYTES);
vm_clone->error_main.counters =
vec_dup (vlib_mains[0]->error_main.counters);
@@ -805,7 +809,7 @@ vlib_worker_thread_node_runtime_update (void)
ASSERT (os_get_cpu_number () == 0);
- if (vec_len (vlib_mains) == 0)
+ if (vec_len (vlib_mains) == 1)
return;
vm = vlib_mains[0];
@@ -1148,7 +1152,7 @@ vlib_worker_thread_barrier_sync (vlib_main_t * vm)
f64 deadline;
u32 count;
- if (!vlib_mains)
+ if (vec_len (vlib_mains) < 2)
return;
count = vec_len (vlib_mains) - 1;
@@ -1179,7 +1183,7 @@ vlib_worker_thread_barrier_release (vlib_main_t * vm)
{
f64 deadline;
- if (!vlib_mains)
+ if (vec_len (vlib_mains) < 2)
return;
if (--vlib_worker_threads[0].recursion_level > 0)