All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: libvir-list@redhat.com,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	Luiz Capitulino <lcapitulino@redhat.com>,
	Markus Armbruster <armbru@redhat.com>,
	Laine Stump <laine@laine.org>
Subject: Re: [Qemu-devel] [libvirt] [PATCHv2 3/4] qemu: fix RTC_CHANGE event for <clock offset='variable' basis='utc'/>
Date: Fri, 23 May 2014 14:56:27 +0100	[thread overview]
Message-ID: <20140523135627.GE31879@redhat.com> (raw)
In-Reply-To: <20140523134818.GB1358@amt.cnet>

On Fri, May 23, 2014 at 10:48:18AM -0300, Marcelo Tosatti wrote:
> On Fri, May 23, 2014 at 03:35:19PM +0200, Markus Armbruster wrote:
> > Luiz Capitulino <lcapitulino@redhat.com> writes:
> > 
> > > On Fri, 23 May 2014 00:50:38 -0300
> > > Marcelo Tosatti <mtosatti@redhat.com> wrote:
> > >
> > >> > Then the guest triggers an RTC update, so qemu sends an event, but the
> > >> > event is lost. Then libvirtd starts again, and doesn't realize the
> > >> > event is lost.
> > >> 
> > >> Yes, but that case is also true for any other QMP asynchronous event,
> > >> and therefore should be handled generically i suppose (QMP channel data
> > >> should be maintained across libvirtd shutdown). Luiz?
> > >
> > > Maintaining QMP channel data doesn't solve this problem, because all sorts
> > > of race conditions are still possible. For example, libvirt could crash
> > > after having received the event but before handling it.
> > >
> > > The most reliable way we found to solve this problem, and that's what we
> > > do for other events, is to allow libvirt to query the information the event
> > > is reporting. An event is nothing more than a state change in QEMU, and QEMU
> > > state is persistent during the life time of the VM, so we allow libvirt to
> > > query the state of anything that may send an event.
> > 
> > In fact, this is a general rule: when libvirt tracks an event, it also
> > needs a way to poll for the information in the event.
> 
> I see.
> 
> This also seems pretty harmful wrt losing events:
> 
> /* Global, one-time initializer to configure the rate limiting
>  * and initialize state */
> static void monitor_protocol_event_init(void)
> {
>     /* Limit RTC & BALLOON events to 1 per second */
>     monitor_protocol_event_throttle(QEVENT_RTC_CHANGE, 1000);
> 
> Better remove it.

That is intentionally designed such that it doesn't cause any real
problems actually - the monitor rate limiting code will only drop
intermediate events - it is guaranteed you'll get the most recent
event after the rate limiting period elapse. eg if the guest OS
emits 6 events in the space on 1 second:

   RTC_CHANGE 353
   RTC_CHANGE 1338
   RTC_CHANGE 3542
   RTC_CHANGE 255
   RTC_CHANGE 522
   RTC_CHANGE 320

then, the monitor rate limiting may discard all except the very
last event. ie libvirt will see RTC_CHANGE == 320. The fact that
it didn't see the previous events is no problem, because they're
obsoleted by the new event.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

  parent reply	other threads:[~2014-05-23 13:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1400756850-19807-1-git-send-email-laine@laine.org>
     [not found] ` <1400756850-19807-4-git-send-email-laine@laine.org>
2014-05-22 19:33   ` [Qemu-devel] [libvirt] [PATCHv2 3/4] qemu: fix RTC_CHANGE event for <clock offset='variable' basis='utc'/> Eric Blake
2014-05-23  3:50     ` Marcelo Tosatti
2014-05-23  9:17       ` Laine Stump
2014-05-23 10:19         ` Laine Stump
2014-05-23 14:54           ` Eric Blake
2014-05-23 16:42             ` Marcelo Tosatti
2014-05-23 17:56             ` Eric Blake
2014-05-23 18:31             ` Laine Stump
2014-05-23 12:43       ` Luiz Capitulino
2014-05-23 13:35         ` Markus Armbruster
2014-05-23 13:48           ` Marcelo Tosatti
2014-05-23 13:54             ` Marcelo Tosatti
2014-05-23 13:54             ` Luiz Capitulino
2014-05-23 13:56             ` Daniel P. Berrange [this message]
2014-05-23 14:04             ` Eric Blake
2014-05-23 21:36           ` Paolo Bonzini

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=20140523135627.GE31879@redhat.com \
    --to=berrange@redhat.com \
    --cc=armbru@redhat.com \
    --cc=laine@laine.org \
    --cc=lcapitulino@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=mtosatti@redhat.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 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.