All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu list <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/1] rng backend: open backend in blocking mode
Date: Wed, 3 Apr 2013 11:58:23 +0530	[thread overview]
Message-ID: <20130403062823.GA8995@amit.redhat.com> (raw)
In-Reply-To: <874nfpf62k.fsf@codemonkey.ws>

On (Tue) 02 Apr 2013 [07:52:19], Anthony Liguori wrote:
> Amit Shah <amit.shah@redhat.com> writes:
> 
> > On (Mon) 01 Apr 2013 [09:02:46], Anthony Liguori wrote:
> >> Amit Shah <amit.shah@redhat.com> writes:
> >> 
> >> > Opening backends in non-blocking mode isn't necessary, we don't do
> >> > anything while waiting for data.
> >> >
> >> > This also excuses us from checking for EAGAIN, which for the default
> >> > random backend, is a very common return error type.
> >> 
> >> It's not common...  It really shouldn't happen however.
> >
> > EAGAIN is common when a file is opened in non-blocking mode.  Needs to
> > be made verbose?
> 
> EAGAIN doesn't just happen randomly.  It only happens when you read from
> an fd when no data is present.  Normally, that is something that is
> predictable.

When we open /dev/random as the default backend, we should expect more
EAGAINs than data :-)  i.e. /dev/random blocks, we know it.

> >> > backends/rng-random.c:44:entropy_available: assertion failed: (len != -1)
> >> >
> >> > without this fix.
> >> 
> >> This fix would cause QEMU to block indefinitely which I don't think is
> >> very good behavior.  I think a better solution would be:

How about relegating it to glib functions, and hooking it up so that
/dev/random is polled for data, and this function gets called when
/dev/random has data to give out?  Sure, when a read is attempted,
there might be no data available again, but we could then go back to
polling.


		Amit

  reply	other threads:[~2013-04-03  6:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01  9:25 [Qemu-devel] [PATCH 1/1] rng backend: open backend in blocking mode Amit Shah
2013-04-01 14:02 ` Anthony Liguori
2013-04-02 10:35   ` Amit Shah
2013-04-02 12:52     ` Anthony Liguori
2013-04-03  6:28       ` Amit Shah [this message]
2013-04-03 20:08         ` Anthony Liguori
2013-04-08  6:09           ` Amit Shah

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=20130403062823.GA8995@amit.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.