All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,
	leyi.rong@intel.com, Yipeng Wang <yipeng1.wang@intel.com>,
	Sameh Gobriel <sameh.gobriel@intel.com>,
	Alan Liu <zaoxingliu@gmail.com>,
	Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Subject: Re: [PATCH] member: fix PRNG seed reset in NitroSketch mode
Date: Mon, 03 Jul 2023 17:00:31 +0200	[thread overview]
Message-ID: <10296784.nUPlyArG6x@thomas> (raw)
In-Reply-To: <20230620211720.350336-1-dmitry.kozliuk@gmail.com>

Any comment?

20/06/2023 23:17, Dmitry Kozlyuk:
> Sketch creation seeded the global PRNG
> using the supplied seed for hashing.
> The use of this seed by SKETCH set summary was not documented.
> SKETCH set summary does not require two independent hash seeds,
> unlike other set summary types.
> Seeding the global PRNG at sketch creation
> does not make the sketch operation deterministic:
> it uses rte_rand() later, the PRNG may be seeded again by that point.
> On the other hand, seeding the global PRNG with a hash seed,
> is likely undesired, because it may be low-entropy or even constant.
> Deterministic operation can be achieved by seeding the PRNG externally.
> 
> Remove the call to rte_srand() at sketch creation.
> Document that hash seeds are not used by SKETCH set summary type.
> 
> Fixes: db354bd2e1f8 ("member: add NitroSketch mode")
> Cc: leyi.rong@intel.com
> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
> ---
>  lib/member/rte_member.h        | 1 +
>  lib/member/rte_member_sketch.c | 1 -
>  2 files changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/member/rte_member.h b/lib/member/rte_member.h
> index 072a253c89..d08b143e51 100644
> --- a/lib/member/rte_member.h
> +++ b/lib/member/rte_member.h
> @@ -314,6 +314,7 @@ struct rte_member_parameters {
>  	 * for bucket location.
>  	 * For vBF type, these two hashes and their combinations are used as
>  	 * hash locations to index the bit array.
> +	 * For Sketch type, these seeds are not used.
>  	 */
>  	uint32_t prim_hash_seed;
>  
> diff --git a/lib/member/rte_member_sketch.c b/lib/member/rte_member_sketch.c
> index 524ba77620..d5f35aabe9 100644
> --- a/lib/member/rte_member_sketch.c
> +++ b/lib/member/rte_member_sketch.c
> @@ -227,7 +227,6 @@ rte_member_create_sketch(struct rte_member_setsum *ss,
>  		goto error_runtime;
>  	}
>  
> -	rte_srand(ss->prim_hash_seed);
>  	for (i = 0; i < ss->num_row; i++)
>  		ss->hash_seeds[i] = rte_rand();
>  
> 






  reply	other threads:[~2023-07-03 15:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20 21:17 [PATCH] member: fix PRNG seed reset in NitroSketch mode Dmitry Kozlyuk
2023-07-03 15:00 ` Thomas Monjalon [this message]
2023-07-03 15:54 ` Stephen Hemminger
2023-07-06 16:20   ` Thomas Monjalon
2023-07-06 17:22     ` 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=10296784.nUPlyArG6x@thomas \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=leyi.rong@intel.com \
    --cc=sameh.gobriel@intel.com \
    --cc=yipeng1.wang@intel.com \
    --cc=zaoxingliu@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.