summaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorVladimir Isaev <visaev@netgate.com>2020-03-17 12:30:11 +0300
committerDamjan Marion <dmarion@me.com>2020-03-21 12:09:38 +0000
commit18a4a371646bccfd299e6a509e801a524aeb4c92 (patch)
treea72cda0acabefbbd850d51f650d833c43289204c /src/vlib
parent2d822818210f7783244ea6b4343566cf0cd7c9e2 (diff)
vlib: complain if workers are configured twice
Right now following configuration leads to crash: cpu { corelist-workers 2 workers 2 } because threads count will be set to 2, but we have only one core in coremask. Type: fix Signed-off-by: Vladimir Isaev <visaev@netgate.com> Change-Id: Ia93b892733971e7c8ddfceaaec5f4eb8bf9063ac
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/threads.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index e9d9cb5a158..a7d9155cb58 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -1299,6 +1299,10 @@ cpu_config (vlib_main_t * vm, unformat_input_t * input)
return clib_error_return (0,
"corelist cannot be set for '%s' threads",
name);
+ if (tr->count)
+ return clib_error_return
+ (0, "core placement of '%s' threads is already configured",
+ name);
tr->coremask = bitmap;
tr->count = clib_bitmap_count_set_bits (tr->coremask);
@@ -1317,9 +1321,14 @@ cpu_config (vlib_main_t * vm, unformat_input_t * input)
return clib_error_return (0, "no such thread type 3 '%s'", name);
tr = (vlib_thread_registration_t *) p[0];
+
if (tr->fixed_count)
return clib_error_return
- (0, "number of %s threads not configurable", tr->name);
+ (0, "number of '%s' threads not configurable", name);
+ if (tr->count)
+ return clib_error_return
+ (0, "number of '%s' threads is already configured", name);
+
tr->count = count;
}
else