From f2aaacf36186c749e96f2cc1ee27c905b2ac7ef2 Mon Sep 17 00:00:00 2001 From: hsandid Date: Mon, 10 Jun 2024 16:06:37 +0200 Subject: [PATCH] vlib: require main core with 'skip-cores' attribute Type: fix Not specifying main core with 'skip-cores' attribute can result in launch issues e.g. if main thread pinned automatically by scheduler to a cpu in 'skip-cores' range. Change-Id: Ie47b3691e25ed4ff5d53887d3e1d5e8cb2be00b9 Signed-off-by: Hadi Rayan Al-Sandid --- src/vlib/threads.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vlib/threads.c b/src/vlib/threads.c index 0a5779c2d2e..0d1cf502f6e 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -1164,6 +1164,11 @@ cpu_config (vlib_main_t * vm, unformat_input_t * input) if (use_corelist && tm->main_lcore == ~0) return clib_error_return (0, "main-core must be specified when using " "corelist-* or coremask-* attribute"); + + if (tm->skip_cores != 0 && tm->main_lcore == ~0) + return clib_error_return ( + 0, "main-core must be specified when using skip-cores attribute"); + if (tm->sched_priority != ~0) { if (tm->sched_policy == SCHED_FIFO || tm->sched_policy == SCHED_RR) -- 2.16.6