ChangeSet 1.1361, 2005/03/24 17:22:38+00:00, kaf24@xxxxxxxxxxxxxxxxxxxx
Fix VIRQ_TIMER holdoff for SMP guests.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c | 18 ++----
xen/arch/ia64/patch/linux-2.6.7/time.c | 2
xen/arch/x86/time.c | 16 ++----
xen/common/sched_atropos.c | 4 -
xen/common/sched_bvt.c | 4 -
xen/common/sched_rrobin.c | 4 -
xen/common/schedule.c | 53 ++++++++++++--------
xen/include/xen/sched-if.h | 40 ++++++---------
xen/include/xen/sched.h | 1
xen/include/xen/time.h | 6 +-
10 files changed, 74 insertions(+), 74 deletions(-)
diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c
b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c
--- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c 2005-03-24
13:01:53 -05:00
+++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/time.c 2005-03-24
13:01:53 -05:00
@@ -672,6 +672,7 @@
{
u64 alarm = 0;
int ret = 0;
+ unsigned long j;
#ifdef CONFIG_SMP
unsigned long seq;
#endif
@@ -685,13 +686,14 @@
#ifdef CONFIG_SMP
do {
seq = read_seqbegin(&xtime_lock);
- if (smp_processor_id())
- alarm = __jiffies_to_st(jiffies + 1);
- else
- alarm = __jiffies_to_st(jiffies + 1);
+ j = jiffies + 1;
+ alarm = __jiffies_to_st(j);
} while (read_seqretry(&xtime_lock, seq));
#else
- alarm = __jiffies_to_st(next_timer_interrupt());
+ j = next_timer_interrupt();
+ if (j < (jiffies + 1))
+ j = jiffies + 1;
+ alarm = __jiffies_to_st(j);
#endif
/* Failure is pretty bad, but we'd best soldier on. */
@@ -726,7 +728,6 @@
}
#ifdef CONFIG_SMP
-#define xxprint(msg) HYPERVISOR_console_io(CONSOLEIO_write, strlen(msg), msg)
static irqreturn_t local_timer_interrupt(int irq, void *dev_id,
struct pt_regs *regs)
@@ -762,11 +763,6 @@
if (regs)
profile_tick(CPU_PROFILING, regs);
#endif
- }
-
- if (smp_processor_id() == 0) {
- xxprint("bug bug\n");
- BUG();
}
return IRQ_HANDLED;
diff -Nru a/xen/arch/ia64/patch/linux-2.6.7/time.c
b/xen/arch/ia64/patch/linux-2.6.7/time.c
--- a/xen/arch/ia64/patch/linux-2.6.7/time.c 2005-03-24 13:01:53 -05:00
+++ b/xen/arch/ia64/patch/linux-2.6.7/time.c 2005-03-24 13:01:53 -05:00
@@ -70,11 +70,11 @@
+ return now;
+}
+
-+int update_dom_time(struct exec_domain *ed)
++void update_dom_time(struct exec_domain *ed)
+{
+// FIXME: implement this?
+// printf("update_dom_time: called, not implemented, skipping\n");
-+ return 0;
++ return;
+}
+
+/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
diff -Nru a/xen/arch/x86/time.c b/xen/arch/x86/time.c
--- a/xen/arch/x86/time.c 2005-03-24 13:01:53 -05:00
+++ b/xen/arch/x86/time.c 2005-03-24 13:01:53 -05:00
@@ -296,18 +296,16 @@
spin_unlock(&d->time_lock);
}
-int update_dom_time(struct exec_domain *ed)
+void update_dom_time(struct exec_domain *ed)
{
unsigned long flags;
- if ( ed->domain->shared_info->tsc_timestamp == full_tsc_irq )
- return 0;
-
- read_lock_irqsave(&time_lock, flags);
- __update_dom_time(ed);
- read_unlock_irqrestore(&time_lock, flags);
-
- return 1;
+ if ( ed->domain->shared_info->tsc_timestamp != full_tsc_irq )
+ {
+ read_lock_irqsave(&time_lock, flags);
+ __update_dom_time(ed);
+ read_unlock_irqrestore(&time_lock, flags);
+ }
}
/* Set clock to <secs,usecs> after 00:00:00 UTC, 1 January, 1970. */
diff -Nru a/xen/common/sched_atropos.c b/xen/common/sched_atropos.c
--- a/xen/common/sched_atropos.c 2005-03-24 13:01:53 -05:00
+++ b/xen/common/sched_atropos.c 2005-03-24 13:01:53 -05:00
@@ -325,7 +325,7 @@
/**
* ATROPOS - main scheduler function
*/
-task_slice_t ksched_scheduler(s_time_t time)
+struct task_slice ksched_scheduler(s_time_t time)
{
struct domain *cur_sdom = current; /* Current sdom */
s_time_t newtime;
@@ -335,7 +335,7 @@
struct at_dom_info *cur_info;
static unsigned long waitq_rrobin = 0;
int i;
- task_slice_t ret;
+ struct task_slice ret;
cur_info = DOM_INFO(cur_sdom);
diff -Nru a/xen/common/sched_bvt.c b/xen/common/sched_bvt.c
--- a/xen/common/sched_bvt.c 2005-03-24 13:01:53 -05:00
+++ b/xen/common/sched_bvt.c 2005-03-24 13:01:53 -05:00
@@ -363,7 +363,7 @@
* i.e., the domain with lowest EVT.
* The runqueue should be ordered by EVT so that is easy.
*/
-static task_slice_t bvt_do_schedule(s_time_t now)
+static struct task_slice bvt_do_schedule(s_time_t now)
{
struct domain *d;
struct exec_domain *prev = current, *next = NULL, *next_prime, *ed;
@@ -375,7 +375,7 @@
struct bvt_edom_info *p_einf = NULL;
struct bvt_edom_info *next_einf = NULL;
struct bvt_edom_info *next_prime_einf = NULL;
- task_slice_t ret;
+ struct task_slice ret;
ASSERT(prev->ed_sched_priv != NULL);
ASSERT(prev_einf != NULL);
diff -Nru a/xen/common/sched_rrobin.c b/xen/common/sched_rrobin.c
--- a/xen/common/sched_rrobin.c 2005-03-24 13:01:53 -05:00
+++ b/xen/common/sched_rrobin.c 2005-03-24 13:01:53 -05:00
@@ -99,11 +99,11 @@
}
/* Main scheduling function */
-static task_slice_t rr_do_schedule(s_time_t now)
+static struct task_slice rr_do_schedule(s_time_t now)
{
struct domain *prev = current;
int cpu = current->processor;
- task_slice_t ret;
+ struct task_slice ret;
if ( !is_idle_task(prev) )
{
diff -Nru a/xen/common/schedule.c b/xen/common/schedule.c
--- a/xen/common/schedule.c 2005-03-24 13:01:53 -05:00
+++ b/xen/common/schedule.c 2005-03-24 13:01:53 -05:00
@@ -13,6 +13,15 @@
*
*/
+/*#define WAKE_HISTO*/
+/*#define BLOCKTIME_HISTO*/
+
+#if defined(WAKE_HISTO)
+#define BUCKETS 31
+#elif defined(BLOCKTIME_HISTO)
+#define BUCKETS 200
+#endif
+
#include <xen/config.h>
#include <xen/init.h>
#include <xen/lib.h>
@@ -31,15 +40,6 @@
static char opt_sched[10] = "bvt";
string_param("sched", opt_sched);
-/*#define WAKE_HISTO*/
-/*#define BLOCKTIME_HISTO*/
-
-#if defined(WAKE_HISTO)
-#define BUCKETS 31
-#elif defined(BLOCKTIME_HISTO)
-#define BUCKETS 200
-#endif
-
#define TIME_SLOP (s32)MICROSECS(50) /* allow time to slip a bit */
/*
@@ -66,7 +66,7 @@
static void dom_timer_fn(unsigned long data);
/* This is global for now so that private implementations can reach it */
-schedule_data_t schedule_data[NR_CPUS];
+struct schedule_data schedule_data[NR_CPUS];
extern struct scheduler sched_bvt_def;
// extern struct scheduler sched_rrobin_def;
@@ -371,7 +371,7 @@
struct exec_domain *prev = current, *next = NULL;
int cpu = prev->processor;
s_time_t now;
- task_slice_t next_slice;
+ struct task_slice next_slice;
s32 r_time; /* time for new dom to run */
perfc_incrc(sched_run);
@@ -446,9 +446,15 @@
TRACE_2D(TRC_SCHED_SWITCH, next->domain->id, next);
+ prev->sleep_tick = schedule_data[cpu].tick;
+
/* Ensure that the domain has an up-to-date time base. */
- if ( !is_idle_task(next->domain) && update_dom_time(next) )
- send_guest_virq(next, VIRQ_TIMER);
+ if ( !is_idle_task(next->domain) )
+ {
+ update_dom_time(next);
+ if ( next->sleep_tick != schedule_data[cpu].tick )
+ send_guest_virq(next, VIRQ_TIMER);
+ }
context_switch(prev, next);
}
@@ -468,7 +474,7 @@
* - dom_timer: per domain timer to specifiy timeout values
****************************************************************************/
-/* The scheduler timer: force a run through the scheduler*/
+/* The scheduler timer: force a run through the scheduler */
static void s_timer_fn(unsigned long unused)
{
TRACE_0D(TRC_SCHED_S_TIMER_FN);
@@ -476,20 +482,26 @@
perfc_incrc(sched_irq);
}
-/* Periodic tick timer: send timer event to current domain*/
+/* Periodic tick timer: send timer event to current domain */
static void t_timer_fn(unsigned long unused)
{
- struct exec_domain *ed = current;
+ struct exec_domain *ed = current;
+ unsigned int cpu = ed->processor;
TRACE_0D(TRC_SCHED_T_TIMER_FN);
-------------------------------------------------------
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
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/xen-changelog
|