aboutsummaryrefslogtreecommitdiffstats
path: root/xen
diff options
context:
space:
mode:
Diffstat (limited to 'xen')
-rw-r--r--xen/common/dom0_ops.c18
-rw-r--r--xen/common/domain.c18
-rw-r--r--xen/common/keyhandler.c7
-rw-r--r--xen/common/perfc.c120
-rw-r--r--xen/include/xeno/ac_timer.h10
-rw-r--r--xen/include/xeno/perfc.h21
-rw-r--r--xen/include/xeno/perfc_defn.h16
7 files changed, 120 insertions, 90 deletions
diff --git a/xen/common/dom0_ops.c b/xen/common/dom0_ops.c
index aa7768c033..e6d54e9695 100644
--- a/xen/common/dom0_ops.c
+++ b/xen/common/dom0_ops.c
@@ -126,14 +126,22 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
}
break;
+ case DOM0_BVTCTL:
+ {
+ unsigned long ctx_allow = op.u.bvtctl.ctx_allow;
+ ret = sched_bvtctl(ctx_allow);
+
+ }
+ break;
+
case DOM0_ADJUSTDOM:
{
unsigned int dom = op.u.adjustdom.domain;
- unsigned long mcu_adv = op.u.adjustdom.mcu_adv;
- unsigned long warp = op.u.adjustdom.warp;
- unsigned long warpl = op.u.adjustdom.warpl;
- unsigned long warpu = op.u.adjustdom.warpu;
-
+ unsigned long mcu_adv = op.u.adjustdom.mcu_adv;
+ unsigned long warp = op.u.adjustdom.warp;
+ unsigned long warpl = op.u.adjustdom.warpl;
+ unsigned long warpu = op.u.adjustdom.warpu;
+
if ( dom == IDLE_DOMAIN_ID )
{
diff --git a/xen/common/domain.c b/xen/common/domain.c
index 32bf8b7172..5fc4304c01 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -58,10 +58,11 @@ struct task_struct *do_newdomain(unsigned int dom_id, unsigned int cpu)
SET_GDT_ADDRESS(p, DEFAULT_GDT_ADDRESS);
p->addr_limit = USER_DS;
- p->state = TASK_UNINTERRUPTIBLE;
p->active_mm = &p->mm;
p->num_net_vifs = 0;
+ sched_add_domain(p);
+
p->net_ring_base = (net_ring_t *)(p->shared_info + 1);
INIT_LIST_HEAD(&p->pg_head);
p->max_pages = p->tot_pages = 0;
@@ -115,7 +116,8 @@ void kill_domain(void)
}
printk("Killing domain %d\n", current->domain);
- current->state = TASK_DYING;
+
+ sched_rem_domain(current);
schedule();
BUG(); /* never get here */
}
@@ -293,7 +295,7 @@ int final_setup_guestos(struct task_struct * p, dom_meminfo_t * meminfo)
/* set up the shared info structure */
update_dom_time(p->shared_info);
- p->shared_info->cpu_freq = cpu_freq;
+ p->shared_info->cpu_freq = cpu_freq;
p->shared_info->domain_time = 0;
/* we pass start info struct to guest os as function parameter on stack */
@@ -516,8 +518,8 @@ int setup_guestos(struct task_struct *p, dom0_newdomain_t *params)
unmap_domain_mem(l1start);
/* Set up shared info area. */
- update_dom_time(p->shared_info);
- p->shared_info->cpu_freq = cpu_freq;
+ update_dom_time(p->shared_info);
+ p->shared_info->cpu_freq = cpu_freq;
p->shared_info->domain_time = 0;
@@ -555,7 +557,7 @@ int setup_guestos(struct task_struct *p, dom0_newdomain_t *params)
#define SHIP2GUEST(_x) (virt_shinfo_address | (((unsigned long)(_x)) & 0xFFF))
virt_startinfo_address->net_rings =
- (net_ring_t *)SHIP2GUEST(p->net_ring_base);
+ (net_ring_t *)SHIP2GUEST(p->net_ring_base);
virt_startinfo_address->num_net_rings = p->num_net_vifs;
/* Add block io interface */
@@ -597,7 +599,5 @@ int setup_guestos(struct task_struct *p, dom0_newdomain_t *params)
void __init domain_init(void)
{
- printk("Initialising domains\n");
+ printk("Initialising domains\n");
}
-
-
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index 12fd4e7105..e9f99fcf89 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -1,8 +1,6 @@
#include <xeno/keyhandler.h>
#include <xeno/reboot.h>
-extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs);
-
#define KEY_MAX 256
#define STR_MAX 64
@@ -71,8 +69,6 @@ void halt_machine(u_char key, void *dev_id, struct pt_regs *regs)
return;
}
-
-
/* XXX SMH: this is keir's fault */
static char *task_states[] =
{
@@ -110,6 +106,8 @@ void do_task_queues(u_char key, void *dev_id, struct pt_regs *regs)
}
+extern void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs);
+extern void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs);
extern void dump_timerq(u_char key, void *dev_id, struct pt_regs *regs);
extern void dump_runq(u_char key, void *dev_id, struct pt_regs *regs);
@@ -127,6 +125,7 @@ void initialize_keytable()
add_key_handler('d', dump_registers, "dump registers");
add_key_handler('h', show_handlers, "show this message");
add_key_handler('p', perfc_printall, "print performance counters");
+ add_key_handler('P', perfc_reset, "reset performance counters");
add_key_handler('q', do_task_queues, "dump task queues + guest state");
add_key_handler('r', dump_runq, "dump run queue");
add_key_handler('R', halt_machine, "reboot machine ungracefully");
diff --git a/xen/common/perfc.c b/xen/common/perfc.c
index 925ac77264..cc277a914a 100644
--- a/xen/common/perfc.c
+++ b/xen/common/perfc.c
@@ -2,8 +2,9 @@
* xen performance counters
*/
+#include <xeno/lib.h>
#include <xeno/smp.h>
-
+#include <xeno/time.h>
#include <xeno/perfc.h>
#include <xeno/keyhandler.h>
@@ -31,74 +32,85 @@ void __perfc_print (unsigned long counter[], int offset)
int num = 0;
for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++) {
- if (perfc_name[loop][0] == 'C') {
- element_size = NR_CPUS;
- cpus = 1;
- } else {
- num = sscanf (perfc_name[loop], "[%d]", &element_size);
- }
+ if (perfc_name[loop][0] == 'C') {
+ element_size = NR_CPUS;
+ cpus = 1;
+ } else {
+ num = sscanf (perfc_name[loop], "[%d]", &element_size);
+ }
- total_size += element_size == 0 ? 1 : element_size;
- if (total_size > offset) break;
+ total_size += element_size == 0 ? 1 : element_size;
+ if (total_size > offset) break;
}
if (loop == sizeof(perfc_name) / sizeof(char *)) {
- printf ("error: couldn't find variable\n");
- return;
+ printf ("error: couldn't find variable\n");
+ return;
}
if (element_size == 0) { /* single counter */
- printf ("%10ld 0x%08lx %s\n", counter[0], counter[0],
- perfc_name[loop] + 2 + num);
- } else if (cpus) { /* counter per CPU */
- for (loop = 0; loop < smp_num_cpus; loop++) {
- printf ("%10ld 0x%08lx cpu[%02d] %s\n",
- counter[loop], counter[loop],
- loop, perfc_name[loop]);
- }
-
+ printf ("%10ld 0x%08lx %s\n", counter[0], counter[0],
+ perfc_name[loop] + 2 + num);
+ } else if (cpus) { /* counter per CPU */
+ for (loop = 0; loop < smp_num_cpus; loop++) {
+ printf ("%10ld 0x%08lx cpu[%02d] %s\n",
+ counter[loop], counter[loop],
+ loop, perfc_name[loop]);
+ }
+
} else { /* show entire array */
- for (loop = 0; loop < element_size; loop++) {
- printf ("%10ld 0x%08lx %s:%d\n",
- counter[loop], counter[loop],
- perfc_name[loop] + 2 + num, loop);
- }
+ for (loop = 0; loop < element_size; loop++) {
+ printf ("%10ld 0x%08lx %s:%d\n",
+ counter[loop], counter[loop],
+ perfc_name[loop] + 2 + num, loop);
+ }
}
return;
}
void perfc_printall (u_char key, void *dev_id, struct pt_regs *regs)
{
- int loop, idx;
- int element_size;
- int cpus=0;
- int num = 0;
- unsigned long *counters = (unsigned long *)&perfcounters;
+ int loop, idx;
+ int element_size;
+ int cpus=0;
+ int num = 0;
+ s_time_t now = NOW();
+ unsigned long *counters = (unsigned long *)&perfcounters;
- printf ("xen performance counters\n");
+ printf ("xen performance counters: now=0x%08X%08X\n",
+ (u32)(now>>32), (u32)now);
- for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++) {
+ for (loop = 0; loop < sizeof(perfc_name) / sizeof(char *); loop++) {
- if (perfc_name[loop][0] == 'C') {
- element_size = NR_CPUS;
- cpus = 1;
- } else {
- num = sscanf (perfc_name[loop], "[%d]", &element_size);
- }
+ if (perfc_name[loop][0] == 'C') {
+ element_size = NR_CPUS;
+ cpus = 1;
+ } else {
+ num = sscanf (perfc_name[loop], "[%d]", &element_size);
+ }
- for (idx = 0; idx < (element_size ? element_size : 1); idx++) {
- if (cpus) {
- if (idx < smp_num_cpus)
- printf ("%10ld 0x%08lx cpu[%02d] %s\n",
- *counters, *counters, idx, perfc_name[loop] + 1);
- } else if (element_size) {
- printf ("%10ld 0x%08lx %s:%d\n",
- *counters, *counters, perfc_name[loop] + num + 2, idx);
- } else {
- printf ("%10ld 0x%08lx %s\n",
- *counters, *counters, perfc_name[loop] + num + 2);
- }
- counters++;
- }
- }
+ for (idx = 0; idx < (element_size ? element_size : 1); idx++) {
+ if (cpus) {
+ if (idx < smp_num_cpus)
+ printf ("%10ld 0x%08lx cpu[%02d] %s\n",
+ *counters, *counters, idx, perfc_name[loop] + 1);
+ } else if (element_size) {
+ printf ("%10ld 0x%08lx %s:%d\n",
+ *counters, *counters, perfc_name[loop] + num + 2, idx);
+ } else {
+ printf ("%10ld 0x%08lx %s\n",
+ *counters, *counters, perfc_name[loop] + num + 2);
+ }
+ counters++;
+ }
+ }
- return;
+ return;
}
+
+void perfc_reset (u_char key, void *dev_id, struct pt_regs *regs)
+{
+ s_time_t now = NOW();
+ printk ("xen performance counters reset: now=0x%08X%08X\n",
+ (u32)(now>>32), (u32)now);
+ memset (&perfcounters, 0, sizeof(perfcounters));
+}
+
diff --git a/xen/include/xeno/ac_timer.h b/xen/include/xeno/ac_timer.h
index 7cf568d2fc..280f377d17 100644
--- a/xen/include/xeno/ac_timer.h
+++ b/xen/include/xeno/ac_timer.h
@@ -43,10 +43,10 @@
*/
struct ac_timer {
- struct list_head timer_list;
- s_time_t expires; /* system time time out value */
- unsigned long data;
- void (*function)(unsigned long);
+ struct list_head timer_list;
+ s_time_t expires; /* system time time out value */
+ unsigned long data;
+ void (*function)(unsigned long);
};
/* interface for "clients" */
@@ -55,7 +55,7 @@ extern int rem_ac_timer(struct ac_timer *timer);
extern int mod_ac_timer(struct ac_timer *timer, s_time_t new_time);
static inline void init_ac_timer(struct ac_timer *timer)
{
- //timer->next = NULL;
+ timer->timer_list.next = NULL;
}
/* interface used by programmable timer, implemented hardware dependent */
diff --git a/xen/include/xeno/perfc.h b/xen/include/xeno/perfc.h
index 330bb8eba9..4d0164c170 100644
--- a/xen/include/xeno/perfc.h
+++ b/xen/include/xeno/perfc.h
@@ -10,14 +10,18 @@
* PERFCOUNTER_ARRY (counter, string, size) define an array of counters
*
* unsigned long perfc_value (counter) get value of a counter
+ * unsigned long perfc_valuec (counter) get value of a per CPU counter
* unsigned long perfc_valuea (counter, index) get value of an array counter
- * void perfc_incr (counter) increment a counter
- * void perfc_incrc (counter, index) increment a per CPU counter
- * void perfc_incra (counter, index) increment an array counter
- * void perfc_add (counter, value) add a value to a counter
- * void perfc_addc (counter, value) add a value to a per CPU counter
- * void perfc_adda (counter, index, value) add a value to array counter
- * void perfc_print (counter) print out the counter
+ * unsigned long perfc_set (counter, val) set value of a counter
+ * unsigned long perfc_setc (counter, val) set value of a per CPU counter
+ * unsigned long perfc_seta (counter, index, val) set value of an array counter
+ * void perfc_incr (counter) increment a counter
+ * void perfc_incrc (counter, index) increment a per CPU counter
+ * void perfc_incra (counter, index) increment an array counter
+ * void perfc_add (counter, value) add a value to a counter
+ * void perfc_addc (counter, value) add a value to a per CPU counter
+ * void perfc_adda (counter, index, value) add a value to array counter
+ * void perfc_print (counter) print out the counter
*/
#define PERFCOUNTER( var, name ) \
@@ -38,6 +42,9 @@ extern char *perfc_name[];
#define perfc_value(x) perfcounters.x[0]
#define perfc_valuec(x) perfcounters.x[smp_processor_id()]
#define perfc_valuea(x,y) perfcounters.x[y]
+#define perfc_set(x,v) perfcounters.x[0] = v
+#define perfc_setc(x,v) perfcounters.x[smp_processor_id()] = v
+#define perfc_seta(x,y,v) perfcounters.x[y] = v
#define perfc_incr(x) perfcounters.x[0]++
#define perfc_incrc(x) perfcounters.x[smp_processor_id()]++
#define perfc_incra(x,y) perfcounters.x[y]++
diff --git a/xen/include/xeno/perfc_defn.h b/xen/include/xeno/perfc_defn.h
index fde3e1dd72..f006079085 100644
--- a/xen/include/xeno/perfc_defn.h
+++ b/xen/include/xeno/perfc_defn.h
@@ -1,9 +1,13 @@
+PERFCOUNTER_CPU( irqs, "#interrupts" )
+PERFCOUNTER_CPU( irq_time, "cycles spent in irq handler" )
-PERFCOUNTER( blockio_tx, "block io: messages received from tx queue" )
-PERFCOUNTER( blockio_rx, "block io: messages sent on rx queue" )
+PERFCOUNTER( blockio_tx, "block io: messages received from tx queue" )
+PERFCOUNTER( blockio_rx, "block io: messages sent on rx queue" )
-PERFCOUNTER_CPU( apic_timer, "apic timer interrupts" )
-PERFCOUNTER_CPU( sched_irq, "sched: timer" )
-PERFCOUNTER_CPU( sched_run1, "sched: calls to schedule" )
-PERFCOUNTER_CPU( sched_run2, "sched: runs through scheduler" )
+PERFCOUNTER_CPU( apic_timer, "apic timer interrupts" )
+PERFCOUNTER_CPU( ac_timer_max, "ac_timer max error (ns)" )
+PERFCOUNTER_CPU( sched_irq, "sched: timer" )
+PERFCOUNTER_CPU( sched_run1, "sched: calls to schedule" )
+PERFCOUNTER_CPU( sched_run2, "sched: runs through scheduler" )
+PERFCOUNTER_CPU( sched_ctx, "sched: context switches" )