Skip to contentSkip to conversation

some questions about Xenoprof

PATCH In review weiming 5 participants 6 messages Jan 5, 2009 – Jan 6, 2009 Xen hypervisor interface

lore
Share & tools
lore

weiming

author
#0 lore raw

Hi,

I want to use Xenoprof to monitors some system-wide events (like L2 misses etc).

1. I'm using Xen 3.3. I guess I don't need to patch it as I find that a hypercall and some source codes related to xenoprof are already there. So I just downloaded the patch against oprofile. After that, when I run opcontrol --help, I found that "--xen" was listed as an option. So I think my installation should be OK.

2. I will run some workloads on domU. What I want to monitor is the system-wide event counts like L2_LINES_IN. What should I do? Is running "opcontrol --start --no-vmlinux --event=XXXX:YYYY:ZZZZ" on dom0 enough? Need I specify "--passive-domains" or "--active-domains" ?

3. I'm running the system on a muliti-core machine. Can Xenoprof list the event counters per core?

Thanks a lot!
zwm

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 11 lines · weiming

Hi,

I want to use Xenoprof to monitors some system-wide events (like L2 misses etc).

1. I'm using Xen 3.3. I guess I don't need to patch it as I find that a hypercall and some source codes related to xenoprof are already there. So I just downloaded the patch against oprofile. After that, when I run opcontrol --help, I found that "--xen" was listed as an option. So I think my installation should be OK.

Quoted 7 lines

2. I will run some workloads on domU. What I want to monitor is the system-wide event counts like L2_LINES_IN. What should I do? Is running "opcontrol --start --no-vmlinux --event=XXXX:YYYY:ZZZZ" on dom0 enough? Need I specify "--passive-domains" or "--active-domains" ?

3. I'm running the system on a muliti-core machine. Can Xenoprof list the event counters per core?

Not per physical core. However, from what I understand, xenoprof can list the event counters per VCPU if you use the --separate=cpu option. So, you could pin the VCPUs to cores if that is what you really want.

Second, the current version of xenoprof has a bug that prevents it from correctly collecting per-VCPU info. Renato (cc-ed) should have a patch to fix this though.

Cheers,
Niraj

Signature · 2 lines
Niraj Tolia, Researcher, HP Labs
http://www.hpl.hp.com/personal/Niraj_Tolia/
author
#2 lore raw

Hi Niraj,

Thanks for letting me know the "--separate=cpu" option.

As regarding collecting system-wide events, is running the command "opcontrol --start --no-vmlinux --event=XXXX:YYYY:ZZZZ" on dom0 enough? I need host-level statistics, not just of dom0 itself.

Thanks!
zwm

Quoted 33 lines · Niraj Tolia
Quoted 3 lines · weiming

Hi,

I want to use Xenoprof to monitors some system-wide events (like L2

misses

Quoted 4 lines

etc).

1. I'm using Xen 3.3. I guess I don't need to patch it as I find that a hypercall and some source codes related to xenoprof are already there. So

I

Quoted 1 line

just downloaded the patch against oprofile. After that, when I run

opcontrol

Quoted 6 lines

--help, I found that "--xen" was listed as an option. So I think my installation should be OK.

2. I will run some workloads on domU. What I want to monitor is the system-wide event counts like L2_LINES_IN. What should I do? Is running "opcontrol --start --no-vmlinux --event=XXXX:YYYY:ZZZZ" on dom0 enough?

Need

Quoted 4 lines

I specify "--passive-domains" or "--active-domains" ?

3. I'm running the system on a muliti-core machine. Can Xenoprof list the event counters per core?

Not per physical core. However, from what I understand, xenoprof can list the event counters per VCPU if you use the --separate=cpu option. So, you could pin the VCPUs to cores if that is what you really want.

Second, the current version of xenoprof has a bug that prevents it from correctly collecting per-VCPU info. Renato (cc-ed) should have a patch to fix this though.

Quoted 7 lines

Cheers,
Niraj

--
Niraj Tolia, Researcher, HP Labs
http://www.hpl.hp.com/personal/Niraj_Tolia/

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

Nope, you need to either tell xenoprof to do active profiling or passive oprofiling, else it will only do profiling for dom0

For active profile do something like this,

opcontrol --start-daemon --active-domains=3,4 #here 3,4 are domIDs which we need to profile.
This will start the daemon but profiling will not start......

Now go to domU's
opcontrol --start

Go to dom0,
opcontrol --start

go to domU
opcontrol --dump
opreport

This will give you domU profile.....

For passive domain profiling, you need to patch the oprofile userland code. I would recommend oprofile-0.9.3. First download oprofile-0.9.3 and then patch it. The patch can be downloaded from http://xenoprof.sourceforge.net/

Best Regards,
Muhammad Atif
Best Regards,
Muhammad Atif

________________________________
From: weiming <[email protected]>
To: Niraj Tolia <[email protected]>
Cc: "[email protected]" <[email protected]>; "Santos, Jose Renato G" <[email protected]>
Sent: Monday, January 5, 2009 3:02:50 PM
Subject: Re: [Xen-devel] some questions about Xenoprof

