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 428DB43DF8; Thu, 4 Apr 2024 12:11:40 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 33390402D4; Thu, 4 Apr 2024 12:11:40 +0200 (CEST) Received: from mail-oa1-f48.google.com (mail-oa1-f48.google.com [209.85.160.48]) by mails.dpdk.org (Postfix) with ESMTP id CF17740268 for ; Thu, 4 Apr 2024 12:11:37 +0200 (CEST) Received: by mail-oa1-f48.google.com with SMTP id 586e51a60fabf-2220a389390so358545fac.0 for ; Thu, 04 Apr 2024 03:11:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712225497; x=1712830297; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sS5KxjAdgs0OSVEuuaUJ1Ifo7Ib64y0cT4JNNedtMjY=; b=GgNfrf/ZEMb+CVvgtbxMn/2ghJkxPJUhilYNc8jwhFw2/o+xdECXnm/Um7jgKtxHbL KcF+PIKG+HDLid7H3r5xYz63AjiVNGNQTtFcIQnMv87cwwULITyFCRU/AWAc6Lqu0Y2a 1oe9aOR/TANN2RiWQgzfDagZM6A53eQTgZOaDnK0IBtEZZvFH33Ck8BzSFe6PvwngLen /UexsgDbHv6ttVHeaX/MhRQelRsRpIsK8FaT0h3IqAwyCBCnGDLlK68R0ZYbdYGhNt/P ybpib1EDHPTt9X4q3hd0am5pDrX284hWaWzMf7L3Oup4+DwXwC8/B74At9xpz8x9Owuj 3b8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712225497; x=1712830297; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sS5KxjAdgs0OSVEuuaUJ1Ifo7Ib64y0cT4JNNedtMjY=; b=GfuRf21lTN4g7CASVvDt4/zEtCQrNMoRa/kaL/af/p0sXMrQSmQDKjc7GWG0vwjQT3 3CYJOYsmxc957fIViQ8ODeZHv4VaOZGI6DrxXMCO5BzuZz3xum7PICTKCp/0md5eHdN4 kdml63ywhRMf+6niB1nDanIgax7t4GY5U/2rODCI242wLdwJHjQcPv9yS2U3HgiT5phw /Dr753CWk5qeYMLMABLIM1HgrwQgakY1ZCr9pxm+FYjH7iGWNlt2s7iiLfaZPJtygkZE 7rCH4/pGu9z2HYRhwKWSpxdopxGiTH66zXgfIfJOBQ263995n15Qi7lhqUhIgQLVoUGW E/4A== X-Gm-Message-State: AOJu0YzNZ0W/clfS+Knf447GCCQF0yMcRL4X2Bk63fIBGhMFW6FP6lFU qZvbGx6iOYTDU0I2W6evO0CZjhHSqtj/JRT3YTTrzLN9bGFwfxAnJw6hxH4czUuQMgW891PvaWK 6PBE+382WldazfjAItOaKapldGpy0+JIZ X-Google-Smtp-Source: AGHT+IFHjuToGbvp96MBL1UkP/Bp8XkKPsjsSbVQOAdm4/tubxPr7AQ4ngfizPJRspHD3tTMfOun3kVz72MGVQy8+4Q= X-Received: by 2002:a05:6870:d623:b0:222:40ba:85ba with SMTP id a35-20020a056870d62300b0022240ba85bamr1795123oaq.6.1712225496921; Thu, 04 Apr 2024 03:11:36 -0700 (PDT) MIME-Version: 1.0 References: <2EAE263E-7275-432B-B06A-C50CCFD78DE4@arm.com> <20240306101335.246097-1-aomeryamac@gmail.com> In-Reply-To: From: =?UTF-8?B?QWJkdWxsYWggw5ZtZXIgWWFtYcOn?= Date: Thu, 4 Apr 2024 13:11:27 +0300 Message-ID: Subject: Re: [PATCH v3] lib/hash: add defer queue reclaim API To: dev@dpdk.org Cc: Honnappa Nagarahalli , Thomas Monjalon Content-Type: multipart/alternative; boundary="00000000000084fcf4061542909b" 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 --00000000000084fcf4061542909b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello, Could you check the last commit? Thanks On Thu, Mar 14, 2024 at 10:04=E2=80=AFAM Abdullah =C3=96mer Yama=C3=A7 wrote: > Hello, > Is there any other comment on this? > > On Wed, Mar 6, 2024 at 1:13=E2=80=AFPM Abdullah =C3=96mer Yama=C3=A7 > wrote: > >> This patch adds a new feature to the hash library to allow the user to >> reclaim the defer queue. This is useful when the user wants to force >> reclaim resources that are not being used. This API is only available >> if the RCU is enabled. >> >> Signed-off-by: Abdullah =C3=96mer Yama=C3=A7 >> --- >> lib/hash/rte_cuckoo_hash.c | 23 +++++++++++++++++++++++ >> lib/hash/rte_hash.h | 24 ++++++++++++++++++++++++ >> lib/hash/version.map | 6 ++++++ >> 3 files changed, 53 insertions(+) >> >> diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c >> index 9cf94645f6..1c360fa38b 100644 >> --- a/lib/hash/rte_cuckoo_hash.c >> +++ b/lib/hash/rte_cuckoo_hash.c >> @@ -1588,6 +1588,29 @@ rte_hash_rcu_qsbr_add(struct rte_hash *h, struct >> rte_hash_rcu_config *cfg) >> return 0; >> } >> >> +int >> +rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *freed, >> + unsigned int *pending, unsigned int *available) >> +{ >> + int ret; >> + >> + if (h->hash_rcu_cfg =3D=3D NULL) { >> + rte_errno =3D EINVAL; >> + return -1; >> + } >> + >> + ret =3D rte_rcu_qsbr_dq_reclaim(h->dq, >> h->hash_rcu_cfg->max_reclaim_size, >> + freed, pending, >> available); >> + if (ret !=3D 0) { >> + HASH_LOG(ERR, >> + "%s: could not reclaim the defer queue in hash >> table", >> + __func__); >> + return -1; >> + } >> + >> + return 0; >> +} >> + >> static inline void >> remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt, >> unsigned int i) >> diff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h >> index 7ecc021111..edfa262aca 100644 >> --- a/lib/hash/rte_hash.h >> +++ b/lib/hash/rte_hash.h >> @@ -674,6 +674,30 @@ rte_hash_iterate(const struct rte_hash *h, const >> void **key, void **data, uint32 >> */ >> int rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_confi= g >> *cfg); >> >> +/** >> + * Reclaim resources from the defer queue. >> + * This API reclaim the resources from the defer queue if rcu is enable= d. >> + * >> + * @param h >> + * The hash object to reclaim resources. >> + * @param freed >> + * Number of resources that were freed. >> + * @param pending >> + * Number of resources pending on the defer queue. >> + * This number might not be accurate if multi-thread safety is >> configured. >> + * @param available >> + * Number of resources that can be added to the defer queue. >> + * This number might not be accurate if multi-thread safety is >> configured. >> + * @return >> + * On success - 0 >> + * On error - 1 with error code set in rte_errno. >> + * Possible rte_errno codes are: >> + * - EINVAL - invalid pointer >> + */ >> +__rte_experimental >> +int rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *free= d, >> + unsigned int *pending, unsigned int *available); >> + >> #ifdef __cplusplus >> } >> #endif >> diff --git a/lib/hash/version.map b/lib/hash/version.map >> index 6b2afebf6b..fac7f81e6f 100644 >> --- a/lib/hash/version.map >> +++ b/lib/hash/version.map >> @@ -48,3 +48,9 @@ DPDK_24 { >> >> local: *; >> }; >> + >> +EXPERIMENTAL { >> + global: >> + >> + rte_hash_rcu_qsbr_dq_reclaim; >> +}; >> \ No newline at end of file >> -- >> 2.34.1 >> >> --00000000000084fcf4061542909b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello,=C2=A0
Could you check the last commit?
Thanks=

