From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A7978A0588; Fri, 17 Apr 2020 01:50:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5E291DE68; Fri, 17 Apr 2020 01:50:41 +0200 (CEST) Received: from mail-io1-f65.google.com (mail-io1-f65.google.com [209.85.166.65]) by dpdk.org (Postfix) with ESMTP id 84C741DE64 for ; Fri, 17 Apr 2020 01:50:40 +0200 (CEST) Received: by mail-io1-f65.google.com with SMTP id 19so359400ioz.10 for ; Thu, 16 Apr 2020 16:50:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=GblfDjtlhFm6ndAObFe2H+swh3HHcGXmtB+ftQlymRY=; b=E+hPAqLDS8hoR49GrR01ZZC5VxLYZEC/j4truowmujH1zS5FkXecNkA5Xp70WlzdyZ ZDUa2nLIcAlgvE/XES4AUmkzkxu2BALLshIhWrLDR4tyQwoYrAdPfh3ClQC+QIFtqq42 AggqaiYG+dXD6/0cWq6SH8cmwEO0Zo5xCBWpo91ijbRdywNb7TfpZ9l3bYAaQSrjdPm1 GOO384g7sbQLahvT/yfxoRpouQ9jNvZClyB8Sqc7zD9x5A5ywUI9fqrYpemTa/sdBrwE L9RqPMrTrZAgmundAIcKd1ZzvGhxw6vFa3Wu0DU5/joiuSH+itSIqekGjSyV2VOvdnrk FNgQ== X-Gm-Message-State: AGi0PubL7hzg1iHxEOno4w97bukNV0IV2JyGrpnCFkSJjsi6hzj8z1W/ HAKQ7wcYY6wzKNVk9ZOBjwXRjgKyGnSWBIS0tdOX8I2aARU= X-Google-Smtp-Source: APiQypKqEpe9N+AMO6gFkAKTI4xAyh1ur3UoWxNz11EIfGUSNh/cmz2+bdaQJ1whm5sxYu3UZQ93TZCbc1f78ad2VXY= X-Received: by 2002:a02:d5:: with SMTP id 204mr790817jaa.25.1587081039780; Thu, 16 Apr 2020 16:50:39 -0700 (PDT) MIME-Version: 1.0 References: <20200415231119.27845-1-dg@adax.com> <20200415235913.31949-1-dg@adax.com> <85fdf0cb-8cd0-9e31-33fe-1861bb9606d9@ericsson.com> In-Reply-To: <85fdf0cb-8cd0-9e31-33fe-1861bb9606d9@ericsson.com> From: Dan Gora Date: Thu, 16 Apr 2020 20:50:03 -0300 Message-ID: To: =?UTF-8?Q?Mattias_R=C3=B6nnblom?= Cc: Thomas Monjalon , David Marchand , "dev@dpdk.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v2] eal: choose initial PRNG seed source at runtime X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Apr 16, 2020 at 8:30 AM Mattias R=C3=B6nnblom wrote: > > diff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build > > index 0267c3b9d..748359b8c 100644 > > --- a/lib/librte_eal/meson.build > > +++ b/lib/librte_eal/meson.build > > @@ -15,9 +15,6 @@ deps +=3D 'kvargs' > > if dpdk_conf.has('RTE_USE_LIBBSD') > > ext_deps +=3D libbsd > > endif > > -if cc.has_function('getentropy', prefix : '#include ') > > - cflags +=3D '-DRTE_LIBEAL_USE_GETENTROPY' > > -endif > > if cc.has_header('getopt.h') > > cflags +=3D ['-DHAVE_GETOPT_H', '-DHAVE_GETOPT', '-DHAVE_GETOPT_L= ONG'] > > endif > > diff --git a/mk/rte.cpuflags.mk b/mk/rte.cpuflags.mk > > index fa8753531..fb7bf8a53 100644 > > --- a/mk/rte.cpuflags.mk > > +++ b/mk/rte.cpuflags.mk > > @@ -53,6 +53,14 @@ endif > > > > ifneq ($(filter $(AUTO_CPUFLAGS),__RDSEED__),) > > CPUFLAGS +=3D RDSEED > > +else > > +# If the native environment doesn't define __RDSEED__, see > > +# if the compiler supports -mrdseed. > > > For which environments is this true? If you compile on a machine which does not have the RDSEED cpu flag, gcc will not define __RDSEED__ nor compile the _rdseed32_step() functions unless you explicitly set -mrdseed on the gcc/clang command line.. We have a HP DL380 machine which do not have rdseed: model name : Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz And another which does: model name : Intel(R) Xeon(R) CPU E5-2640 v4 @ 2.40GHz _rdseed32_step() will only compile on the v3 if we explicitly set -mrdseed. > > +RDSEED_CPUFLAGS :=3D $(shell $(CC) $(MACHINE_CFLAGS) $(WERROR_FLAGS) $= (EXTRA_CFLAGS) -mrdseed -dM -E - < /dev/null) > > +ifneq ($(filter $(RDSEED_CPUFLAGS),__RDSEED__),) > > > There are no better ways to achieve this? It seems like a bit of a hack. eh.. I don't know of any really.. It's the same command that is used to set AUTO_CPUFLAGS a few lines before, just with -mrdseed set. It doesn't seem that bad to my mind, but if there is a better way, I'm open to suggestions. That said, this patch does not work. We cannot set RTE_MACHINE_CPUFLAG_RDSEED because rte_eal_init() will fail on a machine which does not have rdseed because rte_cpu_is_supported() checks all of these cpu flags set at compile time. Since we're detecting this flag at run time, we have to remove it from this list of "required" CPU flags. I'm working on a new patch.. I should have something tomorrow. There is also still a problem with getting getentropy() to work when the binary is compiled on a system with a glibc < 2.25 but run on a system with glibc >=3D 2.25. It doesn't resolve the weak symbol to the glibc version.. I think that it's because getentropy() is versioned within glibc. I'm still working on how to fix this.. It might come down to using dlopen(), dlsym()... :( I'm not really sure if it's worth it. thanks dan