Currently Oprofile cannot separate samples by VCPU for Xen domains in passive
mode.
This patch fix that.
Renato
=====================================
Signed-of-by: Jose Renato Santos <jsantos@xxxxxxxxxx>
# HG changeset patch
# User Jose Renato Santos <jsantos@xxxxxxxxxx>
# Date 1221866450 25200
# Node ID b01d4ed42d0904eefcc0b70899b5f388b0be4de7
# Parent 7e3c615803843e8f06b1225ee9b94909f14b8d5e
[xenoprof] Assign passive domain samples to the right vcpu.
diff -r 7e3c61580384 -r b01d4ed42d09 drivers/oprofile/buffer_sync.c
--- a/drivers/oprofile/buffer_sync.c Mon Aug 25 09:32:10 2008 -0700
+++ b/drivers/oprofile/buffer_sync.c Fri Sep 19 16:20:50 2008 -0700
@@ -276,7 +276,15 @@ static unsigned long lookup_dcookie(stru
static unsigned long last_cookie = INVALID_COOKIE;
-
+
+/* same as add_cpu_switch() without invalidating COOKIE */
+static void add_vcpu_switch(int i)
+{
+ add_event_entry(ESCAPE_CODE);
+ add_event_entry(CPU_SWITCH_CODE);
+ add_event_entry(i);
+}
+
static void add_cpu_switch(int i)
{
add_event_entry(ESCAPE_CODE);
@@ -572,6 +580,7 @@ void sync_buffer(int cpu)
if (domain_switch) {
cpu_current_domain[cpu] = s->eip;
add_domain_switch(s->eip);
+ add_vcpu_switch(s->event);
domain_switch = 0;
} else {
if (cpu_current_domain[cpu] !=
@@ -595,6 +604,7 @@ void sync_buffer(int cpu)
/* We reset domain to COORDINATOR at each CPU switch */
if (cpu_current_domain[cpu] != COORDINATOR_DOMAIN) {
add_domain_switch(COORDINATOR_DOMAIN);
+ add_vcpu_switch(cpu);
}
mark_done(cpu);
diff -r 7e3c61580384 -r b01d4ed42d09 drivers/oprofile/cpu_buffer.c
--- a/drivers/oprofile/cpu_buffer.c Mon Aug 25 09:32:10 2008 -0700
+++ b/drivers/oprofile/cpu_buffer.c Fri Sep 19 16:20:50 2008 -0700
@@ -281,7 +281,7 @@ void oprofile_add_trace(unsigned long pc
add_sample(cpu_buf, pc, 0);
}
-int oprofile_add_domain_switch(int32_t domain_id)
+int oprofile_add_domain_switch(int32_t domain_id, unsigned int vcpu)
{
struct oprofile_cpu_buffer * cpu_buf = &cpu_buffer[smp_processor_id()];
@@ -293,7 +293,7 @@ int oprofile_add_domain_switch(int32_t d
return 0;
add_code(cpu_buf, CPU_DOMAIN_SWITCH);
- add_sample(cpu_buf, domain_id, 0);
+ add_sample(cpu_buf, domain_id, vcpu);
current_domain = domain_id;
diff -r 7e3c61580384 -r b01d4ed42d09 drivers/xen/xenoprof/xenoprofile.c
--- a/drivers/xen/xenoprof/xenoprofile.c Mon Aug 25 09:32:10 2008 -0700
+++ b/drivers/xen/xenoprof/xenoprofile.c Fri Sep 19 16:20:50 2008 -0700
@@ -171,27 +171,23 @@ static void xenoprof_handle_passive(void
static void xenoprof_handle_passive(void)
{
int i, j;
- int flag_domain, flag_switch = 0;
+ int flag_switch = 0;
for (i = 0; i < pdomains; i++) {
- flag_domain = 0;
for (j = 0; j < passive_domains[i].nbuf; j++) {
xenoprof_buf_t *buf = p_xenoprof_buf[i][j];
if (buf->event_head == buf->event_tail)
continue;
- if (!flag_domain) {
- if (!oprofile_add_domain_switch(
- passive_domains[i].domain_id))
- goto done;
- flag_domain = 1;
- }
+ if (!oprofile_add_domain_switch(
+ passive_domains[i].domain_id, j))
+ goto done;
xenoprof_add_pc(buf, 1);
flag_switch = 1;
}
}
done:
if (flag_switch)
- oprofile_add_domain_switch(COORDINATOR_DOMAIN);
+ oprofile_add_domain_switch(COORDINATOR_DOMAIN,
smp_processor_id());
}
static irqreturn_t
diff -r 7e3c61580384 -r b01d4ed42d09 include/linux/oprofile.h
--- a/include/linux/oprofile.h Mon Aug 25 09:32:10 2008 -0700
+++ b/include/linux/oprofile.h Fri Sep 19 16:20:50 2008 -0700
@@ -86,7 +86,7 @@ void oprofile_add_trace(unsigned long ei
void oprofile_add_trace(unsigned long eip);
/* add a domain switch entry */
-int oprofile_add_domain_switch(int32_t domain_id);
+int oprofile_add_domain_switch(int32_t domain_id, unsigned int vcpu);
/**
* Create a file of the given name as a child of the given root, with
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|