aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vlib/threads.c21
-rw-r--r--src/vpp/vnet/main.c8
2 files changed, 21 insertions, 8 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 4b70642d3cb..7e6ac25f109 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -222,7 +222,12 @@ vlib_thread_init (vlib_main_t * vm)
cpu_set_t cpuset;
CPU_ZERO (&cpuset);
CPU_SET (tm->main_lcore, &cpuset);
- pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ if (pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t),
+ &cpuset))
+ {
+ return clib_error_return (0, "could not pin main thread to cpu %u",
+ tm->main_lcore);
+ }
}
/* Set up thread 0 */
@@ -304,7 +309,8 @@ vlib_thread_init (vlib_main_t * vm)
if (c == ~0)
return clib_error_return (0,
"no available cpus to be used for"
- " the '%s' thread", tr->name);
+ " the '%s' thread #%u",
+ tr->name, tr->count);
avail_cpu = clib_bitmap_set (avail_cpu, 0, avail_c0);
avail_cpu = clib_bitmap_set (avail_cpu, c, 0);
@@ -801,25 +807,26 @@ start_workers (vlib_main_t * vm)
{
for (j = 0; j < tr->count; j++)
{
+
w = vlib_worker_threads + worker_thread_index++;
err = vlib_launch_thread_int (vlib_worker_thread_bootstrap_fn,
w, 0);
if (err)
- clib_error_report (err);
+ clib_unix_error ("%U, thread %s init on cpu %d failed",
+ format_clib_error, err, tr->name, 0);
}
}
else
{
uword c;
- /* *INDENT-OFF* */
clib_bitmap_foreach (c, tr->coremask) {
w = vlib_worker_threads + worker_thread_index++;
err = vlib_launch_thread_int (vlib_worker_thread_bootstrap_fn,
w, c);
if (err)
- clib_error_report (err);
- }
- /* *INDENT-ON* */
+ clib_unix_error ("%U, thread %s init on cpu %d failed",
+ format_clib_error, err, tr->name, c);
+ }
}
}
vlib_worker_thread_barrier_sync (vm);
diff --git a/src/vpp/vnet/main.c b/src/vpp/vnet/main.c
index be34228f01d..3257d9cda57 100644
--- a/src/vpp/vnet/main.c
+++ b/src/vpp/vnet/main.c
@@ -325,7 +325,13 @@ defaulted:
{
CPU_ZERO (&cpuset);
CPU_SET (main_core, &cpuset);
- pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t), &cpuset);
+ if (pthread_setaffinity_np (pthread_self (), sizeof (cpu_set_t),
+ &cpuset))
+ {
+ clib_unix_error (
+ "pthread_setaffinity_np() on cpu %d failed for main thread",
+ main_core);
+ }
}
/* Set up the plugin message ID allocator right now... */