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 8AD46A0C53; Wed, 3 Nov 2021 11:27:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5093841134; Wed, 3 Nov 2021 11:27:28 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 4D95F410E5 for ; Wed, 3 Nov 2021 11:27:26 +0100 (CET) X-IronPort-AV: E=McAfee;i="6200,9189,10156"; a="292304944" X-IronPort-AV: E=Sophos;i="5.87,205,1631602800"; d="scan'208";a="292304944" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2021 03:27:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,205,1631602800"; d="scan'208";a="531880079" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by orsmga001.jf.intel.com with ESMTP; 03 Nov 2021 03:27:25 -0700 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX606.amr.corp.intel.com (10.22.229.19) 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 03:27:24 -0700 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx602.amr.corp.intel.com (10.22.229.15) 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 03:27:24 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.103) 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 03:27:24 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EzoX6SD72cA/5piEd9//BKA1Mo6PuEnibis6xAR4SQ3Rtj5Mtcl69x99O1eW/SiODtzAYNIlS0B7i+4C7CHLea29Yb5j5CFHXVfcLEmPF4/OAmDrUFlmte1BNKumfgPBbcKyS6xGIiDlwLk+nkRTYUFjmbj2R+OkHBI51tJoHnVcPgCYiqXP99292IH6OyClV6EWEome57d2psJOvTtU9OjVTquLL5fnjdmyBnkAn3lDMg4el/PjeSh7WWJYyOFhg1S9F+ipF8Mb5cJRSkerPy4ut3w0FGtPVrpJuQMhBJkblC0c0Stt93lbLG1DodnGDmT+WSJT48IOcjPRVpgazQ== 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=C0EGsUxul/tCPrUwYmd10UI3FB7/VC8g5XddgqEtDH8=; b=AdRX/BHsGlMbTF0HctLrbNJ0f5XFHvf3sGa46519wF3+9y0Ftdmf8KeHYsDL+TbZJx/TeleONBSaEbw340WyCq0GaPdcis4HTAGJgcP+XQDVHbLCet/2lsRjMHOFeA/W1IGzIRBNicCjfQFEq31XZeXjjwQhBwvpDZWQh1U8JT+8ZJkbmcSPH1JXDWKqtKvdUVc0QtnHhpO2WUmfufAVZDycnapRdpCIhLCuhKWU+CalUykTXXYSLjbJz+BJGMy2aFvDlsmnUha+InbfE15UR25feM8E7a3t+G7bOuXwuwBrIBh9WtMWkWehlJqSP2fBCYmw+8H/4W1rBOLFh3BPQA== 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=C0EGsUxul/tCPrUwYmd10UI3FB7/VC8g5XddgqEtDH8=; b=eP5tdIM5Kndvy22s45WxVF4JyQYZaW8MhaexkiGCp/tpbQZSSz+vMgSB+h2UA1YEVaUIK7QiBaKH3SN7NE0gMxrU1y0/YsBTkDp8qzz7kydiStrWMumj6d5+T9Bla3iODUWqzPKklHEsT8HyZffypq6G5qwzAd5qBF6KVsLzr9M= 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 PH0PR11MB5079.namprd11.prod.outlook.com (2603:10b6:510:3d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.11; Wed, 3 Nov 2021 10:27: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 10:27:19 +0000 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> From: David Hunt Message-ID: <386dde71-4d62-f48e-fef8-d24dae6244ea@intel.com> Date: Wed, 3 Nov 2021 10:27:14 +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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB X-ClientProxiedBy: LNXP265CA0077.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::17) 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 LNXP265CA0077.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:76::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4669.10 via Frontend Transport; Wed, 3 Nov 2021 10:27:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 88adfce0-2eca-427a-e278-08d99eb48398 X-MS-TrafficTypeDiagnostic: PH0PR11MB5079: X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oMjDcynRBMjOmGntt6vHSqrGhZVBOa0VEZ8C7EYfIYt9bep+sL/cN4Qq2ppJf8CLqks9g6Z1zNJGi5PkfPA2zPEeG+bJ0LbFj5q/DEAScUU1e12HPdZfWOrWGUNnlPn7lh+5GHgb8K1MgU/CkA6eAxkkpANZem6ukzLZm77Iikn73jOVoZPl8zi6rgRO+uVWmjLhqzohnm6yA7eu8SWe8VD4HXoW2btvjBVARjwYRsey4pSmVF5EP1l3CZcmHF/wHNDkG6903Q0y/W9j1pf9vKvHxUV+kgDz7+4K1dWopSm606seNu21odDhpuM8WstXLDVsGZdBhjLHrn8n9vSkM8mrs566NeXc8QeedzVoGXC26oZVfZ+5UOiDrxrQuLoQ02sQqt1VnvhUxLyDndiXKOBVAJHsyH+hT0pCuLsYlEKq51haz/LucpYtNcCZ5mCVZ23xtbJ5KDCxSKZvjvYC1PkHe9i4atpmI9paNikZ4Vjqc/7vnMe3Td9KgdEK+RpQsx3BK9m1UReHius6C+93jF5oSfc/r87y9Lsgs1+psnHnbkI9DJM0JBhwBZ2qBnaQ6utdUAUDVr49zouE2x1TkkL+SmBWfdCmoDqraDPkk6Izr/fQNrruA/kmONi6YyHWiEDeDlw5Y9SZEg9WBUhky0U/tMlD4DfSTkJdMo/AVVfrV12bD1MzrmQsODT06lFke3jw8djGiko7YsxNSsGAMT5GnNQudUvxMruTbswv1rA= 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)(6486002)(36756003)(5660300002)(66476007)(2616005)(31696002)(66556008)(31686004)(44832011)(2906002)(6916009)(8936002)(508600001)(956004)(86362001)(38100700002)(66946007)(26005)(186003)(53546011)(8676002)(4326008)(6666004)(83380400001)(54906003)(16576012)(316002)(82960400001)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NzVGcTBQd0cwamhWMGRiVHBVcGJ6dzJXb1JiMjVBNUFzaG9XMmxCY3VraFVm?= =?utf-8?B?WDVhSHBpL1BLdTF3YTFrNGY3VERwN2VEa2dEb3Y2V1Jld2xXMWVmVlZHd1Yy?= =?utf-8?B?UnBIUzZ2UjhVbUlUV1hKRWRzZHFaVEF4SWE2dGoxbUdleERoaDlPYXRGd3ow?= =?utf-8?B?bUFLa3J1eG5nZUdpZVFmMHN4VFlQL29sZnJFTVp4YlpRTnRBcmkwUTZHUkVw?= =?utf-8?B?dWQzZklZQkVOK1lQZmtJeEJOQjY1ZzJ0Rm12WHVJeGFTNnQ3ZDZVZnkrWDVB?= =?utf-8?B?TEpQVnQrLzYvQjEzUEl6RTY4YWczQnNKQWJHVTJ0bEIxOGkwQ3VQS2dBQ1NJ?= =?utf-8?B?Tm43d2JDZEFUaVpjY0tQUDZmV2FoakJ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MUpyQjhyOTh4?= =?utf-8?Q?6RgdMR8ExtXcvrSB8xyfwXk=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 88adfce0-2eca-427a-e278-08d99eb48398 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5047.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Nov 2021 10:27:19.0036 (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: 1I5KxpsOTVp2TkRsHxl9JV057Mf6l+bK2lE7fo5ZsMxL/HGv/uxqenWtrRkU6+Do0RUBb6pmFcdJCE1osuiePg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB5079 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" 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. >> for (; i >= 0; i--) >> - if (coremask[i] != '0') >> + if (coremask[i] != '0') { >> + RTE_LOG(ERR, EAL, "invalid characters in coremask: [%s]\n", >> + coremask_orig); > Nit: capital letter. Many other instances of 'invalid' in this file, will I change them all to "Invalid", or just this one? > >> return -1; >> - if (count == 0) >> + } >> + if (count == 0) { >> + RTE_LOG(ERR, EAL, "No lcores in coremask: [%s]\n", >> + coremask_orig); >> + return -1; >> + } >> + >> + if (check_core_list(lcores, count)) >> return -1; >> + >> + /* >> + * Now that we've gto a list of cores no longer than > Same typo I commented on patch 1 for v4. Will fix. > > >> + * RTE_MAX_LCORE, and no lcore in that list is greater >> + * than RTE_MAX_LCORE, populate the cores >> + * array and return. >> + */ >> + do { >> + count--; >> + cores[lcores[count]] = count; >> + } while (count != 0); >> + >> return 0; >> } >> >> -- >> 2.17.1 >>