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 5039BA00C5; Sun, 6 Nov 2022 00:11:39 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2C6440691; Sun, 6 Nov 2022 00:11:38 +0100 (CET) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-eopbgr130050.outbound.protection.outlook.com [40.107.13.50]) by mails.dpdk.org (Postfix) with ESMTP id 3786A4003C for ; Sun, 6 Nov 2022 00:11:37 +0100 (CET) ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=UxgT9gtVPm0vHzwqWSJ+SLzFkm0WyRvqzIytf1gEYz10qNA2/PAPvsi/y/YgdxrlmKMOu9NTSdJlk06eBeBAe2vWGWq/OPhQ4iPVtHYgo9wz/GGtxRuDUQaNJ/CINxBH62rJ3F8Pl/QTFUXQ0/gH4sdDPHIGoEuC8KP5YXS3sNaEB9ZZYABJj5mzT7wDz3V0x2zGaGJzlq6FG3ThrH7uO65dgE65pbsoEertvxzbKRKK0/CDSC6Kk9xfjVfx5KA7huxdK4vs7a1fXIRweY5ACP9Kqq+nB3A8B3yI2yjTnLVxbFnKg9jXeVEvRoicDpGhiAmGasIkP/1OZ0EUWgWO/Q== ARC-Message-Signature: i=2; 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=NLxf/x9o4zMlgSCVf0RLutuUe1XVzX3lVBF+wcAygHQ=; b=VzbixR75Brf2wCyxxwJLJp2LPJJOuA31nh1FjoonjDoLOa0aW4HKS2kg92f2qsmGrykdMMd/gOgiowaPWhEpDa6UxvOZr4f9sXVnC3jc+82t7BQjr6Z2+LSXMXbnIA5p3BRhqL02jYdluDqy5waCit22h7U2odKrfcIElMvjG+eSUpPht/0m1vN6quIVB3DH6bbwJKrctis3RDdevPnwokdKql7+wUbZgr/UuMeR/YXd7ybURkfFDvvUJq67xj/HI1XRgI76hBGgR/9LVDrLBG36NRZhup1QEsnOE3FwdTuGPiYcKd7mzSJedxtGI+fVsT/419vqhfztiqHvyL29Dg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=dpdk.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com]) 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=NLxf/x9o4zMlgSCVf0RLutuUe1XVzX3lVBF+wcAygHQ=; b=LRtXzxot4TeX0KIUWGGxw4m2W4WWPKf0WUqxPeBWgaRHQ+C9LRXdcUaG9eihP8lcLmqD1uHShJTeLJxW/x6B5B0+1g6ytV0Sl79i32vc4WAPbqRx5OokLW8qsliPap+3nOkYoL0x6A/6lqJJZcoMZgVZhzyCFyGVLgS219B/tOQ= Received: from AS9P251CA0014.EURP251.PROD.OUTLOOK.COM (2603:10a6:20b:50f::18) by AM9PR08MB6675.eurprd08.prod.outlook.com (2603:10a6:20b:300::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.11; Sat, 5 Nov 2022 23:11:35 +0000 Received: from AM7EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:50f:cafe::ae) by AS9P251CA0014.outlook.office365.com (2603:10a6:20b:50f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.21 via Frontend Transport; Sat, 5 Nov 2022 23:11:35 +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 AM7EUR03FT049.mail.protection.outlook.com (100.127.140.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.20 via Frontend Transport; Sat, 5 Nov 2022 23:11:34 +0000 Received: ("Tessian outbound 2ff13c8f2c05:v130"); Sat, 05 Nov 2022 23:11:34 +0000 X-CR-MTA-TID: 64aa7808 Received: from 318c3d2c5847.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id D4DF88B2-754D-47AD-AED7-FC64E266933C.1; Sat, 05 Nov 2022 23:11:25 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 318c3d2c5847.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Sat, 05 Nov 2022 23:11:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hzMQdhxKKUI3Wwa5CsvRHzrCw+nSSAXtl7+oWGz9oBs0deRFblhHW+WQRYeyZScEbK0vyvex5t9lXLPt5e+q3rQYsL2Z8Rg3YNHBJp5DetgrC6pw/lfE7c7e5A1oB25YCpNsR1n/bhO7BBkvnCUPo9BYoE0eTbkENLLlz2IMut2n2+2yc9NarozuI6GyhCvqatoERDKm55jJrG/GToJQfleh/+xNn9byki45djKitmVbYoOVbMP3VH1XBG0A3f8F1sok4O2WOnRzTpS8s9B/QoBPpKyo3qz58pmYNCm7C+dLCVPrQRQh/1cTemhdyMtFxc/77MddAMs8K8hesEJjIQ== 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=NLxf/x9o4zMlgSCVf0RLutuUe1XVzX3lVBF+wcAygHQ=; b=PuvVAspz5DD0C9RwMmH1JdOoBso9KZVq5zbAdZPfpqojw0lZWE8KvvSPauZCWJkgpbOW31tKTs6C8Mkkb9t9XNdyuevG7DWhTy+3h0HIibp9eSmsmzN4yoN6Fc9OqFxlIRhRNinHyAfup83tu9uNYvX8wkBkP7QTn97YgS3oOtFWMl542yIpRY+eGvKHqvjojsBnOgNml/COuAzfJ0v5tfGE4RuHjzxvvFHjZrvrPB6dfNU1bdJpf+F70tZfKuZiQW1tmFe8uLvt80njnSL4vbuI7r7amjtd3cQgOWj31YEdpeZeGU4pvZpXBDbOiXZOPZfayeVHb0+nLxuBdG3iBg== 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=NLxf/x9o4zMlgSCVf0RLutuUe1XVzX3lVBF+wcAygHQ=; b=LRtXzxot4TeX0KIUWGGxw4m2W4WWPKf0WUqxPeBWgaRHQ+C9LRXdcUaG9eihP8lcLmqD1uHShJTeLJxW/x6B5B0+1g6ytV0Sl79i32vc4WAPbqRx5OokLW8qsliPap+3nOkYoL0x6A/6lqJJZcoMZgVZhzyCFyGVLgS219B/tOQ= Received: from DBAPR08MB5814.eurprd08.prod.outlook.com (2603:10a6:10:1b1::6) by DB9PR08MB6361.eurprd08.prod.outlook.com (2603:10a6:10:261::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.11; Sat, 5 Nov 2022 23:11:20 +0000 Received: from DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::3fb6:b7b2:1e8d:11d6]) by DBAPR08MB5814.eurprd08.prod.outlook.com ([fe80::3fb6:b7b2:1e8d:11d6%9]) with mapi id 15.20.5813.011; Sat, 5 Nov 2022 23:11:20 +0000 From: Honnappa Nagarahalli To: =?iso-8859-1?Q?Morten_Br=F8rup?= , "dev@dpdk.org" , "olivier.matz@6wind.com" , "andrew.rybchenko@oktetlabs.ru" , Kamalakshitha Aligeri CC: nd , nd Subject: RE: [RFC] mempool: zero-copy cache put bulk Thread-Topic: [RFC] mempool: zero-copy cache put bulk Thread-Index: AdjxHCA/ROrKGJlPRZqF8NgKVJugtwAS1Rvw Date: Sat, 5 Nov 2022 23:11:20 +0000 Message-ID: References: <98CBD80474FA8B44BF855DF32C47DC35D87489@smartserver.smartshare.dk> In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D87489@smartserver.smartshare.dk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: B0C6ED18C5B24B4FA3FAABF15BB40EDD.0 x-checkrecipientchecked: true Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; x-ms-traffictypediagnostic: DBAPR08MB5814:EE_|DB9PR08MB6361:EE_|AM7EUR03FT049:EE_|AM9PR08MB6675:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e87ca92-8feb-4a3a-2a68-08dabf831588 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: KyvPe0uF14exQ2k3xBW2Xm2p2CnS1IISGC6WuWGDn+Zd/tr7oM9mszu3OCsFWKEROKuOuInwlP6WHHXCfEkTp214mYxLh5CiGdO1K4X5o/N7wGz6AOYNUfb7Ya22sOrK1aHy+Xdqdoodf8wYpCHCtqSIIeD6qShdVdoF7pOe77U0guY+4WWVSlSJfafd33+iY4CY3XPMsyPH4orM/nIEjeVOjzofpedgWTe1LV6d0GH5Zuplk600S6elZDfVUMuLxHR2N68DAOU/tsxf/YnxvYZZeWn91cIYWn9oqRH3e3xVj/f8G11OQK9iP69BrKiSRGdQoDVUpU2QwVvqQfeJf6uLWSBiVCVkN4IInRWt952DjVLHWAvvdcmHcHl28h95wUzc7LA6cg/W37u9wcvzc2SEcEoD5RIphwdRrfvhQ6Ys7x+ZQ7RsPL1SYClWbPynSM+mHgqhQFJ1VwQvNkxRfvnMfzrMdcJieSjXgN5q+uAS6AW/vR9rshwBP7KT1yF3x7B63qLX7oIFZkQkqw7PxlV41qm/yvt4Y4SaxX2WD8sV7izTh9tRJIIpgTHEwMypjX8mUAHvehclfrYn0wICg8mPuHzHsFz7KYYdfFrH3ZLZ0W1wAQb/y0MH9zjg6hpFxnlaIuk0tZRrakdE5GQoZEOZiR+iTQtvloxb6aIIVx+aFxfTU21GRlV1tdOUpA8t0VWbKBQQxj08EiG73StrP5FUUOu9AAtKcC5negTU5Uy0+HojsHHOJD3e914ZYVlYr1ysvWItY9cqAzK+tu8BwH2Soxvy0M12p+JWE0GNl3c= X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBAPR08MB5814.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(4636009)(136003)(346002)(366004)(376002)(396003)(39850400004)(451199015)(4326008)(66556008)(66946007)(66476007)(66446008)(76116006)(8676002)(64756008)(71200400001)(55016003)(966005)(6636002)(316002)(110136005)(54906003)(33656002)(38100700002)(122000001)(5660300002)(8936002)(52536014)(2906002)(7696005)(6506007)(41300700001)(83380400001)(66574015)(186003)(9686003)(26005)(53546011)(478600001)(38070700005)(86362001)(66899015); 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: DB9PR08MB6361 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: AM7EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 036ee34b-e62b-4c43-9a6d-08dabf830cf6 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: phjF7UZbN6hA+ofzhJOdFVJY4CRWykqBEQClXAdgwaVKnqN1O72/WeRytu8VQUk0mToNIj3FSxTQI52U48mPFqSpLA+a41kT2jOWKSLeXRRIeId3ai3u9V4iJsEh+uIosv53vR4ANMUkQBbQk9aK12PkukjTWv/lHCqKtnGpU9/sEqAd0c6f3m5pYsxU12bxCADQLR3rKKiyWExgQxjb9O9CwzPfPgnKF7lqyIW5gy3AOHrd9HQLGl/ky5dyuJJLWZKouZBYSm5H1ORwJGv8GZqJs5ftCHBGQMVrYJaGKF2gGUpeB8+0eJ0omegeG/DB7zvqJ4XHt+aAJmcetxauQ9G6qIbAFQ+Z8DM8YYmd/rsW+IzRcI1age3gp+GDQGsJVP1q51eNxSckjLYABuwyhI4SzNY8iAcRLG6bUma60M/tlyNWIJRRoAQuJf0qrdtG2Gu/WkT0SsDFUvJEJrP/NDaMtLr4ABIGCfmxy4EbNUtwtX3/NZ35RyoSF1QBQpbohB/Quf5rAh+81uR2Dv20+bqa7WazZ0IoldsL/iH1JQJYQ/V1qvkTCZLx48OY6HNVgYDOvIOO9X1Kygi2ZbH8UXclF48PpjjKZPnoyqIgqbiQTgqf3YISGLb9jcDCVVseNfMNjaMIv4xbXnQ7scdEXu36z76EOfWSQAgTo3R0harF25bOqrHGop3dgTJApOaAp7vm5eP2M4ZMVk+8h5xb0V38ynsWj8yPfDSPUfQBWpJq7Jnflia0+Gzm88+TVx+CbuYR51BJEIqskljapPf4wg== 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)(136003)(396003)(39850400004)(346002)(451199015)(46966006)(36840700001)(316002)(336012)(86362001)(66574015)(186003)(52536014)(53546011)(6506007)(7696005)(8936002)(33656002)(6636002)(110136005)(54906003)(5660300002)(26005)(9686003)(36860700001)(47076005)(55016003)(41300700001)(2906002)(82740400003)(82310400005)(356005)(81166007)(83380400001)(8676002)(70586007)(4326008)(40480700001)(70206006)(966005)(478600001)(66899015); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Nov 2022 23:11:34.8587 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e87ca92-8feb-4a3a-2a68-08dabf831588 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: AM7EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6675 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 + Akshitha, she is working on similar patch Few comments inline > -----Original Message----- > From: Morten Br=F8rup > Sent: Saturday, November 5, 2022 8:40 AM > To: dev@dpdk.org; olivier.matz@6wind.com; > andrew.rybchenko@oktetlabs.ru; Honnappa Nagarahalli > > Subject: [RFC] mempool: zero-copy cache put bulk >=20 > Zero-copy access to the mempool cache is beneficial for PMD performance, > and must be provided by the mempool library to fix [Bug 1052] without a > performance regression. >=20 > [Bug 1052]: https://bugs.dpdk.org/show_bug.cgi?id=3D1052 >=20 >=20 > This RFC offers a conceptual zero-copy put function, where the applicatio= n > promises to store some objects, and in return gets an address where to st= ore > them. >=20 > I would like some early feedback. >=20 > Notes: > * Allowing the 'cache' parameter to be NULL, and getting it from the > mempool instead, was inspired by rte_mempool_cache_flush(). I am not sure why the 'cache' parameter is required for this API. This API = should take the mem pool as the parameter. We have based our API on 'rte_mempool_do_generic_put' and removed the 'cach= e' parameter. This new API, on success, returns the pointer to memory where= the objects are copied. On failure it returns NULL and the caller has to c= all 'rte_mempool_ops_enqueue_bulk'. Alternatively, the new API could do thi= s as well and PMD does not need to do anything if it gets a NULL pointer. We should think about providing similar API on the RX side to keep it symm= etric. > * Asserting that the 'mp' parameter is not NULL is not done by other > functions, so I omitted it here too. >=20 > NB: Please ignore formatting. Also, this code has not even been compile > tested. We are little bit ahead, tested the changes with i40e PF PMD, wrote unit te= st cases, going through internal review, will send out RFC on Monday >=20 > /** > * Promise to put objects in a mempool via zero-copy access to a user-own= ed > mempool cache. > * > * @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 on error > * with rte_errno set appropriately. > */ > static __rte_always_inline void * > rte_mempool_cache_put_bulk_promise(struct rte_mempool_cache *cache, > struct rte_mempool *mp, > unsigned int n) > { > void **cache_objs; >=20 > if (cache =3D=3D NULL) > cache =3D rte_mempool_default_cache(mp, rte_lcore_id()); > if (cache =3D=3D NULL) { > rte_errno =3D EINVAL; > return NULL; > } >=20 > rte_mempool_trace_cache_put_bulk_promise(cache, mp, n); >=20 > /* The request itself is too big for the cache */ > if (unlikely(n > cache->flushthresh)) { > rte_errno =3D EINVAL; > return NULL; > } >=20 > /* > * The cache follows the following algorithm: > * 1. If the objects cannot be added to the cache without crossing > * the flush threshold, flush the cache to the backend. > * 2. Add the objects to the cache. > */ >=20 > if (cache->len + n <=3D cache->flushthresh) { > cache_objs =3D &cache->objs[cache->len]; > cache->len +=3D n; > } else { > cache_objs =3D &cache->objs[0]; > rte_mempool_ops_enqueue_bulk(mp, cache_objs, cache->len); > cache->len =3D n; > } >=20 > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_bulk, 1); > RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, n); >=20 > return cache_objs; > } >=20 >=20 > Med venlig hilsen / Kind regards, > -Morten Br=F8rup >=20