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 4AB1742DC3; Mon, 3 Jul 2023 17:55:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 226D340EF0; Mon, 3 Jul 2023 17:55:04 +0200 (CEST) Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) by mails.dpdk.org (Postfix) with ESMTP id C54FA40ED5 for ; Mon, 3 Jul 2023 17:55:02 +0200 (CEST) Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-666eba6f3d6so2164335b3a.3 for ; Mon, 03 Jul 2023 08:55:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1688399702; x=1690991702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=bUKN5u//o/IGR1WmrZmtrYXXTycrroH/BYVsI8Dnmv4=; b=b3OrBc3KLd/VZPBdjGmkIAnE3sEqmX2fTkkNm0ioI6H0Ot1iVB3FB0+So06j2A8iPL SXDKStoA/ZSZE3dty3i/OAcfOT1k01Whj31Zrmich+v99VvD6KlxJvnpWYzXAzHrRk8j /YzCAjiAfXNMW+qoBkR7tTRQlei4tjot1+2IykHcjWavDZpgpH7HlCBuojAUIgytyOza nwAdxS2eb9LnNR9nKoPTg5tImCfpv8Y9ebGnjBRsn5ztwg4z5cojP5WXl/gPQet8rcPa XC2LbuyTwK51iNv7ixYlUKoW1Y2Zi0ZYtym15fK6ivmbZAV7xDq/YM2ri8DukBcAy4Wr JcSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688399702; x=1690991702; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bUKN5u//o/IGR1WmrZmtrYXXTycrroH/BYVsI8Dnmv4=; b=M5DzYCfYOp7qcsL6qUlNwiT7Ele+OFo2KrScevtChLWTq/y+WJ1pnGONyZPdeXF9Tx CHznE03J6UGzNKDx8i+nViUd+HE4CPYd9xtXa91eQbWWYHVISmuZDWwbxGoO1RkvzWg0 cmtnJ+g2Vt8SkWsRzqvpA/Pq69pPl7wYfrfPc/YVJtgoYIPYTFFXhRYWf94oSIiECwhg w9eWI7aYztis9CLUIQbAduvdj8SVc3O3v7i0rGKqOeipABnbD2fLB7LyKCGx0P5X+Lix QognhdNrrAUrTbDcjRVCRtOPjK9QeKnQxdcTdgU9vp6TeDywOLC0wABmVs7gSXBGCQ+C dR7w== X-Gm-Message-State: ABy/qLYN8E73Mscyd07IiErXqYQDh0N83G0b41QzOBj+eQaaylgolCIA YSWzmfnICG1rBBVxmo7rM2ucnw== X-Google-Smtp-Source: APBJJlF3giJvyvoHMTptd3QyJkl3QceH6Ir68OjiorScvYQarLR7ASszOfDvphi5pPrcTyOj5t/kTA== X-Received: by 2002:a05:6a00:14cc:b0:67b:a681:4ab2 with SMTP id w12-20020a056a0014cc00b0067ba6814ab2mr12429094pfu.25.1688399701911; Mon, 03 Jul 2023 08:55:01 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id i11-20020aa78b4b000000b0066a6ba123eesm14194542pfd.51.2023.07.03.08.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jul 2023 08:55:00 -0700 (PDT) Date: Mon, 3 Jul 2023 08:54:58 -0700 From: Stephen Hemminger To: Dmitry Kozlyuk Cc: dev@dpdk.org, leyi.rong@intel.com, Yipeng Wang , Sameh Gobriel , Alan Liu Subject: Re: [PATCH] member: fix PRNG seed reset in NitroSketch mode Message-ID: <20230703085458.23c383e6@hermes.local> In-Reply-To: <20230620211720.350336-1-dmitry.kozliuk@gmail.com> References: <20230620211720.350336-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Wed, 21 Jun 2023 00:17:20 +0300 Dmitry Kozlyuk wrote: > 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 This raises a more global issue. rte_srand() overrides the system seed which is set during startup. This is a bad thing, it reduces the entropy in the random number generator. There are two possible solutions to this: 1. Remove all all calls to rte_srand() and deprecate it. 2. Make rte_srand() add a fixed value to existing entropy. This is what the kernel PRNG does. It adds any user supplied additional entropy to original state. Looking at current source. - code in tests seeding PRNG with TSC. This is unnecessary and can be removed. - this code in member library. Should be removed. Acked-by: Stephen Hemminger