Skip to contentSkip to conversation

hash: document breakage with multi-writer thread

PATCH In review Stephen Hemminger 4 participants 12 messages Jun 4, 2020 – Nov 26, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hash: document breakage with multi-writer thread

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Fixes 9d033dac7d7c ("hash: support no free on delete")
Fixes 5915699153d7 ("hash: fix scaling by reducing contention")
---
 doc/guides/prog_guide/hash_lib.rst | 1 +
 lib/librte_hash/rte_cuckoo_hash.c  | 9 +++++++++
 2 files changed, 10 insertions(+)
doc/guides/prog_guide/hash_lib.rst +1 -0
index d06c7de2ead1..29b41a425a43 100644
@@ -85,6 +85,7 @@ For concurrent writes, and concurrent reads and writes the following flag values
 
 *  If the multi-writer flag (RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD) is set, multiple threads writing to the table is allowed.
    Key add, delete, and table reset are protected from other writer threads. With only this flag set, readers are not protected from ongoing writes.
+   The writer threads must be EAL threads, it is not safe to write to a multi-writer hash table from an interrupt, control or other threads.
 
 *  If the read/write concurrency (RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY) is set, multithread read/write operation is safe
    (i.e., application does not need to stop the readers from accessing the hash table until writers finish their updates. Readers and writers can operate on the table concurrently).