Hi Niraj,

Thanks for letting me know the "--separate=cpu" option.

As regarding collecting system-wide events, is running the command "opcontrol --start --no-vmlinux --event=XXXX:YYYY:ZZZZ" on dom0 enough? I need host-level statistics, not just of dom0 itself.

Thanks!
zwm

On Sun, Jan 4, 2009 at 10:51 PM, Niraj Tolia <[email protected]> wrote:

Quoted 11 lines · weiming

Hi,

I want to use Xenoprof to monitors some system-wide events (like L2 misses etc).

1. I'm using Xen 3.3. I guess I don't need to patch it as I find that a hypercall and some source codes related to xenoprof are already there. So I just downloaded the patch against oprofile. After that, when I run opcontrol --help, I found that "--xen" was listed as an option. So I think my installation should be OK.

Quoted 7 lines

2. I will run some workloads on domU. What I want to monitor is the system-wide event counts like L2_LINES_IN. What should I do? Is running "opcontrol --start --no-vmlinux --event=XXXX:YYYY:ZZZZ" on dom0 enough? Need I specify "--passive-domains" or "--active-domains" ?

3. I'm running the system on a muliti-core machine. Can Xenoprof list the event counters per core?

Not per physical core. However, from what I understand, xenoprof can list the event counters per VCPU if you use the --separate=cpu option. So, you could pin the VCPUs to cores if that is what you really want.

Second, the current version of xenoprof has a bug that prevents it from correctly collecting per-VCPU info. Renato (cc-ed) should have a patch to fix this though.

Cheers,
Niraj

--
Niraj Tolia, Researcher, HP Labs
http://www.hpl.hp.com/personal/Niraj_Tolia/

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

PATCH 1/1 Enable Oprofile to separate samples by VCPU

In reply to Niraj Tolia

Currently Oprofile cannot separate samples by VCPU for Xen domains in passive mode. This patch fix that.

Renato

=====================================

# HG changeset patch
# User Jose Renato Santos <[email protected]>
# Date 1221866450 25200
# Node ID b01d4ed42d0904eefcc0b70899b5f388b0be4de7 # Parent 7e3c615803843e8f06b1225ee9b94909f14b8d5e [xenoprof] Assign passive domain samples to the right vcpu.

drivers/oprofile/buffer_sync.c Fri Sep 19 16:20:50 2008 -0700 renamed from drivers/oprofile/buffer_sync.c Mon Aug 25 09:32:10 2008 -0700 +11 -1
diff -r 7e3c61580384 -r b01d4ed42d09 drivers/oprofile/buffer_sync.c
@@ -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);
drivers/oprofile/cpu_buffer.c Fri Sep 19 16:20:50 2008 -0700 renamed from drivers/oprofile/cpu_buffer.c Mon Aug 25 09:32:10 2008 -0700 +2 -2
diff -r 7e3c61580384 -r b01d4ed42d09 drivers/oprofile/cpu_buffer.c
@@ -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;
 
drivers/xen/xenoprof/xenoprofile.c Fri Sep 19 16:20:50 2008 -0700 renamed from drivers/xen/xenoprof/xenoprofile.c Mon Aug 25 09:32:10 2008 -0700 +5 -9
diff -r 7e3c61580384 -r b01d4ed42d09 drivers/xen/xenoprof/xenoprofile.c
@@ -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
include/linux/oprofile.h Fri Sep 19 16:20:50 2008 -0700 renamed from include/linux/oprofile.h Mon Aug 25 09:32:10 2008 -0700 +1 -1
diff -r 7e3c61580384 -r b01d4ed42d09 include/linux/oprofile.h
@@ -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
#5 lore raw

Re: [PATCH] Enable Oprofile to separate samples by VCPU

Doesn't apply to linux-2.6.18-xen.hg. I'm not sure if it's a patch formatting issue or if the patch applies to a different tree.

-- Keir

Quoted 129 lines · Jose Renato G

Currently Oprofile cannot separate samples by VCPU for Xen domains in passive mode.
This patch fix that.

Renato

=====================================

# HG changeset patch
# User Jose Renato Santos <[email protected]>
# 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

drivers/oprofile/buffer_sync.c Fri Sep 19 16:20:50 2008 -0700 renamed from drivers/oprofile/buffer_sync.c Mon Aug 25 09:32:10 2008 -0700 +11 -1
@@ -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

drivers/oprofile/cpu_buffer.c Fri Sep 19 16:20:50 2008 -0700 renamed from drivers/oprofile/cpu_buffer.c Mon Aug 25 09:32:10 2008 -0700 +2 -2
@@ -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

drivers/xen/xenoprof/xenoprofile.c Fri Sep 19 16:20:50 2008 -0700 renamed from drivers/xen/xenoprof/xenoprofile.c Mon Aug 25 09:32:10 2008 -0700 +5 -9
@@ -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

include/linux/oprofile.h Fri Sep 19 16:20:50 2008 -0700 renamed from include/linux/oprofile.h Mon Aug 25 09:32:10 2008 -0700 +1 -1
@@ -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
[email protected]
http://lists.xensource.com/xen-devel