From patchwork Wed Jun 5 10:43:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Mattias_R=C3=B6nnblom?= X-Patchwork-Id: 54408 Return-Path: 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 24AB91B9B2; Wed, 5 Jun 2019 12:44:29 +0200 (CEST) Received: from sessmg22.ericsson.net (sessmg22.ericsson.net [193.180.251.58]) by dpdk.org (Postfix) with ESMTP id 9FE611B9AF for ; Wed, 5 Jun 2019 12:44:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/relaxed; q=dns/txt; i=@ericsson.com; t=1559731467; x=1562323467; 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=6Fig9NeMFQ15Rd7SHUyge2W7mwD2z9PGtKhDx+DlDIU=; b=Jfz1v4764MBOcl99W8hwZ89nUh0gWPfe2CJJ/5Etnp5I6U+SSL5Xa4ValaAOwQs4 Riyphm3qtykoo1o0L/xXUqdYU2mHqWCtxtadhSGWR7XaxIAMFCDmx0jbmQUr5ViQ dOPurAUrK8+6LvV9BsKnfBZlW6d3hQRDF/8vxlPMSK4=; X-AuditID: c1b4fb3a-6f1ff7000000189f-2f-5cf79d0bf0a4 Received: from ESESBMB502.ericsson.se (Unknown_Domain [153.88.183.115]) by sessmg22.ericsson.net (Symantec Mail Security) with SMTP id 02.FD.06303.B0D97FC5; Wed, 5 Jun 2019 12:44:27 +0200 (CEST) Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESBMB502.ericsson.se (153.88.183.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 5 Jun 2019 12:44:26 +0200 Received: from selio1a020.lmera.ericsson.se (153.88.183.153) by smtp.internal.ericsson.com (153.88.183.187) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Wed, 5 Jun 2019 12:44:26 +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 x55AiQRA025408; Wed, 5 Jun 2019 12:44:26 +0200 (CEST) From: =?utf-8?q?Mattias_R=C3=B6nnblom?= To: CC: , , , , =?utf-8?q?Mattias_R=C3=B6nnblom?= Date: Wed, 5 Jun 2019 12:43:54 +0200 Message-ID: <20190605104400.24484-1-mattias.ronnblom@ericsson.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516203529.GA642@bricha3-MOBL.ger.corp.intel.com> References: <20190516203529.GA642@bricha3-MOBL.ger.corp.intel.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrOLMWRmVeSWpSXmKPExsUyM2J7sS733O8xBvvn8FncWGVvsX1FF5vF u0/bmSxuNZ9ks1h8R86B1ePXgqWsHov3vGTy6Dk5j8nj/b6rbB5Xvq9mDGCN4rJJSc3JLEst 0rdL4MrYuG0qS8EWkYrXf80bGC/xdzFycEgImEhMXqXSxcjFISRwlFHi5Id5LBDOV0aJaR9/ skI4FxglVm/vZgbpEBK4xChxP6SLkZODTcBTYvK7bhYQW0RASGLpx8vsIPXMAnsZJV6tmweW EBZwkZjfeYUVpJdFQEVi8XZRkDCvgJPE+VvfWEFsCQF5idUbDjCD2JwCzhLP1i9gArGFgGoW HvrHDFEvKHFy5hOwkcwCmhKt23+zQ9jyEs1bZzND1GtJ3F/yhXkCo9AsJC2zkLTMQtKygJF5 FaNocWpxcW66kZFealFmcnFxfp5eXmrJJkZg8B/c8ttqB+PB546HGAU4GJV4eK/1fo8RYk0s K67MPcQowcGsJMKbePtLjBBvSmJlVWpRfnxRaU5q8SFGaQ4WJXHe6NV7YoQE0hNLUrNTUwtS i2CyTBycUg2M4U3x+V2u1f8EVk6rbkq4ZpoSvmL7zFPVPMF9a8L6bBe33DyYuM/qxPUK46nL pp7YYZH95or4JI9fUmoTV8QFhCkY2LRXHvZsrfzN/nUFp+PH+RuruQ3fCGor52WVyTysFJM5 J5XJ89b0v1GZ3tz4qLpdF85k7Pxy/Pv+p3bPFktw/Ar9UPdQiaU4I9FQi7moOBEAEtcao3oC AAA= Subject: [dpdk-dev] [PATCH v3 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" 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 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 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 | 3 + 13 files changed, 362 insertions(+), 22 deletions(-) create mode 100644 app/test/test_rand_perf.c create mode 100644 lib/librte_eal/common/rte_random.c