diff options
author | Dave Barach <dbarach@cisco.com> | 2018-11-01 08:12:52 -0400 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2018-11-01 20:41:22 +0000 |
commit | f6c68d74eca9038516986254846de60a4f7c02ae (patch) | |
tree | 37ed22a3b75e993252ce81bfe6530fdd5c64d238 /src/vlib | |
parent | f3ffdbc809e912e6cb8ac042a20ad5227c754b23 (diff) |
Move RPC calls off the binary API input queue
Change-Id: I2476e3e916a42b41d1e66bfc1ec4f8c4264c1720
Signed-off-by: Dave Barach <dbarach@cisco.com>
Diffstat (limited to 'src/vlib')
-rw-r--r-- | src/vlib/main.c | 7 | ||||
-rw-r--r-- | src/vlib/main.h | 4 | ||||
-rw-r--r-- | src/vlib/threads.c | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/vlib/main.c b/src/vlib/main.c index a6ad4032dae..df7c2f1e007 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -1534,7 +1534,10 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main) vlib_node_runtime_t *n; if (PREDICT_FALSE (_vec_len (vm->pending_rpc_requests) > 0)) - vl_api_send_pending_rpc_requests (vm); + { + if (!is_main) + vl_api_send_pending_rpc_requests (vm); + } if (!is_main) { @@ -1842,6 +1845,8 @@ vlib_main (vlib_main_t * volatile vm, unformat_input_t * input) vec_validate (vm->pending_rpc_requests, 0); _vec_len (vm->pending_rpc_requests) = 0; + vec_validate (vm->processing_rpc_requests, 0); + _vec_len (vm->processing_rpc_requests) = 0; switch (clib_setjmp (&vm->main_loop_exit, VLIB_MAIN_LOOP_EXIT_NONE)) { diff --git a/src/vlib/main.h b/src/vlib/main.h index 7c34fb6528d..1cf8fe188b1 100644 --- a/src/vlib/main.h +++ b/src/vlib/main.h @@ -207,8 +207,10 @@ typedef struct vlib_main_t /* Earliest barrier can be closed again */ f64 barrier_no_close_before; - /* Vector of pending RPC requests */ + /* RPC requests, main thread only */ uword *pending_rpc_requests; + uword *processing_rpc_requests; + clib_spinlock_t pending_rpc_lock; } vlib_main_t; diff --git a/src/vlib/threads.c b/src/vlib/threads.c index c99458ddaec..7ecfa309378 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -699,6 +699,9 @@ start_workers (vlib_main_t * vm) vlib_worker_threads->node_reforks_required = clib_mem_alloc_aligned (sizeof (u32), CLIB_CACHE_LINE_BYTES); + /* We'll need the rpc vector lock... */ + clib_spinlock_init (&vm->pending_rpc_lock); + /* Ask for an initial barrier sync */ *vlib_worker_threads->workers_at_barrier = 0; *vlib_worker_threads->wait_at_barrier = 1; |