diff -r c0bdfda5183d xen/arch/x86/hvm/vpt.c --- a/xen/arch/x86/hvm/vpt.c Thu Nov 08 14:50:01 2007 +0000 +++ b/xen/arch/x86/hvm/vpt.c Fri Nov 09 09:08:59 2007 -0500 @@ -45,6 +45,26 @@ static void pt_unlock(struct periodic_ti spin_unlock(&pt->vcpu->arch.hvm_vcpu.tm_lock); } +#include +#define PT_MISSED_OPTION_SYNC 0 +#define PT_MISSED_OPTION_ASYNC 1 +int pt_missed_option = 0; +static void pt_missed_option_fn(unsigned char key) +{ + pt_missed_option = pt_missed_option ^ 1; + if(pt_missed_option == PT_MISSED_OPTION_SYNC) + printk("pt_missed_option = 0 (SYNC)\n"); + else + printk("pt_missed_option = 1 (ASYNC)\n"); +} +static int __init pt_missed_option_init(void) +{ + register_keyhandler('D', pt_missed_option_fn, "pt_missed_option"); + return 0; +} + +__initcall(pt_missed_option_init); + static void pt_process_missed_ticks(struct periodic_time *pt) { s_time_t missed_ticks, now = NOW(); @@ -56,9 +76,20 @@ static void pt_process_missed_ticks(stru if ( missed_ticks <= 0 ) return; - missed_ticks = missed_ticks / (s_time_t) pt->period + 1; - pt->pending_intr_nr += missed_ticks; - pt->scheduled += missed_ticks * pt->period; + if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) && (pt_missed_option == PT_MISSED_OPTION_ASYNC) ) + { + pt->pending_intr_nr = 1; + pt->scheduled = now + pt->period; + } + else + { + missed_ticks = missed_ticks / (s_time_t) pt->period + 1; + if ( !mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) + pt->pending_intr_nr += missed_ticks; + else + pt->run_timer = 1; + pt->scheduled += missed_ticks * pt->period; + } } static void pt_freeze_time(struct vcpu *v) @@ -91,8 +122,10 @@ void pt_save_timer(struct vcpu *v) spin_lock(&v->arch.hvm_vcpu.tm_lock); - list_for_each_entry ( pt, head, list ) - stop_timer(&pt->timer); + list_for_each_entry ( pt, head, list ) { + if(!pt->run_timer) + stop_timer(&pt->timer); + } pt_freeze_time(v); @@ -123,7 +156,12 @@ static void pt_timer_fn(void *data) pt_lock(pt); - pt->pending_intr_nr++; + if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) ) { + pt->pending_intr_nr = 1; + pt->run_timer = 0; + } + else + pt->pending_intr_nr++; if ( !pt->one_shot ) { @@ -224,16 +262,11 @@ void pt_intr_post(struct vcpu *v, struct } else { + pt->pending_intr_nr--; if ( mode_is(v->domain, no_missed_tick_accounting) ) - { pt->last_plt_gtime = hvm_get_guest_time(v); - pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */ - } else - { pt->last_plt_gtime += pt->period_cycles; - pt->pending_intr_nr--; - } } if ( mode_is(v->domain, delay_for_missed_ticks) && diff -r c0bdfda5183d xen/include/asm-x86/hvm/vpt.h --- a/xen/include/asm-x86/hvm/vpt.h Thu Nov 08 14:50:01 2007 +0000 +++ b/xen/include/asm-x86/hvm/vpt.h Fri Nov 09 08:53:14 2007 -0500 @@ -84,6 +84,7 @@ struct periodic_time { struct timer timer; /* ac_timer */ time_cb *cb; void *priv; /* point back to platform time source */ + u32 run_timer; };