From ee721412ebd3434bc6dd60f5a78f53a4f6e97667 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Sun, 27 Jan 2019 17:54:11 +0100 Subject: Fix issue with cpu_id and numa_code captured too early Change-Id: I79b213b34c6071d14acf1922f89037a4a5a36c45 Signed-off-by: Damjan Marion --- src/vlib/main.c | 6 ++++++ src/vlib/main.h | 2 +- src/vlib/threads.c | 3 +-- src/vlib/unix/main.c | 3 +-- 4 files changed, 9 insertions(+), 5 deletions(-) (limited to 'src/vlib') diff --git a/src/vlib/main.c b/src/vlib/main.c index 3048a0d72de..cfd23859210 100644 --- a/src/vlib/main.c +++ b/src/vlib/main.c @@ -1696,6 +1696,12 @@ vlib_main_or_worker_loop (vlib_main_t * vm, int is_main) { vlib_node_runtime_t *n; + if (PREDICT_FALSE (vm->cpu_id != clib_get_current_cpu_id ())) + { + vm->cpu_id = clib_get_current_cpu_id (); + vm->numa_node = clib_get_current_numa_node (); + } + if (PREDICT_FALSE (_vec_len (vm->pending_rpc_requests) > 0)) { if (!is_main) diff --git a/src/vlib/main.h b/src/vlib/main.h index 4c6d0f490dd..c6786d8f788 100644 --- a/src/vlib/main.h +++ b/src/vlib/main.h @@ -176,7 +176,7 @@ typedef struct vlib_main_t /* thread, cpu and numa_node indices */ u32 thread_index; - u32 cpu_index; + u32 cpu_id; u32 numa_node; /* List of init functions to call, setup by constructors */ diff --git a/src/vlib/threads.c b/src/vlib/threads.c index e6ac6db543a..6257bb64c90 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -1723,8 +1723,7 @@ vlib_worker_thread_fn (void *arg) ASSERT (vm->thread_index == vlib_get_thread_index ()); - vm->cpu_index = clib_get_current_cpu_index (); - vm->numa_node = clib_get_current_numa_node (); + vm->cpu_id = ~0; vlib_worker_thread_init (w); clib_time_init (&vm->clib_time); diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c index 4d6519ed857..ae92d93adc2 100755 --- a/src/vlib/unix/main.c +++ b/src/vlib/unix/main.c @@ -671,8 +671,7 @@ vlib_unix_main (int argc, char *argv[]) __os_thread_index = 0; vm->thread_index = 0; - vm->cpu_index = clib_get_current_cpu_index (); - vm->numa_node = clib_get_current_numa_node (); + vm->cpu_id = ~0; i = clib_calljmp (thread0, (uword) vm, (void *) (vlib_thread_stacks[0] + -- cgit 1.2.3-korg