From: Anthony Liguori <anthony@codemonkey.ws>
To: Gleb Natapov <gleb@redhat.com>
Cc: qemu-devel@nongnu.org, Jan Kiszka <jan.kiszka@siemens.com>,
Michael Roth <mdroth@linux.vnet.ibm.com>,
Luiz Capitulino <lcapitulino@redhat.com>,
Avi Kivity <avi@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>,
Eric Blake <eblake@redhat.com>
Subject: Re: [Qemu-devel] Rethinking missed tick catchup
Date: Thu, 13 Sep 2012 13:33:31 -0500 [thread overview]
Message-ID: <87392l7oxw.fsf@codemonkey.ws> (raw)
In-Reply-To: <20120913160613.GF25041@redhat.com>
Gleb Natapov <gleb@redhat.com> writes:
> On Thu, Sep 13, 2012 at 10:56:56AM -0500, Anthony Liguori wrote:
>> Gleb Natapov <gleb@redhat.com> writes:
>>
>> > On Thu, Sep 13, 2012 at 09:35:18AM -0500, Anthony Liguori wrote:
>> >> Gleb Natapov <gleb@redhat.com> writes:
>> >>
>> >> > On Thu, Sep 13, 2012 at 09:06:29AM -0500, Anthony Liguori wrote:
>> >> >> "Daniel P. Berrange" <berrange@redhat.com> writes:
>> >> >>
>> >> >> I think it's better for QEMU to talk to qemu-ga. We can tell when a large
>> >> >> period of time has passed in QEMU because we'll accumulate a large
>> >> >> number of missed ticks.
>> >> >>
>> >> > With RTC configured to use vm clock we will not.
>> >>
>> >> Not for host suspend. For stop and live migration, we stop vm_clock.
>> >> But QEMU isn't aware of host suspend so vm_clock cannot be stopped.
>> >>
>> > Hmm, true. What about hooking into suspend and doing vmstop during
>> > suspend.
>>
>> Is suspend the only foreseeable way for this problem to happen? I don't
>> think it is which is what concerns me about any approach that relies on
>> "hooking suspend".
>>
> With RTC using real time clock setting host time far ahead of what is it
> will trigger same behaviour I think.
>
>> Also, I don't think there is a generic way to "hook suspend".
>>
>> >> >> This could happen because of stop, host suspend, live migration to a
>> >> >> file, etc.
>> >> >>
>> >> >> It's much easier for us to call into qemu-ga to do the time correction
>> >> >> whenever this event occurs than to try and have libvirt figure out when
>> >> >> it's necessary.
>> >> > And if guest does not have qemu-ga what is better inject interrupts like
>> >> > crazy for next 2 minutes or leave guest with incorrect time?
>> >>
>> >> Yes, at least that's fixable by the end-user. QEMU consuming 100% CPU
>> >> for a prolonged period of time isn't fixable.
>> >>
>> > You mean yes to "leave guest with incorrect time"? QEMU will still
>> > consume 100% of cpu for some time calling qemu_timer callback millions
>> > times. timedrift code is not the right level to fix that.
>>
>> Not if we put a cap on how many interrupts we'll try to catch up.
>>
> Interrupts ctachup happens at another level. If guest was stopped for
> 24 hours while RTC was configured to 1kHz qemu_timer will fire callback
> 88473600 times. Each invocation will try to inject interrupt and fail
> incrementing coalesced_irq instead. You can cap coalesced_irq but
> callback will still fire 88473600 times.
That's a bug.
The next period calculation should not be based on the last period +
length of period but rather on the current time + delta to next period
boundary.
IOW, if we shouldn't arm timers to expire backwards in time from when
the event occurred. That should be accounted as a missed tick.
Regards,
Anthony Liguori
>
>> As I mentioned previously, if we acrue more than X number of missed
>> ticks, we should simply declare bankruptcy and reset the counter.
>>
>> When that occurs, *if* qemu-ga is present, we should ask qemu-ga to
>> reset the guest's clock based on reading the hardware clock via a
>> 'guest-resync-time' command.
>>
>> If it isn't, time will be off. Hopefully the guest is running NTP and
>> can correct itself. Otherwise, at least the admin can manually fix the
>> time.
>>
>> Regards,
>>
>> Anthony Liguori
>>
>> >
>> > --
>> > Gleb.
>
> --
> Gleb.
next prev parent reply other threads:[~2012-09-13 18:33 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 13:54 [Qemu-devel] Rethinking missed tick catchup Anthony Liguori
2012-09-12 14:21 ` Jan Kiszka
2012-09-12 14:44 ` Anthony Liguori
2012-09-12 14:50 ` Jan Kiszka
2012-09-12 15:06 ` Gleb Natapov
2012-09-12 15:42 ` Jan Kiszka
2012-09-12 15:45 ` Gleb Natapov
2012-09-12 16:16 ` Gleb Natapov
2012-09-12 15:15 ` Gleb Natapov
2012-09-12 18:19 ` Anthony Liguori
2012-09-13 10:49 ` Gleb Natapov
2012-09-13 13:14 ` Eric Blake
2012-09-13 13:28 ` Daniel P. Berrange
2012-09-13 14:06 ` Anthony Liguori
2012-09-13 14:22 ` Gleb Natapov
2012-09-13 14:34 ` Avi Kivity
2012-09-13 14:42 ` Eric Blake
2012-09-13 15:40 ` Avi Kivity
2012-09-13 15:50 ` Anthony Liguori
2012-09-13 15:53 ` Avi Kivity
2012-09-13 18:27 ` Anthony Liguori
2012-09-16 10:05 ` Avi Kivity
2012-09-16 14:37 ` Anthony Liguori
2012-09-19 15:34 ` Avi Kivity
2012-09-19 16:37 ` Gleb Natapov
2012-09-19 16:44 ` Avi Kivity
2012-09-19 16:55 ` Gleb Natapov
2012-09-19 16:57 ` Avi Kivity
2012-09-13 14:35 ` Anthony Liguori
2012-09-13 14:48 ` Gleb Natapov
2012-09-13 15:51 ` Avi Kivity
2012-09-13 15:56 ` Anthony Liguori
2012-09-13 16:06 ` Gleb Natapov
2012-09-13 18:33 ` Anthony Liguori [this message]
2012-09-13 18:56 ` Gleb Natapov
2012-09-13 20:06 ` Anthony Liguori
2012-09-13 16:08 ` Avi Kivity
2012-09-13 13:47 ` Gleb Natapov
2012-09-12 16:27 ` Stefan Weil
2012-09-12 16:45 ` Gleb Natapov
2012-09-12 17:30 ` Stefan Weil
2012-09-12 18:13 ` Gleb Natapov
2012-09-12 19:45 ` Stefan Weil
2012-09-13 10:50 ` Gleb Natapov
2012-09-12 20:06 ` Michael Roth
2012-09-12 17:23 ` Luiz Capitulino
-- strict thread matches above, loose matches on Subject: below --
2012-09-12 18:03 Clemens Kolbitsch
2012-09-13 6:25 ` 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=87392l7oxw.fsf@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=avi@redhat.com \
--cc=eblake@redhat.com \
--cc=gleb@redhat.com \
--cc=jan.kiszka@siemens.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.ibm.com \
--cc=pbonzini@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 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).