From patchwork Mon Aug 28 12:06:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 130786 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 36E6C41B43; Mon, 28 Aug 2023 14:06:59 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B47D40272; Mon, 28 Aug 2023 14:06:58 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 38B4E4021E; Mon, 28 Aug 2023 14:06:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1693224415; x=1724760415; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=5QvuRLdubnWOsj0heleex1Q0SBOR1Ir7AbC4P/l5dNg=; b=Ozgf3iMfZODag1gPlWNjpENOlggVEZsHLPPx0xUSU6AafK8eMMdtNx7O gd66tK+d+7nV3f44Z+RzFBKOmZlLq9mmhA9tKTGZEwnEEPCvcOgnpuObw rdwiHOIG2qYcxsyF8LSZ9vS6CcuMej6XC1rrJYmShpu2ii2yUFKvCH/mb 4SnGaP8WDQFiVq5OvLaDxjlgVYsI+ni6WFJQZ6av24W0SwTsTNit5ZWQR j7rnhyxmBgtMdbvNURhTvdHtBK8LYX/qImMHQAnE8p6FpvM1Jgf+sSCeW gBp/wmdQFO1O2kXCmurl19KcJYHW9U/HBZ+sA+qxld+xN7UiqQPyawpJy g==; X-IronPort-AV: E=McAfee;i="6600,9927,10815"; a="439031228" X-IronPort-AV: E=Sophos;i="6.02,207,1688454000"; d="scan'208";a="439031228" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2023 05:06:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10815"; a="715089753" X-IronPort-AV: E=Sophos;i="6.02,207,1688454000"; d="scan'208";a="715089753" Received: from silpixa00401191.ir.intel.com ([10.55.128.139]) by orsmga006.jf.intel.com with ESMTP; 28 Aug 2023 05:06:43 -0700 From: Anatoly Burakov To: dev@dpdk.org, =?utf-8?q?Mattias_R=C3=B6nnblom?= , Bruce Richardson Cc: stable@dpdk.org Subject: [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads Date: Mon, 28 Aug 2023 12:06:40 +0000 Message-Id: <366f5750e01894c56d5d486c75d312e85c404277.1693224396.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Currently, the rte_rand() state is initialized with seed, and each rand state is initialized up until RTE_MAX_LCORE'th rand state. However, rand state also has one extra rand state reserved for non-EAL threads, which is not initialized. Fix it by initializing this extra state. Fixes: 3f002f069612 ("eal: replace libc-based random generation with LFSR") Cc: mattias.ronnblom@ericsson.com Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov Acked-by: Mattias Rönnblom Acked-by: Morten Brørup --- lib/eal/common/rte_random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/eal/common/rte_random.c b/lib/eal/common/rte_random.c index 565f2401ce..e5691813a4 100644 --- a/lib/eal/common/rte_random.c +++ b/lib/eal/common/rte_random.c @@ -83,7 +83,7 @@ rte_srand(uint64_t seed) unsigned int lcore_id; /* add lcore_id to seed to avoid having the same sequence */ - for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) + for (lcore_id = 0; lcore_id < RTE_MAX_LCORE + 1; lcore_id++) __rte_srand_lfsr258(seed + lcore_id, &rand_states[lcore_id]); }