lib/librte_hash/rte_cuckoo_hash.c +9 -0
index 90cb99b0eef8..79c94107a582 100644
@@ -979,6 +979,9 @@ __rte_hash_add_key_with_hash(const struct rte_hash *h, const void *key,
 	/* Did not find a match, so get a new slot for storing the new key */
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		if (lcore_id == LCORE_ID_ANY)
+			return -EINVAL;
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
 		/* Try to get a free slot from the local cache */
 		if (cached_free_slots->len == 0) {
@@ -1382,6 +1385,10 @@ remove_entry(const struct rte_hash *h, struct rte_hash_bucket *bkt, unsigned i)
 
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		ERR_IF_TRUE((lcore_id == LCORE_ID_ANY),
+			    "%s: attempt to remove entry from non EAL thread\n",
+			    __func__);
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
 		/* Cache full, need to free it. */
 		if (cached_free_slots->len == LCORE_CACHE_SIZE) {
@@ -1637,6 +1644,8 @@ rte_hash_free_key_with_position(const struct rte_hash *h,
 
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		RETURN_IF_TRUE((lcore_id == LCORE_ID_ANY), -EINVAL);
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
 		/* Cache full, need to free it. */
 		if (cached_free_slots->len == LCORE_CACHE_SIZE) {
Signature · 1 line
2.26.2
#1 lore raw

<snip>

Quoted 9 lines

Subject: [PATCH] hash: document breakage with multi-writer thread

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Having multiple non-EAL writer threads is a valid use case. Should we fix the issue instead?

Quoted 73 lines
Fixes 9d033dac7d7c ("hash: support no free on delete")
Fixes 5915699153d7 ("hash: fix scaling by reducing contention")

---
doc/guides/prog_guide/hash_lib.rst | 1 + lib/librte_hash/rte_cuckoo_hash.c
| 9 +++++++++

 2 files changed, 10 insertions(+)
doc/guides/prog_guide/hash_lib.rst +0 -0
index d06c7de2ead1..29b41a425a43 100644
@@ -85,6 +85,7 @@ For concurrent writes, and concurrent reads and writes

the following flag values

* If the multi-writer flag (RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD) is
set, multiple threads writing to the table is allowed.
Key add, delete, and table reset are protected from other writer threads.
With only this flag set, readers are not protected from ongoing writes.
+ The writer threads must be EAL threads, it is not safe to write to a multi-
writer hash table from an interrupt, control or other threads.

* If the read/write concurrency
(RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY) is set, multithread read/write operation is safe
(i.e., application does not need to stop the readers from accessing the hash
table until writers finish their updates. Readers and writers can operate on the table concurrently).

lib/librte_hash/rte_cuckoo_hash.c +3 -0
index 90cb99b0eef8..79c94107a582 100644
@@ -979,6 +979,9 @@ __rte_hash_add_key_with_hash(const struct
 rte_hash *h, const void *key,
 	/* Did not find a match, so get a new slot for storing the new key */
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		if (lcore_id == LCORE_ID_ANY)
+			return -EINVAL;
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
 		/* Try to get a free slot from the local cache */
lib/librte_hash/rte_cuckoo_hash.c +4 -0
 		if (cached_free_slots->len == 0) {
@@ -1382,6 +1385,10 @@ remove_entry(const struct rte_hash *h, struct
 rte_hash_bucket *bkt, unsigned i)
 
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		ERR_IF_TRUE((lcore_id == LCORE_ID_ANY),
+			    "%s: attempt to remove entry from non EAL
 thread\n",
+			    __func__);
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
lib/librte_hash/rte_cuckoo_hash.c +0 -0
 		/* Cache full, need to free it. */
 		if (cached_free_slots->len == LCORE_CACHE_SIZE) { @@ -

1637,6 +1644,8 @@ rte_hash_free_key_with_position(const struct rte_hash *h,

lib/librte_hash/rte_cuckoo_hash.c +2 -1
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		RETURN_IF_TRUE((lcore_id == LCORE_ID_ANY), -EINVAL);
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
 		/* Cache full, need to free it. */
 		if (cached_free_slots->len == LCORE_CACHE_SIZE) {
--

2.26.2

#2 lore raw
Quoted 4 lines · On Thu, 4 Jun 2020 17:51:43 +0000 Honnappa Nagarahalli…

<snip>

Quoted 2 lines

Subject: [PATCH] hash: document breakage with multi-writer thread

Quoted 8 lines
Quoted 7 lines

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Having multiple non-EAL writer threads is a valid use case. Should we fix the issue instead?

Discovered this the hard way...

Fixing is non-trivial. Basically, the local cache has to be take out and that leads to having to do real locking or atomic operations.

#3 lore raw
Quoted 10 lines
Quoted 10 lines

<snip>

Quoted 8 lines

Subject: [PATCH] hash: document breakage with multi-writer thread

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Add error checks and document the restriction.

Having multiple non-EAL writer threads is a valid use case. Should we fix the

issue instead?

Discovered this the hard way...

Fixing is non-trivial. Basically, the local cache has to be take out and that leads to having to do real locking or atomic operations.

Looking at rte_hash_create function:

        if (params->extra_flag & RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD) {
                use_local_cache = 1;
                writer_takes_lock = 1;
        }

The writer locks are in place already. The code to handle the case when local cache is taken out is also there.
What we need is another input flag that says 'multi writer + non-eal threads' which would set 'use_local_cache = 0' and 'writer_takes_lock = 1'.
Not sure, it would be valuable addition. But looks like this is what you were expecting when you had enabled 'RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD'. Many other APIs in DPDK do not provide this kind of MT safety.

#4 lore raw
Quoted 27 lines
Quoted 11 lines
Quoted 11 lines

<snip>

Quoted 9 lines

Subject: [PATCH] hash: document breakage with multi-writer thread

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Quoted 8 lines
Quoted 2 lines

Having multiple non-EAL writer threads is a valid use case. Should we fix the

issue instead?

Discovered this the hard way...

Fixing is non-trivial. Basically, the local cache has to be take out and that leads to having to do real locking or atomic operations.

Looking at rte_hash_create function:

        if (params->extra_flag &
RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD) {
                use_local_cache = 1;
                writer_takes_lock = 1;
        }
Quoted 8 lines

The writer locks are in place already. The code to handle the case when local cache is taken out is also there.
What we need is another input flag that says 'multi writer + non-eal threads' which would set 'use_local_cache = 0' and 'writer_takes_lock = 1'. Not sure, it would be valuable addition. But looks like this is what you were expecting when you had enabled 'RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD'. Many other APIs in DPDK do not provide this kind of MT safety.

[Wang, Yipeng]
If possible, we can try to not add new flags, because there are already a lot of flag options.
How about in the code, we check if the writer is a non-eal or not by checking the rte_lcore_id, and operate on the global queue? Could this work?

If(h->use_local_cache) {
	lcore_id = rte_lcore_id();
	if(lcore_id == LCORE_ID_ANY) {   // this is non-eal threads
		<call rte_ring_mp/mc_* to directly operate on global queue>
	}
	Else {
		<original path>
	}
}
#5 lore raw

<snip>

Quoted 44 lines
Quoted 27 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Subject: [PATCH] hash: document breakage with multi-writer thread

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Quoted 8 lines
Quoted 2 lines

Having multiple non-EAL writer threads is a valid use case. Should we fix the

issue instead?

Discovered this the hard way...

Fixing is non-trivial. Basically, the local cache has to be take out and that leads to having to do real locking or atomic operations.

Looking at rte_hash_create function:

        if (params->extra_flag &
RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD) {
                use_local_cache = 1;
                writer_takes_lock = 1;
        }
Quoted 3 lines

The writer locks are in place already. The code to handle the case when local cache is taken out is also there.
What we need is another input flag that says 'multi writer + non-eal

threads'

Quoted 4 lines

which would set 'use_local_cache = 0' and 'writer_takes_lock = 1'. Not sure, it would be valuable addition. But looks like this is what you were expecting when you had enabled 'RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD'. Many other APIs in DPDK

do

Quoted 1 line

not provide this kind of MT safety.

[Wang, Yipeng]
If possible, we can try to not add new flags, because there are already a lot of flag options.
How about in the code, we check if the writer is a non-eal or not by checking the rte_lcore_id, and operate on the global queue?
Could this work?

Quoted 9 lines
If(h->use_local_cache) {
	lcore_id = rte_lcore_id();
	if(lcore_id == LCORE_ID_ANY) {   // this is non-eal threads
		<call rte_ring_mp/mc_* to directly operate on global queue>
	}
	Else {
		<original path>
	}
}

The other thing I wanted to do was saving on the memory allocated for the local cache when the writers are non-eal threads. Without knowing the kind of threads upfront, we might have to create the local cache when a writer adds the entry first time.

#6 lore raw
Quoted 67 lines

-----Original Message-----
From: Honnappa Nagarahalli <[email protected]>
Sent: Thursday, June 4, 2020 12:34 PM
To: Wang, Yipeng1 <[email protected]>; Stephen Hemminger <[email protected]>
Cc: Gobriel, Sameh <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; De Lara Guarch, Pablo <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH] hash: document breakage with multi-writer thread

<snip>

Quoted 27 lines
Quoted 27 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Subject: [PATCH] hash: document breakage with multi-writer thread

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Quoted 8 lines
Quoted 2 lines

Having multiple non-EAL writer threads is a valid use case. Should we fix the

issue instead?

Discovered this the hard way...

Fixing is non-trivial. Basically, the local cache has to be take out and that leads to having to do real locking or atomic operations.

Looking at rte_hash_create function:

        if (params->extra_flag &
RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD) {
                use_local_cache = 1;
                writer_takes_lock = 1;
        }
Quoted 8 lines
Quoted 3 lines

The writer locks are in place already. The code to handle the case when local cache is taken out is also there.
What we need is another input flag that says 'multi writer + non-eal

threads'

Quoted 4 lines

which would set 'use_local_cache = 0' and 'writer_takes_lock = 1'. Not sure, it would be valuable addition. But looks like this is what you were expecting when you had enabled 'RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD'. Many other APIs in

DPDK

Quoted 9 lines

do

Quoted 1 line

not provide this kind of MT safety.

[Wang, Yipeng]
If possible, we can try to not add new flags, because there are already a lot of flag options.
How about in the code, we check if the writer is a non-eal or not by checking the rte_lcore_id, and operate on the global queue? Could this work?

Quoted 9 lines
If(h->use_local_cache) {
	lcore_id = rte_lcore_id();
	if(lcore_id == LCORE_ID_ANY) {   // this is non-eal threads
		<call rte_ring_mp/mc_* to directly operate on global queue>
	}
	Else {
		<original path>
	}
}
Quoted 4 lines

The other thing I wanted to do was saving on the memory allocated for the local cache when the writers are non-eal threads. Without knowing the kind of threads upfront, we might have to create the local cache when a writer adds the entry first time.

I got what you mean. If people only use non-eal threads, we could save the space of local cache completely. Creating local cache during the first write is one solution. But the current rte_hash always allocate things during table creation time. This provides guarantee that the program won't fail in the middle due to memory allocation issue.

Meanwhile I would rather be wasting some space than adding another option flag related to multi-threading. In my opinion, all those flags are already confusing enough. It would also be harder to maintain in future.

#7 lore raw
Quoted 72 lines · On Thu, 4 Jun 2020 20:22:06 +0000 "Wang, Yipeng1" <[email protected]>…
Quoted 67 lines

-----Original Message-----
From: Honnappa Nagarahalli <[email protected]>
Sent: Thursday, June 4, 2020 12:34 PM
To: Wang, Yipeng1 <[email protected]>; Stephen Hemminger <[email protected]>
Cc: Gobriel, Sameh <[email protected]>; Richardson, Bruce <[email protected]>; [email protected]; De Lara Guarch, Pablo <[email protected]>; nd <[email protected]>; Honnappa Nagarahalli <[email protected]>; nd <[email protected]>
Subject: RE: [PATCH] hash: document breakage with multi-writer thread

<snip>

Quoted 27 lines
Quoted 27 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

Subject: [PATCH] hash: document breakage with multi-writer thread

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Quoted 8 lines
Quoted 2 lines

Having multiple non-EAL writer threads is a valid use case. Should we fix the

issue instead?

Discovered this the hard way...

Fixing is non-trivial. Basically, the local cache has to be take out and that leads to having to do real locking or atomic operations.

Looking at rte_hash_create function:

        if (params->extra_flag &
RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD) {
                use_local_cache = 1;
                writer_takes_lock = 1;
        }
Quoted 8 lines
Quoted 3 lines

The writer locks are in place already. The code to handle the case when local cache is taken out is also there.
What we need is another input flag that says 'multi writer + non-eal

threads'

Quoted 4 lines

which would set 'use_local_cache = 0' and 'writer_takes_lock = 1'. Not sure, it would be valuable addition. But looks like this is what you were expecting when you had enabled 'RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD'. Many other APIs in

DPDK

Quoted 9 lines

do

Quoted 1 line

not provide this kind of MT safety.

[Wang, Yipeng]
If possible, we can try to not add new flags, because there are already a lot of flag options.
How about in the code, we check if the writer is a non-eal or not by checking the rte_lcore_id, and operate on the global queue? Could this work?

Quoted 9 lines
If(h->use_local_cache) {
	lcore_id = rte_lcore_id();
	if(lcore_id == LCORE_ID_ANY) {   // this is non-eal threads
		<call rte_ring_mp/mc_* to directly operate on global queue>
	}
	Else {
		<original path>
	}
}  
Quoted 4 lines

The other thing I wanted to do was saving on the memory allocated for the local cache when the writers are non-eal threads. Without knowing the kind of threads upfront, we might have to create the local cache when a writer adds the entry first time.

Quoted 6 lines

I got what you mean. If people only use non-eal threads, we could save the space of local cache completely. Creating local cache during the first write is one solution. But the current rte_hash always allocate things during table creation time. This provides guarantee that the program won't fail in the middle due to memory allocation issue.

Meanwhile I would rather be wasting some space than adding another option flag related to multi-threading. In my opinion, all those flags are already confusing enough. It would also be harder to maintain in future.

Don't care about exact fix. Just don't want to randomly corrupt memory. Having it work would be better. But can we just error out for now; existing code is broken

Acked-by on v1 1/1
#8 lore raw
In reply to Stephen Hemminger
Quoted 90 lines

-----Original Message-----
From: Stephen Hemminger <[email protected]>
Sent: Thursday, June 4, 2020 10:18 AM
To: Wang, Yipeng1 <[email protected]>; Gobriel, Sameh <[email protected]>; Richardson, Bruce <[email protected]>
Cc: [email protected]; Stephen Hemminger <[email protected]>; [email protected]; De Lara Guarch, Pablo <[email protected]>
Subject: [PATCH] hash: document breakage with multi-writer thread

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Fixes 9d033dac7d7c ("hash: support no free on delete")
Fixes 5915699153d7 ("hash: fix scaling by reducing contention")
---
 doc/guides/prog_guide/hash_lib.rst | 1 +
lib/librte_hash/rte_cuckoo_hash.c  | 9 +++++++++
 2 files changed, 10 insertions(+)
doc/guides/prog_guide/hash_lib.rst +0 -0
index d06c7de2ead1..29b41a425a43 100644
@@ -85,6 +85,7 @@ For concurrent writes, and concurrent reads and writes

the following flag values

* If the multi-writer flag (RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD)
is set, multiple threads writing to the table is allowed.
Key add, delete, and table reset are protected from other writer threads.
With only this flag set, readers are not protected from ongoing writes.
+ The writer threads must be EAL threads, it is not safe to write to a multi-
writer hash table from an interrupt, control or other threads.

* If the read/write concurrency
(RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY) is set, multithread read/write operation is safe
(i.e., application does not need to stop the readers from accessing the hash
table until writers finish their updates. Readers and writers can operate on the table concurrently).

lib/librte_hash/rte_cuckoo_hash.c +3 -0
index 90cb99b0eef8..79c94107a582 100644
@@ -979,6 +979,9 @@ __rte_hash_add_key_with_hash(const struct
 rte_hash *h, const void *key,
 	/* Did not find a match, so get a new slot for storing the new key */
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		if (lcore_id == LCORE_ID_ANY)
+			return -EINVAL;
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
 		/* Try to get a free slot from the local cache */
lib/librte_hash/rte_cuckoo_hash.c +4 -0
 		if (cached_free_slots->len == 0) {
@@ -1382,6 +1385,10 @@ remove_entry(const struct rte_hash *h, struct
 rte_hash_bucket *bkt, unsigned i)
 
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		ERR_IF_TRUE((lcore_id == LCORE_ID_ANY),
+			    "%s: attempt to remove entry from non EAL
 thread\n",
+			    __func__);
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
lib/librte_hash/rte_cuckoo_hash.c +0 -0
 		/* Cache full, need to free it. */
 		if (cached_free_slots->len == LCORE_CACHE_SIZE) { @@ -

1637,6 +1644,8 @@ rte_hash_free_key_with_position(const struct rte_hash *h,

lib/librte_hash/rte_cuckoo_hash.c +2 -1
 	if (h->use_local_cache) {
 		lcore_id = rte_lcore_id();
+		RETURN_IF_TRUE((lcore_id == LCORE_ID_ANY), -EINVAL);
+
 		cached_free_slots = &h->local_free_slots[lcore_id];
 		/* Cache full, need to free it. */
 		if (cached_free_slots->len == LCORE_CACHE_SIZE) {
--
Quoted 1 line

2.26.2

[Wang, Yipeng]
Since no conclusion on a better fix yet, I acked this fix.

#9 lore raw
In reply to Stephen Hemminger
Quoted 6 lines · On Thu, 4 Jun 2020 10:17:31 -0700 Stephen Hemminger…

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Quoted 7 lines

Add error checks and document the restriction.

Fixes 9d033dac7d7c ("hash: support no free on delete")
Fixes 5915699153d7 ("hash: fix scaling by reducing contention")

This restriction also needs to be added to the known issues section of EAL

#10 lore raw

05/06/2020 20:35, Stephen Hemminger:

Quoted 11 lines
Quoted 8 lines · On Thu, 4 Jun 2020 10:17:31 -0700 Stephen Hemminger…

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Quoted 8 lines
Quoted 5 lines
Fixes 9d033dac7d7c ("hash: support no free on delete")
Fixes 5915699153d7 ("hash: fix scaling by reducing contention")

This restriction also needs to be added to the known issues section of EAL

Are you going to send a v2 adding doc?

#11 lore raw

16/06/2020 18:12, Thomas Monjalon:

Quoted 18 lines

05/06/2020 20:35, Stephen Hemminger:

Quoted 17 lines
Quoted 13 lines · On Thu, 4 Jun 2020 10:17:31 -0700 Stephen Hemminger…

The code in rte_cuckoo_hash multi-writer support is broken if write operations are called from a non-EAL thread.

rte_lcore_id() wil return LCORE_ID_ANY (UINT32_MAX) for non EAL thread and that leads to using wrong local cache.

Add error checks and document the restriction.

Fixes 9d033dac7d7c ("hash: support no free on delete")
Fixes 5915699153d7 ("hash: fix scaling by reducing contention")
Quoted 4 lines
Quoted 2 lines

This restriction also needs to be added to the known issues section of EAL

Are you going to send a v2 adding doc?

Any follow-up?