qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ian Molton <ian.molton@collabora.co.uk>
To: Jamie Lokier <jamie@shareable.org>
Cc: qemu-devel@nongnu.org, Gerd Hoffmann <kraxel@redhat.com>,
	Paul Brook <paul@codesourcery.com>
Subject: Re: [Qemu-devel] [PATCH 2/2] VirtIO RNG
Date: Sat, 24 Apr 2010 10:16:57 +0100	[thread overview]
Message-ID: <4BD2B709.5070302@collabora.co.uk> (raw)
In-Reply-To: <20100423173252.GB15349@shareable.org>

On 23/04/10 18:32, Jamie Lokier wrote:
> Ian Molton wrote:
>>> You can configure any chardev to be a tcp client. I never do that though
>>> as I find it much more convenient to configure it as server.
>>
>> Perhaps thats because chardev clients are nearly useless right now
>> because they just die if the connection drops...
>
> Which is why drops/missing server should be a QMP event + action, same
> as other triggers like disk full and watchdog trigger.

So write the code then. I neither want nor care about that feature, so 
why should I write it?

> I do not want my guests to continue running if they are configured to
> depend on Qemu entropy and it's not available.

Realistically though, causes of EGD dissapearing...

1) the daemon dies
2) the daemon is replaced

in the case of 1) then potentially the host, and *every single* guest 
will run out of entropy. You only need one flashing red light, and the 
host can tell you that as well as any of the guests.

Entropy starvation doesnt usually lead to the catastrophic failure you 
describe - 99.9999% of linux machines have no entropy source configured 
and they get along just fine - even with process address space 
randomisation enabled.

In the case of 2) then the downtime is so short that a warning would be 
inappropriate, and the sysadmin would be *right there* anyway.

>> Or are you suggesting that we create another type of chardev, thats
>> nearly like a socket, but speaks egd and can reconnect? That seems
>> hideous to me.
>
> Why hideous?

Because automatic reconection should not apply to only one type of 
socket, but all. Why deliberately cripple a feature and make it specific 
when one does not have to?

> An egd chardev is a good thing because you can then trivially
> use it as a random byte source for virtio-serial, isa-serial,
> pci-serial, custom-soc-serial, debug-port even :-), and anything
> else which might want random bytes as Gerd said.

Yes, but qemu (AFAICT) does not support "line disciplines" so we can 
either have

chrdev_egd+reconnect  ->  virtio-* backend

or

chrdev_socket+reconnect -> virtio-rng+egd backend


IOW, we can either have generic reconnect support, or generic egd 
support, but not both.

Ideally, we'd have line disciplines and it'd be more like this:

chrdev_socket+reconnect -> egd ldisc -> virtio-* backend

So, given that we dont have line disciplines (and I'm not about to write 
more code that is just going to get squabbled over for months) that 
leaves us with a choice to make.

I personally say that generic EGD support is less useful than generic 
socket reconnect support, since at a pinch, and as others have pointed 
out, EGD can be implemented externally to qemu.

Socket reconnection _cannot_ be implemented externally, and frankly, I 
consider it a bug that qemu basically presents an option (client 
sockets) that once it dies, the user has no way of re-instating other 
than to kill and restart qemu.

> That's way more useful than restricting to virtio-rng, because most
> guests don't support virtio at all, but they can probably all take
> entropy from a serial-like device.

a) The kind of guest that cant do virtio is damn unlikely to be in use 
in a server-farm, and

b) Nothing stops someone running an egd->serial converter on the host in 
order to feed a serial-like device.

> Similarly the ability to connect to /dev/urandom directly, with the
> rate-limiting but no auto-reconnection, looking like a chardev in
> the same way, would make sense.  Reconnection is not needed in this
> case - missing device should be an error at startup.

My current code will happily read entropy from a file, a char device or 
a socket. It can *also* speak EGD on bidirectional connections like sockets.

> Your idea for an 'egd line discipline' would need to look exactly like
> a chardev internally

Well of course it would. Thats what line disciplines are supposed to do. 
(look at their analogue in the linux tty code)

> In which case it's quite natural to expose the options as a
> user-visible chardev 'egd', defined to return random bytes on input
> and ignore output, which takes all the same options as 'socket' and
> actually uses a 'socket' chardev (passing along the options).

Unless I'm missing something, qemu cannot chain multiple chrdevs 
together. Which means that the hypothetical egd chardev would have to 
duplicate 100% of the socket chrdev logic.

> I think rate-limiting is more generically useful as a 'line
> discipline'-like feature, to work with any chardev type.  But it
> should then have properties governing incoming and outgoing rate
> limiting separately, which won't get much testing for the only
> imminent user which is input-only.

but again, qemu doesn't *have* line disciplines.

-Ian

  reply	other threads:[~2010-04-24  9:18 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-30 14:05 [Qemu-devel] [PATCH 0/2] VirtIO RNG Ian Molton
2010-03-30 14:12 ` [Qemu-devel] [PATCH 1/2] " Ian Molton
2010-03-30 14:13 ` [Qemu-devel] [PATCH 2/2] " Ian Molton
2010-04-01 12:17   ` Paul Brook
2010-04-01 12:30     ` Jamie Lokier
2010-04-01 14:03       ` Paul Brook
2010-04-02 10:13         ` Ian Molton
2010-04-03 15:06           ` Paul Brook
2010-04-13 14:41             ` Ian Molton
2010-04-13 15:01               ` Paul Brook
2010-04-13 15:32               ` Paul Brook
2010-04-20 15:15                 ` Ian Molton
2010-04-20 16:13                   ` Jamie Lokier
2010-04-20 19:52                     ` Ian Molton
2010-04-20 20:11                       ` Blue Swirl
2010-04-20 20:56                       ` Jamie Lokier
2010-04-20 21:31                         ` Ian Molton
2010-04-20 21:55                           ` Jamie Lokier
2010-04-21  7:43                           ` Gerd Hoffmann
2010-04-21  9:40                             ` Jamie Lokier
2010-04-21 12:34                               ` Ian Molton
2010-04-21 13:55                                 ` Gerd Hoffmann
2010-04-22 19:06                                   ` Ian Molton
2010-04-22 21:05                                     ` Jamie Lokier
2010-04-23 10:17                                       ` Ian Molton
2010-04-24  1:37                                         ` Jamie Lokier
2010-04-24  8:58                                           ` Ian Molton
2010-04-23  8:27                                     ` Gerd Hoffmann
2010-04-23  9:28                                       ` Ian Molton
2010-04-23 14:07                                         ` Gerd Hoffmann
2010-04-23 15:49                                           ` Ian Molton
2010-04-23 17:32                                             ` Jamie Lokier
2010-04-24  9:16                                               ` Ian Molton [this message]
2010-04-02 10:15       ` Ian Molton
2010-04-02 10:07     ` Ian Molton
2010-05-03 17:56   ` Anthony Liguori

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=4BD2B709.5070302@collabora.co.uk \
    --to=ian.molton@collabora.co.uk \
    --cc=jamie@shareable.org \
    --cc=kraxel@redhat.com \
    --cc=paul@codesourcery.com \
    --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 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).