[v4,0/5] Pseudo-random number generation improvements
Message ID | 20190628090124.16849-1-mattias.ronnblom@ericsson.com (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 586281B9AC; Fri, 28 Jun 2019 11:01:39 +0200 (CEST) Received: from sesbmg22.ericsson.net (sesbmg22.ericsson.net [193.180.251.48]) by dpdk.org (Postfix) with ESMTP id 776724C6C for <dev@dpdk.org>; Fri, 28 Jun 2019 11:01:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/relaxed; q=dns/txt; i=@ericsson.com; t=1561712489; x=1564304489; 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=ZvSCKu33XY4zX5GCRmiYvfrQEqWjgeXkdq+Kgw3YBws=; b=VrwT6lBb+8iKE8r6g0dRDLuVyAxGRx4yQtaUgPFMY+0rKnNgL6GIMHvU1aa62/kn 8B6xavb+RZVYKEFRi4vvxkin/GlWecAVDAj0V+nP9XluCKJz33XT/RT4rku8waER AR0eBXJHgGZcauIiFdA2Z/3jtfqO2WHiBLnW+Px1i6o=; X-AuditID: c1b4fb30-6f5ff70000001814-81-5d15d769a26c Received: from ESESBMB505.ericsson.se (Unknown_Domain [153.88.183.118]) by sesbmg22.ericsson.net (Symantec Mail Security) with SMTP id 4E.97.06164.967D51D5; Fri, 28 Jun 2019 11:01:29 +0200 (CEST) Received: from ESESSMR501.ericsson.se (153.88.183.108) by ESESBMB505.ericsson.se (153.88.183.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 28 Jun 2019 11:01:29 +0200 Received: from ESESBMB502.ericsson.se (153.88.183.169) by ESESSMR501.ericsson.se (153.88.183.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 28 Jun 2019 11:01:29 +0200 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.185) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Fri, 28 Jun 2019 11:01:29 +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 x5S91SYU019342; Fri, 28 Jun 2019 11:01:28 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com> To: <dev@dpdk.org> CC: <nhorman@tuxdriver.com>, <stephen@networkplumber.org>, <david.marchand@redhat.com>, <bruce.richardson@intel.com>, <thomas@monjalon.net>, =?utf-8?q?Mattias_R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com> Date: Fri, 28 Jun 2019 11:01:19 +0200 Message-ID: <20190628090124.16849-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190605104400.24484-1-mattias.ronnblom@ericsson.com> References: <20190605104400.24484-1-mattias.ronnblom@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeLIzCtJLcpLzFFi42KZGbG9TDfzumisQeNqY4sbq+wttq/oYrN4 92k7k8Wt5pNsFovvyFl8enCCxYHN49eCpawei/e8ZPI4dnMau0fPyXlMHu/3XWXzuPJ9NWMA WxSXTUpqTmZZapG+XQJXRt/Zq0wF50QrOm/OZWtg3CnQxcjJISFgIvHu3iPmLkYuDiGBo4wS R3Z1MEI43xglNv5rYoVzHhzZwQLhXGSUeP71LFTZZUaJV/MOMIIMYxPwlJj8rpsFxBYREJJY +vEyO0gRs8A1Romvl14wgySEBVwkHk39CdbAIqAqcXj1FCCbg4NXwEli06p6iKPkJVZvOABW zingLPF4+n4mEFsIqKTr/0E2EJtXQFDi5MwnYLuYBTQlWrf/Zoew5SWat85mhqjXkri/5Avz BEbhWUhaZiFpmYWkZQEj8ypG0eLU4qTcdCMjvdSizOTi4vw8vbzUkk2MwJg5uOW3wQ7Gl88d DzEKcDAq8fAu2CMaK8SaWFZcmXuIUYKDWUmEV/KcSKwQb0piZVVqUX58UWlOavEhRmkOFiVx 3vXe/2KEBNITS1KzU1MLUotgskwcnFINjAVtjWst2xdcFTYRl59uWPdBR33y7d+zn6mImx3n tuRtd19mmfnu6E8jTZXNQUXt1ZYJ/7hYOkKcLRXuREVs9ejjSN3WVhnyQP1H27KKyo8Ff/sj RK5PSAosKZt2PzzCtFFW/ZG5cuw76e+fL730U/zr8JE1rPmomqvSxKIb667vyY9U39OhxFKc kWioxVxUnAgA+o5uqJUCAAA= Subject: [dpdk-dev] [PATCH v4 0/5] Pseudo-random number generation improvements X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Message
Mattias Rönnblom
June 28, 2019, 9:01 a.m. UTC
Fix bugs in DPDK pseudo-random number generation, make it multi-thread safe, go faster and produce better-quality pseudo-random numbers. Thanks to Stephen Hemminger, Bruce Richardson, Keith Wiles and Neil Horman for valuable feedback. PATCH v4: * Fold the MAINTAINERS update and release notes commit into the other commits. * Add rte_rand() performance test to the meson build. PATCH v3: * Rebase 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 <rte_memory.h> 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 (5): 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 MAINTAINERS | 6 + app/test/Makefile | 1 + app/test/meson.build | 2 + app/test/test_rand_perf.c | 92 +++++++++ doc/guides/rel_notes/release_19_08.rst | 14 +- 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 | 3 + 14 files changed, 364 insertions(+), 23 deletions(-) create mode 100644 app/test/test_rand_perf.c create mode 100644 lib/librte_eal/common/rte_random.c