xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: kevin.tian@intel.com, keir@xen.org, ian.campbell@citrix.com,
	stefano.stabellini@eu.citrix.com, jun.nakajima@intel.com,
	eddie.dong@intel.com, ian.jackson@eu.citrix.com,
	xen-devel@lists.xen.org, jbeulich@suse.com,
	suravee.suthikulpanit@amd.com
Subject: Re: [PATCH v2 2/2] x86/HVM: Use fixed TSC value when saving or restoring domain
Date: Fri, 04 Apr 2014 11:54:00 -0400	[thread overview]
Message-ID: <533ED598.3040405@oracle.com> (raw)
In-Reply-To: <1396367638-4111-3-git-send-email-boris.ostrovsky@oracle.com>

On 04/01/2014 11:53 AM, Boris Ostrovsky wrote:
> When a domain is saved each VCPU's TSC value needs to be preserved. To get it we
> use hvm_get_guest_tsc(). This routine (either itself or via get_s_time() which
> it may call) calculates VCPU's TSC based on current host's TSC value (by doing a
> rdtscll()). Since this is performed for each VCPU separately we end up with
> un-synchronized TSCs.
>
> Similarly, during a restore each VCPU is assigned its TSC based on host's current
> tick, causing virtual TSCs to diverge further.
>
> With this, we can easily get into situation where a guest may see time going
> backwards.
>
> Instead of reading new TSC value for each VCPU when saving/restoring it we should
> use the same value across all VCPUs.
>
> (As part of the patch, update rdtscll's definition so that its variables don't
> clash with outer code)
>
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Reviewed-by: Kevin Tian <kevin.tian@intel.com>

This patch will need to be updated as it doesn't quite fix the problem 
on some AMD processors (they may do one extra rdtsc in 
svm_set_tsc_offset()).

-boris

      reply	other threads:[~2014-04-04 15:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-01 15:53 [PATCH v2 0/2] Time-related fixes for migration Boris Ostrovsky
2014-04-01 15:53 ` [PATCH v2 1/2] libxl: Set guest parameters from config file during a restore Boris Ostrovsky
2014-04-07 12:51   ` Ian Campbell
2014-04-08 15:25     ` Ian Campbell
2014-04-08 15:31       ` Boris Ostrovsky
2014-04-01 15:53 ` [PATCH v2 2/2] x86/HVM: Use fixed TSC value when saving or restoring domain Boris Ostrovsky
2014-04-04 15:54   ` Boris Ostrovsky [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=533ED598.3040405@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=xen-devel@lists.xen.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).