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 4321E42B9B; Thu, 25 May 2023 16:53:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BED0940DF8; Thu, 25 May 2023 16:53:58 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 3377440DDB for ; Thu, 25 May 2023 16:53:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685026437; x=1716562437; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=2Jov7JzPSHLsZ6LN+eK8RPvmnPzlTcASpPcMyCEG4X4=; b=Ctaovkxxl9hp0eBhBNgj3t4u67gVqJsO3Y01mSrqy5GmdOen0LzgZImV AJpIjJ//Lv/ATLJ+WD20LEPel25eAEFJfgpbxo8zaZMUl+HXEZcZW7jB/ 62N3YIexoKpxggFP/JfOD0TvRc+GY39btGH9SrbRnS8AGYmAEQ2X4a6/z eqUbFu0fOmGh1pQd2St634sgwhrAf1burIOc+rQBaZZKe0jiHmgMi+Xhd hGLSsyHu8PqS/++ccwymMQuqf7S3V5xujO3HHQWsPi6fvFJq8y4Dbt8JF 38GeexY3XImNXL1rKWzwyM5A8d5FX4j2y13Sw/38zEUOUVW3k64fyctvx g==; X-IronPort-AV: E=McAfee;i="6600,9927,10721"; a="352751940" X-IronPort-AV: E=Sophos;i="6.00,191,1681196400"; d="scan'208";a="352751940" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 May 2023 07:53:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10721"; a="879140624" X-IronPort-AV: E=Sophos;i="6.00,191,1681196400"; d="scan'208";a="879140624" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga005.jf.intel.com with ESMTP; 25 May 2023 07:53:55 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 25 May 2023 07:53:55 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 25 May 2023 07:53:54 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 25 May 2023 07:53:54 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.48) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 25 May 2023 07:53:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VwxDPFByJJP/rboxqojmjIszYkAc8K3bwv9KBwe4NABn8g/2iQSsG6V5hvSJDc3Y3bTSbVbvRWc97ghHymOz87Y6gVMdNC01DuR4fuSCx8fV639pzFfMsOF5Kyum6ZtavKPz7Ygs4ZaSqLT4VG5DHf7RxTNiyHTQ995FGGQq2K36ee+07WFqU2U2bAVLYw5Lq/VegrkPEsIpt3ABISP6A1SffBpnS0axq3NJAp98ZUWN1Y5XfrevQ09Ow2lqAZJnTv6iiq37Agxa5gIUcv2Qp/4B53FELkIxKUgRfZblsNRe4LLYzTnkZuDMnG10uVD0j2dg4bg78tgqV2lN2aIHYQ== 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=2SrkUGiPMucaCdPa36YAGb7b+TbVsmaUCs8u3mCH+SU=; b=aiZpdbyZcQFwOjprEK/5g8fWPHUuO4kEL/NCkB2hELTzBuOTMMcwsp94rC4gyXC8lu5XuMb0OZtTaT5Th9Rj8B6kGfKXtZ765GZ8QuU/7E4KQGQ8gCwGkgJKu/ksCnJD84yhdTy0IqjO9yQ0+MAf+bUj1k2lO6uV1AuyG9LADpEpZWzZfN0Ma39gHWSc/tI7JwPLtwyCFRsZWXrJCjBJmoyi4q91Bq6jYwEsZTvXek5ULtb6tvF6YpAn1BXY9yizba3+3CExL0kL6tzKhVvoE3H+pjGGC1hUdf0lUYyzuWSSmFZ1J8RnmSgbHqkApuPpx1PMHiDRRWS39imRU5WVbA== 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 DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) by CY8PR11MB7826.namprd11.prod.outlook.com (2603:10b6:930:76::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.15; Thu, 25 May 2023 14:53:53 +0000 Received: from DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::49c0:aa4c:e5b4:e718]) by DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::49c0:aa4c:e5b4:e718%5]) with mapi id 15.20.6433.017; Thu, 25 May 2023 14:53:53 +0000 Message-ID: Date: Thu, 25 May 2023 15:53:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.11.0 Subject: Re: [PATCH v4] lib: set/get max memzone segments Content-Language: en-US To: Ophir Munk , , Bruce Richardson , Devendra Singh Rawat , Alok Prasad CC: Ophir Munk , Matan Azrad , "Thomas Monjalon" , Lior Margalit References: <20230503072641.474600-1-ophirmu@nvidia.com> <20230524222550.3538819-1-ophirmu@nvidia.com> From: "Burakov, Anatoly" In-Reply-To: <20230524222550.3538819-1-ophirmu@nvidia.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P123CA0446.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a9::19) To DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6502:EE_|CY8PR11MB7826:EE_ X-MS-Office365-Filtering-Correlation-Id: ccd25610-3ada-4e11-30f3-08db5d2fdb7f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: izA2Me3IQ615WlQfkQmm4br8Vt/NHerGI44enCA7r5ay8TIwG+4t7g3JIEPCysHlK75xH31m6kLSIGP8T7SPSYfJn2Ee8O8NAHXrBzH6+FyrwrodQ99fJJkomBi/gl3E66ktqCk2NzwkO+cvHGEmkUkzEtQD3LSv6pl0kpgQJaakpbnFljlF1Ix/R8qNfZHaybJ7Sj4Cahl0XAg7wBE0Vj+rXq6D+6y5AOcpAq1Sz4xUP3KMW65WTR1DM7nKFYD51VZqkrZhvzAZ67Ffx61aHb6NNTze++w/pJr9KCcE/MMTgZbSk1nzYt17LsfRNmVcq5HapeylSQLAhPBOvtxo5hj72PJ24oym+Asc/5Ejkh+CkJXqjjhOsxYVcLY2/v5ef0jcoi4r/aCWqm8r+o6uE3rzKEuf3cR+m/7zgImBAJBGsQvQIH6KAbT8OU0zKWOoolj5s7Ummbcq6OPHT9ZWpMPtSTARo8xDR+ChzvvchrolMi0XV7LMSoTbA3MWrKzfqKBub/A9D1Fu7pLAT1OOFdc3A5HzuD+DYuT94CKLzcS2gaMfm9q0wj6sp/kvDiELjBmc3POY44HrokJp3230QjT8gSrr05FtvRy2weMJ0TbGeQbphrSVoN7IW6S4y/Db6/GR7tcAm1BheQxxq7Ovkw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB6502.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(346002)(396003)(366004)(376002)(136003)(39860400002)(451199021)(4326008)(6666004)(66946007)(6506007)(6512007)(26005)(316002)(66556008)(66476007)(110136005)(54906003)(6486002)(31686004)(41300700001)(478600001)(2616005)(5660300002)(8936002)(8676002)(31696002)(86362001)(82960400001)(2906002)(36756003)(38100700002)(186003)(53546011)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?a3RSNHp0Q01sRUl4c0dZR2hOUUQvYTFSOHNWeUQvNStFN1NpNTFTY0FpWXBU?= =?utf-8?B?MUhETU03L25tSW5USldrT1pLN1MzakJXbGRlL2NXM2RxY0dKVVlhUllSYkcz?= =?utf-8?B?aGRoaWtoa0xacWRBcUZwTDNldnlhemlhTEw5T2FlUEl2Tllqa29FY0xvZUcz?= =?utf-8?B?RXN2S0xOQVpvUXc0YndHYW10KzYzL0FFWGJsZ1JZVk9ZS0JTai8rd2x4QnN5?= =?utf-8?B?d3BKSnRqT1lLUXdLSCtDMytPbUwzYU5Ic2l4SGlXOXhnNE9TajVOZVl3a3ph?= =?utf-8?B?aDl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3YUxpdmhmaElPVW14VUlvMXlpRElG?= =?utf-8?B?WVA4eUtEcnBxTmRxUEJsQm9HYVRTWWlBRW9RMzdZSlByUWtaOHk3aUNwbmxM?= =?utf-8?B?Y0E9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: ccd25610-3ada-4e11-30f3-08db5d2fdb7f X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6502.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 May 2023 14:53:53.3177 (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: R5a9LHn7Y7Y4zxGoUm2I1Ye5zLUezvSR9UGqEIOoVrMO5tqSscdELF38KMIUdrO2HBDhFjS9oyV7Dfv6NpOdyUf04kDSxWOm+tjOPHmlxC0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7826 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 5/24/2023 11:25 PM, Ophir Munk wrote: > Currently, the max memzones count constat (RTE_MAX_MEMZONE) is used to > decide how many memzones a DPDK application can have. This value could > technically be changed by manually editing `rte_config.h` before > compilation, but if DPDK is already compiled, that option is not useful. > There are certain use cases that would benefit from making this value > configurable. > > This commit addresses the issue by adding a new API to set the max > number of memzones before EAL initialization (while using the old > constant as default value), as well as an API to get current maximum > number of memzones. > > Signed-off-by: Ophir Munk > Acked-by: Morten Brørup > --- > + > +int > +rte_memzone_max_set(size_t max) > +{ > + struct rte_mem_config *mcfg; > + > + if (eal_get_internal_configuration()->init_complete > 0) > + return -1; > + > + mcfg = rte_eal_get_configuration()->mem_config; > + if (!mcfg) > + return -1; > + > + mcfg->max_memzone = max; > + > + return 0; > +} Would this even work? AFAIR mem_config is only available some time during EAL init, not before (mem_config pointer will be NULL at that point). I suggest the following flow: set(): if init_complete => return -1 else => set local static value get(): if init_complete => return memzones.count else => return local static value (set to our default) That way we don't actually need the memconfig, and multiprocess will work because memzones.count is shared between primary and secondary anyway. -- Thanks, Anatoly