From: Laurent Vivier <lvivier@redhat.com>
To: Thomas Huth <thuth@redhat.com>,
qemu-ppc@nongnu.org, agraf@suse.de, david@gibson.dropbear.id.au
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [Qemu-ppc] [RFC PATCH] ppc/spapr_hcall: Implement H_RANDOM hypercall
Date: Thu, 6 Aug 2015 14:35:31 +0200 [thread overview]
Message-ID: <55C35493.2040707@redhat.com> (raw)
In-Reply-To: <55C34D79.5010802@redhat.com>
On 06/08/2015 14:05, Thomas Huth wrote:
> On 06/08/15 13:26, Laurent Vivier wrote:
>> Hi,
>>
>> As "/dev/random" can be blocking perhaps it is possible/better to use
>> the QEMU rng backend instead ?
>
> Actually, I tried to use the rng backends first ... but they turned out
> to be horrible for being used in a synchronous call like I need here:
> You've got to install a callback function which is called at a "random"
> point in time when some data becomes available - and it is even called
> with less bytes than you requested! (i.e. I requested 8 bytes, but the
> callback got only called with 6 bytes). So to use it, I'd have to
> introduce a ring buffer or something similar to query enough random data
> in advance - and when it runs empty, the H_RANDOM hypercall would need
> to block again anyway.
>
> So instead of introducing a hard-to-understand-and-maintain "monster
> wrapper" around the rng backend functions, I think the short and easy
> understandable qemu_random() implementation in this patch here is the
> better choice.
>
> And looking at https://patchwork.ozlabs.org/patch/497062/ I think it
> also should not hurt too much that qemu_random() might be slow here
> since the real hardware number generator is apparently also not very fast.
It seems a good choice...
Why do you use buffered file descriptor, fopen/fread/fclose instead of
open/read/close ?
Laurent
next prev parent reply other threads:[~2015-08-06 12:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-06 8:23 [Qemu-devel] [RFC PATCH] ppc/spapr_hcall: Implement H_RANDOM hypercall Thomas Huth
2015-08-06 11:26 ` [Qemu-devel] [Qemu-ppc] " Laurent Vivier
2015-08-06 12:05 ` Thomas Huth
2015-08-06 12:35 ` Laurent Vivier [this message]
2015-08-06 12:43 ` Thomas Huth
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=55C35493.2040707@redhat.com \
--to=lvivier@redhat.com \
--cc=agraf@suse.de \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
/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).