Re: [PATCH v2 2/2] random: make rte_rand() thread safe for non-EAL threads

2023-09-09 Thread Mattias Rönnblom
On 2023-09-08 22:56, Stephen Hemminger wrote: On Fri, 8 Sep 2023 22:48:54 +0200 Mattias Rönnblom 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: repl

Re: [PATCH v2 2/2] random: make rte_rand() thread safe for non-EAL threads

2023-09-08 Thread Stephen Hemminger
On Fri, 8 Sep 2023 22:48:54 +0200 Mattias Rönnblom 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

Re: [PATCH v2 2/2] random: make rte_rand() thread safe for non-EAL threads

2023-09-08 Thread Mattias Rönnblom
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 guaran

Re: [PATCH v2 2/2] random: make rte_rand() thread safe for non-EAL threads

2023-09-07 Thread David Marchand
On Thu, Sep 7, 2023 at 5:48 PM Stephen Hemminger wrote: > > On Thu, 7 Sep 2023 08:24:56 -0700 > Stephen Hemminger wrote: > > > > > +static __rte_always_inline > > +void __rte_rand_put_state(struct rte_rand_state *state) > > +{ > > + if (state == &rand_states[RTE_MAX_LCORE]) > > +

[PATCH v2 2/2] random: make rte_rand() thread safe for non-EAL threads

2023-09-07 Thread Stephen Hemminger
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") Signed-off-by: Stephen Hemminger --- lib/eal/common/rte_random.c | 54 -