From: Richard Henderson <richard.henderson@linaro.org>
To: Laurent Vivier <lvivier@redhat.com>, qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>,
Amit Shah <amit@kernel.org>,
"Richard W . M . Jones" <rjones@redhat.com>,
Kashyap Chamarthy <kchamart@redhat.com>
Subject: Re: [Qemu-devel] [RFC] rng-builtin: add an RNG backend that uses qemu_guest_getrandom()
Date: Thu, 9 May 2019 09:59:03 -0700 [thread overview]
Message-ID: <1a0649e8-b283-2cb5-9621-4eacf086d300@linaro.org> (raw)
In-Reply-To: <20190509142342.6132-1-lvivier@redhat.com>
On 5/9/19 7:23 AM, Laurent Vivier wrote:
> Add a new RNG backend using QEMU builtin getrandom function.
>
> It can be created with "-object rng-builtin".
>
> This patch applies on top of
> "[PATCH v4 00/24] Add qemu_getrandom and ARMv8.5-RNG etc"
> Based-on: <20190506173353.32206-1-richard.henderson@linaro.org>
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
> backends/Makefile.objs | 2 +-
> backends/rng-builtin.c | 56 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 57 insertions(+), 1 deletion(-)
> create mode 100644 backends/rng-builtin.c
Looks good. Thanks for picking this up.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> +static void rng_builtin_request_entropy(RngBackend *b, RngRequest *req)
> +{
> + RngBuiltin *s = RNG_BUILTIN(b);
> +
> + while (!QSIMPLEQ_EMPTY(&s->parent.requests)) {
> + RngRequest *req = QSIMPLEQ_FIRST(&s->parent.requests);
> +
> + qemu_guest_getrandom_nofail(req->data, req->size);
> +
> + req->receive_entropy(req->opaque, req->data, req->size);
> +
> + rng_backend_finalize_request(&s->parent, req);
> + }
> +}
As an aside, with all of the callbacks involved, does anyone know if this gets
processed on the same thread as issued the cpu that issued the i/o operation?
The question is only relevant to debugging mode (w/ -seed), in that if we're
processing this from an i/o worker thread we won't have completely
deterministic results, as we may compete with other cpus for the same RNG.
There's probably not much that can reasonably be done if this does cross
threads, and certainly it would not affect normal usage, but I just wondered.
r~
next prev parent reply other threads:[~2019-05-09 17:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 14:23 [Qemu-devel] [RFC] rng-builtin: add an RNG backend that uses qemu_guest_getrandom() Laurent Vivier
2019-05-09 14:46 ` Daniel P. Berrangé
2019-05-09 16:59 ` Richard Henderson [this message]
2019-05-10 8:38 ` Kashyap Chamarthy
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=1a0649e8-b283-2cb5-9621-4eacf086d300@linaro.org \
--to=richard.henderson@linaro.org \
--cc=amit@kernel.org \
--cc=armbru@redhat.com \
--cc=kchamart@redhat.com \
--cc=lvivier@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rjones@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).