[PATCH v2 2/2] random: make rte_rand() thread safe for non-EAL threads
Stephen Hemminger
stephen at networkplumber.org
Fri Sep 8 22:56:02 CEST 2023
On Fri, 8 Sep 2023 22:48:54 +0200
Mattias Rönnblom <hofors at lysator.liu.se> wrote:
> On 2023-09-07 17:24, Stephen Hemminger wrote:
> > Add missing locking so that if two non-EAL threads call rte_rand()
> > they will not corrupt the per-thread state.
> >
> > Fixes: 3f002f069612 ("eal: replace libc-based random generation with LFSR")
>
> The API documentation clearly states that no MT safety guarantees are
> given for unregistered non-EAL threads. So this patch doesn't fix anything.
>
> rte_rand() is MT safe for *registered* non-EAL threads.
Reading the documentation, it only guarantees safety if registered.
We should add an otherwise clause rather than leaving case as undefined.
More information about the dev
mailing list