From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH] eal: fix parsing of argument of option --lcores Date: Thu, 21 Jul 2016 16:21:33 +0200 Message-ID: <10671507.FyByOGJAaB@xps13> References: <1469081018-55300-1-git-send-email-wei.dai@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: dev@dpdk.org To: Wei Dai Return-path: Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com [209.85.215.43]) by dpdk.org (Postfix) with ESMTP id 9169147D1 for ; Thu, 21 Jul 2016 16:21:36 +0200 (CEST) Received: by mail-lf0-f43.google.com with SMTP id g62so63343090lfe.3 for ; Thu, 21 Jul 2016 07:21:36 -0700 (PDT) In-Reply-To: <1469081018-55300-1-git-send-email-wei.dai@intel.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, 2016-07-21 14:03, Wei Dai: > The '-' in lcores set overrides cpu set of following > lcore set in the argument of EAL option --lcores. > > Fixes: 53e54bf81700 ("eal: new option --lcores for cpu assignment") > > Signed-off-by: Wei Dai Thanks for the catch! > --- a/lib/librte_eal/common/eal_common_options.c > +++ b/lib/librte_eal/common/eal_common_options.c > @@ -563,6 +563,7 @@ convert_to_cpuset(rte_cpuset_t *cpusetp, > * lcores, cpus could be a single digit/range or a group. > * '(' and ')' are necessary if it's a group. > * If not supply '@cpus', the value of cpus uses the same as lcores. > + * The 'a-b' in lcores not within '(' and ')' means a,a+1,...,b-1,b . It also a range when inside a group. The difference is the mapping to the cpus. I think this new comment brings more confusion. Better to skip. > * e.g. '1,2@(5-7),(3-5)@(0,2),(0,6),7-8' means start 9 EAL thread as below > * lcore 0 runs on cpuset 0x41 (cpu 0,6) > * lcore 1 runs on cpuset 0x2 (cpu 1) > @@ -571,6 +572,15 @@ convert_to_cpuset(rte_cpuset_t *cpusetp, > * lcore 6 runs on cpuset 0x41 (cpu 0,6) > * lcore 7 runs on cpuset 0x80 (cpu 7) > * lcore 8 runs on cpuset 0x100 (cpu 8) > + * e.g. '0-2,(3-5)@(3,4),6@(5,6),7@(5-7)'means start 8 EAL threads as below > + * lcore 0 runs on cpuset 0x1 (cpu 0) > + * lcore 1 runs on cpuset 0x2 (cpu 1) > + * lcore 2 runs on cpuset ox4 (cpu 2) > + * lcore 3,4,5 runs on cpuset 0x18 (cpu 3,4) > + * lcore 6 runs on cpuset 0x60 (cpu 5,6) > + * lcore 7 runs on cpuset 0xe0 (cpu 5,6,7) > + * The second case is used to test bugfix for lflags not be cleared after use > + */ > */ Please do not add a second example just to show how to test your fix. > @@ -679,6 +689,8 @@ eal_parse_lcores(const char *lcores) > sizeof(rte_cpuset_t)); > } > > + lflags = 0; > + > lcores = end + 1; > } while (*end != '\0'); It would have more sense to init lflags at the beginning of the loop and replace int lflags = 0; by int lflags;