From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 91792A046B for ; Fri, 28 Jun 2019 22:58:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2D0944C8B; Fri, 28 Jun 2019 22:58:18 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by dpdk.org (Postfix) with ESMTP id 4BC4837A2 for ; Fri, 28 Jun 2019 22:58:17 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id D6B1540016 for ; Fri, 28 Jun 2019 22:58:16 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id C386B40014; Fri, 28 Jun 2019 22:58:16 +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-200-177.mobileonline.telia.com [90.232.200.177]) (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 D035840011; Fri, 28 Jun 2019 22:58:14 +0200 (CEST) To: Ferruh Yigit , dev@dpdk.org, bruce.richardson@intel.com, thomas@monjalon.net Cc: nhorman@tuxdriver.com, stephen@networkplumber.org, david.marchand@redhat.com References: <20190605104400.24484-1-mattias.ronnblom@ericsson.com> <20190628090124.16849-1-mattias.ronnblom@ericsson.com> <20190628090124.16849-4-mattias.ronnblom@ericsson.com> From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= Message-ID: Date: Fri, 28 Jun 2019 22:58:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Subject: Re: [dpdk-dev] [PATCH v4 3/5] eal: improve entropy for initial PRNG seed 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" On 2019-06-28 21:01, Ferruh Yigit wrote: > On 6/28/2019 10:01 AM, Mattias Rönnblom wrote: >> Replace the use of rte_get_timer_cycles() with getentropy() for >> seeding the pseudo-random number generator. getentropy() provides a >> more truly random value. >> >> getentropy() requires glibc 2.25 and Linux kernel 3.17. In case >> getentropy() is not found at compile time, or the relevant syscall >> fails in runtime, the rdseed machine instruction will be used as a >> fallback. >> >> rdseed is only available on x86 (Broadwell or later). In case it is >> not present, rte_get_timer_cycles() will be used as a second fallback. >> >> On non-Meson builds, getentropy() will not be used. >> >> Suggested-by: Bruce Richardson >> Suggested-by: Stephen Hemminger >> Signed-off-by: Mattias Rönnblom >> Acked-by: Bruce Richardson > > <...> > >> +#ifdef RTE_MACHINE_CPUFLAG_RDSEED >> + unsigned int rdseed_rc; >> + unsigned long long rdseed_seed; >> + >> + /* first fallback: rdseed instruction, if available */ >> + rdseed_rc = _rdseed64_step(&rdseed_seed); > > This is causing build error for 32-bit [1] and ICC [2], can you please check? > > [1] > .../dpdk/lib/librte_eal/common/rte_random.c: In function > ‘__rte_random_initial_seed’: > .../dpdk/lib/librte_eal/common/rte_random.c:196:14: error: implicit declaration > of function ‘_rdseed64_step’; did you mean ‘_rdseed32_step’? > [-Werror=implicit-function-declaration] > 196 | rdseed_rc = _rdseed64_step(&rdseed_seed); > | ^~~~~~~~~~~~~~ > | _rdseed32_step > .../dpdk/lib/librte_eal/common/rte_random.c:196:14: error: nested extern > declaration of ‘_rdseed64_step’ [-Werror=nested-externs] > > My suggestion would be to just replace _rdseed64_step() with two _rdseed32_step() calls on both 32-bit and 64-bit x86. I'll submit a patch. > > [2] > Building x86_64-native-linuxapp-icc ... > .../dpdk/lib/librte_eal/common/rte_random.c(196): error #167: argument of type > "unsigned long long *" is incompatible with parameter of type "unsigned long *" > rdseed_rc = _rdseed64_step(&rdseed_seed); > ^ I'll fix this as well. Thanks.