[RFC v2 1/2] eal: add bitset type
Mattias Rönnblom
mattias.ronnblom at ericsson.com
Wed Mar 15 19:27:47 CET 2023
On 2023-03-15 18:20, Stephen Hemminger wrote:
> On Wed, 15 Mar 2023 18:03:41 +0100
> Mattias Rönnblom <mattias.ronnblom at ericsson.com> wrote:
>
>> Introduce a set of functions and macros that operate on sets of bits,
>> kept in arrays of 64-bit elements.
>>
>> RTE bitset is designed for bitsets which are larger than what fits in
>> a single machine word (i.e., 64 bits). For very large bitsets, the
>> <rte_bitmap.h> API may be a more appropriate choice.
>>
>> RFC v2:
>> * Replaced <sys/types.h> with <stddef.h> include, to properly get
>> size_t typedef.
>> * Add <rte_compat.h> to get __rte_experimental in <rte_bitset.h>.
>>
>> Signed-off-by: Mattias Rönnblom <mattias.ronnblom at ericsson.com>
>
> It would be good to have atomic version of these routines.
> Other libraries could use that.
Atomic with the option to specify memory model, like in C11? Or just
atomic, with no implications in regards to memory ordering (i.e.,
__ATOMIC_RELAXED).
It seems to me that the implementation of such an API would require
inline assembler (e.g., lock bts on x86) to do properly (no loops, no
locks).
Related: reading <rte_bitops.h> left me a little confused. The
documentation and naming suggest the bit access operations are
"relaxed", which I'm sure is true, but may leave the user believing the
bit operations are atomic - which they aren't. Why would you otherwise
mentioned the operations are relaxed?
More information about the dev
mailing list