From: Robin Jarry <rjarry@redhat.com>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH dpdk v2 0/3] hash: safe data replacement on overwrite
Date: Fri, 13 Feb 2026 11:34:38 +0100 [thread overview]
Message-ID: <20260213103441.1505659-1-rjarry@redhat.com> (raw)
In-Reply-To: <20260212213313.1376294-5-rjarry@redhat.com>
When rte_hash_add_key_data() is called with an existing key, the old
data pointer is silently overwritten. With RCU-protected readers still
potentially accessing the old data, the application cannot safely free
it since the old pointer is never returned.
This series provides two ways to address the problem:
* Automatic: when RCU is configured with a free_key_data_func callback,
rte_hash_add_key_data() now automatically defers freeing the old data
on overwrite. No caller changes are needed.
* Explicit: a new rte_hash_replace_key_data() API returns the previous
data pointer via an output parameter, giving the caller full control
over the old pointer's life cycle. No automatic deferred free is
performed in that case.
v2:
* New patch to fallback to SYNC mode when DQ fails on delete.
* Check key_idx == EMPTY_SLOT in DQ mode to differentiate when old_data is NULL.
* Also fallback to SYNC mode when DQ fails on replace.
Robin Jarry (3):
hash: avoid leaking entries on RCU defer queue failure
hash: free replaced data on overwrite when RCU is configured
hash: add replace API returning old data on overwrite
app/test/test_hash.c | 214 +++++++++++++++++++++++++
doc/guides/rel_notes/release_26_03.rst | 12 ++
lib/hash/rte_cuckoo_hash.c | 150 +++++++++++++----
lib/hash/rte_hash.h | 75 ++++++++-
4 files changed, 415 insertions(+), 36 deletions(-)
--
2.53.0
next prev parent reply other threads:[~2026-02-13 10:34 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 ` Robin Jarry [this message]
2026-02-13 10:34 ` [PATCH dpdk v2 1/3] hash: avoid leaking entries on RCU defer queue failure Robin Jarry
2026-03-04 10:28 ` 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-1-rjarry@redhat.com \
--to=rjarry@redhat.com \
--cc=dev@dpdk.org \
--cc=stephen@networkplumber.org \
/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