From: Ryan Harper <ryanh@us.ibm.com>
To: Ryan Harper <ryanh@us.ibm.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] xen, xen-sparse: modify spinlocks to use directed yield
Date: Fri, 20 May 2005 13:17:55 -0500 [thread overview]
Message-ID: <20050520181755.GE7577@us.ibm.com> (raw)
In-Reply-To: <20050520165403.GB7577@us.ibm.com>
* Ryan Harper <ryanh@us.ibm.com> [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@us.ibm.com
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@us.ibm.com>
---
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;
};
next prev parent reply other threads:[~2005-05-20 18:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-20 16:54 [PATCH] xen, xen-sparse: modify spinlocks to use directed yield Ryan Harper
2005-05-20 18:16 ` Ryan Harper
2005-05-20 18:17 ` Ryan Harper [this message]
2005-06-03 19:40 ` [PATCH] Yield to VCPU hcall, spinlock yielding Ryan Harper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050520181755.GE7577@us.ibm.com \
--to=ryanh@us.ibm.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.