From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 789BFA0C53; Wed, 3 Nov 2021 14:30:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6168A4270E; Wed, 3 Nov 2021 14:30:31 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 4991642701 for ; Wed, 3 Nov 2021 14:30:29 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10156"; a="228943748" X-IronPort-AV: E=Sophos;i="5.87,205,1631602800"; d="scan'208";a="228943748" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2021 06:30:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,205,1631602800"; d="scan'208";a="531922738" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga001.jf.intel.com with ESMTP; 03 Nov 2021 06:30:21 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 3 Nov 2021 06:30:21 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Wed, 3 Nov 2021 06:30:21 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.176) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Wed, 3 Nov 2021 06:30:21 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cS7mud76uVo8y5pFAGgKel8iqBa8bvsr9u3W3uE9Wv56r03sfNeLlbzKtlfQhrux2Nyllxq+N49+aD3tMgOz3YSclzTjxNVHBhIP4/LKYRR6ffjN9qO4c73WtmGjX9LWeMM9K4Nu0n+aHA4bFsa6JhidX05KiLQSx+QaD3leT9jbkX97ACsnF+R+k0VmUsOVHIs4rD63AkpTuuhwIU1ZCPKnAKhsQ7RehcY2HOOV5ykL9uGJUAvxMYD3eRqrGEKXZa3QS2iu0Vh6OWSxjjWFvPs4OmftJwlu5/HAFc92bMvFJfuW9QR/OrCejX250WfWT40cqY/AB4NECvzN1GppNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GtKA3HWfGXIhWymWY0PfCvJf63xVVFQ4WvxV17fzKMc=; b=VWVTT44OY1Nq6cVI7tcDdWmlquRN71lQyyGSi/JgeXYLPm1XEJfTEVfOjbOEAR/sy1BKAFC2FHzmWWh/myNYM/rv13UT/3XKk376X7cjj8OLz39vLpTORMWX7yGfCT9j99HGzJ5xC41Pqrrcvlq4XWe1Q5dEScmW7zzUrGefT2Lpd8CDLP1d2atCFPuLmsxZ/kfdwHLHwzTgeItlZolou/tA1aIC1DzixDUOp5ytJGT+DfYSTaNLtaWoFWUWHw9Az/z46jbtt0rC2P/LhQlGdLPl1D33eKXY204056It6I81WjgvOAmu86pT/szFKRxfR9AVRqGYRZ/SoGHqOVCTzg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GtKA3HWfGXIhWymWY0PfCvJf63xVVFQ4WvxV17fzKMc=; b=dOwivSu52qf0yNVvieS+mTsZWiR4hpymGZOpLSBgLZP/Qg55uIvu79D3jXQwsSikPFFciC1oBPcRK/jmQR0R4q2yO7XyRXa1qmWqq82VJ87fFg/TykCIWOnUCA1jSKv4E5OvN3M2230CqtvcdQdt3vdE45+eQwnbB8uEbvsT+Fg= Authentication-Results: monjalon.net; dkim=none (message not signed) header.d=none;monjalon.net; dmarc=none action=none header.from=intel.com; Received: from PH0PR11MB5047.namprd11.prod.outlook.com (2603:10b6:510:3c::18) by PH0PR11MB4839.namprd11.prod.outlook.com (2603:10b6:510:42::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10; Wed, 3 Nov 2021 13:30:19 +0000 Received: from PH0PR11MB5047.namprd11.prod.outlook.com ([fe80::f1a0:809a:3d2e:e13c]) by PH0PR11MB5047.namprd11.prod.outlook.com ([fe80::f1a0:809a:3d2e:e13c%9]) with mapi id 15.20.4669.011; Wed, 3 Nov 2021 13:30:19 +0000 From: David Hunt To: David Marchand CC: dev , Bruce Richardson , "Thomas Monjalon" References: <20210922122920.34759-1-david.hunt@intel.com> <20210923110213.21350-1-david.hunt@intel.com> <20210923110213.21350-2-david.hunt@intel.com> <386dde71-4d62-f48e-fef8-d24dae6244ea@intel.com> Message-ID: Date: Wed, 3 Nov 2021 13:30:13 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 In-Reply-To: <386dde71-4d62-f48e-fef8-d24dae6244ea@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: LO4P123CA0117.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::14) To PH0PR11MB5047.namprd11.prod.outlook.com (2603:10b6:510:3c::18) MIME-Version: 1.0 Received: from [10.4.11.161] (95.45.23.115) by LO4P123CA0117.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:192::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11 via Frontend Transport; Wed, 3 Nov 2021 13:30:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a24f7f1f-7c8c-49df-b02f-08d99ece1444 X-MS-TrafficTypeDiagnostic: PH0PR11MB4839: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2803; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zOcrfWKvWE8PACXUrq2dhcPD/Y5HkbnDMCkM9h0jud6d5jNNdPpm474zJ5lVO9rZEWYkniwZUKQK2ZHW9KlScnXWtMN0EYHi8yQaF/9ypSOSVusmAcFo3XWLXtlFEExsbbQgLsyuUzwS2paDsTbk7KjUW05HvTsjfC4ylSd2zuuASW1896w8CbDNFy2OxNdZ/9EZRFR5YKNFIRzXwolCYMOEL6y5EVKd4HRobgnFkonRZxQZyLZpJmSKm+F/0Kw06nwseQX3/4+4rX2iOpXNVpefrG9NgjR00Wv6UOjcwoy5RpVsJGiPxFG48Q1mjgN4XrcsQrEYEoIVENOn/VB11u0feMFx4whO8oysxMf2WmYKO8LMSBO5PR5qB8tBL5r0kWvgmsTmEWQ9R+JKqZE5NxkQS+YbkbkPomBGpsksEtg7XmRR6nlS9hZFkeAMjovJlrN+mpLi9MFS9dchWVfGlsDf68hRgNgRvpUhnZTtKGpUndYvdHiPP0dgvBo0JK0flMaFb1rN0yNRLdoFQbEraHvG0BTQHDROUBXweIONnTVEYAAy1SqxsSyD3GfTzQrNsRgCLaGJBRKOREFlSt9a7YvocQytoSkYmcEXQt9iKfahSw/jeifmliZfPkPiIKx8IST1qSZTDsE9FzLxdf9Z0rAsPDs0EUEWGbsGoRHT0/l3G3lTJnp5gyBCq1xlQ7VONhjPSGbqMXoLUKtckCEPKxPirdAn03/Cy71VgFypNOK+qziCdRHQmgt7TVLC4BXF X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH0PR11MB5047.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(38100700002)(31686004)(36756003)(4326008)(2616005)(26005)(316002)(956004)(186003)(16576012)(6916009)(54906003)(5660300002)(44832011)(82960400001)(31696002)(66946007)(6666004)(86362001)(8676002)(6486002)(53546011)(2906002)(66556008)(508600001)(83380400001)(66476007)(8936002)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SEszRjJRWENBSmlSTVhTdDBoUm5oaHEvTnFrb0F6RTRyR0hOZFdGSUVWYTNl?= =?utf-8?B?MVAxWFZmU2hIU3RCRU9HVlpjRzNUQ0p6QzF5Nk1kalpiTk1ib1BVVHZwQS9s?= =?utf-8?B?M2FMQ2JEa25CTEZVbWZocGZKbnBGZnloOW4yMWxWVEdYVmtZdlVyeUxUQTBJ?= =?utf-8?B?OTNLRklvNy9KUWRWckdQVWUwMUdjNytxeTQrZXhnQm5HcFE2VEk0dVRHN3Bq?= =?utf-8?B?a2FXVDBzVDRsQVZ5aHVTRGxtSTlISXB3N1JrYm96NXBLbkViR3BYM0NDK254?= =?utf-8?B?YlRiaHY1S0pGMUM4TGpmMXI3TktqUUl5clNwSFppaEFQSFpndGlzMmhTQ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k1QVzZGM1FMVjFQd1FZRlJJRDds?= =?utf-8?Q?FJUE3WAs5Q/Y3R5Qlx0kOzI=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: a24f7f1f-7c8c-49df-b02f-08d99ece1444 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5047.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2021 13:30:19.2114 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4EXhXSeXZH5tNdkUI5e45BADy+GGm0ndUMsOEtOUWUz43fRucv5hud3XeH/sW9/kWjDiQAjU8SzpMJpJ6Z/0Ug== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB4839 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH v5 2/2] eal: add additional info if core mask too long X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 3/11/2021 10:27 AM, David Hunt wrote: > Hi David, > > On 2/11/2021 5:45 PM, David Marchand wrote: >> On Thu, Sep 23, 2021 at 1:03 PM David Hunt wrote: >>> If the user requests to use an lcore above 128 using -c, >>> the eal will exit with "EAL: invalid coremask syntax" and >>> very little else useful information. >>> >>> This patch adds some extra information suggesting to use --lcores >>> so that physical cores above RTE_MAX_LCORE (default 128) can be >>> used. This is achieved by using the --lcores option by mapping >>> the logical cores in the application to physical cores. >>> >>> For example, if "-c 0x300000000000000000000000000000000" is >>> used, we see the following additional output on the command line: >>> >>> EAL: lcore 128 >= RTE_MAX_LCORE (128) >>> EAL: lcore 129 >= RTE_MAX_LCORE (128) >>> EAL: to use high physical core ids , please use --lcores to >>> map them to lcore ids below RTE_MAX_LCORE, >>> EAL:     e.g. --lcores 0@128,1@129 >>> >>> Signed-off-by: David Hunt >>> Acked-by: Bruce Richardson >>> --- >>> changes in v3 >>>     * added this patch to the set. Addresses the changes for >>>       the -c option. >>> changes in v4 >>>     * fixed buffer overrun in populating lcore array. >>>     * switched from strlcpy to strdup due to a clang error. >>> changes in v5 >>>     * replaced strdup and frees with a const char *, as we >>>       just need to keep track of original pointer location. >>>     * reverted err: usage to return -1, as no free() needed. >>>     * other minod code cleanups. >>> --- >>> --- >>>   lib/eal/common/eal_common_options.c | 47 >>> ++++++++++++++++++++++++----- >>>   1 file changed, 40 insertions(+), 7 deletions(-) >>> >>> diff --git a/lib/eal/common/eal_common_options.c >>> b/lib/eal/common/eal_common_options.c >>> index 72735e0b09..7f715e4c15 100644 >>> --- a/lib/eal/common/eal_common_options.c >>> +++ b/lib/eal/common/eal_common_options.c >>> @@ -750,10 +750,12 @@ check_core_list(int *lcores, unsigned int count) >>>   static int >>>   eal_parse_coremask(const char *coremask, int *cores) >>>   { >>> -       unsigned count = 0; >>> +       unsigned int count = 0; >>>          int i, j, idx; >>>          int val; >>>          char c; >>> +       int lcores[RTE_MAX_LCORE]; >>> +       const char *coremask_orig = coremask; >>> >>>          for (idx = 0; idx < RTE_MAX_LCORE; idx++) >>>                  cores[idx] = -1; >>> @@ -770,29 +772,60 @@ eal_parse_coremask(const char *coremask, int >>> *cores) >>>          i = strlen(coremask); >>>          while ((i > 0) && isblank(coremask[i - 1])) >>>                  i--; >>> -       if (i == 0) >>> +       if (i == 0) { >>> +               RTE_LOG(ERR, EAL, "No lcores in coremask: [%s]\n", >>> +                               coremask_orig); >>>                  return -1; >>> +       } >>> >>> -       for (i = i - 1; i >= 0 && idx < RTE_MAX_LCORE; i--) { >>> +       for (i = i - 1; i >= 0; i--) { >> This loop exit condition changes here: this ensures that, once we >> leave the loop, i == -1. >> As a consequence... (see below) >> >> >>>                  c = coremask[i]; >>>                  if (isxdigit(c) == 0) { >>>                          /* invalid characters */ >>> +                       RTE_LOG(ERR, EAL, "invalid characters in >>> coremask: [%s]\n", >>> +                                       coremask_orig); >>>                          return -1; >>>                  } >>>                  val = xdigit2val(c); >>> -               for (j = 0; j < BITS_PER_HEX && idx < RTE_MAX_LCORE; >>> j++, idx++) >>> +               for (j = 0; j < BITS_PER_HEX; j++, idx++) >>>                  { >>>                          if ((1 << j) & val) { >>> -                               cores[idx] = count; >>> +                               if (count >= RTE_MAX_LCORE) { >>> +                                       RTE_LOG(ERR, EAL, "Too many >>> lcores provided. Cannot exceed %d\n", >>> + RTE_MAX_LCORE); >>> +                                       return -1; >>> +                               } >>> +                               lcores[count] = idx; >>>                                  count++; >>>                          } >>>                  } >>>          } >> ... this loop below is dead code. > > > Sure, no need to loop. I'll take out the loop, and just check for the > first two characters to be '0x', as they're already trimmed. > > On second thoughts, looking at this closer, the any '0x' or '0X' at the start is skipped earlier in the code, so all we're checking for here is a leading zero to the hex, which does not seem valid, as that would mean that 0x0ff is valid, but 0xff is not. Take the following 2 cases: -c f EAL: Invalid start [0] to coremask: [f] and even worse: -c 0xf EAL: Invalid start [0] to coremask: [0xf] So I think it makes sense to remove that particular check altogether, in which case both "-c f" and "-c 0xf" will work as expected. I will make this change in next version. --snip--