From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by dpdk.org (Postfix) with ESMTP id 2A24F1B56E for ; Fri, 5 Apr 2019 20:04:31 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 9A0F54001C for ; Fri, 5 Apr 2019 20:04:30 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 86BFD40010; Fri, 5 Apr 2019 20:04:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=ALL_TRUSTED,AWL autolearn=disabled version=3.4.1 X-Spam-Score: -0.9 Received: from [192.168.1.59] (host-90-232-144-184.mobileonline.telia.com [90.232.144.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 704F04000A; Fri, 5 Apr 2019 20:04:28 +0200 (CEST) To: Stephen Hemminger Cc: dev@dpdk.org References: <20190405134542.28618-1-mattias.ronnblom@ericsson.com> <20190405095738.145a622d@shemminger-XPS-13-9360> From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= Message-ID: Date: Fri, 5 Apr 2019 20:04:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190405095738.145a622d@shemminger-XPS-13-9360> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Apr 2019 18:04:31 -0000 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 already using lrand48(), I primarily wanted to address lrand48()'s lack of MT safety, nothing else. That said, maybe the easiest way to maintain the current API, provide MT safety and have something portable is for DPDK to carry its own random number generator, instead of relying on libc. Maybe an ARC4 port from BSD? But instead of pulling entropy from the kernel, let the user give the seed, like the current DPDK APIs permit. You could deprecate rte_srand(), but I would vote against such a move, because its sometimes useful to able to have something that is "random", yet reproducible. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D76C9A0679 for ; Fri, 5 Apr 2019 20:04:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B47911B574; Fri, 5 Apr 2019 20:04:32 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by dpdk.org (Postfix) with ESMTP id 2A24F1B56E for ; Fri, 5 Apr 2019 20:04:31 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id 9A0F54001C for ; Fri, 5 Apr 2019 20:04:30 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id 86BFD40010; Fri, 5 Apr 2019 20:04:30 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on bernadotte.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=ALL_TRUSTED,AWL autolearn=disabled version=3.4.1 X-Spam-Score: -0.9 Received: from [192.168.1.59] (host-90-232-144-184.mobileonline.telia.com [90.232.144.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 704F04000A; Fri, 5 Apr 2019 20:04:28 +0200 (CEST) To: Stephen Hemminger Cc: dev@dpdk.org References: <20190405134542.28618-1-mattias.ronnblom@ericsson.com> <20190405095738.145a622d@shemminger-XPS-13-9360> From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= Message-ID: Date: Fri, 5 Apr 2019 20:04:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190405095738.145a622d@shemminger-XPS-13-9360> Content-Type: text/plain; charset="UTF-8"; format="flowed" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [dpdk-dev] [RFC] eal: make rte_rand() MT safe X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190405180428.4CQR-xvMbG-aBl3UvLroh_dfoG4OWRn_UHM3ya3QH0g@z> 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 already using lrand48(), I primarily wanted to address lrand48()'s lack of MT safety, nothing else. That said, maybe the easiest way to maintain the current API, provide MT safety and have something portable is for DPDK to carry its own random number generator, instead of relying on libc. Maybe an ARC4 port from BSD? But instead of pulling entropy from the kernel, let the user give the seed, like the current DPDK APIs permit. You could deprecate rte_srand(), but I would vote against such a move, because its sometimes useful to able to have something that is "random", yet reproducible.