From: David Marchand <david.marchand@redhat.com>
To: "Stephen Hemminger" <stephen@networkplumber.org>,
"Mattias Rönnblom" <hofors@lysator.liu.se>
Cc: dev@dpdk.org, mattias.ronnblom@ericsson.com,
"Morten Brørup" <mb@smartsharesystems.com>,
"Bruce Richardson" <bruce.richardson@intel.com>
Subject: Re: [PATCH v2 1/2] random: initialize the random state for non-EAL threads
Date: Wed, 4 Oct 2023 10:45:42 +0200 [thread overview]
Message-ID: <CAJFAV8wJ7P-tyFH9Ya+8z2GQcWCW3H-NLkD2QS3cv4MHnDTiQg@mail.gmail.com> (raw)
In-Reply-To: <4a0cc5ff-a8e3-79cf-0190-09a4de2f1e9a@lysator.liu.se>
On Mon, Oct 2, 2023 at 2:28 PM Mattias Rönnblom <hofors@lysator.liu.se> wrote:
>
> On 2023-09-07 17:24, Stephen Hemminger wrote:
> > The per-lcore PRNG was not initializing the rand_state of all
> > the lcores. Any usage of rte_random by a non-EAL lcore would
>
> "/../ by an unregistered non-EAL thread /../"
>
> > use rand_states[RTE_MAX_LCORE] which was never initialized.
> >
> > Fix by using RTE_DIM() which will get all lcores.
> >
> > Fixes: 3f002f069612 ("eal: replace libc-based random generation with LFSR")
> > Cc: mattias.ronnblom@ericsson.com
> > Acked-by: Morten Brørup <mb@smartsharesystems.com>
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > ---
> > 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 53636331a27b..812e5b4757b5 100644
> > --- a/lib/eal/common/rte_random.c
> > +++ b/lib/eal/common/rte_random.c
> > @@ -84,7 +84,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_DIM(rand_states); lcore_id++)
> > __rte_srand_lfsr258(seed + lcore_id, &rand_states[lcore_id]);
> > }
> >
>
> With the above-mentioned commit message rewording:
>
> Acked-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
>
Applied this patch.
The second patch is marked as rejected in pw, in favor of a followup doc patch.
Thanks.
--
David Marchand
next prev parent reply other threads:[~2023-10-04 8:45 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-06 15:53 [PATCH] random: initialize the random state for non-eal lcores Stephen Hemminger
2023-09-06 16:25 ` Morten Brørup
2023-09-06 16:28 ` Stephen Hemminger
2023-09-07 15:24 ` [PATCH v2 0/2] fixes to rte_random for non-EAL threads Stephen Hemminger
2023-09-07 15:24 ` [PATCH v2 1/2] random: initialize the random state " Stephen Hemminger
2023-10-02 9:00 ` Morten Brørup
2023-10-02 12:27 ` Mattias Rönnblom
2023-10-02 16:07 ` Stephen Hemminger
2023-10-04 8:45 ` David Marchand [this message]
2023-09-07 15:24 ` [PATCH v2 2/2] random: make rte_rand() thread safe " Stephen Hemminger
2023-09-07 15:47 ` Stephen Hemminger
2023-09-07 16:10 ` David Marchand
2023-09-08 20:48 ` Mattias Rönnblom
2023-09-08 20:56 ` Stephen Hemminger
2023-09-09 7:00 ` Mattias Rönnblom
2023-10-02 16:10 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJFAV8wJ7P-tyFH9Ya+8z2GQcWCW3H-NLkD2QS3cv4MHnDTiQg@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=hofors@lysator.liu.se \
--cc=mattias.ronnblom@ericsson.com \
--cc=mb@smartsharesystems.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).