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 825F24340A; Thu, 30 Nov 2023 09:59:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 463CC42E97; Thu, 30 Nov 2023 09:59:47 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 28E9F42E94 for ; Thu, 30 Nov 2023 09:59:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701334785; x=1732870785; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=Rlo4q86Q5QI49j9IgtRTeuJrsvrNXO8gIRpJkyTEEzQ=; b=eJWa+CjzaPjl0LPHzRKDv3m85irAd6JdezmVJFTM8MA2VlWsejP0Q9Lq hbYyvJ8tbSFvZy+INcJwOGFr5zEGqACnFzh+TPOJKSlxJ9GV/Xo12AQS3 g7WMw2INTxZhHOpIYrUuKiWxk4R5VjwAo2iD7yc9q/rjyNZMG8M7SyIVl M0V2Dj3AvlNSYOMJFIUYLu/oNCLaHfOtOBaG5SWQxmvTQywug0/QMpQ+F f19z2uWMosMctFYHcoKa/a0czue7uxZDkDQS9i57m6sUYvGfBLdQeCT8q lqnyInD4Bgfh6D+n6wkuD1Z/2AHdYerMsqlMhp42kw01b30JTmw+OSg/H w==; X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="392158435" X-IronPort-AV: E=Sophos;i="6.04,237,1695711600"; d="scan'208";a="392158435" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Nov 2023 00:59:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="803609232" X-IronPort-AV: E=Sophos;i="6.04,237,1695711600"; d="scan'208";a="803609232" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga001.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 30 Nov 2023 00:59:43 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) 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.2507.34; Thu, 30 Nov 2023 00:59:43 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) 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.2507.34 via Frontend Transport; Thu, 30 Nov 2023 00:59:43 -0800 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.41) 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.2507.34; Thu, 30 Nov 2023 00:59:42 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BMRKiMxZxavUAMchAmtrQF8XPpjpd9rxKTNTIczp6qj56cN2GzuKxt5BTr/6ZRQcSIpVqUsNnVakXinV7yF1Y8jExKXUZ94uHAeZMV+97dsP3pdsEDfRobNDYslSv5LSI6wDNry3bmGYF/wiYCP4pkXBPEU4o63E0HKrfRpEaSZ40Wlb/GqWUjpUxUptVyOq5vNIFvNIM+ytO9yOBlpaU/VJWK4nFvHMHgzKNKxrz0Gjd44frA2msul36Cl7pjGW3xKSkx/EWuXfIUMwlZ3zpoh8Lkpw/AL3f4HwvjXULtciOQyW/KKPqI50hZ250g2vrySBycZhkQUID2exHqRwOA== 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=wnqWyg0gRjSLwjEVxtkRZrwKhUUgmO+qNpAll4MboNg=; b=TWKP76OAJLLHxaHldxO7tHRIsx9v7KJ+0eHcqHeu+BygLVitdjbjBWtfh5tgOFyxIS3C5P2gWUjzPiRqZg/7rZHh0tUWmdanIFnwgm23ct2wY50wiHYiz6totXxlL4C9pvn7p3jLFja/I/mUE+hk81DRtOu1ZOBze+Ogo+BFnpBy2E8iOpXMnxQ9mnFN+AaqlQrRHFPI+HYXtsGySmZDxh4CDVXRKleG8FWEJ90Xs7Q8/s0BwqkKjeWSpESeAfp4VvzKBqo9TzGmxYUSnuExtb8EFi+gfq5zJrbilUByf7TZ3dhheWjhpPEdwnQfq+ykVZ6fiJMD0NCBBBHdOGtLZg== 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 Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SA1PR11MB6565.namprd11.prod.outlook.com (2603:10b6:806:250::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.28; Thu, 30 Nov 2023 08:59:37 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4782:d54a:209d:cb49]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4782:d54a:209d:cb49%7]) with mapi id 15.20.7046.023; Thu, 30 Nov 2023 08:59:37 +0000 Date: Thu, 30 Nov 2023 08:59:33 +0000 From: Bruce Richardson To: Stephen Hemminger CC: Euan Bourke , , Thomas Monjalon Subject: Re: [PATCH 24.03 v2 1/5] arg_parser: new library for command line parsing Message-ID: References: <20231122164550.3873633-1-euan.bourke@intel.com> <20231128140745.595481-1-euan.bourke@intel.com> <20231128140745.595481-2-euan.bourke@intel.com> <20231129141413.73faa6c8@hermes.local> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20231129141413.73faa6c8@hermes.local> X-ClientProxiedBy: DU2PR04CA0297.eurprd04.prod.outlook.com (2603:10a6:10:28c::32) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SA1PR11MB6565:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b7ac60a-a159-43c6-e677-08dbf182ade4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mAsKR+OSWnsFivToSm+CQWPwJTpd3Hr6gaqfG+oUUi6cy1Usws4dC6A9suO96+RlyNCjNDEdljZ+th1VWB2Kcbvv6e81z5J9cVt116bws8ZzYEFkP88zLvVSHmP3QfbZB6uvjNfIPx7GbffCNOWazFU8D9k2jnCWxCYvK9AWNSLxCn18BQKWIUtsAv0HE+mxZJoe0Qim7RRsVF3WWuYdqfHlthWuP8RdiYQ4Nu+7qK9P5uxA0e1HN9CH2LDfWkpSwZLhwXHVy1VB1JxmO7qtrDAS1d+TXUl2zxxrKcUqq2xJ6Sw83IcIUTvTt05+FNyB732xOzcLFiiCBDIG8tVD4KbnKFRnakd7md0cTqQ4o6Nn3bNW4EdPADR3YlKJnfc1IaonVuVATITtixPPXHfWI0p6KGmmFKqey1Ezhvn1+yd637vS5z4IITs+wFWj2TCfwGCS+2eiPlMgOBgc5BbBnwXiE7mmZPt6oXT2nntm7JUYHq2qw33PSVxU+O+72mLcK5DR2NvOCvE1BcZTOdUKAD2L8X8+41Cs6IPcX7lL3EiMOOnXj+HgXqv+cfRXNWDZNwBzQ1rkTcsXeZeL0mLJuQ+nrQX+zwzxtaiYUIgodu7B5r7ODUCRtvKKmFJNFEzz X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(136003)(346002)(39860400002)(376002)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(5660300002)(2906002)(44832011)(4326008)(8936002)(8676002)(66476007)(6486002)(478600001)(26005)(6666004)(6506007)(41300700001)(66556008)(66946007)(54906003)(6512007)(202311291699003)(83380400001)(38100700002)(6916009)(316002)(86362001)(82960400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?hv/g3zV5mRfzBqHDOxyHMBw0v6bZJ2O4ZIK7ka3BjNCYiv+iFduR3wY9+LhC?= =?us-ascii?Q?RWS4tspqUBRZAmg3UTXkYDCCFkZ1a0RT8PcSQXG3/AW5/ENpJ+iTt0SKjkc6?= =?us-ascii?Q?DMO74EsFZsgPWO2B7Ao7Orv0mf0Zkvn36GqXFpkLiY1AG0T9JtquQkeOzLMk?= =?us-ascii?Q?GyU3TnsPzB0tYMc/vFGdqknPDStsR4XZLx6+cKxzIm7YKuS8lWgOpGiCaD+Y?= =?us-ascii?Q?YBdEyTftesHdIFUzCMNhXn765RaIpx5A51hil1k6pOXylvLroJ1+ngpL8eJP?= =?us-ascii?Q?P5tEzV97K7nUNnZPqpZQJgvi9cJf+z/bqjvKG3h3n2Mhg3COepyMDhx7xQxM?= =?us-ascii?Q?rbzGPfT8oNf5fEOMm9+zT9kMi+ttTAHH5qKjxpAPcLk7P1DrsZAp6tfwGqFI?= =?us-ascii?Q?VDasmTua2vCwz5vNL80stxbR6RPkQ2BDnrg6z44/j7b//KAbdrJUFMha/lYO?= =?us-ascii?Q?tZmkvA9lxcxToOFrldbt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ii?Q?BjCpxdS/dg9bxKAcO/ZppHcBMTzYppnQyQ6M3V8Bvx4Ji8lwScO6u0RC2KK7?= =?us-ascii?Q?8aXcw4l57TeyEbBrUpYn4u6haPXQv3wISIH8Rz6ShTVT10aIhZjT6kpy8kte?= =?us-ascii?Q?XVQVQwgf9F4kdv9rWEG55bPx+yRyVk5IHZeGB8Iec4kQsZ5MUugcXPhJen+6?= =?us-ascii?Q?U/5lVAEn6pO+ip1sBTFk7tEz8kFrJXHEa0h0dMKK2rvD5c6h+5DR1L0o0CvF?= =?us-ascii?Q?9g=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6b7ac60a-a159-43c6-e677-08dbf182ade4 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 08:59:37.0436 (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: KyoSWkRzCSwMaHnCVTYQ5cfOm01bixgoNV8b2AfkAR3soVAgrVXVABBY8yhIdOwR0cbANwAzj+8ktDc38GJo9v9AFhBCG6o+hiJjji21i30= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6565 X-OriginatorOrg: intel.com 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 On Wed, Nov 29, 2023 at 02:14:13PM -0800, Stephen Hemminger wrote: > On Tue, 28 Nov 2023 14:07:41 +0000 > Euan Bourke wrote: > > > +int > > +rte_parse_corelist(const char *corelist, uint16_t *cores, uint32_t cores_len) > > +{ > > + int32_t min = -1; > > + char *end = NULL; > > + > > + struct core_bits *mask = malloc(sizeof(struct core_bits)); > > + if (mask == NULL) > > + return -1; > > + memset(mask, 0, sizeof(struct core_bits)); > > + > > The structure is not variable size, and small, why bother using malloc(). > Just use on stack structure. Well, it's just over 4k in size, and we hit problems in the past with alpine linux where the stack size wasn't as big as expected, leading to issues with telemetry string manipulation. In that case I think it was due to nested calls as well as large stack structs, though. For this core parsing, having this struct on stack is unlikely to cause issues, but for a non-datapath API I suggests to Euan to use malloc as a lower-risk alternative, since performance of an arg parsing API is unlikely to be a major concern. However, if you feel that it should be on the stack and won't cause any issues, it does make the code shorter and easier to work with! /Bruce