From: Hannes Frederic Sowa <hannes@stressinduktion.org>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Tom Herbert <therbert@google.com>,
davem@davemloft.net, netdev@vger.kernel.org,
jesse.brandeburg@intel.com, tytso@mit.edu,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC] random: introduce get_random_bytes_busy_wait_initialized
Date: Wed, 25 Sep 2013 15:35:30 +0200 [thread overview]
Message-ID: <20130925133530.GD4904@order.stressinduktion.org> (raw)
In-Reply-To: <1380110810.3165.140.camel@edumazet-glaptop>
On Wed, Sep 25, 2013 at 05:06:50AM -0700, Eric Dumazet wrote:
> On Wed, 2013-09-25 at 11:00 +0200, Hannes Frederic Sowa wrote:
>
> > /*
> > + * Busy loop until the nonblocking_pool is intialized and return
> > + * random data in buf of size nbytes.
> > + *
> > + * This is used by the network stack to defer the extraction of
> > + * entropy from the nonblocking_pool until the pool is initialized.
> > + *
> > + * We need to busy loop here, because we could be called from an
> > + * atomic section.
> > + */
> > +void get_random_bytes_busy_wait_initialized(void *buf, int nbytes)
> > +{
> > + while (!nonblocking_pool.initialized)
> > + cpu_relax();
> > + get_random_bytes(buf, nbytes);
> > +}
>
> No idea if this can work if called from IRQ context.
>
> How is nonblocking_poll initialized if host has a single cpu ?
We increase the entropy_count and can initialize the random pool from
handle_irq_event.
We can document that it should not get called from irq context and
maybe add a WARN_ON(irqs_disabled())?
next prev parent reply other threads:[~2013-09-25 13:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <alpine.DEB.2.02.1309231535030.23896@tomh.mtv.corp.google.com>
[not found] ` <1379980991.3165.37.camel@edumazet-glaptop>
[not found] ` <20130924023038.GA22393@order.stressinduktion.org>
[not found] ` <20130924033505.GB22393@order.stressinduktion.org>
[not found] ` <1380001118.3165.41.camel@edumazet-glaptop>
[not found] ` <20130924054532.GA24446@order.stressinduktion.org>
[not found] ` <1380028797.3165.65.camel@edumazet-glaptop>
2013-09-25 9:00 ` Hannes Frederic Sowa
2013-09-25 12:06 ` Eric Dumazet
2013-09-25 13:35 ` Hannes Frederic Sowa [this message]
2013-10-02 15:10 ` Theodore Ts'o
2013-10-02 17:18 ` Hannes Frederic Sowa
2013-10-02 19:40 ` Theodore Ts'o
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=20130925133530.GD4904@order.stressinduktion.org \
--to=hannes@stressinduktion.org \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jesse.brandeburg@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
--cc=tytso@mit.edu \
/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
Powered by JetHome