[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xen, xen-sparse: modify spinlocks to use directed yield
* Ryan Harper <ryanh@xxxxxxxxxx> [2005-05-20 11:55]: > The following patch creates a new hypercall, do_confer() which allows a Here is a debug patch I've been using to go along with it. Comment out the printks in the do_confer() routine if you are measuring performance. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@xxxxxxxxxx diffstat output: common/keyhandler.c | 30 ++++++++++++++++++++++++++++++ common/schedule.c | 19 ++++++++++++++++--- include/xen/sched.h | 3 +++ 3 files changed, 49 insertions(+), 3 deletions(-) Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx> --- diff -urN confer/xen/common/keyhandler.c debug/xen/common/keyhandler.c --- confer/xen/common/keyhandler.c 2005-05-19 22:20:27.000000000 -0500 +++ debug/xen/common/keyhandler.c 2005-05-20 10:39:03.565845280 -0500 @@ -11,6 +11,7 @@ #include <xen/sched.h> #include <xen/softirq.h> #include <asm/debugger.h> +#include <public/xen.h> #define KEY_MAX 256 #define STR_MAX 64 @@ -138,6 +139,33 @@ read_unlock(&domlist_lock); } +static void do_dump_confer(unsigned char key) +{ + struct domain *d; + struct exec_domain *ed; + s_time_t now = NOW(); + + printk("'%c' pressed -> dumping confer stats (now=0x%X:%08X)\n", key, + (u32)(now>>32), (u32)now); + + read_lock(&domlist_lock); + for_each_domain ( d ) + { + for_each_exec_domain ( d, ed ) + { + printk("Xen: DOM %d, VCPU %d, CPU %d," + " confers %d, confer_out %d," + " confer_in %d, yield_count %d\n", + d->domain_id, ed->vcpu_id, ed->processor, + ed->confercnt, ed->confer_out, + ed->confer_in, ed->vcpu_info->yield_count + ); + } + + } + read_unlock(&domlist_lock); +} + extern void dump_runq(unsigned char key); extern void print_sched_histo(unsigned char key); extern void reset_sched_histo(unsigned char key); @@ -183,6 +211,8 @@ register_keyhandler( 'q', do_task_queues, "dump task queues + guest state"); register_keyhandler( + 'c', do_dump_confer, "dump confer stats"); + register_keyhandler( 'r', dump_runq, "dump run queues"); register_irq_keyhandler( 'R', halt_machine, "reboot machine"); diff -urN confer/xen/common/schedule.c debug/xen/common/schedule.c --- confer/xen/common/schedule.c 2005-05-20 10:37:58.367756896 -0500 +++ debug/xen/common/schedule.c 2005-05-20 10:39:03.575843760 -0500 @@ -228,7 +228,11 @@ if ( test_bit(_VCPUF_conferring, ¤t->vcpu_flags) ) { clear_bit(_VCPUF_conferring, ¤t->vcpu_flags); set_bit(_VCPUF_conferred, ¤t->vcpu_flags); + /* increment confer counters */ + current->confer_out++; + ed->confer_in++; } + SCHED_OP(wake, ed); #ifdef WAKE_HISTO ed->wokenup = NOW(); @@ -283,6 +287,9 @@ { struct domain *d = current->domain; + /* count hcalls */ + current->confercnt++; + /* Validate CONFER prereqs: * - vcpu is within bounds * - vcpu is a valid in this domain @@ -299,16 +306,22 @@ if (d->exec_domain[vcpu] == NULL) return 0; - if (!test_bit(_VCPUF_canconfer, ¤t->vcpu_flags)) + if (!test_bit(_VCPUF_canconfer, ¤t->vcpu_flags)) { + printk("confer: canconfer not set, %d->vcpu-flags = 0x%08lx\n", current->vcpu_id, current->vcpu_flags); return 0; + } /* even counts indicate a running vcpu, odd is preempted/conferred */ /* don't confer if holder is currently running */ - if ((d->exec_domain[vcpu]->vcpu_info->yield_count & 1) == 0) + if ((d->exec_domain[vcpu]->vcpu_info->yield_count & 1) == 0) { + printk("confer: vcpu %d already running\n", vcpu); return 0; + } - if (d->exec_domain[vcpu]->vcpu_info->yield_count != yield_count) + if (d->exec_domain[vcpu]->vcpu_info->yield_count != yield_count) { + printk("confer: yield_count mismatch\n"); return 0; + } /* * set current's state to conferring, wake target diff -urN confer/xen/include/xen/sched.h debug/xen/include/xen/sched.h --- confer/xen/include/xen/sched.h 2005-05-20 10:37:58.378755224 -0500 +++ debug/xen/include/xen/sched.h 2005-05-20 10:39:03.577843456 -0500 @@ -87,6 +87,9 @@ atomic_t pausecnt; cpumap_t cpumap; /* which cpus this domain can run on */ + u32 confer_out; /* inc when conferring to another vcpu */ + u32 confer_in; /* inc when conferred from another vcpu */ + u32 confercnt; /* # of do_confer hcalls */ struct arch_exec_domain arch; }; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |