[dpdk-dev] [RFC] eal: make rte_rand() MT safe

2019-04-05 Thread Mattias Rönnblom
The rte_rand() documentation left it unspecified if the rte_rand() was multi-thread safe or not, and the implementation (based on lrand48()) was not. This commit makes rte_rand() safe to use from any lcore thread by using lrand48_r() and per-lcore random state structs. Besides the obvious improvem

Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe

2019-04-05 Thread Mattias Rönnblom
On 2019-04-05 15:45, Mattias Rönnblom wrote: The rte_rand() documentation left it unspecified if the rte_rand() was multi-thread safe or not, and the implementation (based on lrand48()) was not. This commit makes rte_rand() safe to use from any lcore thread by using lrand48_r() and per-lcore ran

Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe

2019-04-05 Thread Bruce Richardson
On Fri, Apr 05, 2019 at 03:51:39PM +0200, Mattias Rönnblom wrote: > On 2019-04-05 15:45, Mattias Rönnblom wrote: > > The rte_rand() documentation left it unspecified if the rte_rand() was > > multi-thread safe or not, and the implementation (based on lrand48()) > > was not. > > > > This commit mak

Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe

2019-04-05 Thread Mattias Rönnblom
On 2019-04-05 16:28, Bruce Richardson wrote: On Fri, Apr 05, 2019 at 03:51:39PM +0200, Mattias Rönnblom wrote: On 2019-04-05 15:45, Mattias Rönnblom wrote: The rte_rand() documentation left it unspecified if the rte_rand() was multi-thread safe or not, and the implementation (based on lrand48()

Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe

2019-04-05 Thread Stephen Hemminger
On Fri, 5 Apr 2019 15:45:42 +0200 Mattias Rönnblom wrote: > The rte_rand() documentation left it unspecified if the rte_rand() was > multi-thread safe or not, and the implementation (based on lrand48()) > was not. > > This commit makes rte_rand() safe to use from any lcore thread by > using lran

Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe

2019-04-05 Thread Mattias Rönnblom
On 2019-04-05 18:57, Stephen Hemminger wrote: rand48 is a terrible PRNG, why not use something better? Similar discussion in Linux kernel pointed at: http://www.pcg-random.org/posts/some-prng-implementations.html Mail thread here: https://www.spinics.net/lists/netdev/msg560231.html DPDK was

Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe

2019-04-05 Thread Stephen Hemminger
On Fri, 5 Apr 2019 20:04:28 +0200 Mattias Rönnblom wrote: > On 2019-04-05 18:57, Stephen Hemminger wrote: > > > > rand48 is a terrible PRNG, why not use something better? > > > > Similar discussion in Linux kernel pointed at: > > http://www.pcg-random.org/posts/some-prng-implementations.html >

Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe

2019-04-05 Thread Mattias Rönnblom
On 2019-04-05 22:50, Stephen Hemminger wrote: Read the discussion link about ARC4. http://www.pcg-random.org/ As a general-purpose PRNG, it is rather slow, and it is also slow by the standards of modern cryptographic PRNGs and is also considered too weak to use for crypt