public inbox for dev@dpdk.org
 help / color / mirror / Atom feed
From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org, Yipeng Wang <yipeng1.wang@intel.com>,
	Sameh Gobriel <sameh.gobriel@intel.com>,
	Bruce Richardson <bruce.richardson@intel.com>,
	Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH dpdk v2 1/3] hash: avoid leaking entries on RCU defer queue failure
Date: Fri, 13 Feb 2026 11:34:39 +0100	[thread overview]
Message-ID: <20260213103441.1505659-2-rjarry@redhat.com> (raw)
In-Reply-To: <20260213103441.1505659-1-rjarry@redhat.com>

When rte_rcu_qsbr_dq_enqueue() fails in DQ mode, the deleted key slot
is never freed and becomes permanently leaked. Fall back to synchronous
reclamation instead of only logging an error.

Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 lib/hash/rte_cuckoo_hash.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index da12825c6ed2..8189bde024be 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -1870,18 +1870,15 @@ __rte_hash_del_key_with_hash(const struct rte_hash *h, const void *key,
 		/* Key index where key is stored, adding the first dummy index */
 		rcu_dq_entry.key_idx = ret + 1;
 		rcu_dq_entry.ext_bkt_idx = index;
-		if (h->dq == NULL) {
+		if (h->dq == NULL || rte_rcu_qsbr_dq_enqueue(h->dq, &rcu_dq_entry) != 0) {
 			/* Wait for quiescent state change if using
-			 * RTE_HASH_QSBR_MODE_SYNC
+			 * RTE_HASH_QSBR_MODE_SYNC or if RCU enqueue failed.
 			 */
 			rte_rcu_qsbr_synchronize(h->hash_rcu_cfg->v,
 						 RTE_QSBR_THRID_INVALID);
 			__hash_rcu_qsbr_free_resource((void *)((uintptr_t)h),
 						      &rcu_dq_entry, 1);
-		} else if (h->dq)
-			/* Push into QSBR FIFO if using RTE_HASH_QSBR_MODE_DQ */
-			if (rte_rcu_qsbr_dq_enqueue(h->dq, &rcu_dq_entry) != 0)
-				HASH_LOG(ERR, "Failed to push QSBR FIFO");
+		}
 	}
 	__hash_rw_writer_unlock(h);
 	return ret;
-- 
2.53.0


  reply	other threads:[~2026-02-13 10:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 21:33 [PATCH dpdk 0/2] hash: safe data replacement on overwrite Robin Jarry
2026-02-12 21:33 ` [PATCH dpdk 1/2] hash: free replaced data on overwrite when RCU is configured Robin Jarry
2026-02-12 21:33 ` [PATCH dpdk 2/2] hash: add replace API returning old data on overwrite Robin Jarry
2026-02-12 22:55 ` [PATCH dpdk 0/2] hash: safe data replacement " Stephen Hemminger
2026-02-13 10:34 ` [PATCH dpdk v2 0/3] " Robin Jarry
2026-02-13 10:34   ` Robin Jarry [this message]
2026-03-04 10:28     ` [PATCH dpdk v2 1/3] hash: avoid leaking entries on RCU defer queue failure Konstantin Ananyev
2026-02-13 10:34   ` [PATCH dpdk v2 2/3] hash: free replaced data on overwrite when RCU is configured Robin Jarry
2026-03-04 11:40     ` Konstantin Ananyev
2026-03-04 11:45       ` Robin Jarry
2026-03-04 12:50         ` Robin Jarry
2026-02-13 10:34   ` [PATCH dpdk v2 3/3] hash: add replace API returning old data on overwrite Robin Jarry
2026-03-04 11:44     ` Konstantin Ananyev
2026-03-06  8:47 ` [PATCH dpdk v3 0/2] hash: safe data replacement " Robin Jarry
2026-03-06  8:47   ` [PATCH dpdk v3 1/2] hash: avoid leaking entries on RCU defer queue failure Robin Jarry
2026-03-06  8:47   ` [PATCH dpdk v3 2/2] hash: free replaced data on overwrite when RCU is configured Robin Jarry
2026-03-09  7:48     ` Konstantin Ananyev
2026-03-09  7:50   ` [PATCH dpdk v3 0/2] hash: safe data replacement on overwrite Konstantin Ananyev
2026-03-09  7:52     ` Robin Jarry
2026-03-09  8:32       ` Konstantin Ananyev
2026-03-17  9:40   ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260213103441.1505659-2-rjarry@redhat.com \
    --to=rjarry@redhat.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=sameh.gobriel@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=vladimir.medvedkin@intel.com \
    --cc=yipeng1.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox