Various PCL fixes
Subsystems (2)
cover Various PCL fixes
Here are a few fixes for PCL I found when testing on ppc64.
PATCH 1/8 perf report: Fix -z option
Fix a copy and paste error, -z was setting the group option.
---
tools/perf/builtin-top.c +1 -1
@@ -675,7 +675,7 @@ "put the counters into a counter group"),OPT_STRING ('s' ,"sym-filter" , &sym_filter,"pattern" ,"only display symbols matchig this pattern" ), -OPT_BOOLEAN ('z' ,"zero" , &group, +OPT_BOOLEAN ('z' ,"zero" , &zero,"zero history across updates" ),OPT_INTEGER ('F' ,"freq" , &freq, "profile at this frequency"),
[tip:perfcounters/urgent] perf report: Fix -z option
Commit-ID: 1f208ea67821703fd4de056ea6f0baa81f4ad4a5 Gitweb: http://git.kernel.org/tip/1f208ea67821703fd4de056ea6f0baa81f4ad4a5 Author: Anton Blanchard <[email protected]> AuthorDate: Wed, 1 Jul 2009 09:00:44 +1000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 1 Jul 2009 01:25:18 +0200
perf report: Fix -z option
Fix a copy and paste error, -z was setting the group option.
LKML-Reference: <[email protected]>
--- tools/perf/builtin-top.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/builtin-top.c +1 -1
@@ -675,7 +675,7 @@ static const struct option options[] = { "put the counters into a counter group"),OPT_STRING ('s' ,"sym-filter" , &sym_filter,"pattern" ,"only display symbols matchig this pattern" ), -OPT_BOOLEAN ('z' ,"zero" , &group, +OPT_BOOLEAN ('z' ,"zero" , &zero,"zero history across updates" ),OPT_INTEGER ('F' ,"freq" , &freq, "profile at this frequency"),
PATCH 2/8 perf_counter tools: Remove zlib dependency
In reply to Anton BlanchardThe zlib devel libraries may not be installed and since we aren't using zlib we may as well remove it.
---
tools/perf/Makefile +0 -6
@@ -379,12 +379,6 @@ endif endif -ifdef ZLIB_PATH - BASIC_CFLAGS += -I$(ZLIB_PATH)/include - EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib) -endif -EXTLIBS += -lz - ifdef NEEDS_SOCKET EXTLIBS += -lsocket endif
[tip:perfcounters/urgent] perf_counter tools: Remove zlib dependency
Commit-ID: 6717534ddc328ae5cdf89f1ef802db83fc451f19 Gitweb: http://git.kernel.org/tip/6717534ddc328ae5cdf89f1ef802db83fc451f19 Author: Anton Blanchard <[email protected]> AuthorDate: Wed, 1 Jul 2009 09:00:45 +1000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 1 Jul 2009 01:25:18 +0200
perf_counter tools: Remove zlib dependency
The zlib devel libraries may not be installed and since we aren't using zlib we may as well remove it.
LKML-Reference: <[email protected]>
--- tools/perf/Makefile | 6 ------ 1 files changed, 0 insertions(+), 6 deletions(-)
tools/perf/Makefile +0 -6
@@ -381,12 +381,6 @@ ifndef CC_LD_DYNPATH endif endif -ifdef ZLIB_PATH - BASIC_CFLAGS += -I$(ZLIB_PATH)/include - EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib) -endif -EXTLIBS += -lz - ifdef NEEDS_SOCKET EXTLIBS += -lsocket endif
PATCH 3/8 perf top: Move skip symbols to an array
In reply to Anton BlanchardMove the list of symbols we skip into an array, making it easier to add new ones.
---
tools/perf/builtin-top.c +17 -7
@@ -286,11 +286,22 @@return NULL ; } +/* Tag samples to be skipped. */ +char *skip_symbols[] = { +"default_idle" , +"cpu_idle" , +"enter_idle" , +"exit_idle" , +"mwait_idle" , +NULL +}; +static int symbol_filter (struct dso *self,struct symbol *sym) {static int filter_match;struct sym_entry *syme;const char *name = sym->name; +int i; if (!strcmp(name, "_text") || !strcmp(name, "_etext") ||
@@ -302,13 +313,12 @@return 1 ; syme =dso__sym_priv (self, sym); -/* Tag samples to be skipped. */ -if (!strcmp ("default_idle" , name) || - !strcmp ("cpu_idle" , name) || - !strcmp ("enter_idle" , name) || - !strcmp ("exit_idle" , name) || - !strcmp ("mwait_idle" , name)) - syme->skip =1 ; +for (i =0 ; skip_symbols[i]; i++) { +if (!strcmp (skip_symbols[i], name)) { + syme->skip =1 ; +break ; + } + }if (filter_match ==1 ) { filter_end = sym->start;
[tip:perfcounters/urgent] perf top: Move skip symbols to an array
Commit-ID: 2ab52083ffc057014e502cf3473adc41436922fa Gitweb: http://git.kernel.org/tip/2ab52083ffc057014e502cf3473adc41436922fa Author: Anton Blanchard <[email protected]> AuthorDate: Wed, 1 Jul 2009 09:00:46 +1000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 1 Jul 2009 01:25:19 +0200
perf top: Move skip symbols to an array
Move the list of symbols we skip into an array, making it easier to add new ones.
LKML-Reference: <[email protected]>
--- tools/perf/builtin-top.c | 24 +++++++++++++++++------- 1 files changed, 17 insertions(+), 7 deletions(-)
tools/perf/builtin-top.c +17 -7
@@ -286,11 +286,22 @@ static void *display_thread(void *arg)return NULL ; } +/* Tag samples to be skipped. */ +char *skip_symbols[] = { +"default_idle" , +"cpu_idle" , +"enter_idle" , +"exit_idle" , +"mwait_idle" , +NULL +}; +static int symbol_filter (struct dso *self,struct symbol *sym) {static int filter_match;struct sym_entry *syme;const char *name = sym->name; +int i; if (!strcmp(name, "_text") || !strcmp(name, "_etext") ||
@@ -302,13 +313,12 @@ static int symbol_filter(struct dso *self, struct symbol *sym)return 1 ; syme =dso__sym_priv (self, sym); -/* Tag samples to be skipped. */ -if (!strcmp ("default_idle" , name) || - !strcmp ("cpu_idle" , name) || - !strcmp ("enter_idle" , name) || - !strcmp ("exit_idle" , name) || - !strcmp ("mwait_idle" , name)) - syme->skip =1 ; +for (i =0 ; skip_symbols[i]; i++) { +if (!strcmp (skip_symbols[i], name)) { + syme->skip =1 ; +break ; + } + }if (filter_match ==1 ) { filter_end = sym->start;
Re: [patch 3/8] perf top: Move skip symbols to an array
In reply to Anton BlanchardHI Anton,
tools/perf/builtin-top.c line 290
Quoted 3 lines · On Wed, 01 Jul 2009 09:00:46 +1000 Anton Blanchard <[email protected]> wrote:
tools/perf/builtin-top.c +2
-0+/* Tag samples to be skipped. */ +char *skip_symbols[] = {
"static const" ?
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [patch 3/8] perf top: Move skip symbols to an array
Quoted 8 lines · Stephen Rothwell
HI Anton,
tools/perf/builtin-top.c line 290
Quoted 3 lines · On Wed, 01 Jul 2009 09:00:46 +1000 Anton Blanchard <[email protected]> wrote:
tools/perf/builtin-top.c +2
-0+/* Tag samples to be skipped. */ +char *skip_symbols[] = {"static const" ?
I fixed this. Too bad there's no GCC warning for that. (Sparse catches is but it is not enabled yet for perf.)
Ingo
PATCH 4/8 perf top: Add ppc64 specific skip symbols and strip ppc64 . prefix
In reply to Anton BlanchardFilter out some ppc64 specific idle loop functions and remove leading '.' on ppc64 text symbols.
---
Do we want to wrap them with #ifdef __PPC__ ?
tools/perf/builtin-top.c +9 -0
@@ -293,6 +293,8 @@"enter_idle" ,"exit_idle" ,"mwait_idle" , +"ppc64_runlatch_off" , +"pseries_dedicated_idle_sleep" , NULL };
@@ -303,6 +305,13 @@const char *name = sym->name;int i; +/* +* ppc64 uses function descriptors and appends a '.' to the +* start of every instruction address. Remove it. +*/ +if (name[0 ] =='.' ) + name++; + if (!strcmp(name, "_text") || !strcmp(name, "_etext") || !strcmp(name, "_sinittext") ||
Re: [patch 4/8] perf top: Add ppc64 specific skip symbols and strip ppc64 . prefix
tools/perf/builtin-top.c line 297
Quoted 13 lines · Anton Blanchard
Filter out some ppc64 specific idle loop functions and remove leading '.' on ppc64 text symbols.
Signed-off-by Anton Blanchard <[email protected]>---
Do we want to wrap them with #ifdef
__PPC__?tools/perf/builtin-top.c +2
-0"enter_idle" ,"exit_idle" ,"mwait_idle" , +"ppc64_runlatch_off" , + "pseries_dedicated_idle_sleep",
We only want to wrap them into #ifdef __PPC__ if we do so for the x86 ones too.
I think it's fine as-is - the names should be pretty unique, right?
Ingo
Re: [patch 4/8] perf top: Add ppc64 specific skip symbols and strip ppc64 . prefix
Hi Ingo,
Quoted 11 lines
tools/perf/builtin-top.c line 297
Quoted 7 lines
Do we want to wrap them with #ifdef
__PPC__?tools/perf/builtin-top.c +2
-0"enter_idle" ,"exit_idle" ,"mwait_idle" , +"ppc64_runlatch_off" , + "pseries_dedicated_idle_sleep",We only want to wrap them into #ifdef
__PPC__if we do so for the x86 ones too.
Quoted 1 line
I think it's fine as-is - the names should be pretty unique, right?
I agree, we can start wrapping them if things get out of hand.
Anton
[tip:perfcounters/urgent] perf top: Add ppc64 specific skip symbols and strip ppc64 . prefix
In reply to Anton BlanchardCommit-ID: 3a3393ef75a14ae259a82f3f38624efa17884168 Gitweb: http://git.kernel.org/tip/3a3393ef75a14ae259a82f3f38624efa17884168 Author: Anton Blanchard <[email protected]> AuthorDate: Wed, 1 Jul 2009 09:00:47 +1000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 1 Jul 2009 01:25:19 +0200
perf top: Add ppc64 specific skip symbols and strip ppc64 . prefix
Filter out some ppc64 specific idle loop functions and remove leading '.' on ppc64 text symbols.
LKML-Reference: <[email protected]>
--- tools/perf/builtin-top.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
tools/perf/builtin-top.c +9 -0
@@ -293,6 +293,8 @@ char *skip_symbols[] = {"enter_idle" ,"exit_idle" ,"mwait_idle" , +"ppc64_runlatch_off" , +"pseries_dedicated_idle_sleep" , NULL };
@@ -303,6 +305,13 @@ static int symbol_filter(struct dso *self, struct symbol *sym)const char *name = sym->name;int i; +/* +* ppc64 uses function descriptors and appends a '.' to the +* start of every instruction address. Remove it. +*/ +if (name[0 ] =='.' ) + name++; + if (!strcmp(name, "_text") || !strcmp(name, "_etext") || !strcmp(name, "_sinittext") ||
PATCH 5/8 perf report: Fix reporting of hypervisor
In reply to Anton BlanchardPERF_EVENT_MISC_* is not a bitmask, so we have to mask and compare.
---
tools/perf/builtin-report.c +5 -2
@@ -1210,6 +1210,7 @@struct map *map =NULL ;void *more_data = event->ip.__more_data;struct ip_callchain *chain =NULL ; +int cpumode;if (sample_type &PERF_SAMPLE_PERIOD ) { period = *(u64 *)more_data;
@@ -1250,7 +1251,9 @@return -1 ; } -if (event->header.misc &PERF_EVENT_MISC_KERNEL ) { + cpumode = event->header.misc &PERF_EVENT_MISC_CPUMODE_MASK ; + +if (cpumode ==PERF_EVENT_MISC_KERNEL ) { show =SHOW_KERNEL ; level ='k' ;
@@ -1258,7 +1261,7 @@dprintf (" ...... dso: %s\n" , dso->name); - }else if (event->header.misc &PERF_EVENT_MISC_USER ) { + }else if (cpumode ==PERF_EVENT_MISC_USER ) { show =SHOW_USER ; level ='.' ;
[tip:perfcounters/urgent] perf report: Fix reporting of hypervisor
Commit-ID: d8db1b57d31a6b30ea2f0df318eab50fc92b38d6 Gitweb: http://git.kernel.org/tip/d8db1b57d31a6b30ea2f0df318eab50fc92b38d6 Author: Anton Blanchard <[email protected]> AuthorDate: Wed, 1 Jul 2009 09:00:48 +1000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 1 Jul 2009 01:25:20 +0200
perf report: Fix reporting of hypervisor
PERF_EVENT_MISC_* is not a bitmask, so we have to mask and compare.
LKML-Reference: <[email protected]>
--- tools/perf/builtin-report.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
tools/perf/builtin-report.c +5 -2
@@ -1213,6 +1213,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)struct map *map =NULL ;void *more_data = event->ip.__more_data;struct ip_callchain *chain =NULL ; +int cpumode;if (sample_type &PERF_SAMPLE_PERIOD ) { period = *(u64 *)more_data;
@@ -1256,7 +1257,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)if (comm_list && !strlist__has_entry (comm_list, thread->comm))return 0 ; -if (event->header.misc &PERF_EVENT_MISC_KERNEL ) { + cpumode = event->header.misc &PERF_EVENT_MISC_CPUMODE_MASK ; + +if (cpumode ==PERF_EVENT_MISC_KERNEL ) { show =SHOW_KERNEL ; level ='k' ;
@@ -1264,7 +1267,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head)dprintf (" ...... dso: %s\n" , dso->name); - }else if (event->header.misc &PERF_EVENT_MISC_USER ) { + }else if (cpumode ==PERF_EVENT_MISC_USER ) { show =SHOW_USER ; level ='.' ;
PATCH 6/8 perf report: Add hypervisor dso
In reply to Anton BlanchardAdd a dso for hypervisor samples. We don't get any symbol information on the ppc64 hypervisor but this at least gives us a high level summary of the time spent in there.
---
tools/perf/builtin-report.c +14 -1
@@ -118,6 +118,7 @@static LIST_HEAD (dsos);static struct dso *kernel_dso;static struct dso *vdso; +static struct dso *hypervisor_dso;static void dsos__add (struct dso *dso) {
@@ -199,6 +200,11 @@dsos__add (vdso); + hypervisor_dso =dso__new ("[hypervisor]" ,0 ); +if (!hypervisor_dso) +return -1 ; +dsos__add (hypervisor_dso); +return err; }
@@ -637,7 +643,8 @@if (self->sym) { ret +=fprintf (fp,"[%c] %s" , - self->dso == kernel_dso ?'k' :'.' , self->sym->name); + self->dso == kernel_dso ?'k' : + self->dso == hypervisor_dso ?'h' :'.' , self->sym->name); }else { ret +=fprintf (fp,"%#016llx" , (u64 )self->ip); }
@@ -960,6 +967,9 @@ }switch (context) { +case PERF_CONTEXT_HV : + dso = hypervisor_dso; +break ;case PERF_CONTEXT_KERNEL : dso = kernel_dso;break ;
@@ -1269,6 +1279,9 @@ }else { show =SHOW_HV ; level ='H' ; + + dso = hypervisor_dso; +dprintf (" ...... dso: [hypervisor]\n" ); }
[tip:perfcounters/urgent] perf report: Add hypervisor dso
Commit-ID: fb9c818873a788c5c01c9868cc6050df96e2c7df Gitweb: http://git.kernel.org/tip/fb9c818873a788c5c01c9868cc6050df96e2c7df Author: Anton Blanchard <[email protected]> AuthorDate: Wed, 1 Jul 2009 09:00:49 +1000 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 1 Jul 2009 01:25:20 +0200
perf report: Add hypervisor dso
Add a dso for hypervisor samples. We don't get any symbol information on the ppc64 hypervisor but this at least gives us a high level summary of the time spent in there.
LKML-Reference: <[email protected]>
--- tools/perf/builtin-report.c | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-)
tools/perf/builtin-report.c +14 -1
@@ -121,6 +121,7 @@ typedef union event_union {static LIST_HEAD (dsos);static struct dso *kernel_dso;static struct dso *vdso; +static struct dso *hypervisor_dso;static void dsos__add (struct dso *dso) {
@@ -202,6 +203,11 @@ static int load_kernel(void)dsos__add (vdso); + hypervisor_dso =dso__new ("[hypervisor]" ,0 ); +if (!hypervisor_dso) +return -1 ; +dsos__add (hypervisor_dso); +return err; }
@@ -640,7 +646,8 @@ sort__sym_print(FILE *fp, struct hist_entry *self)if (self->sym) { ret +=fprintf (fp,"[%c] %s" , - self->dso == kernel_dso ?'k' :'.' , self->sym->name); + self->dso == kernel_dso ?'k' : + self->dso == hypervisor_dso ?'h' :'.' , self->sym->name); }else { ret +=fprintf (fp,"%#016llx" , (u64 )self->ip); }
@@ -963,6 +970,9 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, }switch (context) { +case PERF_CONTEXT_HV : + dso = hypervisor_dso; +break ;case PERF_CONTEXT_KERNEL : dso = kernel_dso;break ;
@@ -1275,6 +1285,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) }else { show =SHOW_HV ; level ='H' ; + + dso = hypervisor_dso; +dprintf (" ...... dso: [hypervisor]\n" ); }
PATCH 7/8 powerpc: Cleanup PCL output by hiding and adding symbols
In reply to Anton BlanchardA lot of hits in "setup" doesn't make much sense, so hide this symbol and allow all the hits to end up in copy_4k_page.
Also add some dummy symbols for the branches at 0xf00, 0xf20 and 0xf40, otherwise hits end up in trap_0e which is confusing.
---
arch/powerpc/lib/copypage_64.S +2 -2
@@ -26,11 +26,11 @@ srd r8,r5,r11 mtctr r8 -setup: +.Lsetup: dcbt r9,r4 dcbz r9,r3 add r9,r9,r12 - bdnz setup + bdnz .Lsetup END_FTR_SECTION_IFSET(CPU_FTR_CP_USE_DCBTZ) addi r3,r3,-8 srdi r8,r5,7 /* page is copied in 128 byte strides */
arch/powerpc/kernel/exceptions-64s.S +3 -0
@@ -185,12 +185,15 @@ * prolog code of the PerformanceMonitor one. A little * trickery is thus necessary */ +performance_monitor_pSeries_1: . = 0xf00 b performance_monitor_pSeries +altivec_unavailable_pSeries_1: . = 0xf20 b altivec_unavailable_pSeries +vsx_unavailable_pSeries_1: . = 0xf40 b vsx_unavailable_pSeries
Re: [patch 7/8] powerpc: Cleanup PCL output by hiding and adding symbols
Quoted 7 lines · Anton Blanchard
A lot of hits in "setup" doesn't make much sense, so hide this symbol and allow all the hits to end up in
copy_4k_page.Also add some dummy symbols for the branches at
0xf00,0xf20and0xf40, otherwise hits end up intrap_0ewhich is confusing.Signed-off-by Anton Blanchard <[email protected]>
looks good (we have similar fixes for x86 too), but i think this one should go via BenH (Cc:-ed) as it affects generic PowerPC code.
Ingo
PATCH 8/8 powerpc: Fix PCL vdso detection
In reply to Anton BlanchardPCL uses arch_vma_name() to detect a vdso region which in turn uses current->mm->context.vdso_base. We need to initialise this before doing the mmap or else we fail to detect the vdso.
---
arch/powerpc/kernel/vdso.c +10 -4
@@ -235,6 +235,13 @@ }/* +* Put vDSO base into mm struct. We need to do this before calling +* install_special_mapping or the perf counter mmap tracking code +* will fail to recognise it as a vDSO (since arch_vma_name fails). +*/ + current->mm->context.vdso_base = vdso_base; + +/* * our vma flags don't have VM_WRITE so by default, the process isn't * allowed to write those pages. * gdb can break that with ptrace interface, and thus trigger COW on
@@ -254,11 +261,10 @@VM_MAYREAD |VM_MAYWRITE |VM_MAYEXEC |VM_ALWAYSDUMP , vdso_pagelist); -if (rc) +if (rc) { + current->mm->context.vdso_base =0 ; goto fail_mmapsem; - -/* Put vDSO base into mm struct */ - current->mm->context.vdso_base = vdso_base; + }up_write (&mm->mmap_sem);return 0 ;
Re: [patch 8/8] powerpc: Fix PCL vdso detection
Quoted 3 lines · Anton Blanchard
PCL uses
arch_vma_name()to detect a vdso region which in turn usescurrent->mm->context.vdso_base. We need to initialise this before doing the mmap or else we fail to detect the vdso.
This too should go via the PowerPC tree i think.
I've applied the rest - nice stuff!!
Ingo