DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dan Gora <dg@adax.com>
To: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
	David Marchand <david.marchand@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] eal: choose initial PRNG seed source at runtime
Date: Thu, 16 Apr 2020 20:50:03 -0300	[thread overview]
Message-ID: <CAGyogRbE98DNumPVjKCEoN3uV_00mqXLMmfqKAt89Dt+5qfoMA@mail.gmail.com> (raw)
In-Reply-To: <85fdf0cb-8cd0-9e31-33fe-1861bb9606d9@ericsson.com>

On Thu, Apr 16, 2020 at 8:30 AM Mattias Rönnblom
<mattias.ronnblom@ericsson.com> 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 += 'kvargs'
> >   if dpdk_conf.has('RTE_USE_LIBBSD')
> >       ext_deps += libbsd
> >   endif
> > -if cc.has_function('getentropy', prefix : '#include <unistd.h>')
> > -     cflags += '-DRTE_LIBEAL_USE_GETENTROPY'
> > -endif
> >   if cc.has_header('getopt.h')
> >       cflags += ['-DHAVE_GETOPT_H', '-DHAVE_GETOPT', '-DHAVE_GETOPT_LONG']
> >   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 += 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 := $(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 >= 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

  reply	other threads:[~2020-04-16 23:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 23:11 [dpdk-dev] [PATCH] " Dan Gora
2020-04-15 23:59 ` [dpdk-dev] [PATCH v2] " Dan Gora
2020-04-16 11:30   ` Mattias Rönnblom
2020-04-16 23:50     ` Dan Gora [this message]
2020-04-17  9:24       ` Mattias Rönnblom
2020-04-16  6:07 ` [dpdk-dev] [PATCH] " Jerin Jacob
2020-04-16 11:36   ` Mattias Rönnblom
2020-04-16 11:48     ` Jerin Jacob
2020-04-16 12:00       ` Mattias Rönnblom
2020-04-16 12:11         ` Jerin Jacob

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=CAGyogRbE98DNumPVjKCEoN3uV_00mqXLMmfqKAt89Dt+5qfoMA@mail.gmail.com \
    --to=dg@adax.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=thomas@monjalon.net \
    /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).