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 CAB8143B4C; Mon, 19 Feb 2024 18:36:27 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66DB840275; Mon, 19 Feb 2024 18:36:27 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.14]) by mails.dpdk.org (Postfix) with ESMTP id 523C640263 for ; Mon, 19 Feb 2024 18:36:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708364185; x=1739900185; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=t8t7zAN8DgRbu+/RV5zwpEvzZRlW5G6H04WnSPM4AU4=; b=aEJs7K0YFv4EQnnu7Ll0rQOd/4Ia+wYD0Q6R9f0YoR9+MUfdeAE/CdpK mqWI9qS37BZGSSXDobitaG7M7DFYs90LHTtME45wfOuTrWy0gLlQ7GB9J u2HjdfNDpy7DLFpKFx1bL1HgJby3nTO6bmVyQHrhlNCzMSbzM+L9d9gwT GNf27SFGSVPAPnOxe0ERHN79dZfF1fa8cSYq/7BhhpFHkYloRlTW2lTE7 F7tmvRq7URZIux7WdEDrc+LYTQLRLQp4VtFYB2IJ7o0UFDfsWFrshnbiN dynnJgqIqQMwm37I8v59mgdpDkstDM1KYUTFZR+hjrLlwDN28y2iikoQk g==; X-IronPort-AV: E=McAfee;i="6600,9927,10989"; a="2597146" X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="2597146" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa108.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Feb 2024 09:36:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,170,1705392000"; d="scan'208";a="4533110" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orviesa009.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 19 Feb 2024 09:36:24 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 19 Feb 2024 09:36:23 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) 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.35; Mon, 19 Feb 2024 09:36:22 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 19 Feb 2024 09:36:22 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) 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.35; Mon, 19 Feb 2024 09:36:22 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eMB5r9FQvA3XV8olyE90/P5+WfYMEoZoQqUS4iwq/Ks5RwcSVSXX3r3zW92OrU1rS8j89Lbg0r7BUIgddFENnnOGr79aiIsDN7UrLWH22guVQbIm73VAYdCqwEFWr2/8Wr2+T2gSmEYnSjnS2Xke9remOrMwcwQMEzH5aHfA1fGeJZpDks7xCZTipZ8wrfenQibQEXoR/OGYUS8hu0TRmyNEojsCnDknjo0MCGmLj4ezaAkLCnzu7slRE2UxPSBuDBFd4nDfiXtPK1TGn9ngTAIjRV3NTNUBY4FbuXK0PgJokQQWeCyDb7AhF1O5CyWBfMW8PSKKAh+7HiGuF1eE0g== 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=puDgt3r7E/hsrZ/CL6G+yH8rnGGVHGVkETj7EHhPTGc=; b=e1IX22FBe9/wP6S/WBraOB0sqhp4CC4437le1z1O2qk9yGrrgC5DKDPfWlrs8K0DSTB1M1s+aiHhSuX2FONzkENQmDbVol29IcAKlkNA4w7VR05j2UAMtSA/21+N0k+TNacrdEWbzVhIJ4EBlkAZ1vMCLGaseyz4iCY6YvMPIVUnXf/tQdBsjE9i9tW5bFZPzBJLZDoTlGvwBWGw4IZ4J3MsoinIgufnooK2yYfBWal0TxaqzaGAIIrT+B6xmJe3zueYUCqdHCr8cx3vJ08utX0LlzqNx33avLIGtWwBDZQOp33WC4+3+YJLlOA+At46kl2E7fY8TbHvOevT8bC2cA== 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 SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) by IA0PR11MB8397.namprd11.prod.outlook.com (2603:10b6:208:48b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.37; Mon, 19 Feb 2024 17:36:21 +0000 Received: from SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::fc4:cc9e:c910:f4b9]) by SJ0PR11MB5772.namprd11.prod.outlook.com ([fe80::fc4:cc9e:c910:f4b9%2]) with mapi id 15.20.7292.036; Mon, 19 Feb 2024 17:36:20 +0000 Message-ID: Date: Mon, 19 Feb 2024 17:36:16 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] lib/hash,lib/rcu: feature hidden key count in hash To: =?UTF-8?B?QWJkdWxsYWggw5ZtZXIgWWFtYcOn?= , CC: Honnappa Nagarahalli , Yipeng Wang , Sameh Gobriel , "Bruce Richardson" , Thomas Monjalon References: <20240207153340.34146-1-aomeryamac@gmail.com> Content-Language: en-US From: "Medvedkin, Vladimir" In-Reply-To: <20240207153340.34146-1-aomeryamac@gmail.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: DU6P191CA0060.EURP191.PROD.OUTLOOK.COM (2603:10a6:10:53e::10) To SJ0PR11MB5772.namprd11.prod.outlook.com (2603:10b6:a03:422::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR11MB5772:EE_|IA0PR11MB8397:EE_ X-MS-Office365-Filtering-Correlation-Id: 95eb1cf6-1be2-4173-2cae-08dc3171491b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K19sU3GZqRuGqVgnWcQXtsFeDDvEN5931XV7wxgHaoJVnpWAht/aMGp0MHvrqx8Ch/PJejz5BR8AY2hWY5dfpeM1Xr8ujXeMgqskWdRjUNwAtU4l2lTWIrGp4j3GjAp8QKdTP08UrwYzS9iqi53CeKbxYMMk8CA2uWlRC23ZMCMXPDzzmcbdQl+VJDlWaNxJ05z4DMAQJIE3OLcsT/MIb8Fuo64/+F5RPbgAqqbnII8a8NuOqOD8rsEdLOkoaHIUkVra8mSxLM4RHET29XpM/u9NkrLZwGwtG95fK0m4EXeaKkZG9loqfHndsvTQU7N5UljaMZqZ+TvZxbkpjvdrNqtoEjNI+rT7XyGPT+KR/zjvfrwRwOWVJjZM+ktNQ0rL5FFijAWiIjwq0XH5EDGxFR/Lv/wr8wyf7wt1XtksZPqjHK0dwu20A6kkJSUxPOLmvrK1CWpqKc6xy3vT/SBH3SpveRRp20aAKtXKGhAWMQvC6s+JjLjZuR5Qi+gssZVONRAFIUQ2+v0uMMF8pRZRA1pn8Zb40BGUr/VMUqqzHLY= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR11MB5772.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?U1hUc3kxK0RrT0FkM21vK2xLd2lOQjRTQVI3c3AxeGNFWWZuL3lvcHF2SGdt?= =?utf-8?B?RktodFdqZ2ZxK1Z4bmkzMEVVek9wQnBOcUVubDRYNzZEalhwS2ppQ3o2TU1r?= =?utf-8?B?OHVwNXJrVWdxamNnOEVCNVNJekZOZHAxVjFIQ05qOW9VRzVDUm12SHBHT09B?= =?utf-8?B?SHR2QWZBQTB1NWY1d3ZkQW1Oc0Y2alNXSXovVDhTZTRja1ZOVlVYU1l5YnhW?= =?utf-8?B?MFgzRFNYNnNYN1l2cWtGRFllZDJYUGlDTVRaL0M0R0VrQWx2RE82SWI0WSsv?= =?utf-8?B?MjBUVW1IMG0vSTFYdmpMRDNCWkJmaG9wbWwySGFNd2pRVjhUNUxHT0RuSThx?= =?utf-8?B?WEZFUExKZ1F6dTVYODNKWGRhaEhaTWN3Vk9QekFlaTJ6aWZmMEZIYndGR3J2?= =?utf-8?B?SS9Ba3djODNISUhRbHlNVUJJZzR0YU1Gc0JDSFgzT1BQcGFWTWVWZGdFTFNM?= =?utf-8?B?RzZpa0dPR2psNmZrZS8vNDBBSHJFd0F6bVNFWmN5end6ZlRsQ3Z2TWxvSnV4?= =?utf-8?B?Z1N1TytsTlJjN3BxdnQ2dGVXdWxhcHRQbTlYNjl2O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WMGlKcnIwMzlLTlNSNFllME9kYm5SWlMyZ00xbDA4alk2M0NpUTIr?= =?utf-8?B?dUNxOVUwNC9BK3JiMnBRTEZDZnhBemtzaWxkNGg0OU4rTVh5azhOWXRkeHVJ?= =?utf-8?B?L3RuK3AzQ1VQL3E2aFdYSVlyZStyMGYycThPUUZYbWNSekN2WlN4eHNUMGUr?= =?utf-8?B?ZFZwcWN1RHBhMzRWYWFvd2pjQmhhQk9KUEhvby9EcitIUU9LV2hUNUliNWpi?= =?utf-8?B?aENJSkZ3UVhvUEdLb0JlM1ZTRjNqemlDTjNoMWtxQ3c5NzJpRWlsejNSSndD?= =?utf-8?B?QmZ2RDVZQzdsMitZVFUyS3BFWjRFRWRaOHVGZ3VieDBQcURMK200UlpVWE1X?= =?utf-8?B?WEFyZXNuQjdiMDlNeFBUcGRPbE0xU1BWUU01TDRLV2JleHMyNmxaRkx3Ti9v?= =?utf-8?B?ZzBUdjVHUzUyZWZoQzV3Y2FTMlNoSitZNHVSSU0veHo4MDYreTJDTXo2ZERF?= =?utf-8?B?bkFsdGlFWHdUNEp1L2ZJU3dyM0VCVmpHQ1hQbkx1bzdQeCtwU3E1UTNCaVA1?= =?utf-8?B?dG9kT21Tcjk1eEJPZ3JkVWNBTUUrUXFqN05PWHJBODVhekF5V3RKdTAveWdw?= =?utf-8?B?YmFCSGVMTW5rN0pYMDdUeUdlSzBERzcvSzBmdW9lZER3NHNZQVdnSmtKZTlY?= =?utf-8?B?UXpCMXl5OERlTlB2eUZPNWs0Ui9oNkk1NzE3WTlXK0MrUnBGejNlOWJDdWxm?= =?utf-8?B?M0E9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 95eb1cf6-1be2-4173-2cae-08dc3171491b X-MS-Exchange-CrossTenant-AuthSource: SJ0PR11MB5772.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Feb 2024 17:36:20.8246 (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: Q4Y1GbUTXIbuIC/ym0fAOpAS0xaVjvQ4nCkyj/WYXUtql8rdrHrR93EO5WeGqGMEPgre0BiphCVM1RV+AqPoS8YFmauL5xgYgQU9INOGbjs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB8397 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 Hi Abdullah, Could you please tell more about use cases where this API may be useful? >a new API to get the hidden key count in the hash table if the rcu qsbr is enabled Here in commit message and down below in doxygen comments, I think this statement should be more specific because rcu can be created with RTE_HASH_QSBR_MODE_SYNC mode i.e. without defer queue. Also, new API must be reflected in release notes On 07/02/2024 15:33, Abdullah Ömer Yamaç wrote: > This patch introduce a new API to get the hidden key count in the hash > table if the rcu qsbr is enabled. When using rte_hash_count with rcu > qsbr enabled, it will return the number of elements that are not in the > free queue. Unless rte_rcu_qsbr_dq_reclaim is called, the number of > elements in the defer queue will not be counted and freed. Therefore I > added a new API to get the number of hidden (defer queue) elements > in the hash table. Then the user can calculate the total number of > elements that are available in the hash table. > > Signed-off-by: Abdullah Ömer Yamaç > > --- > Cc: Honnappa Nagarahalli > Cc: Yipeng Wang > Cc: Sameh Gobriel > Cc: Bruce Richardson > Cc: Vladimir Medvedkin > --- > lib/hash/rte_cuckoo_hash.c | 9 +++++++++ > lib/hash/rte_hash.h | 13 +++++++++++++ > lib/hash/version.map | 1 + > lib/rcu/rte_rcu_qsbr.c | 8 ++++++++ > lib/rcu/rte_rcu_qsbr.h | 11 +++++++++++ > lib/rcu/version.map | 1 + > 6 files changed, 43 insertions(+) > > diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c > index 70456754c4..3553f3efc7 100644 > --- a/lib/hash/rte_cuckoo_hash.c > +++ b/lib/hash/rte_cuckoo_hash.c > @@ -555,6 +555,15 @@ rte_hash_max_key_id(const struct rte_hash *h) > return h->entries; > } > > +int32_t > +rte_hash_dq_count(const struct rte_hash *h) > +{ > + if (h->dq == NULL) input arguments must be checked since this is a public API, the same is true for rte_rcu_qsbr_dq_count() > + return -EINVAL; why not just return 0? > + > + return rte_rcu_qsbr_dq_count(h->dq); > +} > + > int32_t > rte_hash_count(const struct rte_hash *h) > { > diff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h > index 7ecc021111..8ea97e297d 100644 > --- a/lib/hash/rte_hash.h > +++ b/lib/hash/rte_hash.h > @@ -193,6 +193,19 @@ rte_hash_free(struct rte_hash *h); > void > rte_hash_reset(struct rte_hash *h); > > + > +/** > + * Return the number of records in the defer queue of the hash table > + * if RCU is enabled. > + * @param h > + * Hash table to query from > + * @return > + * - -EINVAL if parameters are invalid > + * - A value indicating how many records were inserted in the table. did you mean how many records are kept in defer queue? > + */ > +int32_t > +rte_hash_dq_count(const struct rte_hash *h); > + > /** > * Return the number of keys in the hash table > * @param h > diff --git a/lib/hash/version.map b/lib/hash/version.map > index 6b2afebf6b..7f7b158cf1 100644 > --- a/lib/hash/version.map > +++ b/lib/hash/version.map > @@ -9,6 +9,7 @@ DPDK_24 { > rte_hash_add_key_with_hash; > rte_hash_add_key_with_hash_data; > rte_hash_count; > + rte_hash_dq_count; new API must introduced as an experimental API. The same is true for rte_rcu_qsbr_dq_count() > rte_hash_crc32_alg; > rte_hash_crc_set_alg; > rte_hash_create; > diff --git a/lib/rcu/rte_rcu_qsbr.c b/lib/rcu/rte_rcu_qsbr.c > index bd0b83be0c..89f8da4c4c 100644 > --- a/lib/rcu/rte_rcu_qsbr.c > +++ b/lib/rcu/rte_rcu_qsbr.c > @@ -450,6 +450,14 @@ rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n, > return 0; > } > > +/** > + * Return the number of entries in a defer queue. > + */ > +unsigned int rte_rcu_qsbr_dq_count(struct rte_rcu_qsbr_dq *dq) > +{ > + return rte_ring_count(dq->r); > +} > + > /* Delete a defer queue. */ > int > rte_rcu_qsbr_dq_delete(struct rte_rcu_qsbr_dq *dq) > diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h > index 23c9f89805..ed5a590edd 100644 > --- a/lib/rcu/rte_rcu_qsbr.h > +++ b/lib/rcu/rte_rcu_qsbr.h > @@ -794,6 +794,17 @@ int > rte_rcu_qsbr_dq_reclaim(struct rte_rcu_qsbr_dq *dq, unsigned int n, > unsigned int *freed, unsigned int *pending, unsigned int *available); > > +/** > + * Return the number of entries in a defer queue. > + * > + * @param dq > + * Defer queue. > + * @return > + * The number of entries in the defer queue. > + */ > +unsigned int > +rte_rcu_qsbr_dq_count(struct rte_rcu_qsbr_dq *dq); > + > /** > * Delete a defer queue. > * > diff --git a/lib/rcu/version.map b/lib/rcu/version.map > index 982ffd59d9..f410ab41e7 100644 > --- a/lib/rcu/version.map > +++ b/lib/rcu/version.map > @@ -5,6 +5,7 @@ DPDK_24 { > rte_rcu_qsbr_dq_create; > rte_rcu_qsbr_dq_delete; > rte_rcu_qsbr_dq_enqueue; > + rte_rcu_qsbr_dq_count; > rte_rcu_qsbr_dq_reclaim; > rte_rcu_qsbr_dump; > rte_rcu_qsbr_get_memsize; -- Regards, Vladimir