direct-io.hg
changeset 7478:2c0b3b807756
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@intel.com>
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
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@intel.com>
Signed-off-by: Edwin Zhai <edwin.zhai@intel.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Sun Oct 23 16:54:51 2005 +0100 (2005-10-23) |
parents | 5a7baecb1c70 |
children | 5a728a884242 |
files | xen/arch/x86/vmx_intercept.c xen/arch/x86/vmx_io.c xen/include/asm-x86/vmx.h xen/include/asm-x86/vmx_virpit.h xen/include/asm-x86/vmx_vmcs.h |
line diff
1.1 --- a/xen/arch/x86/vmx_intercept.c Sun Oct 23 16:51:47 2005 +0100 1.2 +++ b/xen/arch/x86/vmx_intercept.c Sun Oct 23 16:54:51 2005 +0100 1.3 @@ -254,6 +254,8 @@ void vmx_hooks_assist(struct vcpu *v) 1.4 vpit->init_val); 1.5 vpit->period = 1000000; 1.6 } 1.7 + vpit->period_cycles = (u64)vpit->period * cpu_khz / 1000000L; 1.8 + printk("VMX_PIT: guest freq in cycles=%lld\n",(long long)vpit->period_cycles); 1.9 1.10 vpit->channel = ((p->u.data >> 24) & 0x3); 1.11 vpit->first_injected = 0;
2.1 --- a/xen/arch/x86/vmx_io.c Sun Oct 23 16:51:47 2005 +0100 2.2 +++ b/xen/arch/x86/vmx_io.c Sun Oct 23 16:54:51 2005 +0100 2.3 @@ -799,6 +799,7 @@ static inline void 2.4 interrupt_post_injection(struct vcpu * v, int vector, int type) 2.5 { 2.6 struct vmx_virpit *vpit = &(v->domain->arch.vmx_platform.vmx_pit); 2.7 + u64 drift; 2.8 2.9 switch(type) 2.10 { 2.11 @@ -812,6 +813,13 @@ interrupt_post_injection(struct vcpu * v 2.12 vpit->pending_intr_nr--; 2.13 } 2.14 vpit->inject_point = NOW(); 2.15 + drift = vpit->period_cycles * vpit->pending_intr_nr; 2.16 + drift = v->arch.arch_vmx.tsc_offset - drift; 2.17 + __vmwrite(TSC_OFFSET, drift); 2.18 + 2.19 +#if defined (__i386__) 2.20 + __vmwrite(TSC_OFFSET_HIGH, (drift >> 32)); 2.21 +#endif 2.22 2.23 } 2.24 break;
3.1 --- a/xen/include/asm-x86/vmx.h Sun Oct 23 16:51:47 2005 +0100 3.2 +++ b/xen/include/asm-x86/vmx.h Sun Oct 23 16:54:51 2005 +0100 3.3 @@ -65,6 +65,7 @@ extern unsigned int cpu_rev; 3.4 CPU_BASED_MWAIT_EXITING | \ 3.5 CPU_BASED_MOV_DR_EXITING | \ 3.6 CPU_BASED_ACTIVATE_IO_BITMAP | \ 3.7 + CPU_BASED_USE_TSC_OFFSETING | \ 3.8 CPU_BASED_UNCOND_IO_EXITING \ 3.9 ) 3.10
4.1 --- a/xen/include/asm-x86/vmx_virpit.h Sun Oct 23 16:51:47 2005 +0100 4.2 +++ b/xen/include/asm-x86/vmx_virpit.h Sun Oct 23 16:54:51 2005 +0100 4.3 @@ -19,6 +19,7 @@ 4.4 struct vmx_virpit { 4.5 /* for simulation of counter 0 in mode 2*/ 4.6 u32 period; /* pit frequency in ns */ 4.7 + u64 period_cycles; /* pit frequency in cpu cycles */ 4.8 s_time_t scheduled; /* scheduled timer interrupt */ 4.9 unsigned int channel; /* the pit channel, counter 0~2 */ 4.10 unsigned int pending_intr_nr; /* the couner for pending timer interrupts */
5.1 --- a/xen/include/asm-x86/vmx_vmcs.h Sun Oct 23 16:51:47 2005 +0100 5.2 +++ b/xen/include/asm-x86/vmx_vmcs.h Sun Oct 23 16:54:51 2005 +0100 5.3 @@ -96,6 +96,7 @@ struct arch_vmx_struct { 5.4 struct msr_state msr_content; 5.5 struct mmio_op mmio_op; /* MMIO */ 5.6 void *io_bitmap_a, *io_bitmap_b; 5.7 + u64 tsc_offset; 5.8 }; 5.9 5.10 #define vmx_schedule_tail(next) \