= On Thu, Mar 14, 2024 at 10:04=E2=80=AFAM Abdullah =C3=96mer Yama=C3=A7 <= aomeryamac@gmail.com> wrote:=
Hello,
Is there any other comment on this?=C2=A0

On Wed, Mar 6, 2024 = at 1:13=E2=80=AFPM Abdullah =C3=96mer Yama=C3=A7 <aomeryamac@gmail.com> wrote:
=
This patch adds a n= ew feature to the hash library to allow the user to
reclaim the defer queue. This is useful when the user wants to force
reclaim resources that are not being used. This API is only available
if the RCU is enabled.

Signed-off-by: Abdullah =C3=96mer Yama=C3=A7 <aomeryamac@gmail.com>
---
=C2=A0lib/hash/rte_cuckoo_hash.c | 23 +++++++++++++++++++++++
=C2=A0lib/hash/rte_hash.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 24 +++++++++++++++++= +++++++
=C2=A0lib/hash/version.map=C2=A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 6 ++++++
=C2=A03 files changed, 53 insertions(+)

diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index 9cf94645f6..1c360fa38b 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -1588,6 +1588,29 @@ rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte= _hash_rcu_config *cfg)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 0;
=C2=A0}

+int
+rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *freed,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int *pendi= ng, unsigned int *available)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0int ret;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (h->hash_rcu_cfg =3D=3D NULL) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0rte_errno =3D EINVA= L;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0ret =3D rte_rcu_qsbr_dq_reclaim(h->dq, h->= ;hash_rcu_cfg->max_reclaim_size,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0freed, pending, available);=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (ret !=3D 0) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0HASH_LOG(ERR,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0"%s: could not reclaim the defer queue in hash table",<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0__func__);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return 0;
+}
+
=C2=A0static inline void
=C2=A0remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt, =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned int i)
diff --git a/lib/hash/rte_hash.h b/lib/hash/rte_hash.h
index 7ecc021111..edfa262aca 100644
--- a/lib/hash/rte_hash.h
+++ b/lib/hash/rte_hash.h
@@ -674,6 +674,30 @@ rte_hash_iterate(const struct rte_hash *h, const void = **key, void **data, uint32
=C2=A0 */
=C2=A0int rte_hash_rcu_qsbr_add(struct rte_hash *h, struct rte_hash_rcu_con= fig *cfg);

+/**
+ * Reclaim resources from the defer queue.
+ * This API reclaim the resources from the defer queue if rcu is enabled.<= br> + *
+ * @param h
+ *=C2=A0 =C2=A0The hash object to reclaim resources.
+ * @param freed
+ *=C2=A0 =C2=A0Number of resources that were freed.
+ * @param pending
+ *=C2=A0 =C2=A0Number of resources pending on the defer queue.
+ *=C2=A0 =C2=A0This number might not be accurate if multi-thread safety is= configured.
+ * @param available
+ *=C2=A0 =C2=A0Number of resources that can be added to the defer queue. + *=C2=A0 =C2=A0This number might not be accurate if multi-thread safety is= configured.
+ * @return
+ *=C2=A0 =C2=A0On success - 0
+ *=C2=A0 =C2=A0On error - 1 with error code set in rte_errno.
+ *=C2=A0 =C2=A0Possible rte_errno codes are:
+ *=C2=A0 =C2=A0- EINVAL - invalid pointer
+ */
+__rte_experimental
+int rte_hash_rcu_qsbr_dq_reclaim(struct rte_hash *h, unsigned int *freed,<= br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned int *pendi= ng, unsigned int *available);
+
=C2=A0#ifdef __cplusplus
=C2=A0}
=C2=A0#endif
diff --git a/lib/hash/version.map b/lib/hash/version.map
index 6b2afebf6b..fac7f81e6f 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -48,3 +48,9 @@ DPDK_24 {

=C2=A0 =C2=A0 =C2=A0 =C2=A0 local: *;
=C2=A0};
+
+EXPERIMENTAL {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0global:
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0rte_hash_rcu_qsbr_dq_reclaim;
+};
\ No newline at end of file
--
2.34.1

--00000000000084fcf4061542909b--