DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
To: "Mattias Rönnblom" <mattias.ronnblom@ericsson.com>
Cc: David Marchand <david.marchand@redhat.com>,
	 Stephen Hemminger <stephen@networkplumber.org>,
	dpdk-dev <dev@dpdk.org>,  "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH dpdk-dev] rte_random: fix crash when random init
Date: Wed, 15 Apr 2020 07:42:01 +0800	[thread overview]
Message-ID: <CAMDZJNUC09R0nAj=oNXz8kNN2b6RznQunFr__9BQKaRznWhMxA@mail.gmail.com> (raw)
In-Reply-To: <f7f80dba-b6fb-9e19-8cf3-ee7f43f5e4c5@ericsson.com>

On Tue, Apr 14, 2020 at 11:37 PM Mattias Rönnblom
<mattias.ronnblom@ericsson.com> wrote:
>
> On 2020-04-14 15:35, David Marchand wrote:
> > On Tue, Apr 14, 2020 at 3:20 PM Mattias Rönnblom
> > <mattias.ronnblom@ericsson.com> wrote:
> >> On 2020-04-14 06:43, Tonghao Zhang wrote:
> >>> On Tue, Apr 14, 2020 at 12:07 PM Stephen Hemminger
> >>> <stephen@networkplumber.org> wrote:
> >>>> On Sun, 12 Apr 2020 16:27:53 +0800
> >>>> xiangxia.m.yue@gmail.com wrote:
> >>>>
> >>>>> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >>>>>
> >>>>> When rte_rand_init is invoked, and the kernel
> >>>>> (kernel version < 3.17) running dpdk does't support
> >>>>> *getentropy, at the same time, the cpu does't support
> >>>>> rdseed, the rte_rand_init will invoke rte_get_timer_cycles
> >>>>> which function will invoke rte_get_hpet_cycles
> >>>>> (RTE_LIBEAL_USE_HPET was enabled) while *eal_hpet is not
> >>>>> allocated.
> >>>>>
> >>>>> Fixes: faf8fd252785 ("eal: improve entropy for initial PRNG seed")
> >>>>> Fixes: 3f002f069612 ("eal: replace libc-based random generation with LFSR")
> >>>>>
> >>>>> Cc: stable@dpdk.org
> >>>>>
> >>>>> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> >>>> Are you sure this patch won't change current default to use HPET (which is slower)?
> >>> In rte_eal_timer_init (linux/eal_timer.c), it will set
> >>> eal_timer_source = EAL_TIMER_TSC too.
> >>> So after rte_eal_init, eal_timer_source == EAL_TIMER_TSC which is the
> >>> default timer source actually.
> >>> Then this patch will affect RTE_INIT function which invoke
> >>> rte_get_timer_cycles. but hpet is not available yet.
> >>
> >> Would using rte_rdtsc() directly be an option?
> > s/rte_rdtsc/rte_get_tsc_cycles/
> >
> > This could work, but I am a bit surprised to see an initialisation in
> > a constructor.
> > The commitlog that moved rte_srand() from rte_eal_init does not
> > explain why it was moved.
> >
> >
> The initialization (i.e. automatic seeding) grew in complexity somewhat,
> and with the new rte_random.c file, it felt like it would have a good,
> new home.
>
>
> That said, maybe it would have been better to add an initialization
> function to the rte_random.h API, and have it called from
> rte_eal_init(), to avoid the ordering issues with constructors.
If we use that solution  we can register a callback which invoked when
almost resources are  available:
http://patches.dpdk.org/patch/68313/
> Yet
> another alternative would be to just move the seeding logic.
>
>


-- 
Best regards, Tonghao

  reply	other threads:[~2020-04-14 23:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-12  8:27 xiangxia.m.yue
2020-04-14  4:06 ` Stephen Hemminger
2020-04-14  4:43   ` Tonghao Zhang
2020-04-14 13:19     ` Mattias Rönnblom
2020-04-14 13:35       ` David Marchand
2020-04-14 15:37         ` Mattias Rönnblom
2020-04-14 23:42           ` Tonghao Zhang [this message]
2020-04-15  6:01             ` Mattias Rönnblom
2020-04-15  8:10               ` David Marchand

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='CAMDZJNUC09R0nAj=oNXz8kNN2b6RznQunFr__9BQKaRznWhMxA@mail.gmail.com' \
    --to=xiangxia.m.yue@gmail.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=mattias.ronnblom@ericsson.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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).