public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Zachary Amsden <zamsden@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: KVM clock synchronization
Date: Wed, 5 Jan 2011 10:17:12 -0200	[thread overview]
Message-ID: <20110105121712.GA708@amt.cnet> (raw)
In-Reply-To: <1293601100-32109-1-git-send-email-zamsden@redhat.com>

On Tue, Dec 28, 2010 at 07:38:16PM -1000, Zachary Amsden wrote:
> A further set of improvements to KVM clock.  Now it actually can
> stay synchronized on SMP systems with a stable TSC, does not get
> destabilized by host suspend, and is resistant to migration.
> 
> I did look a bit into the second to last remaining migration issue;
> that is, we read the TSCs for all VCPUs at different times, then
> write them back at different times as well.  We have compensation
> for this already (see patch 1), but there is a possibility that
> ordering issues create a backwards condition:
> 
>   read VTSC-0
>   stop VCPU-0
>   read VTSC-1
>   stop VCPU-1
> 
> In that case, what the compensation code does is reset VTSC-1
> back to VTSC-0.  With the above ordering, this is broken.
> 
> However, in QEMU, the migration order is:
> 
>   stop VCPU-0
>   stop VCPU-1
>   read VTSC-0
>   read VTSC-1
> 
> So even if a higher TSC value is read for VTSC-1, no backwards
> condition can be generated, as VCPU-1 was not running at the time
> and thus could not have observed the higher TSC.
> 
> This brings us close to having a perfect KVM clock.
> 
> Next steps will be testing to see if this in practice allows us
> to drop the atomic backwards protection for KVM clock, and if so,
> to implement vread so we have fast system calls for time.
> 
> Zach

Patchset looks good to me.


      parent reply	other threads:[~2011-01-05 12:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-29  5:38 KVM clock synchronization Zachary Amsden
2010-12-29  5:38 ` [KVM Clock Synchronization 1/4] Make cyc_to_nsec conversions more reliable Zachary Amsden
2010-12-29  5:38 ` [KVM Clock Synchronization 2/4] Keep TSC synchronized across host suspend Zachary Amsden
2011-01-04 15:36   ` Marcelo Tosatti
2011-01-05  4:43     ` Zachary Amsden
2011-01-05 11:44       ` Marcelo Tosatti
2010-12-29  5:38 ` [KVM Clock Synchronization 3/4] Refactor KVM clock update code Zachary Amsden
2010-12-29  5:38 ` [KVM Clock Synchronization 4/4] Add master clock for KVM clock Zachary Amsden
2011-01-04 18:20   ` Marcelo Tosatti
2011-01-04 21:50     ` Zachary Amsden
2011-01-05 12:17 ` Marcelo Tosatti [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=20110105121712.GA708@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=zamsden@redhat.com \
    /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