diff options
author | Damjan Marion <damarion@cisco.com> | 2019-02-26 17:15:48 +0100 |
---|---|---|
committer | Ed Warnicke <hagbard@gmail.com> | 2019-02-27 15:25:21 +0000 |
commit | bad0bcd442417f943f2205112128dabeab36bf34 (patch) | |
tree | fc0136da49c5615c54cf18aacea46f5156fd6705 | |
parent | 372a33efe8b8cc941c6313a70d5050ddc6f26259 (diff) |
Fix crash in barrier sync when vlib_worker_threads is zero
Change-Id: I6819dd9dbfc15c17740bdb98b51bdd639ef8c4d2
Signed-off-by: Damjan Marion <damarion@cisco.com>
(cherry picked from commit 8343ee5665942353e57ee074da62b9d07c1c510b)
-rw-r--r-- | src/vlib/threads.c | 3 | ||||
-rw-r--r-- | src/vlib/threads.h | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c index 3e184e3e1cd..af60bc6def6 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -1360,7 +1360,7 @@ vlib_worker_thread_fork_fixup (vlib_fork_fixup_t which) #endif void -vlib_worker_thread_barrier_sync_int (vlib_main_t * vm) +vlib_worker_thread_barrier_sync_int (vlib_main_t * vm, const char *func_name) { f64 deadline; f64 now; @@ -1374,6 +1374,7 @@ vlib_worker_thread_barrier_sync_int (vlib_main_t * vm) ASSERT (vlib_get_thread_index () == 0); + vlib_worker_threads[0].barrier_caller = func_name; count = vec_len (vlib_mains) - 1; /* Record entry relative to last close */ diff --git a/src/vlib/threads.h b/src/vlib/threads.h index 0e9cba52103..0ceb21e1218 100644 --- a/src/vlib/threads.h +++ b/src/vlib/threads.h @@ -201,9 +201,10 @@ u32 vlib_frame_queue_main_init (u32 node_index, u32 frame_queue_nelts); #define BARRIER_SYNC_TIMEOUT (1.0) #endif -#define vlib_worker_thread_barrier_sync(X) {vlib_worker_threads[0].barrier_caller=__FUNCTION__;vlib_worker_thread_barrier_sync_int(X);} +#define vlib_worker_thread_barrier_sync(X) {vlib_worker_thread_barrier_sync_int(X, __FUNCTION__);} -void vlib_worker_thread_barrier_sync_int (vlib_main_t * vm); +void vlib_worker_thread_barrier_sync_int (vlib_main_t * vm, + const char *func_name); void vlib_worker_thread_barrier_release (vlib_main_t * vm); void vlib_worker_thread_node_refork (void); |