# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1196942211 0
# Node ID 0f9b5ab59579e8b980e231bfd3fdf5ab8a74e005
# Parent d7a0a73e5dca64466843a420a3975ecf665d4762
hvm: Split no_missed_tick_accounting into two modes:
* no_missed_ticks_pending ('SYNC')
* one_missed_tick_pending ('MIXED')
This is based on a patch by Dave Winchell <dwinchell@xxxxxxxxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
xen/arch/x86/hvm/hvm.c | 4 +---
xen/arch/x86/hvm/vpt.c | 13 ++++++++++---
xen/include/asm-x86/hvm/vpt.h | 1 +
xen/include/public/hvm/params.h | 12 +++++++++---
4 files changed, 21 insertions(+), 9 deletions(-)
diff -r d7a0a73e5dca -r 0f9b5ab59579 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c Thu Dec 06 11:29:18 2007 +0000
+++ b/xen/arch/x86/hvm/hvm.c Thu Dec 06 11:56:51 2007 +0000
@@ -1874,9 +1874,7 @@ long do_hvm_op(unsigned long op, XEN_GUE
break;
case HVM_PARAM_TIMER_MODE:
rc = -EINVAL;
- if ( (a.value != HVMPTM_delay_for_missed_ticks) &&
- (a.value != HVMPTM_no_delay_for_missed_ticks) &&
- (a.value != HVMPTM_no_missed_tick_accounting) )
+ if ( a.value > HVMPTM_one_missed_tick_pending )
goto param_fail;
break;
}
diff -r d7a0a73e5dca -r 0f9b5ab59579 xen/arch/x86/hvm/vpt.c
--- a/xen/arch/x86/hvm/vpt.c Thu Dec 06 11:29:18 2007 +0000
+++ b/xen/arch/x86/hvm/vpt.c Thu Dec 06 11:56:51 2007 +0000
@@ -57,7 +57,10 @@ static void pt_process_missed_ticks(stru
return;
missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
- pt->pending_intr_nr += missed_ticks;
+ if ( mode_is(pt->vcpu->domain, no_missed_ticks_pending) )
+ pt->do_not_freeze = !pt->pending_intr_nr;
+ else
+ pt->pending_intr_nr += missed_ticks;
pt->scheduled += missed_ticks * pt->period;
}
@@ -92,7 +95,8 @@ 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);
+ if ( !pt->do_not_freeze )
+ stop_timer(&pt->timer);
pt_freeze_time(v);
@@ -217,6 +221,8 @@ void pt_intr_post(struct vcpu *v, struct
return;
}
+ pt->do_not_freeze = 0;
+
if ( pt->one_shot )
{
pt->enabled = 0;
@@ -224,7 +230,7 @@ void pt_intr_post(struct vcpu *v, struct
}
else
{
- if ( mode_is(v->domain, no_missed_tick_accounting) )
+ if ( mode_is(v->domain, one_missed_tick_pending) )
{
pt->last_plt_gtime = hvm_get_guest_time(v);
pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */
@@ -290,6 +296,7 @@ void create_periodic_time(
pt->enabled = 1;
pt->pending_intr_nr = 0;
+ pt->do_not_freeze = 0;
/* Periodic timer must be at least 0.9ms. */
if ( (period < 900000) && !one_shot )
diff -r d7a0a73e5dca -r 0f9b5ab59579 xen/include/asm-x86/hvm/vpt.h
--- a/xen/include/asm-x86/hvm/vpt.h Thu Dec 06 11:29:18 2007 +0000
+++ b/xen/include/asm-x86/hvm/vpt.h Thu Dec 06 11:56:51 2007 +0000
@@ -74,6 +74,7 @@ struct periodic_time {
struct list_head list;
char enabled;
char one_shot; /* one shot time */
+ char do_not_freeze;
u8 irq;
struct vcpu *vcpu; /* vcpu timer interrupt delivers to */
u32 pending_intr_nr; /* the couner for pending timer interrupts */
diff -r d7a0a73e5dca -r 0f9b5ab59579 xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h Thu Dec 06 11:29:18 2007 +0000
+++ b/xen/include/public/hvm/params.h Thu Dec 06 11:56:51 2007 +0000
@@ -67,13 +67,19 @@
* As above, missed interrupts are delivered, but guest time always tracks
* wallclock (i.e., real) time while doing so.
* no_missed_ticks_pending:
- * No more than one missed interrupt is held pending, and guest time always
- * tracks wallclock (i.e., real) time.
+ * No missed interrupts are held pending. Instead, to ensure ticks are
+ * delivered at some non-zero rate, if we detect missed ticks then the
+ * internal tick alarm is not disabled if the VCPU is preempted during the
+ * next tick period.
+ * one_missed_tick_pending:
+ * Missed interrupts are collapsed together and delivered as one 'late tick'.
+ * Guest time always tracks wallclock (i.e., real) time.
*/
#define HVM_PARAM_TIMER_MODE 10
#define HVMPTM_delay_for_missed_ticks 0
#define HVMPTM_no_delay_for_missed_ticks 1
-#define HVMPTM_no_missed_tick_accounting 2
+#define HVMPTM_no_missed_ticks_pending 2
+#define HVMPTM_one_missed_tick_pending 3
#define HVM_NR_PARAMS 11
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|