Pvrdtscp: move write_rdtscp_aux() to paravirt_ctxt_switch_to() -
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 14 Dec 2009 07:45:04 +0000 (07:45 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 14 Dec 2009 07:45:04 +0000 (07:45 +0000)
Currently write_rdtscp_aux() is placed in update_vcpu_system_time(),
which is called by schedule() before context_switch(). This will break
the HVM guest TSC_AUX state because at this point, MSR hasn't beed
saved for HVM guests.So put the function in the point when a PV vcpu
is really scheduled in.

Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
xen/arch/x86/domain.c
xen/arch/x86/time.c

index 84493aba435abff29ff76f698cd2314dcc915367..07d72fb37d8454210bb283a455ff3c8b3b536b1b 100644 (file)
@@ -1298,6 +1298,10 @@ static void paravirt_ctxt_switch_to(struct vcpu *v)
         write_debugreg(6, v->arch.guest_context.debugreg[6]);
         write_debugreg(7, v->arch.guest_context.debugreg[7]);
     }
+
+    if ( (v->domain->arch.tsc_mode ==  TSC_MODE_PVRDTSCP) &&
+         boot_cpu_has(X86_FEATURE_RDTSCP) )
+        write_rdtscp_aux(v->domain->arch.incarnation);
 }
 
 /* Update per-VCPU guest runstate shared memory area (if registered). */
index cb8f1ff4ecf634c073d5a216e2029b670d155f62..d474bb5038d1a54650b8925bac983c185eb63152 100644 (file)
@@ -832,10 +832,6 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
     else
         tsc_stamp = t->local_tsc_stamp;
 
-    if ( (d->arch.tsc_mode ==  TSC_MODE_PVRDTSCP) &&
-         boot_cpu_has(X86_FEATURE_RDTSCP) )
-        write_rdtscp_aux(d->arch.incarnation);
-
     /* Don't bother unless timestamps have changed or we are forced. */
     if ( !force && (u->tsc_timestamp == tsc_stamp) )
         return;