[IA64] let VMM do itc sync for guest on VTI domain
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 14 Jun 2006 22:05:45 +0000 (16:05 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Wed, 14 Jun 2006 22:05:45 +0000 (16:05 -0600)
Previously, on SMP VTI-domain, Guest OS was responsible for
syncing itc by calling ia64_sync_itc, but the round trip may
be very large on VTI domain, that may cause guest itcs are
not synced well and cause guest wall clock is not accurate.

This patch intends to fix this issue, when guest wants to sync
itc( vcpus other than vcpu0 write itc), VMM directly get vcpu0
itc for other vcpus.

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
xen/arch/ia64/vmx/vlsapic.c

index d519cdafa0ef382f484bc42dba6566e86150a028..dab483a8a0f92d63925f2c4ef48a6172ac144b4c 100644 (file)
@@ -140,8 +140,6 @@ uint64_t vtm_get_itc(VCPU *vcpu)
 }
 
 
-
-
 void vtm_set_itc(VCPU *vcpu, uint64_t new_itc)
 {
     uint64_t    vitm, vitv;
@@ -149,8 +147,15 @@ void vtm_set_itc(VCPU *vcpu, uint64_t new_itc)
     vitm = VCPU(vcpu,itm);
     vitv = VCPU(vcpu,itv);
     vtm=&(vcpu->arch.arch_vmx.vtm);
-    vtm->vtm_offset = new_itc - ia64_get_itc();
-    vtm->last_itc = new_itc;
+    if(vcpu->vcpu_id == 0){
+        vtm->vtm_offset = new_itc - ia64_get_itc();
+        vtm->last_itc = new_itc;
+    }
+    else{
+        vtm->vtm_offset = vcpu->domain->vcpu[0]->arch.arch_vmx.vtm.vtm_offset;
+        new_itc=vtm->vtm_offset + ia64_get_itc();
+        vtm->last_itc = new_itc;
+    }
     if(vitm < new_itc){
         clear_bit(ITV_VECTOR(vitv), &VCPU(vcpu, irr[0]));
         stop_timer(&vtm->vtm_timer);