From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 1A50EAE99 for ; Tue, 15 Apr 2014 15:50:48 +0200 (CEST) Received: by mail-wg0-f41.google.com with SMTP id n12so9725225wgh.24 for ; Tue, 15 Apr 2014 06:50:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=ABN/JMJ/QHffpUC7dwpzqryqwfZVAhOz8sqQZgu3v5A=; b=LBGV2Fa7XEk1fp5mBoSjiK11sTR9DwD6ehPaFpNhb7t1UFhVqRj49l8lZ4b/alEXnV 9Oa6BdbnVyCYYE3fYND1ClJjEfpkQH1gnsj/yL/wC5Q9FIxbmnPP6BxjzIdqUyMHvGMX BHBX0X4h0kyZsQxNQY7yc/ZJ1ExuV/tdQk/takB6oRKo0x9YeliMLwAR9DaNE5dkyU13 vHBll318ubFpce3nnkVIJMx484PpxHJ7VwgzRw1a2gU7tUPvEZXxbW1CfYVkXVfqar1M EOnZrURTJL56ryx4A5MBX7YVVLXHDj1DNqT2ONjab32epOCOaT/gwALzX62qpbzrMehv zs6A== X-Gm-Message-State: ALoCoQnBLkuOKegM0fqaRmbrJzLOZlixTRsx3ZS0Y9twfge0IK12LrnyXGkgcVcSBl3w/e5Jy0CM X-Received: by 10.194.89.40 with SMTP id bl8mr9024wjb.90.1397569848239; Tue, 15 Apr 2014 06:50:48 -0700 (PDT) Received: from alcyon.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id or5sm29842558wjc.2.2014.04.15.06.50.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Apr 2014 06:50:47 -0700 (PDT) From: David Marchand To: dev@dpdk.org Date: Tue, 15 Apr 2014 15:50:42 +0200 Message-Id: <1397569842-12562-1-git-send-email-david.marchand@6wind.com> X-Mailer: git-send-email 1.7.10.4 Subject: [dpdk-dev] [PATCH] eal: check coremask against detected lcores X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Apr 2014 13:50:48 -0000 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 --- 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 d2753ec..04b2b32 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; -- 1.7.10.4