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 611884246E; Mon, 23 Jan 2023 15:31:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CE8B400EF; Mon, 23 Jan 2023 15:31:17 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id A63F6400D4 for ; Mon, 23 Jan 2023 15:31:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1674484274; x=1706020274; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=eq+H7gBGFes+SFo05EMwDQFcLQGo869JJmtcRyssJBg=; b=Eo0NKF5gm0z/kjhuti965b4ECtdx/oV0tiTc8luHjv6+nvhyPmyaplS+ 2qoqIn74XknMrfVkh60UganKOJQILhbaK8SAUdO/oqX2UNRH2Sxequ88L F0gEmD0VwZ+BlJloaQWuYuTnSQcgkWuW713960XZE19A0ivLyeOPQ7hhZ 15tvwdQBeVmGC7gN5uBMHlt9c6dPArjZm860KE0ffuO5NUggGhMCCDjxJ ODKuWpXl3fObBnvN0qgc9lUEUitrp8QEuXdAMdFTJaU/hh5YWz8MIDUz+ Q/1Ye6GtY5iLXxQD3HIaVVV5MIbKPFjXhgTzkM9NCb4E4NmEFQE1JbnPQ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10598"; a="306403895" X-IronPort-AV: E=Sophos;i="5.97,239,1669104000"; d="scan'208";a="306403895" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jan 2023 06:31:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10598"; a="661652887" X-IronPort-AV: E=Sophos;i="5.97,239,1669104000"; d="scan'208";a="661652887" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga002.jf.intel.com with ESMTP; 23 Jan 2023 06:31:13 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 23 Jan 2023 06:31:12 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Mon, 23 Jan 2023 06:31:11 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Mon, 23 Jan 2023 06:31:11 -0800 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.43) 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.16; Mon, 23 Jan 2023 06:31:11 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cuyxz71kuNHEiN0rFkGo60eX1f5+nDgomaYlDWDFsceqwbV9e9HpYei94Zl5X9M6njEQs2SWJedKtWJ73gCtzW3hA7HWlqOnI2BcrDC4moMcu914RTdMm1oSnKgZ9OlNn5Jw9s5kPb+67/GScL2IptZHdsPYRcCluJnfFpS5iH5SWST14RxgHiH0WZ3JJ8YzHT2xmBl5B7i4kIZC2BTd34U9qMIuXUb0LPUoKGoZxjTx8/3aQuydYvIBPhNJsanThfjjSRjbglVpO0LOFYOs2YNmCsqFc14RdzL3TYtSJZizPcTUHJvVdlD+3UlvxK38ETwmxVFP6P1WOoADQO6K/w== 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=PPi93R7qf1E0fq4iwIDQHTCGWaiyMjXLdKBHokJwBwc=; b=MOwdRA3NoJCWohsF9Am1AOPSs+icMnPCDpFDFFLVp/iKXgFVvFon9U5Xwa97SzSbOEGcP3FiZVdHI0xAJXGwzFnvP6a4RsyoKmIvfuEjyAVnDzIFkXlViuSTyJQrdK96uBUNqIXcBk44Ah9vTTk8ESq2Nvp5egbY0oC5nwd9GjmDbi7hk1qBIhZPGfbS7HjoQeWi32AaReWVgbxJT5qIfFaFQ5Bq+Nhwh6eAlPx0ejR/tAvw+9Xn9CC5dVBJijRvUQYV/0sg9Vdu/3aaL7pMktMxvgS8KTWhfHAUGA/qbnwaxfTj6CnxN8XdFN4L97p2/yOT1ED6s1esIr+rz4qTrg== 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 IA1PR11MB7890.namprd11.prod.outlook.com (2603:10b6:208:3ff::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.33; Mon, 23 Jan 2023 14:31:04 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee%7]) with mapi id 15.20.6002.027; Mon, 23 Jan 2023 14:31:04 +0000 Date: Mon, 23 Jan 2023 14:30:57 +0000 From: Bruce Richardson To: Morten =?iso-8859-1?Q?Br=F8rup?= CC: Konstantin Ananyev , Konstantin Ananyev , , , , , , Subject: Re: [PATCH v5] mempool cache: add zero-copy get and put functions 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> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35D876A9@smartserver.smartshare.dk> X-ClientProxiedBy: LO4P123CA0434.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a9::7) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|IA1PR11MB7890:EE_ X-MS-Office365-Filtering-Correlation-Id: 94e3eef0-67d6-4c4d-c3ce-08dafd4e74fc X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: od0qER/bemUYladewpxighxcZVRMjdo5I4aj9bPSZvPnvoduD/DLIPEL9DO4WBYhqFuyZPGQzuf0K+E+dOgMMeEv4T/UpAA6iGF/a6/GdILFUYb0W0z4dWxmGooBuB0Va3QroO1xIOiBRzxQa7IGgHgOt9BIrXdocg6pTizRvIrzfuIK4uYjg1aR7BniV85m7hrntmHwJA7FJCO36cHh8aRzlw0HXRdwYmpxk165OOBqydfmTbFE+pdup0L5MmwS9wgxanLcoBc70BAdNGXrYpXC2rb+31sxb3nq+8PwIVnfvGC6O6AngsbHLZX49HxdYfQl+N1pnh0y5dU5ira2RI4aaVK8n+39TMjiXcu7HuSD2chX3jSf6pCbJcv2FiFXOAheb1rShhNlHHfc/S2intIjGTNf5ldCY9U/9DanXZ6Xnxd1iwnKiirklVAWRsK+aM4o5LbWtKtp0FrZfI/xBf+CYryotY5Yk8jImkZ+ot4/EfeJdYWWvtZgef79xrndB1FD+7YGw5pKT6v3hz0vJg82ivp+xoF/6K0cYbMDC117vQsUk1XFD+Rar/TRYCX5qxl01/7X3XchzKARRRElRNgscW2U0F85BtSIL/wbSCMUcmho19ZuRWZyK1upxDYh9VBo309f5moVrkhXRPCGZglQCMl1ettRG3+Y0ZRGbFERGp4Q6ieWN1esNuozSsPoZheGDT7xUuwMT657QzTQ1joADuu3iy5VKW/gm7vcS38= 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:(13230022)(39860400002)(396003)(366004)(376002)(346002)(136003)(451199015)(316002)(86362001)(66476007)(6916009)(4326008)(66946007)(8676002)(66556008)(54906003)(26005)(6512007)(186003)(6666004)(6506007)(83380400001)(6486002)(478600001)(66574015)(5660300002)(44832011)(8936002)(41300700001)(2906002)(82960400001)(38100700002)(23180200003)(67856001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?R1WEIcClJMo4RWKWS7wbaVfUMih24T5gw3z9lhcmcIiiXyTRe5s+7VdF4V?= =?iso-8859-1?Q?WO+BypJqeeFNyLi6d7FToItVqeqJRY/uTT49mkAnYQUPMgOPvbLycq71Kz?= =?iso-8859-1?Q?U+/YJnj76m/KvXsmx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?Q?tBHkDi4pHKfNloeSFlEfYj+oRocenXuRBO9Chiaux5mb0srFFaf/8okUHq?= =?iso-8859-1?Q?L8/n6YqQ+piWq1ypz5P3Ifv5mfAXEKlzvWGNaDobt1J8i8Y2PNzQ4L8Hqs?= =?iso-8859-1?Q?F5wa2xhaeEA7P4d2XDJIfaRaqaLmW32Pzzui2ETns+lF5ciZ62TWSsskP/?= =?iso-8859-1?Q?78MxOg9ZM4rZ5Nwlt6l6yfspaSCRjPhoJRrpwvT2NQ1R6B84bvGxar8K/6?= =?iso-8859-1?Q?rrd7b8xYLdwup2kIl1uVsOgSEBmqT5knB460yy4Zg2TKM57OU3FuFaxPzB?= =?iso-8859-1?Q?+TypiP067K15Z+YBsnPv1qNCNsy4YdWzISItIx+h0dj8/sPh5WSKNw5qor?= =?iso-8859-1?Q?OvTDar+3R5OHfJqMPXNH7f7RxCOE4yGiBERANd5wWg2vorhxhFx7V5R9TN?= =?iso-8859-1?Q?OctYtgLjcc3dW1WeZ9MXxsqYcxLEjF8Mv/MMGpzGcWYQNT2XEjYL6TSY6D?= =?iso-8859-1?Q?6SEoUFQBrfetpSSggONONuj0N3MZkT6yUddzKXc2ip2+BRGBWOzYD9/DdI?= =?iso-8859-1?Q?sDgw1dYooeQMzBkgJkCV/IkNEglLKYQrSavtRyz0rKj1FINTwKEY0WKkhO?= =?iso-8859-1?Q?80+SHGa/4SEHNQZZQ3KmPVL2EoFQk3ZlHXlcBpxOQ7DTIHYgHvzR/vvw?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 94e3eef0-67d6-4c4d-c3ce-08dafd4e74fc X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jan 2023 14:31:04.0689 (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: oaM7ePdq2FXw6Trgt5NoKlyPYqnnIPuLlqjJ0AGzBBlEHljm+93SWGD6qTw0BFaN7j/mj/12BzYlA4oMruuywVD2P7cY/Cg7fq/5nCS8UNo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7890 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 Mon, Jan 23, 2023 at 01:23:50PM +0100, Morten Brørup wrote: > > From: Konstantin Ananyev [mailto:konstantin.ananyev@huawei.com] > > Sent: Monday, 23 January 2023 12.54 > > > > > > Few nits, see below. > > > > Also I still think we do need a test case for _zc_get_ before > > > > accepting it in the mainline. > > > > > > Poking at my bad conscience... :-) > > > > > > It's on my todo-list. Apparently not high enough. ;-) > > > > > > > With that in place: > > > > Acked-by: Konstantin Ananyev > > > > > > [...] > > > > > > +/** > > > > > + * @warning > > > > > + * @b EXPERIMENTAL: This API may change, or be removed, without > > > > prior notice. > > > > > + * > > > > > + * Zero-copy put objects in a user-owned mempool cache 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 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 ** > > > > > +rte_mempool_cache_zc_put_bulk(struct rte_mempool_cache *cache, > > > > > + struct rte_mempool *mp, > > > > > + unsigned int n) > > > > > +{ > > > > > + RTE_ASSERT(cache != NULL); > > > > > + RTE_ASSERT(mp != 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, without > > > > prior notice. > > > > > + * > > > > > + * Zero-copy un-put objects in a user-owned mempool cache. > > > > > + * > > > > > + * @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 > > > > > +rte_mempool_cache_zc_put_rewind(struct rte_mempool_cache *cache, > > > > > + unsigned int n) > > > > > +{ > > > > > + RTE_ASSERT(cache != NULL); > > > > > + RTE_ASSERT(n <= cache->len); > > > > > + > > > > > + rte_mempool_trace_cache_zc_put_rewind(cache, n); > > > > > + > > > > > + cache->len -= n; > > > > > + > > > > > + RTE_MEMPOOL_CACHE_STAT_ADD(cache, put_objs, (int)-n); > > > > > +} > > > > > + > > > > > +/** > > > > > + * @warning > > > > > + * @b EXPERIMENTAL: This API may change, or be removed, without > > > > prior notice. > > > > > + * > > > > > + * Zero-copy get objects from a user-owned mempool cache 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 having > > > called the function. > > > You might also notice that the n parameter for the zc_put() 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 headline > > to keep it simple. > > > > > > If you think "get" is a more correct description of the n 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 grammar > > is very different, and I am highly uncertain about my English > > > grammar here! I originally considered this phrase, but concluded that > > the "prefetch" description was easier to understand - especially > > > for non-native English readers. > > > > For me 'prefetch' seems a bit unclear in that situation... > > Probably: "number of objects that user plans to extract from the > > cache"? > > But again, I am not native English speaker too, so might be someone can > > suggest a better option. > > > > @Bruce (or any other native English speaking person), your input would be appreciated here! > 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 "number 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 otherwise consider it clearer that talking of prefetching or "getting". My 2c. /Bruce