From 4f04db8b8909523d87486457f2fc4fa1f9a5740f Mon Sep 17 00:00:00 2001 From: David Marchand Date: Tue, 15 Apr 2014 15:50:42 +0200 Subject: [PATCH] eal: check coremask against detected lcores lcores that are set in coremask should be checked against lcores detected on system. This way, we won't need to check them later. Besides, if specifying an unavailable lcore, we currently panic in eal_thread_loop() because pthread_setaffinity_np fails. So this check will return an error with a more explicit message in eal_parse_coremask(). "EAL: pthread_setaffinity_np failed PANIC in eal_thread_loop(): cannot set affinity" becomes : "EAL: lcore 4 unavailable EAL: invalid coremask" Signed-off-by: David Marchand Acked-by: Neil Horman --- lib/librte_eal/linuxapp/eal/eal.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index 3ded563725..4f74eca253 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -441,6 +441,11 @@ eal_parse_coremask(const char *coremask) val = xdigit2val(c); for(j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; j++, idx++) { if((1 << j) & val) { + if (!lcore_config[idx].detected) { + RTE_LOG(ERR, EAL, "lcore %u " + "unavailable\n", idx); + return -1; + } cfg->lcore_role[idx] = ROLE_RTE; if(count == 0) cfg->master_lcore = idx; -- 2.20.1