WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Enable TSC-offsetting capability to ensure that VMX

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Enable TSC-offsetting capability to ensure that VMX
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 24 Oct 2005 08:06:07 +0000
Delivery-date: Mon, 24 Oct 2005 08:04:11 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 2c0b3b8077564205640952f8919e39ee05872cfd
# Parent  5a7baecb1c70a0fb583a87dd9e22858e541da099
Enable TSC-offsetting capability to ensure that VMX
guest's TSC remains in sync with virtual-PIT interrupts.
This avoids the following message from full-virt Linux:
       "Losing too many ticks!
        TSC cannot be used as a timesource. =20
        Possible reasons for this are:
          You're running with Speedstep,
        ......"

Signed-off-by: Eddie Dong <eddie.dong@xxxxxxxxx>
Signed-off-by: Edwin Zhai <edwin.zhai@xxxxxxxxx>

diff -r 5a7baecb1c70 -r 2c0b3b807756 xen/arch/x86/vmx_intercept.c
--- a/xen/arch/x86/vmx_intercept.c      Sun Oct 23 15:51:47 2005
+++ b/xen/arch/x86/vmx_intercept.c      Sun Oct 23 15:54:51 2005
@@ -254,6 +254,8 @@
                    vpit->init_val);
             vpit->period = 1000000;
         }
+         vpit->period_cycles = (u64)vpit->period * cpu_khz / 1000000L;
+         printk("VMX_PIT: guest freq in cycles=%lld\n",(long 
long)vpit->period_cycles);
 
         vpit->channel = ((p->u.data >> 24) & 0x3);
         vpit->first_injected = 0;
diff -r 5a7baecb1c70 -r 2c0b3b807756 xen/arch/x86/vmx_io.c
--- a/xen/arch/x86/vmx_io.c     Sun Oct 23 15:51:47 2005
+++ b/xen/arch/x86/vmx_io.c     Sun Oct 23 15:54:51 2005
@@ -799,6 +799,7 @@
 interrupt_post_injection(struct vcpu * v, int vector, int type)
 {
     struct vmx_virpit *vpit = &(v->domain->arch.vmx_platform.vmx_pit);
+    u64    drift;
 
     switch(type)
     {
@@ -812,6 +813,13 @@
                 vpit->pending_intr_nr--;
             }
             vpit->inject_point = NOW();
+            drift = vpit->period_cycles * vpit->pending_intr_nr;
+            drift = v->arch.arch_vmx.tsc_offset - drift;
+            __vmwrite(TSC_OFFSET, drift);
+
+#if defined (__i386__)
+            __vmwrite(TSC_OFFSET_HIGH, (drift >> 32));
+#endif
  
         }
         break;
diff -r 5a7baecb1c70 -r 2c0b3b807756 xen/include/asm-x86/vmx.h
--- a/xen/include/asm-x86/vmx.h Sun Oct 23 15:51:47 2005
+++ b/xen/include/asm-x86/vmx.h Sun Oct 23 15:54:51 2005
@@ -65,6 +65,7 @@
     CPU_BASED_MWAIT_EXITING | \
     CPU_BASED_MOV_DR_EXITING | \
     CPU_BASED_ACTIVATE_IO_BITMAP | \
+    CPU_BASED_USE_TSC_OFFSETING  | \
     CPU_BASED_UNCOND_IO_EXITING \
     )
 
diff -r 5a7baecb1c70 -r 2c0b3b807756 xen/include/asm-x86/vmx_virpit.h
--- a/xen/include/asm-x86/vmx_virpit.h  Sun Oct 23 15:51:47 2005
+++ b/xen/include/asm-x86/vmx_virpit.h  Sun Oct 23 15:54:51 2005
@@ -19,6 +19,7 @@
 struct vmx_virpit {
     /* for simulation of counter 0 in mode 2*/
     u32 period;                /* pit frequency in ns */
+    u64 period_cycles;                 /* pit frequency in cpu cycles */
     s_time_t scheduled;                 /* scheduled timer interrupt */
     unsigned int channel;  /* the pit channel, counter 0~2 */
     unsigned int pending_intr_nr; /* the couner for pending timer interrupts */
diff -r 5a7baecb1c70 -r 2c0b3b807756 xen/include/asm-x86/vmx_vmcs.h
--- a/xen/include/asm-x86/vmx_vmcs.h    Sun Oct 23 15:51:47 2005
+++ b/xen/include/asm-x86/vmx_vmcs.h    Sun Oct 23 15:54:51 2005
@@ -96,6 +96,7 @@
     struct msr_state        msr_content;
     struct mmio_op          mmio_op;  /* MMIO */
     void                    *io_bitmap_a, *io_bitmap_b;
+    u64                     tsc_offset;
 };
 
 #define vmx_schedule_tail(next)         \

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Enable TSC-offsetting capability to ensure that VMX, Xen patchbot -unstable <=