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 813194246F; Tue, 24 Jan 2023 02:53:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E6AD40150; Tue, 24 Jan 2023 02:53:56 +0100 (CET) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on2068.outbound.protection.outlook.com [40.107.6.68]) by mails.dpdk.org (Postfix) with ESMTP id 49DAD400EF for ; Tue, 24 Jan 2023 02:53:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lAcsLLC6DVahPlHW9d5vX69gCe7P1GbgIs4D+98zFFE=; b=GJY4Hg+nbzPeA+nbk08smqNnNscwIiNmiF7I8Eugu9s8IUL1JXnSGyumQ/HKnFb9UMdFslW/vr4ocVK/QVCI9PAJ7OVcqYn2v35hP5BgUd9gkEa9EZeTXoOgYs0FhkY9g2+SY2bCuV8p7kQf7m+ue+Tv8TJZA5K5cH5+rChRLmk= Received: from DB6PR07CA0109.eurprd07.prod.outlook.com (2603:10a6:6:2c::23) by DBBPR08MB6058.eurprd08.prod.outlook.com (2603:10a6:10:201::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 01:53:53 +0000 Received: from DBAEUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2c:cafe::ca) by DB6PR07CA0109.outlook.office365.com (2603:10a6:6:2c::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.13 via Frontend Transport; Tue, 24 Jan 2023 01:53:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT035.mail.protection.outlook.com (100.127.142.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6023.16 via Frontend Transport; Tue, 24 Jan 2023 01:53:53 +0000 Received: ("Tessian outbound 8038f0863a52:v132"); Tue, 24 Jan 2023 01:53:53 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 69c60afd0fca6781 X-CR-MTA-TID: 64aa7808 Received: from 6b57bb04b7b6.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4255CD99-2F4E-4422-8A68-1A84B189F00F.1; Tue, 24 Jan 2023 01:53:46 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 6b57bb04b7b6.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 24 Jan 2023 01:53:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ljVft+yLd4OD7Z0P4+UazBbGPzX7hsGfzrgPW8dXIEXejM4p6hSBYiI7UFnC9kKi3cHNhxvuJCHZYUPHQqCIzt2Vxu3BEvMgmHMpe/3E5+qcUzrz1TVH32KjvWBd9ZsVz/CG8H9WUzeYrgdQleDMqy99Yp8LJria6G5nW6yCxiGqpr7bDM41FpmxuMU4zMFsQv/qXHot8ADhFxLVzerIrUodM9gZDguUOjP5ClWbk3MejLuU+gF5iuvgy61IG6bocvwL7b7DeD4B6nElrsmG/6jW6pqWGxs+RBhLbyYvPpHW7+JERnLPRn4r0Hw0QI85lIoIg951OpG1SnE09MjFrA== 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=lAcsLLC6DVahPlHW9d5vX69gCe7P1GbgIs4D+98zFFE=; b=jUjVRQXPENcSJtEQZwY0UvcxBsozjcyqru8IJfKNTpsVs68rredpAJM5mPA6H0T2Gv4I013fdYHAtdqVhOUqC3L/4BeNTlLvSdn8cQzKE4QYl+igoMANHyOpejQK4M3hY/JZJA6mc4gwtPFZPCVffI50ItQ0FZ2rxZFZxFxYPOnYjnSfzXcn46Z0tkele3Jp8WSgOwW6lQ0MrWR6GdYHjeOLiwMxNRHkf0TXsCk5xZ1MZgyqC+vfuzxnFV6H09Xen4mJb/xGAvtIS2iCz0jY2ZJ7yzhOtBXPmOUezY6jy69vBrHD/wnhcWYQ4iClQvrAG6wfwZl5hLiLCdFvUdHuRg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lAcsLLC6DVahPlHW9d5vX69gCe7P1GbgIs4D+98zFFE=; b=GJY4Hg+nbzPeA+nbk08smqNnNscwIiNmiF7I8Eugu9s8IUL1JXnSGyumQ/HKnFb9UMdFslW/vr4ocVK/QVCI9PAJ7OVcqYn2v35hP5BgUd9gkEa9EZeTXoOgYs0FhkY9g2+SY2bCuV8p7kQf7m+ue+Tv8TJZA5K5cH5+rChRLmk= Received: from DB7PR08MB3865.eurprd08.prod.outlook.com (2603:10a6:10:74::25) by DBBPR08MB6218.eurprd08.prod.outlook.com (2603:10a6:10:209::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Tue, 24 Jan 2023 01:53:44 +0000 Received: from DB7PR08MB3865.eurprd08.prod.outlook.com ([fe80::ee54:c9dc:b13d:727b]) by DB7PR08MB3865.eurprd08.prod.outlook.com ([fe80::ee54:c9dc:b13d:727b%7]) with mapi id 15.20.6002.033; Tue, 24 Jan 2023 01:53:44 +0000 From: Kamalakshitha Aligeri To: Bruce Richardson , =?iso-8859-1?Q?Morten_Br=F8rup?= CC: Konstantin Ananyev , Konstantin Ananyev , "olivier.matz@6wind.com" , "andrew.rybchenko@oktetlabs.ru" , Honnappa Nagarahalli , "dev@dpdk.org" , nd , nd Subject: RE: [PATCH v5] mempool cache: add zero-copy get and put functions Thread-Topic: [PATCH v5] mempool cache: add zero-copy get and put functions Thread-Index: AQHZGgZWctRcm+YMw0qPFIdyUqzm366rDdKAgAAMFICAAPSuAIAACHgAgAAjhICAAL2v0A== Date: Tue, 24 Jan 2023 01:53:44 +0000 Message-ID: References: <98CBD80474FA8B44BF855DF32C47DC35D87488@smartserver.smartshare.dk> <20221227151700.80887-1-mb@smartsharesystems.com> <60d35262-51bd-3d74-28f8-c2dda50d3400@yandex.ru> <98CBD80474FA8B44BF855DF32C47DC35D876A3@smartserver.smartshare.dk> <81e1ec960f6d4a1c80b236d9314cb549@huawei.com> <98CBD80474FA8B44BF855DF32C47DC35D876A9@smartserver.smartshare.dk> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: D15B348390908C48A0FF96350A1EBA46.0 Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: DB7PR08MB3865:EE_|DBBPR08MB6218:EE_|DBAEUR03FT035:EE_|DBBPR08MB6058:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f7a1448-edaa-4276-451e-08dafdadd8b2 x-checkrecipientrouted: true nodisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 45dEMC45nppLGigF0p/qzw+MUUZ7bbtUBXYrax2gszc2jhA65EHl3NBdgCBwjAg/V9Y7mwE9vw4449KWvluZwkwR4Ln7ES5tm9iEwNoghjeG/InFPhAYqlvwaY4JXdDzoSpvz03SJiaNYYcvyB0miTQmwlubwaGTkMO0lZQ/TYBHCkR0XWqg6W6onsPXdPvOPXoIbKWzI4q8+TCKxQKA1Y/YX9YGhtRTSeoNqj1b+V9cNo0V8j4J2C0//wxLHw++wMRt0U+QkaZ2e0MeI3LwqfT2Zu67/tjkkoMxEI0iyxiKgt60N7RRGSgq0ggQ0rDvAK8Xkzzbs7Vond4JEI1XwXoudNvcdMqZkP9MYxh+c1WUWbLf8Y+JERbSp+S7OvxVOfo+W3ZfH0nFRQIv+ltzfh1ll6/rOPHomhPaVGJlXDRiaBWmig6s5+Ht/YwL8gG1P0Ft/mAywBxTP6WCUBd+Kyy89v/IhfckkPlqVN46ZvHG/GCxPYrSTVRHFlgfe4Ttrpnf5u/WSEFZeUnS1QUNoU8iAEKSMqrY3Tstike4PkwDF4JVdNtW4YKDCDaO+guv54CN9lHHfSXJy75phGBVqD/rVSARKD+6t4eTI7sG3yiL/ITC5+mgHDxJqNmwACtyfKyn0vIJu6yR08uULPeoaYxQKTAtzxQobX+JiMyiNJ4AVhZCHZeeHY4g9ICG7rPeJNBf1O4uUr/PtaY9p5ZI2w== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DB7PR08MB3865.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(39860400002)(376002)(346002)(136003)(396003)(366004)(451199015)(38100700002)(122000001)(33656002)(38070700005)(2906002)(52536014)(5660300002)(66446008)(64756008)(8936002)(66946007)(66556008)(66476007)(41300700001)(55016003)(66574015)(9686003)(26005)(6506007)(53546011)(83380400001)(186003)(4326008)(76116006)(110136005)(8676002)(54906003)(316002)(478600001)(7696005)(71200400001)(86362001); DIR:OUT; SFP:1101; Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6218 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0e1c4bc2-d3c2-4484-b5e3-08dafdadd33e X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MJdWgK6XwoLElLblKvRAxEAUe4mHDu3qI7uAZtsLSVkHlV+LseHvGR96JhTPeMGjM9xIfMff8JUJAvrCpCtQ/eZyS+V9HnIWJUsZtMDyRJb9Qe+qlISz5OnVodcYLt370UL6mZ22ffdzsOj3kBpNNVrwZEiwlXkIY7L0SsuLaw0EqONxhIYXDoCZLqWbsnrFfFEK2n6Iv+HF12NGwXTD8WsRDHfnug1UqWS1R0/z79z8Jtkl+C/omTXFxsmicprHEAzTTdmgf5XI/AbQVcehRdamcz9BbVGlLflfhwUQ92UhgJBYt4XZRHyrLw0qBF7ywh8CMQmWUz1edtW3jnvweSj2iIRie0Q8qeUE77sEBpKGhEqwI3Umy8GnS1ugwwRsToXSbK3QkqjZfAmb7jG3BG7FqQBWNPzuYRNWHeboQ1F9NbPHSWnpBxCy9trMHGv2fdFCea2Tczvm/C0AjJAcUPDHiCQA2MoufRdXo+yuOA+6cvM1WUJHJKD9N9EbIUv1rYtm6A5GrtabcUY1FQwgVFkncshQpz/++FBxIykasAMbDiYRT44Y+/7jH3ctzvFBX14Rkp13bl3hRiWeQQubc5DXdxabx9V00lrggLEg2PRt1zh0M0WGYDKmltYiUfIDLiWoI7abOJ4jo8x0o24+YrNSdAdFNAzxKXo1/17rNMocWt+itxvj+Txcoh1eHILeQO7F8MSE4x7DVUwBwSOqJCFJUl6IXiloA8EHWRfmFBo= X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230022)(4636009)(376002)(396003)(39860400002)(136003)(346002)(451199015)(46966006)(36840700001)(40470700004)(81166007)(82740400003)(33656002)(40460700003)(40480700001)(55016003)(356005)(82310400005)(86362001)(478600001)(316002)(54906003)(336012)(110136005)(70586007)(4326008)(8676002)(66574015)(47076005)(70206006)(7696005)(53546011)(36860700001)(2906002)(6506007)(52536014)(26005)(9686003)(186003)(83380400001)(41300700001)(8936002)(5660300002)(23180200003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2023 01:53:53.2921 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f7a1448-edaa-4276-451e-08dafdadd8b2 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT035.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB6058 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 -----Original Message----- From: Bruce Richardson =20 Sent: Monday, January 23, 2023 6:31 AM To: Morten Br=F8rup Cc: Konstantin Ananyev ; Konstantin Ananyev = ; olivier.matz@6wind.com; andrew.rybchenko@= oktetlabs.ru; Honnappa Nagarahalli ; Kamalaks= hitha Aligeri ; dev@dpdk.org; nd Subject: Re: [PATCH v5] mempool cache: add zero-copy get and put functions On Mon, Jan 23, 2023 at 01:23:50PM +0100, Morten Br=EF=BF=BDrup wrote: > > From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com] > > Sent: Monday, 23 January 2023 12.54 > >=20 > > > > Few nits, see below. > > > > Also I still think we do need a test case for _zc_get_ before=20 > > > > accepting it in the mainline. > > > I am working on the test cases. Will submit it soon > > > Poking at my bad conscience... :-) > > > > > > It's on my todo-list. Apparently not high enough. ;-) > > > > > > > With that in place: > > > > Acked-by: Konstantin Ananyev > > > > >=20 > [...] >=20 > > > > > +/** > > > > > + * @warning > > > > > + * @b EXPERIMENTAL: This API may change, or be removed,=20 > > > > > +without > > > > prior notice. > > > > > + * > > > > > + * Zero-copy put objects in a user-owned mempool cache backed=20 > > > > > + by > > the > > > > specified mempool. > > > > > + * > > > > > + * @param cache > > > > > + * A pointer to the mempool cache. > > > > > + * @param mp > > > > > + * A pointer to the mempool. > > > > > + * @param n > > > > > + * The number of objects to be put in the mempool cache. > > > > > + * @return > > > > > + * The pointer to where to put the objects in the mempool > > cache. > > > > > + * NULL if the request itself is too big for the cache, i.e. > > > > > + * exceeds the cache flush threshold. > > > > > + */ > > > > > +__rte_experimental > > > > > +static __rte_always_inline void **=20 > > > > > +rte_mempool_cache_zc_put_bulk(struct rte_mempool_cache *cache, > > > > > + struct rte_mempool *mp, > > > > > + unsigned int n) > > > > > +{ > > > > > + RTE_ASSERT(cache !=3D NULL); > > > > > + RTE_ASSERT(mp !=3D NULL); > > > > > + > > > > > + rte_mempool_trace_cache_zc_put_bulk(cache, mp, n); > > > > > + return __rte_mempool_cache_zc_put_bulk(cache, mp, n); } > > > > > + > > > > > +/** > > > > > + * @warning > > > > > + * @b EXPERIMENTAL: This API may change, or be removed,=20 > > > > > +without > > > > prior notice. > > > > > + * > > > > > + * Zero-copy un-put objects in a user-owned mempool cache. Why is it written as user-owned mempool cache. API expects a pointer to mem= pool cache right, whether it is default or user-owned does not make any dif= ference Please correct me if I am wrong > > > > > + * > > > > > + * @param cache > > > > > + * A pointer to the mempool cache. > > > > > + * @param n > > > > > + * The number of objects not put in the mempool cache after > > > > calling > > > > > + * rte_mempool_cache_zc_put_bulk(). > > > > > + */ > > > > > +__rte_experimental > > > > > +static __rte_always_inline void=20 > > > > > +rte_mempool_cache_zc_put_rewind(struct rte_mempool_cache *cache, > > > > > + unsigned int n) > > > > > +{ > > > > > + RTE_ASSERT(cache !=3D NULL); > > > > > + RTE_ASSERT(n <=3D cache->len); > > > > > + > > > > > + rte_mempool_trace_cache_zc_put_rewind(cache, n); > > > > > + > > > > > + cache->len -=3D n; > > > > > + > > > > > + RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, (int)-n); } > > > > > + > > > > > +/** > > > > > + * @warning > > > > > + * @b EXPERIMENTAL: This API may change, or be removed,=20 > > > > > +without > > > > prior notice. > > > > > + * > > > > > + * Zero-copy get objects from a user-owned mempool cache=20 > > > > > + backed > > by > > > > the specified mempool. > > > > > + * > > > > > + * @param cache > > > > > + * A pointer to the mempool cache. > > > > > + * @param mp > > > > > + * A pointer to the mempool. > > > > > + * @param n > > > > > + * The number of objects to prefetch into the mempool cache. > > > > > > > > Why not 'get' instead of 'prefetch'? > > > > > > This was my thinking: > > > > > > The function "prefetches" the objects into the cache. It is the > > application itself that "gets" the objects from the cache after=20 > > having > > > called the function. > > > You might also notice that the n parameter for the zc_put()=20 > > > function > > is described as "to be put" (future), not "to put" (now) in the > > > cache. > > > > > > On the other hand, I chose "Zero-copy get" for the function=20 > > > headline > > to keep it simple. > > > > > > If you think "get" is a more correct description of the n=20 > > > parameter, > > I can change it. > > > > > > Alternatively, I can use the same style as zc_put(), i.e. "to be > > gotten from the mempool cache" - but that would require input from a > > > natively English speaking person, because Danish and English=20 > > > grammar > > is very different, and I am highly uncertain about my English > > > grammar here! I originally considered this phrase, but concluded=20 > > > that > > the "prefetch" description was easier to understand - especially > > > for non-native English readers. > >=20 > > For me 'prefetch' seems a bit unclear in that situation... > > Probably: "number of objects that user plans to extract from the=20 > > cache"? > > But again, I am not native English speaker too, so might be someone=20 > > can suggest a better option. > >=20 >=20 > @Bruce (or any other native English speaking person), your input would be= appreciated here! >=20 I was happily ignoring this thread until you went and dragged me in with a = hard question. :-) I think the longer explanation the clearer it is likely to be. How about "n= umber of objects to be made available for extraction from the cache"? I don= 't like the reference to "the user" in the longer suggestion above, but oth= erwise consider it clearer that talking of prefetching or "getting". My 2c. /Bruce