xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/vtsc: update vcpu_time after hvm_set_guest_time
@ 2013-06-04  9:10 Roger Pau Monne
  2013-06-04  9:24 ` Jan Beulich
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Roger Pau Monne @ 2013-06-04  9:10 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Keir Fraser, Jan Beulich, Roger Pau Monne

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.

This was not done correctly, since in context_switch
update_vcpu_system_time was called before vmx_do_resume, which caused
the vcpu_info time structure to be updated with the wrong values. This
patch fixes this by calling update_vcpu_system_time after the call to
hvm_set_guest_time has happened.

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>
---
 xen/arch/x86/hvm/hvm.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a962ce2..e257dcf 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -343,6 +343,12 @@ void hvm_do_resume(struct vcpu *v)
     ioreq_t *p;
 
     pt_restore_timer(v);
+    /*
+     * Update vcpu_info, since the call to pt_restore_timer can change
+     * the value in v->arch.hvm_vcpu.stime_offset that is used
+     * to calculate the TSC in vcpu_info->time.
+     */
+    update_vcpu_system_time(v);
 
     check_wakeup_from_wait();
 
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-06-04 12:48 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-04  9:10 [PATCH] x86/vtsc: update vcpu_time after hvm_set_guest_time Roger Pau Monne
2013-06-04  9:24 ` Jan Beulich
2013-06-04  9:46   ` Roger Pau Monné
2013-06-04  9:56     ` George Dunlap
2013-06-04 10:41       ` Jan Beulich
2013-06-04  9:47 ` George Dunlap
2013-06-04  9:58   ` Roger Pau Monné
2013-06-04 10:00     ` George Dunlap
2013-06-04 10:12       ` Roger Pau Monné
2013-06-04 11:15   ` Roger Pau Monné
2013-06-04 11:45     ` Jan Beulich
2013-06-04 12:48       ` Roger Pau Monné
2013-06-04 10:24 ` Alex Bligh
2013-06-04 10:28   ` George Dunlap

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).