patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads
@ 2023-08-28 12:06 Anatoly Burakov
  2023-08-28 12:22 ` Mattias Rönnblom
  2023-10-02  8:25 ` David Marchand
  0 siblings, 2 replies; 7+ messages in thread
From: Anatoly Burakov @ 2023-08-28 12:06 UTC (permalink / raw)
  To: dev, Mattias Rönnblom, Bruce Richardson; +Cc: stable

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 <anatoly.burakov@intel.com>
---
 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]);
 }
 
-- 
2.37.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads
  2023-08-28 12:06 [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads Anatoly Burakov
@ 2023-08-28 12:22 ` Mattias Rönnblom
  2023-08-28 12:48   ` Morten Brørup
  2023-10-02  8:25 ` David Marchand
  1 sibling, 1 reply; 7+ messages in thread
From: Mattias Rönnblom @ 2023-08-28 12:22 UTC (permalink / raw)
  To: Anatoly Burakov, dev, Mattias Rönnblom, Bruce Richardson; +Cc: stable

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 <anatoly.burakov@intel.com>
> ---
>   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 <mattias.ronnblom@ericsson.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads
  2023-08-28 12:22 ` Mattias Rönnblom
@ 2023-08-28 12:48   ` Morten Brørup
  0 siblings, 0 replies; 7+ messages in thread
From: Morten Brørup @ 2023-08-28 12:48 UTC (permalink / raw)
  To: Mattias Rönnblom, Anatoly Burakov, dev,
	Mattias Rönnblom, Bruce Richardson
  Cc: stable

> From: Mattias Rönnblom [mailto:hofors@lysator.liu.se]
> Sent: Monday, 28 August 2023 14.23
> 
> 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 <anatoly.burakov@intel.com>
> > ---

Acked-by: Morten Brørup <mb@smartsharesystems.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads
  2023-08-28 12:06 [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads Anatoly Burakov
  2023-08-28 12:22 ` Mattias Rönnblom
@ 2023-10-02  8:25 ` David Marchand
  2023-10-02  9:02   ` Morten Brørup
                     ` (2 more replies)
  1 sibling, 3 replies; 7+ messages in thread
From: David Marchand @ 2023-10-02  8:25 UTC (permalink / raw)
  To: Anatoly Burakov, Mattias Rönnblom, Stephen Hemminger
  Cc: dev, Bruce Richardson, stable, Morten Brørup

Hello guys,

On Mon, Aug 28, 2023 at 2:07 PM Anatoly Burakov
<anatoly.burakov@intel.com> 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 <anatoly.burakov@intel.com>

We have two series for fixing related issues.

Stephen alternative patch 1 handles Anatoly fix here.
https://patchwork.dpdk.org/project/dpdk/list/?series=29449&state=%2A&archive=both

I see Anatoly was acked by Mattias and Morten, though Stephen
(RTE_DIM) fix is more elegant.
How do you guys want me to proceed?


Thanks.
-- 
David Marchand


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads
  2023-10-02  8:25 ` David Marchand
@ 2023-10-02  9:02   ` Morten Brørup
  2023-10-02 12:22   ` Mattias Rönnblom
  2023-10-04 11:37   ` Burakov, Anatoly
  2 siblings, 0 replies; 7+ messages in thread
From: Morten Brørup @ 2023-10-02  9:02 UTC (permalink / raw)
  To: David Marchand, Anatoly Burakov, Mattias Rönnblom,
	Stephen Hemminger
  Cc: dev, Bruce Richardson, stable

> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Monday, 2 October 2023 10.26
> 
> Hello guys,
> 
> On Mon, Aug 28, 2023 at 2:07 PM Anatoly Burakov
> <anatoly.burakov@intel.com> 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 <anatoly.burakov@intel.com>
> 
> We have two series for fixing related issues.
> 
> Stephen alternative patch 1 handles Anatoly fix here.
> https://patchwork.dpdk.org/project/dpdk/list/?series=29449&state=%2A&archive=b
> oth
> 
> I see Anatoly was acked by Mattias and Morten, though Stephen
> (RTE_DIM) fix is more elegant.
> How do you guys want me to proceed?

Please use patch 1 from Stephen, which I have now thoroughly reviewed, instead of this patch from Anatoly.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads
  2023-10-02  8:25 ` David Marchand
  2023-10-02  9:02   ` Morten Brørup
@ 2023-10-02 12:22   ` Mattias Rönnblom
  2023-10-04 11:37   ` Burakov, Anatoly
  2 siblings, 0 replies; 7+ messages in thread
From: Mattias Rönnblom @ 2023-10-02 12:22 UTC (permalink / raw)
  To: David Marchand, Anatoly Burakov, Mattias Rönnblom,
	Stephen Hemminger
  Cc: dev, Bruce Richardson, stable, Morten Brørup

On 2023-10-02 10:25, David Marchand wrote:
> Hello guys,
> 
> On Mon, Aug 28, 2023 at 2:07 PM Anatoly Burakov
> <anatoly.burakov@intel.com> 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 <anatoly.burakov@intel.com>
> 
> We have two series for fixing related issues.
> 
> Stephen alternative patch 1 handles Anatoly fix here.
> https://patchwork.dpdk.org/project/dpdk/list/?series=29449&state=%2A&archive=both
> 
> I see Anatoly was acked by Mattias and Morten, though Stephen
> (RTE_DIM) fix is more elegant.

Stephen hadn't posted his fix when I acked this, I believe.

RTE_DIM() makes the thing more readable. I'm fine with either 
"RTE_MAX_LCORE + 1" or "RTE_DIM()", but I would prefer the latter.

> How do you guys want me to proceed?
> 
> 
> Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads
  2023-10-02  8:25 ` David Marchand
  2023-10-02  9:02   ` Morten Brørup
  2023-10-02 12:22   ` Mattias Rönnblom
@ 2023-10-04 11:37   ` Burakov, Anatoly
  2 siblings, 0 replies; 7+ messages in thread
From: Burakov, Anatoly @ 2023-10-04 11:37 UTC (permalink / raw)
  To: David Marchand, Mattias Rönnblom, Stephen Hemminger
  Cc: dev, Bruce Richardson, stable, Morten Brørup

On 10/2/2023 9:25 AM, David Marchand wrote:
> Hello guys,
> 
> On Mon, Aug 28, 2023 at 2:07 PM Anatoly Burakov
> <anatoly.burakov@intel.com> 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 <anatoly.burakov@intel.com>
> 
> We have two series for fixing related issues.
> 
> Stephen alternative patch 1 handles Anatoly fix here.
> https://patchwork.dpdk.org/project/dpdk/list/?series=29449&state=%2A&archive=both
> 
> I see Anatoly was acked by Mattias and Morten, though Stephen
> (RTE_DIM) fix is more elegant.
> How do you guys want me to proceed?
> 
> 
> Thanks.

I'm OK with either, so please feel free to merge Stephen's patch :)

-- 
Thanks,
Anatoly


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-04 11:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28 12:06 [PATCH v1 1/1] eal/random: fix random state initialization for non-eal threads Anatoly Burakov
2023-08-28 12:22 ` Mattias Rönnblom
2023-08-28 12:48   ` Morten Brørup
2023-10-02  8:25 ` David Marchand
2023-10-02  9:02   ` Morten Brørup
2023-10-02 12:22   ` Mattias Rönnblom
2023-10-04 11:37   ` Burakov, Anatoly

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).