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 3DA06A00E6 for ; Thu, 16 May 2019 19:55:22 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D0DD65B38; Thu, 16 May 2019 19:55:20 +0200 (CEST) Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by dpdk.org (Postfix) with ESMTP id DBFEE4CAB for ; Thu, 16 May 2019 19:55:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/relaxed; q=dns/txt; i=@ericsson.com; t=1558029318; x=1560621318; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=eWb5Z1WyqMZGKMfN8JzQcWtCkFauww7qeNk/ZXXUWpE=; b=Tfx7j+Pj4ZsGtqW/iR/3phJXEAfmEX3AMUZC3+gOh0EK33xL2LS8wXrol6qbR0oO s50FOwKrvpEUxf3bR9kSKlJnKcbMWOq3IIK0coqj10azLw63EItLRBpXQ8/ReMGv u8d/lZyupJR1q7E93Iwr3qrfhR+2bv1LPUeAV/mp14Y=; X-AuditID: c1b4fb3a-709ff7000000189f-dc-5cdda406a88e Received: from ESESBMB504.ericsson.se (Unknown_Domain [153.88.183.117]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id 2D.CB.06303.604ADDC5; Thu, 16 May 2019 19:55:18 +0200 (CEST) Received: from ESESSMR502.ericsson.se (153.88.183.110) by ESESBMB504.ericsson.se (153.88.183.187) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 16 May 2019 19:55:18 +0200 Received: from ESESBMB503.ericsson.se (153.88.183.170) by ESESSMR502.ericsson.se (153.88.183.110) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Thu, 16 May 2019 19:55:18 +0200 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.186) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Thu, 16 May 2019 19:55:17 +0200 Received: from breslau.lmera.ericsson.se (breslau.lmera.ericsson.se [150.132.109.241]) by selio1a020.lmera.ericsson.se (8.15.1+Sun/8.15.1) with ESMTP id x4GHtHcs023701; Thu, 16 May 2019 19:55:17 +0200 (CEST) From: =?UTF-8?q?Mattias=20R=C3=B6nnblom?= To: CC: , , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= Date: Thu, 16 May 2019 19:55:04 +0200 Message-ID: <20190516175510.27154-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190514092046.30808-1-mattias.ronnblom@ericsson.com> References: <20190514092046.30808-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRmVeSWpSXmKPExsUyM2J7qS7bkrsxBo3LJC1urLK3ePdpO5PF 4jtyDswevxYsZfVYvOclk0fPyXlMAcxRXDYpqTmZZalF+nYJXBnPtzWzFiwRrfj47QRLA+NO gS5GDg4JAROJFf+4uhi5OIQEjjJKTJ++mwnC+cYo8WZTJ4Lz//MsNgjnIqPEuznzoZzLjBJb 925h6WLk5GAT8JSY/K4bzBYREJJY+vEyO0gRs0Aro8SOh42sIAlhAReJX6v7mEFsFgFViQO/ 2tlAbF4BJ4kr8x+CNUsIyEus3nAArIZTwFli0pRb7CC2EFDN58N9rBD1ghInZz4Bq2cW0JRo 3f6bHcKWl2jeOpsZol5L4v6SL8wTGIVnIWmZhaRlFpKWBYzMqxhFi1OLi3PTjYz0Uosyk4uL 8/P08lJLNjECw/7glt9WOxgPPnc8xCjAwajEwxs7526MEGtiWXFl7iFGCQ5mJRHeDe9vxwjx piRWVqUW5ccXleakFh9ilOZgURLnjV69J0ZIID2xJDU7NbUgtQgmy8TBKdXAmOagrza/njXj 7U7DJQm/GrLSrp5obQkzZ8xYOO/dpHrjxR6Llpu+3b80VHP2a8uip0surzKzio69WuUe86NP 8u+9tCsGcXGRp92DVvKeEP7PmXjwtabd1b9bJO7u+JTxa6l2yrprjc2Tri9bu9q2+uyaHe19 LId5L6bo1f32FVz5nq/k21uBWCWW4oxEQy3mouJEANNWlzd3AgAA Subject: [dpdk-dev] [PATCH v2 0/6] Pseudo-random number generation improvements 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" Make DPDK pseudo-random number generation multi-thread safe, go faster and produce better-quality pseudo-random numbers. This patchset requires the yet-to-be-merged rdseed build detection patch for rdseed support to be enabled. http://patchwork.dpdk.org/patch/53404/ Thanks to Stephen Hemminger, Bruce Richardson, Keith Wiles and Neil Horman for valuable feedback. PATCH v2: * Introduce the x86 rdseed machine instruction as a first fallback, in case getentropy() is unavailable * Use meson to detect getentropy() and rdseed PATCH v1: * Added performance tests * Added __experimental to rte_rand_max() declaration * Introduced a PRNG section in the MAINTAINERS file * Added missing include * Use getentropy() instead of rdtsc for seeding the internal LCG RFC v3: * Since rte_rand() and rte_srand() have been a part of the API since long, the experimental attribute was removed and the symbols were moved out of the experimental section of the version.map file. * rte_rand_max() performance improvements: * Avoid repeated rte_lcore_id() calls. * Handle a power-of-2 upper bound as a special case. * Added a Bugzilla reference to the rte_rand() MT safety bug. RFC v2: * Removed 32-bit version of rte_rand() and rte_rand_max(). * Switched from a four-sequence LFSR (producing a 32-bit number) to a five-sequence LFSR (producing a 64-bit number). * Added a note on generator not being cryptographically secure. Mattias Rönnblom (6): eal: replace libc-based random number generation with LFSR eal: add pseudo-random number generation performance test eal: improve entropy for initial PRNG seed eal: introduce random generator function with upper bound eal: add bounded PRNG performance tests eal: add PRNG to MAINTAINERS and release notes MAINTAINERS | 6 + app/test/Makefile | 1 + app/test/test_rand_perf.c | 92 +++++++++ doc/guides/rel_notes/release_19_08.rst | 13 ++ lib/librte_eal/common/include/rte_random.h | 47 +++-- lib/librte_eal/common/meson.build | 1 + lib/librte_eal/common/rte_random.c | 212 +++++++++++++++++++++ lib/librte_eal/freebsd/eal/Makefile | 1 + lib/librte_eal/freebsd/eal/eal.c | 2 - lib/librte_eal/linux/eal/Makefile | 1 + lib/librte_eal/linux/eal/eal.c | 2 - lib/librte_eal/meson.build | 3 + lib/librte_eal/rte_eal_version.map | 9 + 13 files changed, 368 insertions(+), 22 deletions(-) create mode 100644 app/test/test_rand_perf.c create mode 100644 lib/librte_eal/common/rte_random.c -- 2.17.1