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 8F73B42E9C; Mon, 17 Jul 2023 15:33:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2853840E25; Mon, 17 Jul 2023 15:33:57 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 1D81040698 for ; Mon, 17 Jul 2023 15:33:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689600835; x=1721136835; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=YngvE54JnRJFB2WK4TQgP5+UgYnsAdnu6Kjq5olhlbs=; b=RPUuJHMuU+VOGlEqPE5p/UvbsiwP8GtZ2mt1G6J9Damm7Ud/43zTOgQo LKmUSLLN+232qfsyeBruNfFemLy+yQzsOFQok9yhIE7QQkI8r2+f/RKNd fU0goxyg2dHTKZQ/9mepqnpJRWLJAW8MvlomsFOfdfjuZFGcDLBvMMTC9 r4WzL538T16jX8dKEKE132rAiytE7zXj7en4XsLIy/QhWCpb9zR2zA1lP lRrducY+fZOnnxBDrNP2wx6Jm55FkthwXRoCWWS+Ce+KrBWUsInfNdx38 JjGtexHvpF9kj0maUGlDBfBWV9S4PcPeMJeWJC4U0GGafpiOO9LByO0Ee Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="355868141" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="355868141" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jul 2023 06:33:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10774"; a="758411270" X-IronPort-AV: E=Sophos;i="6.01,211,1684825200"; d="scan'208";a="758411270" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga001.jf.intel.com with ESMTP; 17 Jul 2023 06:33:53 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 17 Jul 2023 06:33:52 -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.27 via Frontend Transport; Mon, 17 Jul 2023 06:33:52 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) 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.27; Mon, 17 Jul 2023 06:33:52 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I67lD0HFCoGKk0CYgjQli5JaTlGfnHmyM3ui98SR6rgaySY2qh7s03gZxdU78BcLvjprbKlyMYtNq6pqm+NPLkcOaDHPjksT/8YYB95yX4CFIpsvzxpk0dptT6Q9nI/lPMlnLSNr82j74fEaF/RI7//C9cxGGoQAnGbSTedANqbVmw6+XvQ9RLWbSW6e805FAxo2i9On65o69RC0oa2cM7IDNWgki/6weIJ9/iljg4sA5pn7DJ6aDt1Jt47YFqY03qdKOMHPtZ41G84PCVaJQMkYmeqO1TsgEQeMhskdQwctC4jmiDnhVJJaYDd5PaauNH6MD/+0FtgXl326mTn51w== 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=9aMq8H0o56qnKq0P2Da7qheu0MZ9Bw0b2pisX2sEkPg=; b=g65X6c5S93cOBH5hD6kqYJ2/+ifLMaJzRu/7cxAYZqPd88UnaDgOvo2WZxCmb38jgaWeQFIGYRvkWuk58T7KAcMBKXanFQLwyX+VJ7QhWXBoAjiAaImVKTtSWnbkD7MMmTnVY1N+0d6ogSbKBdcghP/E51CHBmA2rZD7qLsaN9gcwQBTXdoqdf2zDwlbFatIKUg0BEByhmK7+NzlBilCzJ7i8jOJA8z1d8rvTBZWCxAgthwiuYSVhcmAtf7Oe6phDkJxP3+HnljnVNJ3/1BZvg3b7WIxj4KKpzuTegwWoM9kiEPNWC2hvI6xZoxsleKAIgYd0rjAwV+XCixcIzfdpA== 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 CO6PR11MB5665.namprd11.prod.outlook.com (2603:10b6:5:354::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Mon, 17 Jul 2023 13:33:51 +0000 Received: from DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::d0ad:26fd:7bc2:4487]) by DM4PR11MB6502.namprd11.prod.outlook.com ([fe80::d0ad:26fd:7bc2:4487%3]) with mapi id 15.20.6588.031; Mon, 17 Jul 2023 13:33:50 +0000 Message-ID: Date: Mon, 17 Jul 2023 14:33:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.13.0 Subject: Re: [PATCH v16 3/6] memarea: support alloc and free API Content-Language: en-US To: Chengwen Feng , , CC: , , , , , References: <20220721044648.6817-1-fengchengwen@huawei.com> <20230710064923.19849-1-fengchengwen@huawei.com> <20230710064923.19849-4-fengchengwen@huawei.com> From: "Burakov, Anatoly" In-Reply-To: <20230710064923.19849-4-fengchengwen@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DUZPR01CA0114.eurprd01.prod.exchangelabs.com (2603:10a6:10:4bb::13) To DM4PR11MB6502.namprd11.prod.outlook.com (2603:10b6:8:89::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6502:EE_|CO6PR11MB5665:EE_ X-MS-Office365-Filtering-Correlation-Id: a9e7333a-a227-454a-0d87-08db86ca7508 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ek+fo8ed7jiJn/S9S+v7IEsPuDy42bnywZGxBZrH+W3wTuNeRTevk0ugqxB8EsoyNoDoR8cBF6XzAvDTQSzQ2bUwZ4s0EuTp43DfYX/CGyKQjI/bO1c32FBNhV0P8rrYhjUUZfRKgdgAOJwMf50dpByqnMCcgT78Hjx8EQSkYqQm07he69TPFfIzT2pjVcgrdDiHFoC+mOV0BnbVBrXOD7loU4WbW5R/QSyfmf7ykggjiAZkfHXwe/oKKze6D7aekLvj5aqteoJRr1qZ3L89JYYvYO+q/5i0lnDIvaJKg8yrkJ/TO8A1mwlJ1kEz+tIATIe6S46tUh2BC03DPOi0AWwBshE4PhAuHQFvQnfZ2pqzyLBIBxih6MdMK5cyJ2oKdJSsAFr7Ha/hmxQYsg745UnrJSvU9NENKcFh8P4iEpHYzdsWSeqMS3QvbGqdey34dduAjOHqNv/bybPKMgwpr2juowuWH0wgWHzHDyvTiqM3kRWVbklDy/XtKIz5rWfaNUzEImF5Y0nY/Bs7jivCYmVcqqOR+M3sQPOq/HsRDc1iEcFFpfA/vrRg7xLp4wOXZ5/9YtSSFp3wGZ8sQZKM6uFkKczXSak1MtZqRpDqR87G4DwxPJbnvrtyr1nzJqedCLLfGIjDWto33UX2zfF/0g== 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)(136003)(376002)(366004)(39860400002)(346002)(396003)(451199021)(4326008)(66946007)(316002)(86362001)(31686004)(38100700002)(31696002)(82960400001)(6666004)(6512007)(6486002)(478600001)(8936002)(66574015)(41300700001)(2616005)(8676002)(66476007)(66556008)(53546011)(186003)(26005)(5660300002)(6506007)(83380400001)(66899021)(2906002)(36756003)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?VFVSSU5FLzVRb010YmszRm9GaSsvOStUcUNGaWplVmdvTVphU3lYbkRlRkVD?= =?utf-8?B?SmV2Zll4K2cyNytCVC9xSnFpTjEvZWttSU9ya0V1OHhuU2IxZjlpaVVsVlBC?= =?utf-8?B?QVFOc3NxZm16Ry9tUkN4RTJna3RkQVo3Y1dweXd1bm14aTh2MW1NdUM1eVBu?= =?utf-8?B?dG1wZzBNQU1zRWd1aXVoRzVwaVFFMzVXKzNqU3pjWEdvWVAvVHd5OERCUWVk?= =?utf-8?B?K2ZRb1h1QnZlOC9sTmZ0Z3FVMG1GZFk2WCs3Qnd5bU9UTER2MnJ4TEZ5TGFB?= =?utf-8?B?dGljakptNTFxU2FjUXVMb1dNdWtGZmFVZ0hFci9ETGZJMmRBTk5tM1FRLzNI?= =?utf-8?B?a3NvancyRkh6eDBZeWNlNVlUWURlbXZFc1dpMXBlZnhwb2UwV0hYdVNXd2tr?= =?utf-8?B?aGN0b083WW1iN0w2Z1htaC9TWDJEaU5ycjV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change-CrossTenant-AuthSource: DM4PR11MB6502.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jul 2023 13:33:50.9416 (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: 3hKB/x84kpxKTmkDRbA5owRo4cS8RXCkbpMJ6VQxjVU3zizGZaeKmJsnToiAWxWXIqA+zSUlMcfsZd+EJqKdlEYUG0hLFxhz74JaO58n8xM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR11MB5665 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 7/10/2023 7:49 AM, Chengwen Feng wrote: > This patch supports rte_memarea_alloc() and rte_memarea_free() API. > > Signed-off-by: Chengwen Feng > Reviewed-by: Dongdong Liu > Acked-by: Morten Brørup > --- Hi, Kind of a general question: the allocation code doesn't seem to take into account that since we're potentially reusing memory between alloc/free calls, the memory may/will be dirty, and any subsequent alloc/free call may require memset(0) from the user. This is the kind of thing C programmers are familiar with already, so it's not a big deal, I'm just wondering what your intention was with this API: do you think it should be user's responsibility to erase memory before using it, or can we make it part of API guarantees? If it's the latter, then it would be good to have some sort of note in documentation explicitly mentioning that the memory returned is not guaranteed to be zeroed out? > +static inline void > +memarea_unlock(struct rte_memarea *ma) > +{ > + if (ma->init.mt_safe) > + rte_spinlock_unlock(&ma->lock); > +} > + > +/** > + * Check cookie or panic. > + * > + * @param status > + * - 0: object is supposed to be available. > + * - 1: object is supposed to be allocated. > + * - 2: just check that cookie is valid (available or allocated). > + */ Same as with previous patches: I feel like it would've been better if status were #define'd somewhere, so that we don't use explicit numbers in code. Acked-by: Anatoly Burakov -- Thanks, Anatoly