aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/vpt.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-09-16 09:29:17 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-09-16 09:29:17 +0100
commit057958b0ab83fe767397a7ef896b4e6ed63529d5 (patch)
tree7f0fa92196811b7c9b874e4cad305bf1b97d8d75 /xen/arch/x86/hvm/vpt.c
parente3cc5f93ca77e2b81435a47d76dd8d4cb7524ba2 (diff)
downloadxen-057958b0ab83fe767397a7ef896b4e6ed63529d5.tar.gz
xen-057958b0ab83fe767397a7ef896b4e6ed63529d5.tar.bz2
xen-057958b0ab83fe767397a7ef896b4e6ed63529d5.zip
x86 hvm: don't set periodical timer again until its IRQ is delivered.
Modern Windows OS (ex XP,2003,2008) never use the PIT timer, and neither cpu#0's LAPIC timer after boot. Despite that, xen emulates them busily. It's inefficient. With this patch, setting a timer is defered while its IRQ is masked. The reasons why pt_timer_fn() simply calls vcpu_kick() are: - checking by pt_irq_masked() is duplicated. pt_update_irq() also does. - pt_timer_fn() is likely called on the same processor as pt->vcpu->processor. Hence vcpu_kick() hardly send IPI. Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Diffstat (limited to 'xen/arch/x86/hvm/vpt.c')
-rw-r--r--xen/arch/x86/hvm/vpt.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index 7721873f2c..f586d242d1 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -187,8 +187,11 @@ void pt_restore_timer(struct vcpu *v)
list_for_each_entry ( pt, head, list )
{
- pt_process_missed_ticks(pt);
- set_timer(&pt->timer, pt->scheduled);
+ if ( pt->pending_intr_nr == 0 )
+ {
+ pt_process_missed_ticks(pt);
+ set_timer(&pt->timer, pt->scheduled);
+ }
}
pt_thaw_time(v);
@@ -205,15 +208,7 @@ static void pt_timer_fn(void *data)
pt->pending_intr_nr++;
pt->do_not_freeze = 0;
- if ( !pt->one_shot )
- {
- pt->scheduled += pt->period;
- pt_process_missed_ticks(pt);
- set_timer(&pt->timer, pt->scheduled);
- }
-
- if ( !pt_irq_masked(pt) )
- vcpu_kick(pt->vcpu);
+ vcpu_kick(pt->vcpu);
pt_unlock(pt);
}
@@ -302,6 +297,9 @@ void pt_intr_post(struct vcpu *v, struct hvm_intack intack)
}
else
{
+ pt->scheduled += pt->period;
+ pt_process_missed_ticks(pt);
+
if ( mode_is(v->domain, one_missed_tick_pending) ||
mode_is(v->domain, no_missed_ticks_pending) )
{
@@ -313,6 +311,9 @@ void pt_intr_post(struct vcpu *v, struct hvm_intack intack)
pt->last_plt_gtime += pt->period;
pt->pending_intr_nr--;
}
+
+ if ( pt->pending_intr_nr == 0 )
+ set_timer(&pt->timer, pt->scheduled);
}
if ( mode_is(v->domain, delay_for_missed_ticks) &&