vlib: require main core with 'skip-cores' attribute 99/41099/4
authorhsandid <[email protected]>
Mon, 10 Jun 2024 14:06:37 +0000 (16:06 +0200)
committerDamjan Marion <[email protected]>
Sun, 13 Apr 2025 19:06:22 +0000 (19:06 +0000)
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 <[email protected]>
src/vlib/threads.c

index 0a5779c..0d1cf50 100644 (file)
@@ -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)