ChangeSet 1.1553, 2005/05/25 15:28:37+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx
More simplification and cleanup of the ac_timer interface.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
arch/ia64/vlsapic.c | 42 ++++-----------------------
arch/x86/vmx_intercept.c | 15 +++------
common/ac_timer.c | 22 +++++---------
common/sched_bvt.c | 20 ++++--------
common/sched_sedf.c | 9 +++--
common/schedule.c | 31 ++++++-------------
include/asm-ia64/vtm.h | 1
include/xen/ac_timer.h | 73 +++++++++++++++++++----------------------------
8 files changed, 75 insertions(+), 138 deletions(-)
diff -Nru a/xen/arch/ia64/vlsapic.c b/xen/arch/ia64/vlsapic.c
--- a/xen/arch/ia64/vlsapic.c 2005-05-25 11:01:31 -04:00
+++ b/xen/arch/ia64/vlsapic.c 2005-05-25 11:01:31 -04:00
@@ -88,10 +88,10 @@
}
/* callback function when vtm_timer expires */
-static void vtm_timer_fn(unsigned long data)
+static void vtm_timer_fn(void *data)
{
vtime_t *vtm;
- VCPU *vcpu = (VCPU*)data;
+ VCPU *vcpu = data;
u64 cur_itc,vitm;
UINT64 vec;
@@ -105,7 +105,6 @@
//fire_itc2 = cur_itc;
//fire_itm2 = vitm;
update_last_itc(vtm,cur_itc); // pseudo read to update vITC
- vtm->timer_hooked = 0;
}
void vtm_init(VCPU *vcpu)
@@ -118,12 +117,7 @@
itc_freq = local_cpu_data->itc_freq;
vtm->cfg_max_jump=itc_freq*MAX_JUMP_STEP/1000;
vtm->cfg_min_grun=itc_freq*MIN_GUEST_RUNNING_TIME/1000;
- /* set up the actimer */
- init_ac_timer(&(vtm->vtm_timer));
- vtm->timer_hooked = 0;
- vtm->vtm_timer.cpu = 0; /* Init value for SMP case */
- vtm->vtm_timer.data = (unsigned long)vcpu;
- vtm->vtm_timer.function = vtm_timer_fn;
+ init_ac_timer(&vtm->vtm_timer, vtm_timer_fn, vcpu, 0);
vtm_reset(vcpu);
}
@@ -166,10 +160,8 @@
vtm=&(vcpu->arch.arch_vmx.vtm);
local_irq_save(spsr);
itv = VPD_CR(vcpu, itv);
- if ( ITV_IRQ_MASK(itv) && vtm->timer_hooked ) {
- rem_ac_timer(&(vtm->vtm_timer));
- vtm->timer_hooked = 0;
- }
+ if ( ITV_IRQ_MASK(itv) )
+ rem_ac_timer(&vtm->vtm_timer);
vtm_interruption_update(vcpu, vtm);
local_irq_restore(spsr);
}
@@ -204,25 +196,16 @@
if ( diff_last >= 0 ) {
// interrupt already fired.
- if ( vtm->timer_hooked ) {
- rem_ac_timer(&(vtm->vtm_timer));
- vtm->timer_hooked = 0;
- }
+ rem_ac_timer(&vtm->vtm_timer);
}
else if ( diff_now >= 0 ) {
// ITV is fired.
vmx_vcpu_pend_interrupt(vcpu, vitv&0xff);
}
/* Both last_itc & cur_itc < itm, wait for fire condition */
- else if ( vtm->timer_hooked ) {
- expires = NOW() + tick_to_ns(0-diff_now) + TIMER_SLOP;
- set_ac_timer(&vtm->vtm_timer, expires);
- }
else {
expires = NOW() + tick_to_ns(0-diff_now) + TIMER_SLOP;
- vtm->vtm_timer.cpu = vcpu->processor;
set_ac_timer(&vtm->vtm_timer, expires);
- vtm->timer_hooked = 1;
}
local_irq_restore(spsr);
}
@@ -233,16 +216,7 @@
*/
void vtm_domain_out(VCPU *vcpu)
{
- vtime_t *vtm;
- uint64_t spsr;
-
- vtm=&(vcpu->arch.arch_vmx.vtm);
- local_irq_save(spsr);
- if ( vtm->timer_hooked ) {
- rem_ac_timer(&(vtm->vtm_timer));
- vtm->timer_hooked = 0;
- }
- local_irq_restore(spsr);
+ rem_ac_timer(&vcpu->arch.arch_vmx.vtm.vtm_timer);
}
/*
@@ -256,8 +230,6 @@
vtm=&(vcpu->arch.arch_vmx.vtm);
vtm_interruption_update(vcpu, vtm);
}
-
-
/*
* Next for vLSapic
diff -Nru a/xen/arch/x86/vmx_intercept.c b/xen/arch/x86/vmx_intercept.c
--- a/xen/arch/x86/vmx_intercept.c 2005-05-25 11:01:31 -04:00
+++ b/xen/arch/x86/vmx_intercept.c 2005-05-25 11:01:31 -04:00
@@ -189,13 +189,13 @@
}
/* hooks function for the PIT initialization response iopacket */
-static void pit_timer_fn(unsigned long data)
+static void pit_timer_fn(void *data)
{
- struct vmx_virpit_t *vpit = (struct vmx_virpit_t*)data;
+ struct vmx_virpit_t *vpit = data;
- /*set the pending intr bit in shared page, send evtchn notification to
myself*/
+ /* Set the pending intr bit, and send evtchn notification to myself. */
if (test_and_set_bit(vpit->vector, vpit->intr_bitmap))
- vpit->pending_intr_nr++; /* if originaly set, then count the pending
intr */
+ vpit->pending_intr_nr++; /* already set, then count the pending intr */
set_ac_timer(&vpit->pit_timer, NOW() + MILLISECS(vpit->period));
}
@@ -249,11 +249,8 @@
vpit->intr_bitmap = intr;
/* set up the actimer */
- init_ac_timer(&(vpit->pit_timer));
- vpit->pit_timer.cpu = 0; /*FIXME: change for SMP */
- vpit->pit_timer.data = (unsigned long)vpit;
- vpit->pit_timer.function = pit_timer_fn;
- pit_timer_fn((unsigned long)vpit); /* timer seed */
+ init_ac_timer(&vpit->pit_timer, pit_timer_fn, vpit, 0);
+ pit_timer_fn(vpit); /* timer seed */
/*restore the state*/
p->state = STATE_IORESP_READY;
diff -Nru a/xen/common/ac_timer.c b/xen/common/ac_timer.c
--- a/xen/common/ac_timer.c 2005-05-25 11:01:31 -04:00
+++ b/xen/common/ac_timer.c 2005-05-25 11:01:31 -04:00
@@ -1,14 +1,8 @@
-/****************************************************************************
- * (C) 2002-2003 - Rolf Neugebauer - Intel Research Cambridge
- * (C) 2002-2003 University of Cambridge
- ****************************************************************************
- *
- * File: ac_timer.c
- * Author: Rolf Neugebauer (neugebar@xxxxxxxxxxxxx)
- * Keir Fraser (kaf24@xxxxxxxxxxxx)
- *
- * Environment: Xen Hypervisor
- * Description: Accurate timer for the Hypervisor
+/******************************************************************************
+ * ac_timer.c
+ *
+ * Copyright (c) 2002-2003 Rolf Neugebauer
+ * Copyright (c) 2002-2005 K A Fraser
*/
#include <xen/config.h>
@@ -202,7 +196,7 @@
int cpu = smp_processor_id();
struct ac_timer *t, **heap;
s_time_t now;
- void (*fn)(unsigned long);
+ void (*fn)(void *);
ac_timers[cpu].softirqs++;
@@ -219,7 +213,7 @@
if ( (fn = t->function) != NULL )
{
- unsigned long data = t->data;
+ void *data = t->data;
spin_unlock_irq(&ac_timers[cpu].lock);
(*fn)(data);
spin_lock_irq(&ac_timers[cpu].lock);
@@ -252,7 +246,7 @@
for ( j = 1; j <= GET_HEAP_SIZE(ac_timers[i].heap); j++ )
{
t = ac_timers[i].heap[j];
- printk (" %d : %p ex=0x%08X%08X %lu\n",
+ printk (" %d : %p ex=0x%08X%08X %p\n",
j, t, (u32)(t->expires>>32), (u32)t->expires, t->data);
}
spin_unlock_irqrestore(&ac_timers[i].lock, flags);
diff -Nru a/xen/common/sched_bvt.c b/xen/common/sched_bvt.c
--- a/xen/common/sched_bvt.c 2005-05-25 11:01:31 -04:00
+++ b/xen/common/sched_bvt.c 2005-05-25 11:01:31 -04:00
@@ -94,9 +94,9 @@
/* Warp/unwarp timer functions */
-static void warp_timer_fn(unsigned long pointer)
+static void warp_timer_fn(void *data)
{
- struct bvt_dom_info *inf = (struct bvt_dom_info *)pointer;
+ struct bvt_dom_info *inf = data;
unsigned int cpu = inf->domain->exec_domain[0]->processor;
spin_lock_irq(&schedule_data[cpu].schedule_lock);
@@ -115,9 +115,9 @@
spin_unlock_irq(&schedule_data[cpu].schedule_lock);
}
-static void unwarp_timer_fn(unsigned long pointer)
+static void unwarp_timer_fn(void *data)
{
- struct bvt_dom_info *inf = (struct bvt_dom_info *)pointer;
+ struct bvt_dom_info *inf = data;
unsigned int cpu = inf->domain->exec_domain[0]->processor;
spin_lock_irq(&schedule_data[cpu].schedule_lock);
@@ -212,15 +212,9 @@
inf->warp_value = 0;
inf->warpl = MILLISECS(2000);
inf->warpu = MILLISECS(1000);
- /* initialise the timers */
- init_ac_timer(&inf->warp_timer);
- inf->warp_timer.cpu = d->processor;
- inf->warp_timer.data = (unsigned long)inf;
- inf->warp_timer.function = &warp_timer_fn;
- init_ac_timer(&inf->unwarp_timer);
- inf->unwarp_timer.cpu = d->processor;
- inf->unwarp_timer.data = (unsigned long)inf;
- inf->unwarp_timer.function = &unwarp_timer_fn;
+ /* Initialise the warp timers. */
+ init_ac_timer(&inf->warp_timer, warp_timer_fn, inf, d->processor);
+ init_ac_timer(&inf->unwarp_timer, unwarp_timer_fn, inf, d->processor);
}
einf->exec_domain = d;
diff -Nru a/xen/common/sched_sedf.c b/xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c 2005-05-25 11:01:31 -04:00
+++ b/xen/common/sched_sedf.c 2005-05-25 11:01:31 -04:00
@@ -116,6 +116,7 @@
struct list_head runnableq;
struct list_head waitq;
struct list_head extraq[2];
+ s_time_t current_slice_expires;
};
#define EDOM_INFO(d) ((struct sedf_edom_info *)((d)->sched_priv))
@@ -350,11 +351,12 @@
d->vcpu_id);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|