From: Diana Crisan <dcrisan@flexiant.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Keir Fraser <keir@xen.org>, Alex Bligh <alex@alex.org.uk>,
Jan Beulich <jbeulich@suse.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time
Date: Wed, 05 Jun 2013 13:02:45 +0100 [thread overview]
Message-ID: <51AF28E5.60500@flexiant.com> (raw)
In-Reply-To: <1370359933-3418-1-git-send-email-roger.pau@citrix.com>
On 04/06/13 16:32, Roger Pau Monne wrote:
> When using a vtsc, hvm_set_guest_time changes hvm_vcpu.stime_offset,
> which is used in the vcpu time structure to calculate the
> tsc_timestamp, so after updating stime_offset we need to propagate the
> change to vcpu_time in order for the guest to get the right time if
> using the PV clock.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Keir Fraser <keir@xen.org>
> Cc: Jan Beulich <jbeulich@suse.com>
> Cc: George Dunlap <george.dunlap@eu.citrix.com>
Tested-By: Diana Crisan <dcrisan@flexiant.com>
> ---
> Changes since v2:
> * Check for v == current instead of v->is_running to know if the vcpu
> is running.
> Changes since v1:
> * Perform the call to update_vcpu_system_time in hvm_set_guest_time
> if the offset has changed and the vCPU is running.
> ---
> xen/arch/x86/hvm/vpt.c | 13 ++++++++++++-
> 1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
> index 8dee662..4b1e1a3 100644
> --- a/xen/arch/x86/hvm/vpt.c
> +++ b/xen/arch/x86/hvm/vpt.c
> @@ -57,7 +57,18 @@ u64 hvm_get_guest_time(struct vcpu *v)
>
> void hvm_set_guest_time(struct vcpu *v, u64 guest_time)
> {
> - v->arch.hvm_vcpu.stime_offset += guest_time - hvm_get_guest_time(v);
> + u64 offset = guest_time - hvm_get_guest_time(v);
> +
> + if ( offset ) {
> + v->arch.hvm_vcpu.stime_offset += offset;
> + /*
> + * If hvm_vcpu.stime_offset is updated make sure to
> + * also update vcpu time, since this value is used to
> + * calculate the TSC.
> + */
> + if ( v == current )
> + update_vcpu_system_time(v);
> + }
> }
>
> static int pt_irq_vector(struct periodic_time *pt, enum hvm_intsrc src)
I have tested this patch and I have not been able to reproduce the guest
stuck-clock problem we were seeing before (see *HVM Migration of domU on
Qemu-upstream DM causes stuck system clock with ACPI* for details of the
problem).
Note: this was tested without the temporary fix to our problem ( which
is specifying tsc_mode='native_paravirt').
Thanks,
Diana
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-06-05 12:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-04 15:32 [PATCH v3] x86/vtsc: update vcpu_time in hvm_set_guest_time Roger Pau Monne
2013-06-04 16:29 ` George Dunlap
2013-06-05 12:02 ` Diana Crisan [this message]
2013-06-05 13:06 ` George Dunlap
2013-06-05 13:35 ` Diana Crisan
2013-06-06 6:59 ` Alex Bligh
2013-06-06 7:20 ` Jan Beulich
2013-06-06 8:45 ` George Dunlap
2013-06-06 9:36 ` Alex Bligh
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=51AF28E5.60500@flexiant.com \
--to=dcrisan@flexiant.com \
--cc=alex@alex.org.uk \
--cc=george.dunlap@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=roger.pau@citrix.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).