From: Jamie Lokier <jamie@shareable.org>
To: qemu-devel@nongnu.org
Cc: libvir-list@redhat.com, Jan Kiszka <jan.kiszka@web.de>,
Paul Brook <paul@codesourcery.com>,
Hollis Blanchard <hollisb@us.ibm.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] Re: [libvirt] Re: [PATCH 2/3] Introduce monitor 'wait' command
Date: Thu, 9 Apr 2009 18:12:17 +0100 [thread overview]
Message-ID: <20090409171217.GD14196@shareable.org> (raw)
In-Reply-To: <49DDFE76.7000008@codemonkey.ws>
Anthony Liguori wrote:
> Paul Brook wrote:
> >No you don't. If you use event flags rather than discrete events then you
> >don't need to buffer at all. You just need to be able to store the state
> >of each type of event you're going to raise, which should be a bounded set.
> >
> >This has its own set of issues - typically race conditions or "lost"
> >events if the client (libvirt) code isn't written carefully, and means you
> >can't attach information with an event, only indicate that something
> >happened.
> >However if the correct model is used (event driven polling rather than
> >purely event driven) this shouldn't be problem.
>
> It's just deferring the problem. Consider the case of VNC user
> authentication. You want to have events associated with whenever a user
> connects and disconnects so you can keep track of who's been on a
> virtual machine for security purposes.
>
> In my model, you record the last 10 minutes worth of events. If a user
> aggressively connects/reconnects, you could consume a huge amount of
> memory. You could further limit it by recording only a finite number of
> events to combat that problem.
It's not deferring the problem - it's mixing two different, slightly
incompatible problems, and that means bugs.
One is monitoring state of QEMU. (E.g. is the VM running, has it
stopped due to ENOSPC, has the watchdog triggered, what's the current
list of attached VNC and monitor clients, how's that migration going).
That's a good use for event-driven polling, because that won't break
no matter if a monitoring app goes to sleep for 15 minutes,
disconnects and reconnects, etc. etc.
The other problem is logging discrete events. For that you do need to
expire things, keep a maximum number of events, probably timestamp
events, and not merge equivalent events together.
But that is unreliable for event-driven state monitoring. What
happens if there are 1000 VNC connect/disconnect pairs in rapid
succession (think client bug or open port facing the net)? If the
event log has a limit of 1000 stored events, it will throw away some
events before a monitoring app sees them. That app then fails to
notice that the VM stopped due to ENOSPC, because that event was
thrown away before the monitoring app could read it.
Linux has something analogous to these two: normal signals and
real-time queued signals. Normal signals are fixed-size state, and
they are never lost if used properly. Real-time queued signals carry
information, such as about some I/O or timer which has completed, but
there's a problem which is the limited queue size. It's important to
avoid losing data when the queue is full, because apps depend on
deducing state from the queued events, so there's a special "queue
full" signal always sent when the real-time signal queue is full.
This tells apps that detailed queued data has been lost, and they need
to poll everything to check the state of everything.
To support state-monitoring apps (e.g. one which says if the VM is
still running :-), you mustn't discard the "VM has stopped" events no
matter how many times that or other events are sent. But you can
merge them into a single pending state.
To support looking at recent VNC connections, you do need a limit on
the number of stored events, discard when the limit is reached, and
not to merge them.
One way to make both of these work is to have a "some events have been
discarded here" event. At least state-monitoring apps can see that
means they should poll all the state again. It's not ideal though, if
that happens often.
-- Jamie
next prev parent reply other threads:[~2009-04-09 17:12 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-08 14:16 [Qemu-devel] [PATCH 1/3] Allow multiple monitor devices Anthony Liguori
2009-04-08 14:16 ` [Qemu-devel] [PATCH 2/3] Introduce monitor 'wait' command Anthony Liguori
2009-04-08 14:33 ` [Qemu-devel] " Daniel P. Berrange
2009-04-08 14:39 ` Anthony Liguori
2009-04-08 15:03 ` [Qemu-devel] Re: [libvirt] " Gerd Hoffmann
2009-04-08 15:25 ` Jan Kiszka
2009-04-08 17:44 ` Anthony Liguori
2009-04-08 19:06 ` Jamie Lokier
2009-04-08 19:35 ` Anthony Liguori
2009-04-08 20:28 ` Hollis Blanchard
2009-04-08 21:14 ` Anthony Liguori
2009-04-08 21:31 ` Hollis Blanchard
2009-04-09 13:59 ` Anthony Liguori
2009-04-08 21:39 ` Paul Brook
2009-04-09 8:24 ` Avi Kivity
2009-04-09 13:56 ` Anthony Liguori
2009-04-09 17:12 ` Jamie Lokier [this message]
2009-04-08 21:27 ` Zachary Amsden
2009-04-09 9:55 ` Daniel P. Berrange
2009-04-09 17:13 ` Jamie Lokier
2009-04-09 9:44 ` Gerd Hoffmann
2009-04-09 13:31 ` Anthony Liguori
2009-04-08 14:16 ` [Qemu-devel] [PATCH 3/3] Implement vm-state notifications Anthony Liguori
2009-04-08 14:27 ` [Qemu-devel] Re: [PATCH 1/3] Allow multiple monitor devices Jan Kiszka
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=20090409171217.GD14196@shareable.org \
--to=jamie@shareable.org \
--cc=hollisb@us.ibm.com \
--cc=jan.kiszka@web.de \
--cc=kraxel@redhat.com \
--cc=libvir-list@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).