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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
On Sun, Jan 4, 2009 at 7:32 PM, weiming <zephyr.zhao@gmail.com> wrote:> 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?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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
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 <ntolia@gmail.com> wrote:> On Sun, Jan 4, 2009 at 7:32 PM, weiming <zephyr.zhao@gmail.com> wrote: > > 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? > > > 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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
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 <zephyr.zhao@gmail.com> To: Niraj Tolia <ntolia@gmail.com> Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>; "Santos, Jose Renato G" <joserenato.santos@hp.com> 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 <ntolia@gmail.com> wrote: On Sun, Jan 4, 2009 at 7:32 PM, weiming <zephyr.zhao@gmail.com> wrote:> 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?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 Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Santos, Jose Renato G
2009-Jan-06 02:18 UTC
[Xen-devel] [PATCH] Enable Oprofile to separate samples by VCPU
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@hpl.hp.com> # HG changeset patch # User Jose Renato Santos <jsantos@hpl.hp.com> # 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@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-Jan-06 14:05 UTC
Re: [Xen-devel] [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 On 06/01/2009 02:18, "Santos, Jose Renato G" <joserenato.santos@hp.com> wrote:> > 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@hpl.hp.com> > > # HG changeset patch > # User Jose Renato Santos <jsantos@hpl.hp.com> > # 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@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel