From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1052441B44 for ; Mon, 28 Aug 2023 14:22:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1580740282; Mon, 28 Aug 2023 14:22:55 +0200 (CEST) Received: from mail.lysator.liu.se (mail.lysator.liu.se [130.236.254.3]) by mails.dpdk.org (Postfix) with ESMTP id E79B94021E; Mon, 28 Aug 2023 14:22:52 +0200 (CEST) Received: from mail.lysator.liu.se (localhost [127.0.0.1]) by mail.lysator.liu.se (Postfix) with ESMTP id A42D64C62; Mon, 28 Aug 2023 14:22:52 +0200 (CEST) Received: by mail.lysator.liu.se (Postfix, from userid 1004) id A29FA500C; Mon, 28 Aug 2023 14:22:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on hermod.lysator.liu.se X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED, AWL, NICE_REPLY_A autolearn=disabled version=3.4.6 X-Spam-Score: -2.6 Received: from [192.168.1.59] (h-62-63-215-114.A163.priv.bahnhof.se [62.63.215.114]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.lysator.liu.se (Postfix) with ESMTPSA id 3AF2A4C61; Mon, 28 Aug 2023 14:22:52 +0200 (CEST) Message-ID: <013a09d0-1eb2-aa45-a1b1-5b88161ce291@lysator.liu.se> Date: Mon, 28 Aug 2023 14:22:51 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads To: Anatoly Burakov , dev@dpdk.org, =?UTF-8?Q?Mattias_R=c3=b6nnblom?= , Bruce Richardson Cc: stable@dpdk.org References: <366f5750e01894c56d5d486c75d312e85c404277.1693224396.git.anatoly.burakov@intel.com> Content-Language: en-US From: =?UTF-8?Q?Mattias_R=c3=b6nnblom?= In-Reply-To: <366f5750e01894c56d5d486c75d312e85c404277.1693224396.git.anatoly.burakov@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 2023-08-28 14:06, Anatoly Burakov wrote: > 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 > --- > 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]); > } > Acked-by: Mattias Rönnblom