From: Vladimir Isaev Date: Tue, 17 Mar 2020 09:30:11 +0000 (+0300) Subject: vlib: complain if workers are configured twice X-Git-Tag: v19.08.3~127 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=704ebc1f89aa8b9e2ee022b76f25756fbd40c416;p=vpp.git 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 Change-Id: Ia93b892733971e7c8ddfceaaec5f4eb8bf9063ac (cherry picked from commit 18a4a371646bccfd299e6a509e801a524aeb4c92) --- diff --git a/src/vlib/threads.c b/src/vlib/threads.c index e1a9e8cbae5..3488d70cec3 100644 --- a/src/vlib/threads.c +++ b/src/vlib/threads.c @@ -1272,6 +1272,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); @@ -1290,9 +1294,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