Support 1000 HZ guests
PATCH 1/1 Support 1000 HZ guests
- Support guests with 1000 Hz
- cleanup the trailing garbage in vmx_virtpit.h
- Don't queue up pending timer interrupts before the first interrupt is injected
- This fixes the low bogomips problem
- Protect xen against guests programming a bad value for the counter
xen/arch/x86/vmx_intercept.c +13 -4
@@ -203,7 +203,7 @@/* Only some PIT operations such as load init counter need a hypervisor hook. -* leave many other operations in user space DM +* leave all other operations in user space DM */ void vmx_hooks_assist (struct exec_domain *d) {
@@ -213,11 +213,20 @@struct vmx_virpit_t *vpit = &(d->arch.arch_vmx.vmx_platform.vmx_pit);int rw_mode; -if (p->state ==STATE_IORESP_HOOK ) {/*load init count*/ - vpit->init_val = (p->u.data &0xFFFF ) ;/* frequency(ms) of pit */ - vpit->period = (vpit->init_val) *1000 /PIT_FREQ ;/* frequency(ms) of pit */ +/* load init count*/ +if (p->state ==STATE_IORESP_HOOK ) { +/* init count for this channel */ + vpit->init_val = (p->u.data &0xFFFF ) ; +/* frequency(ms) of pit */ + vpit->period =DIV_ROUND (((vpit->init_val) *1000 ),PIT_FREQ ); +if (vpit->period <1 ) { +printk ("VMX_PIT: guest programmed too small an init_val: %lx\n" , + vpit->init_val); + vpit->period =1 ; + } vpit->vector = ((p->u.data >>16 ) &0xFF ); vpit->channel = ((p->u.data >>24 ) &0x3 ); + vpit->first_injected =0 ; vpit->count_LSB_latched =0 ; vpit->count_MSB_latched =0 ;
===== xen/arch/x86/vmx_io.c 1.13 vs edited =====
xen/arch/x86/vmx_io.c +6 -0
@@ -367,6 +367,12 @@else clear_highest_bit (d, highest_vector); +/* close the window between guest PIT initialization and sti */ +if (highest_vector == vpit->vector && !vpit->first_injected){ + vpit->first_injected =1 ; + vpit->pending_intr_nr =0 ; + } + intr_fields = (INTR_INFO_VALID_MASK |INTR_TYPE_EXT_INTR | highest_vector);__vmwrite (VM_ENTRY_INTR_INFO_FIELD , intr_fields);
===== xen/include/asm-x86/vmx_virpit.h 1.1 vs edited =====
xen/include/asm-x86/vmx_virpit.h +1 -40
55 lines not on this page · raw message
===== xen/include/xen/lib.h 1.21 vs edited =====
xen/include/xen/lib.h +2 -0
@@ -23,6 +23,8 @@#define SWAP (_a, _b) \ do { typeof(_a) _t = (_a); (_a) = (_b); (_b) = _t; } while ( 0 ) +#define DIV_ROUND (x, y) (((x) + (y) - 1) / (y)) +#define reserve_bootmem (_p,_l) ((void)0)struct domain ;
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click