clarification on RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF flag
Stephen Hemminger
stephen at networkplumber.org
Wed Jul 6 17:22:56 CEST 2022
On Wed, 6 Jul 2022 19:07:54 +0530
venkatesh bs <venki.bsv at gmail.com> wrote:
> Hi All,
>
> In multithreaded/Multicore environment can we use
> RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF
> independently,
> or this flag should always be used with
> RTE_HASH_EXTRA_FLAGS_MULTI_WRITER_ADD.
>
> We are trying to create and access the hash table with
> RTE_HASH_EXTRA_FLAGS_RW_CONCURRENCY_LF
> only.
> We are getting crashes in multi core environments , we debugged nothing
> wrong in the application , everything looks good.
>
> We call rte_hash_del_key() first and from the returned position we are
> calling rte_hash_free_key_with_position().
>
> Please let me know if we missed something.
>
> Thanks,
> Venkatesh.
Repeating same question doesn't get answer faster.
Read the code, it is fairly straightforward.
The multi-writer add means that writers take a lock.
If doing lock free support then:
1. It is up to your application to use a single writer and/or
wrap writer calls in a lock.
2. You need to use RCU mechanism to guarantee that no reader
will access a deleted entry. Something like:
rte_hash_del_key()
synchronize_rcu()
rte_hash_free_key_with_position()
You can use either the DPDK RCU library or the userspace RCU library.
Read that documentation, RCU is non-trivial change.
More information about the dev
mailing list