From: Paolo Bonzini <pbonzini@redhat.com>
To: Michael Chapman <mike@very.puzzling.org>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH resend] kvmclock: fix clock_is_reliable on migration from QEMU < 2.9
Date: Fri, 6 Apr 2018 13:40:31 +0200 [thread overview]
Message-ID: <6fb71ee8-bd07-81d2-06d7-9b355b0689c7@redhat.com> (raw)
In-Reply-To: <20180406053406.774-1-mike@very.puzzling.org>
On 06/04/2018 07:34, Michael Chapman wrote:
> When migrating from a pre-2.9 QEMU, no clock_is_reliable flag is
> transferred. We should assume that the source host has an unreliable
> KVM_GET_CLOCK, rather than using whatever was determined locally, to
> ensure that any drift from the TSC-based value calculated by the guest
> is corrected.
>
> Signed-off-by: Michael Chapman <mike@very.puzzling.org>
> ---
> Resent due to missing CCs.
>
> hw/i386/kvm/clock.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 1707434db3..7dac319403 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -241,6 +241,19 @@ static const VMStateDescription kvmclock_reliable_get_clock = {
> }
> };
>
> +/*
> + * When migrating, assume the source has an unreliable
> + * KVM_GET_CLOCK unless told otherwise.
> + */
> +static int kvmclock_pre_load(void *opaque)
> +{
> + KVMClockState *s = opaque;
> +
> + s->clock_is_reliable = false;
> +
> + return 0;
> +}
> +
> /*
> * When migrating, read the clock just before migration,
> * so that the guest clock counts during the events
> @@ -268,6 +281,7 @@ static const VMStateDescription kvmclock_vmsd = {
> .name = "kvmclock",
> .version_id = 1,
> .minimum_version_id = 1,
> + .pre_load = kvmclock_pre_load,
> .pre_save = kvmclock_pre_save,
> .fields = (VMStateField[]) {
> VMSTATE_UINT64(clock, KVMClockState),
>
Queued, thanks.
Paolo
prev parent reply other threads:[~2018-04-06 11:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-06 5:34 [Qemu-devel] [PATCH resend] kvmclock: fix clock_is_reliable on migration from QEMU < 2.9 Michael Chapman
2018-04-06 11:40 ` Paolo Bonzini [this message]
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=6fb71ee8-bd07-81d2-06d7-9b355b0689c7@redhat.com \
--to=pbonzini@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcel@redhat.com \
--cc=mike@very.puzzling.org \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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).