[tip:perf/core] perf tools: Fix build on non-glibc systems due to libio.h absence

2013-03-21 Thread tip-bot for Cody P Schafer
Commit-ID:  861e10be08c69808065d755d3e3cab5d520a2d32
Gitweb: http://git.kernel.org/tip/861e10be08c69808065d755d3e3cab5d520a2d32
Author: Cody P Schafer 
AuthorDate: Thu, 14 Mar 2013 15:27:51 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 15 Mar 2013 13:05:13 -0300

perf tools: Fix build on non-glibc systems due to libio.h absence

Including libio.h causes build failures on uClibc systems (which lack
libio.h).

It appears that libio.h was only included to pull in a definition for
NULL, so it has been replaced by stddef.h.

On powerpc, libio.h was conditionally included, but could be removed
completely as it is unneeded. Also, the included of stdlib.h was changed
to stddef.h (as again, only NULL is needed).

Signed-off-by: Cody P Schafer 
Cc: Ingo Molnar 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1363300074-26288-1-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/arm/util/dwarf-regs.c | 5 +
 tools/perf/arch/powerpc/util/dwarf-regs.c | 5 +
 tools/perf/arch/s390/util/dwarf-regs.c| 2 +-
 tools/perf/arch/sh/util/dwarf-regs.c  | 2 +-
 tools/perf/arch/sparc/util/dwarf-regs.c   | 2 +-
 tools/perf/arch/x86/util/dwarf-regs.c | 2 +-
 6 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/tools/perf/arch/arm/util/dwarf-regs.c 
b/tools/perf/arch/arm/util/dwarf-regs.c
index e8d5c55..33ec5b3 100644
--- a/tools/perf/arch/arm/util/dwarf-regs.c
+++ b/tools/perf/arch/arm/util/dwarf-regs.c
@@ -8,10 +8,7 @@
  * published by the Free Software Foundation.
  */
 
-#include 
-#ifndef __UCLIBC__
-#include 
-#endif
+#include 
 #include 
 
 struct pt_regs_dwarfnum {
diff --git a/tools/perf/arch/powerpc/util/dwarf-regs.c 
b/tools/perf/arch/powerpc/util/dwarf-regs.c
index 7cdd61d..733151c 100644
--- a/tools/perf/arch/powerpc/util/dwarf-regs.c
+++ b/tools/perf/arch/powerpc/util/dwarf-regs.c
@@ -9,10 +9,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include 
-#ifndef __UCLIBC__
-#include 
-#endif
+#include 
 #include 
 
 
diff --git a/tools/perf/arch/s390/util/dwarf-regs.c 
b/tools/perf/arch/s390/util/dwarf-regs.c
index e19653e..0469df0 100644
--- a/tools/perf/arch/s390/util/dwarf-regs.c
+++ b/tools/perf/arch/s390/util/dwarf-regs.c
@@ -6,7 +6,7 @@
  *
  */
 
-#include 
+#include 
 #include 
 
 #define NUM_GPRS 16
diff --git a/tools/perf/arch/sh/util/dwarf-regs.c 
b/tools/perf/arch/sh/util/dwarf-regs.c
index a11edb0..0d0897f 100644
--- a/tools/perf/arch/sh/util/dwarf-regs.c
+++ b/tools/perf/arch/sh/util/dwarf-regs.c
@@ -19,7 +19,7 @@
  *
  */
 
-#include 
+#include 
 #include 
 
 /*
diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c 
b/tools/perf/arch/sparc/util/dwarf-regs.c
index 0ab8848..92eda41 100644
--- a/tools/perf/arch/sparc/util/dwarf-regs.c
+++ b/tools/perf/arch/sparc/util/dwarf-regs.c
@@ -9,7 +9,7 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#include 
+#include 
 #include 
 
 #define SPARC_MAX_REGS 96
diff --git a/tools/perf/arch/x86/util/dwarf-regs.c 
b/tools/perf/arch/x86/util/dwarf-regs.c
index a794d30..be22dd4 100644
--- a/tools/perf/arch/x86/util/dwarf-regs.c
+++ b/tools/perf/arch/x86/util/dwarf-regs.c
@@ -20,7 +20,7 @@
  *
  */
 
-#include 
+#include 
 #include 
 
 /*
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Only un-prelink non-zero symbols

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  8db24c70ab43a4dd38c39b0b0cb4d4874257de55
Gitweb: http://git.kernel.org/tip/8db24c70ab43a4dd38c39b0b0cb4d4874257de55
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:49 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 12:54:06 -0300

perf symbols: Only un-prelink non-zero symbols

Prelink only adjusts the addresses of non-zero symbols. Do the same when we
reverse the adjustments.

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-4-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 9ca89f8..e037609 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -717,7 +717,7 @@ int dso__load_sym(struct dso *dso, struct map *map, const 
char *name, int fd,
goto new_symbol;
}
 
-   if (curr_dso->adjust_symbols) {
+   if (curr_dso->adjust_symbols && sym.st_value) {
pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " 
"
  "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 
"\n", __func__,
  (u64)sym.st_value, (u64)shdr.sh_addr,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Remove unused function map__objdump_2ip

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  0f75a710dfd8fd5cd9e558e3f26c474c8fa63e3c
Gitweb: http://git.kernel.org/tip/0f75a710dfd8fd5cd9e558e3f26c474c8fa63e3c
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:50 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 12:55:09 -0300

perf symbols: Remove unused function map__objdump_2ip

map__objdump_2ip was introduced in:

ee11b90b12 perf top: Fix annotate for userspace

And it's last user removed in:

36532461a0 perf top: Ditch private annotation code, share perf annotate's

Remove it.

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-5-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/map.c |8 
 tools/perf/util/map.h |1 -
 2 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 287cb34..7d37159 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -262,14 +262,6 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
return addr;
 }
 
-u64 map__objdump_2ip(struct map *map, u64 addr)
-{
-   u64 ip = map->dso->adjust_symbols ?
-   addr :
-   map->unmap_ip(map, addr);   /* RIP -> IP */
-   return ip;
-}
-
 void map_groups__init(struct map_groups *mg)
 {
int i;
diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
index c98ab19..25ab4cd 100644
--- a/tools/perf/util/map.h
+++ b/tools/perf/util/map.h
@@ -104,7 +104,6 @@ static inline u64 identity__map_ip(struct map *map __used, 
u64 ip)
 
 /* rip/ip <-> addr suitable for passing to `objdump --start-address=` */
 u64 map__rip_2objdump(struct map *map, u64 rip);
-u64 map__objdump_2ip(struct map *map, u64 addr);
 
 struct symbol;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Remove unneeded call to dso__set_long_name()

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  261ee821c256dffa02e5608c7df51744a03992a2
Gitweb: http://git.kernel.org/tip/261ee821c256dffa02e5608c7df51744a03992a2
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:52 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:04:32 -0300

perf symbols: Remove unneeded call to dso__set_long_name()

dso__set_long_name() is already called by dso__load_vmlinux(), avoid
calling it a second time unnecessarily.

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-7-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol.c |4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index f02de8a..42c0d94 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1388,10 +1388,8 @@ int dso__load_vmlinux_path(struct dso *dso, struct map 
*map,
filename = dso__build_id_filename(dso, NULL, 0);
if (filename != NULL) {
err = dso__load_vmlinux(dso, map, filename, filter);
-   if (err > 0) {
-   dso__set_long_name(dso, filename);
+   if (err > 0)
goto out;
-   }
free(filename);
}
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Correct comment wrt kallsyms loading

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  72f86204419e1b83f18b9bc2c97141a52dc534d2
Gitweb: http://git.kernel.org/tip/72f86204419e1b83f18b9bc2c97141a52dc534d2
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:47 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:10:10 -0300

perf symbols: Correct comment wrt kallsyms loading

In kallsyms_parse() when calling process_symbol() (a callback argument
to kallsyms_parse()), we pass start as both start & end (ie:
start=start, end=start).

In map__process_kallsym_symbol(), the length is calculated as 'end -
start + 1', making the length 1, not 0.

Essentially, start & end define an inclusive range.

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-2-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 42c0d94..9f181a8 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -605,7 +605,7 @@ int kallsyms__parse(const char *filename, void *arg,
 
/*
 * module symbols are not sorted so we add all
-* symbols with zero length and rely on
+* symbols, setting length to 1, and rely on
 * symbols__fixup_end() to fix it up.
 */
err = process_symbol(arg, symbol_name,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Simplify out_fixup in kernel syms loading

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  0a0317b41e20770f81bc61d7b208957385466c3f
Gitweb: http://git.kernel.org/tip/0a0317b41e20770f81bc61d7b208957385466c3f
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:53 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:22:32 -0300

perf symbols: Simplify out_fixup in kernel syms loading

The only site that jumps to out_fixup has (kallsyms_filename == NULL).
And all paths that reach 'if (err > 0)' without 'goto out_fixup' have
kallsyms_filename != NULL.

So skip over both the check & dso__set_long_name(), and remove the
check.

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-8-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 2127002..e5c3817 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1503,9 +1503,8 @@ do_kallsyms:
free(kallsyms_allocated_filename);
 
if (err > 0) {
+   dso__set_long_name(dso, strdup("[kernel.kallsyms]"));
 out_fixup:
-   if (kallsyms_filename != NULL)
-   dso__set_long_name(dso, strdup("[kernel.kallsyms]"));
map__fixup_start(map);
map__fixup_end(map);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: only set vmlinux longname & mark loaded if really loaded

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  515850e4fbd87c8f249446faa2e5ad98e672711d
Gitweb: http://git.kernel.org/tip/515850e4fbd87c8f249446faa2e5ad98e672711d
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:54 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:24:12 -0300

perf symbols: only set vmlinux longname & mark loaded if really loaded

dso__load_vmlinux() uses the filename passed to it to directly set the
dso long_name, which resulted in a use after free due to
dso__load_vmlinux_path() treating 0 symbols as a load failure and
subsequently freeing the contents of dso->long_name.

Change dso__load_vmlinux() so that finding 0 symbols does not cause it
to consider itself loaded, and do not set long_name in such a case.

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-9-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e5c3817..96dbf28 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1364,13 +1364,14 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
if (fd < 0)
return -1;
 
-   dso__set_long_name(dso, (char *)vmlinux);
-   dso__set_loaded(dso, map->type);
err = dso__load_sym(dso, map, symfs_vmlinux, fd, filter, 0, 0);
close(fd);
 
-   if (err > 0)
+   if (err > 0) {
+   dso__set_long_name(dso, (char *)vmlinux);
+   dso__set_loaded(dso, map->type);
pr_debug("Using %s for symbols\n", symfs_vmlinux);
+   }
 
return err;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Avoid segfault in elf_strptr

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  492746546fe380da768c8496213e26aa91b9b3aa
Gitweb: http://git.kernel.org/tip/492746546fe380da768c8496213e26aa91b9b3aa
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:55 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:25:23 -0300

perf symbols: Avoid segfault in elf_strptr

If we call elf_section_by_name() with a truncated elf image (ie: the
file header indicates that the section headers are placed past the end
of the file), elf_strptr() causes a segfault within libelf.

Avoid this by checking that we can access the section string table
properly.

Should really be fixed in libelf/elfutils.

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-10-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index a2e994e..a9a194d 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -129,6 +129,10 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr 
*ep,
Elf_Scn *sec = NULL;
size_t cnt = 1;
 
+   /* Elf is corrupted/truncated, avoid calling elf_strptr. */
+   if (!elf_rawdata(elf_getscn(elf, ep->e_shstrndx), NULL))
+   return NULL;
+
while ((sec = elf_nextscn(elf, sec)) != NULL) {
char *str;
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Track symtab_type of vmlinux

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  21ea4539b4d1b26de7f2eb227b5d1a092b32cc19
Gitweb: http://git.kernel.org/tip/21ea4539b4d1b26de7f2eb227b5d1a092b32cc19
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:56 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:26:18 -0300

perf symbols: Track symtab_type of vmlinux

Previously, symtab_type would have been left at 0, or KALLSYMS, which is
not quite accurate.

Introduce DSO_BINARY_TYPE__VMLINUX[_GUEST].

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-11-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol.c |9 +
 tools/perf/util/symbol.h |2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 96dbf28..8f5cabbf 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -923,6 +923,7 @@ char dso__symtab_origin(const struct dso *dso)
 {
static const char origin[] = {
[DSO_BINARY_TYPE__KALLSYMS] = 'k',
+   [DSO_BINARY_TYPE__VMLINUX]  = 'v',
[DSO_BINARY_TYPE__JAVA_JIT] = 'j',
[DSO_BINARY_TYPE__DEBUGLINK]= 'l',
[DSO_BINARY_TYPE__BUILD_ID_CACHE]   = 'B',
@@ -933,6 +934,7 @@ char dso__symtab_origin(const struct dso *dso)
[DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE]  = 'K',
[DSO_BINARY_TYPE__GUEST_KALLSYMS]   = 'g',
[DSO_BINARY_TYPE__GUEST_KMODULE]= 'G',
+   [DSO_BINARY_TYPE__GUEST_VMLINUX]= 'V',
};
 
if (dso == NULL || dso->symtab_type == DSO_BINARY_TYPE__NOT_FOUND)
@@ -1008,7 +1010,9 @@ int dso__binary_type_file(struct dso *dso, enum 
dso_binary_type type,
 
default:
case DSO_BINARY_TYPE__KALLSYMS:
+   case DSO_BINARY_TYPE__VMLINUX:
case DSO_BINARY_TYPE__GUEST_KALLSYMS:
+   case DSO_BINARY_TYPE__GUEST_VMLINUX:
case DSO_BINARY_TYPE__JAVA_JIT:
case DSO_BINARY_TYPE__NOT_FOUND:
ret = -1;
@@ -1364,6 +1368,11 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
if (fd < 0)
return -1;
 
+   if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
+   dso->symtab_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
+   else
+   dso->symtab_type = DSO_BINARY_TYPE__VMLINUX;
+
err = dso__load_sym(dso, map, symfs_vmlinux, fd, filter, 0, 0);
close(fd);
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index c9534fe..37f1ea1 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -158,6 +158,8 @@ struct addr_location {
 enum dso_binary_type {
DSO_BINARY_TYPE__KALLSYMS = 0,
DSO_BINARY_TYPE__GUEST_KALLSYMS,
+   DSO_BINARY_TYPE__VMLINUX,
+   DSO_BINARY_TYPE__GUEST_VMLINUX,
DSO_BINARY_TYPE__JAVA_JIT,
DSO_BINARY_TYPE__DEBUGLINK,
DSO_BINARY_TYPE__BUILD_ID_CACHE,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Introduce symsrc structure.

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  b68e2f919c6d3a0422239c98673c35ff503e52fb
Gitweb: http://git.kernel.org/tip/b68e2f919c6d3a0422239c98673c35ff503e52fb
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:57 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:31:44 -0300

perf symbols: Introduce symsrc structure.

Factors opening of certain sections & tracking certain elf info into an
external structure.

The goal here is to keep multiple elfs (and their looked up
sections/indexes) around during the symbol generation process (in
dso__load()).

We need this to properly resolve symbols on PPC due to the use of
function descriptors & the .opd section (ie: symbols which are functions
don't point to their actual location, they point to their function
descriptor in .opd which contains their actual location.

It would be possible to just keep the (Elf *) around, but then we'd end
up with duplicate code for looking up the same sections and checking for
the existence of an important section wouldn't be as clean (and we need
to keep the Elf stuff confined to symtab-elf.c).

Utilized by the later patch
"perf symbols: Use both runtime and debug images"

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-12-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c |  119 -
 tools/perf/util/symbol-minimal.c |   30 +-
 tools/perf/util/symbol.c |   22 
 tools/perf/util/symbol.h |   36 +++-
 4 files changed, 163 insertions(+), 44 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index a9a194d..6974b2a 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -536,24 +536,25 @@ static int dso__swap_init(struct dso *dso, unsigned char 
eidata)
return 0;
 }
 
-int dso__load_sym(struct dso *dso, struct map *map, const char *name, int fd,
- symbol_filter_t filter, int kmodule, int want_symtab)
+
+void symsrc__destroy(struct symsrc *ss)
+{
+   free(ss->name);
+   elf_end(ss->elf);
+   close(ss->fd);
+}
+
+int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
+enum dso_binary_type type)
 {
-   struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL;
-   struct map *curr_map = map;
-   struct dso *curr_dso = dso;
-   Elf_Data *symstrs, *secstrs;
-   uint32_t nr_syms;
int err = -1;
-   uint32_t idx;
GElf_Ehdr ehdr;
-   GElf_Shdr shdr, opdshdr;
-   Elf_Data *syms, *opddata = NULL;
-   GElf_Sym sym;
-   Elf_Scn *sec, *sec_strndx, *opdsec;
Elf *elf;
-   int nr = 0;
-   size_t opdidx = 0;
+   int fd;
+
+   fd = open(name, O_RDONLY);
+   if (fd < 0)
+   return -1;
 
elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
if (elf == NULL) {
@@ -580,19 +581,88 @@ int dso__load_sym(struct dso *dso, struct map *map, const 
char *name, int fd,
goto out_elf_end;
}
 
-   sec = elf_section_by_name(elf, &ehdr, &shdr, ".symtab", NULL);
+   ss->symtab = elf_section_by_name(elf, &ehdr, &ss->symshdr, ".symtab",
+   NULL);
+   if (ss->symshdr.sh_type != SHT_SYMTAB)
+   ss->symtab = NULL;
+
+   ss->dynsym_idx = 0;
+   ss->dynsym = elf_section_by_name(elf, &ehdr, &ss->dynshdr, ".dynsym",
+   &ss->dynsym_idx);
+   if (ss->dynshdr.sh_type != SHT_DYNSYM)
+   ss->dynsym = NULL;
+
+   ss->opdidx = 0;
+   ss->opdsec = elf_section_by_name(elf, &ehdr, &ss->opdshdr, ".opd",
+   &ss->opdidx);
+   if (ss->opdshdr.sh_type != SHT_PROGBITS)
+   ss->opdsec = NULL;
+
+   if (dso->kernel == DSO_TYPE_USER) {
+   GElf_Shdr shdr;
+   ss->adjust_symbols = (ehdr.e_type == ET_EXEC ||
+   elf_section_by_name(elf, &ehdr, &shdr,
+".gnu.prelink_undo",
+NULL) != NULL);
+   } else {
+   ss->adjust_symbols = 0;
+   }
+
+   ss->name   = strdup(name);
+   if (!ss->name)
+   goto out_elf_end;
+
+   ss->elf= elf;
+   ss->fd = fd;
+   ss->ehdr   = ehdr;
+   ss->type   = type;
+
+   return 0;
+
+out_elf_end:
+   elf_end(elf);
+out_close:
+   close(fd);
+   return err;
+}
+
+int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss,
+ symbol_filter_t filter, int kmodule, int want_symtab)
+{
+   struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL;
+   struct map *curr_map = map;
+   struct dso *curr_dso = dso;
+

[tip:perf/core] perf symbols: Set symtab_type in dso__load_sym

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  005f92947a0da7eb47b0f1ff611f8fc3d7ab4751
Gitweb: http://git.kernel.org/tip/005f92947a0da7eb47b0f1ff611f8fc3d7ab4751
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:58 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:33:01 -0300

perf symbols: Set symtab_type in dso__load_sym

In certain cases, dso__load requires dso->symbol_type to be set prior to
calling it. With the introduction of symsrc*, the symtab_type is now
stored in a symsrc which is then passed to dso__load_sym().

Change dso__load_sym() to use the symtab_type from them symsrc (setting
dso->symtab_type as well).

Setup for later patch

"perf symbols: Use both runtime and debug images"

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-13-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c |2 ++
 tools/perf/util/symbol.c |   13 +++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 6974b2a..3a9c38a 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -645,6 +645,8 @@ int dso__load_sym(struct dso *dso, struct map *map, struct 
symsrc *ss,
int nr = 0;
size_t opdidx = 0;
 
+   dso->symtab_type = ss->type;
+
elf = ss->elf;
ehdr = ss->ehdr;
sec = ss->symtab;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index afec3f0..2b3495a 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1079,14 +1079,14 @@ int dso__load(struct dso *dso, struct map *map, 
symbol_filter_t filter)
 restart:
for (i = 0; i < DSO_BINARY_TYPE__SYMTAB_CNT; i++) {
 
-   dso->symtab_type = binary_type_symtab[i];
+   enum dso_binary_type symtab_type = binary_type_symtab[i];
 
-   if (dso__binary_type_file(dso, dso->symtab_type,
+   if (dso__binary_type_file(dso, symtab_type,
  root_dir, name, PATH_MAX))
continue;
 
/* Name is now the name of the next image to try */
-   if (symsrc__init(&ss, dso, name, dso->symtab_type) < 0)
+   if (symsrc__init(&ss, dso, name, symtab_type) < 0)
continue;
 
ret = dso__load_sym(dso, map, &ss, filter, 0,
@@ -1361,16 +1361,17 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
int err = -1;
struct symsrc ss;
char symfs_vmlinux[PATH_MAX];
+   enum dso_binary_type symtab_type;
 
snprintf(symfs_vmlinux, sizeof(symfs_vmlinux), "%s%s",
 symbol_conf.symfs, vmlinux);
 
if (dso->kernel == DSO_TYPE_GUEST_KERNEL)
-   dso->symtab_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
+   symtab_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
else
-   dso->symtab_type = DSO_BINARY_TYPE__VMLINUX;
+   symtab_type = DSO_BINARY_TYPE__VMLINUX;
 
-   if (symsrc__init(&ss, dso, symfs_vmlinux, dso->symtab_type))
+   if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type))
return -1;
 
err = dso__load_sym(dso, map, &ss, filter, 0, 0);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf symbols: Remove unused 'end' arg in kallsyms parse cb

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  82151520938ec79e5e3adb7e61977f002031c38c
Gitweb: http://git.kernel.org/tip/82151520938ec79e5e3adb7e61977f002031c38c
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:48 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:10:31 -0300

perf symbols: Remove unused 'end' arg in kallsyms parse cb

kallsyms__parse() takes a callback that is called on every discovered
symbol. As /proc/kallsyms does not supply symbol sizes, the callback was
simply called with end=start, faking the symbol size to 1.

All of the callbacks (there are 2) used in calls to kallsyms__parse()
are _only_ used as callbacks for kallsyms__parse().

Given that kallsyms__parse() lacks real information about what
end/length should be, don't make up a length in kallsyms__parse().
Instead have the callbacks handle guessing the length.

Also relocate a comment regarding symbol creation to the callback which
does symbol creation (kallsyms__parse() is not in general used to create
symbols).

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-3-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/event.c  |2 +-
 tools/perf/util/symbol.c |   21 ++---
 tools/perf/util/symbol.h |2 +-
 3 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 2a6f33c..3a0f1a5 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -412,7 +412,7 @@ struct process_symbol_args {
 };
 
 static int find_symbol_cb(void *arg, const char *name, char type,
- u64 start, u64 end __used)
+ u64 start)
 {
struct process_symbol_args *args = arg;
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 9f181a8..2127002 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -563,7 +563,7 @@ size_t dso__fprintf(struct dso *dso, enum map_type type, 
FILE *fp)
 
 int kallsyms__parse(const char *filename, void *arg,
int (*process_symbol)(void *arg, const char *name,
- char type, u64 start, u64 end))
+ char type, u64 start))
 {
char *line = NULL;
size_t n;
@@ -603,13 +603,8 @@ int kallsyms__parse(const char *filename, void *arg,
break;
}
 
-   /*
-* module symbols are not sorted so we add all
-* symbols, setting length to 1, and rely on
-* symbols__fixup_end() to fix it up.
-*/
err = process_symbol(arg, symbol_name,
-symbol_type, start, start);
+symbol_type, start);
if (err)
break;
}
@@ -636,7 +631,7 @@ static u8 kallsyms2elf_type(char type)
 }
 
 static int map__process_kallsym_symbol(void *arg, const char *name,
-  char type, u64 start, u64 end)
+  char type, u64 start)
 {
struct symbol *sym;
struct process_kallsyms_args *a = arg;
@@ -645,8 +640,12 @@ static int map__process_kallsym_symbol(void *arg, const 
char *name,
if (!symbol_type__is_a(type, a->map->type))
return 0;
 
-   sym = symbol__new(start, end - start + 1,
- kallsyms2elf_type(type), name);
+   /*
+* module symbols are not sorted so we add all
+* symbols, setting length to 0, and rely on
+* symbols__fixup_end() to fix it up.
+*/
+   sym = symbol__new(start, 0, kallsyms2elf_type(type), name);
if (sym == NULL)
return -ENOMEM;
/*
@@ -1729,7 +1728,7 @@ struct process_args {
 };
 
 static int symbol__in_kernel(void *arg, const char *name,
-char type __used, u64 start, u64 end __used)
+char type __used, u64 start)
 {
struct process_args *args = arg;
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 38ccbbb..c9534fe 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -299,7 +299,7 @@ bool __dsos__read_build_ids(struct list_head *head, bool 
with_hits);
 int build_id__sprintf(const u8 *build_id, int len, char *bf);
 int kallsyms__parse(const char *filename, void *arg,
int (*process_symbol)(void *arg, const char *name,
- char type, u64 start, u64 end));
+ char type, u64 start));
 int filename__read_debuglink(const char *filename, char *debuglink,
 size_t size);
 
--
To unsubscribe from this 

[tip:perf/core] perf symbols: Switch dso__synthesize_plt_symbols() to use symsrc

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  a44f605b2f6eadb771a052aa3a5eefb342b38a39
Gitweb: http://git.kernel.org/tip/a44f605b2f6eadb771a052aa3a5eefb342b38a39
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:22:59 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:34:36 -0300

perf symbols: Switch dso__synthesize_plt_symbols() to use symsrc

Previously dso__synthesize_plt_symbols() was reopening the elf file to
obtain dynsyms from it. Rather than reopen the file, use the already
opened reference within the symsrc to access it.

Setup for the later patch

"perf symbols: Use both runtime and debug images"

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-14-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c |   25 +++--
 tools/perf/util/symbol-minimal.c |3 ++-
 tools/perf/util/symbol.c |8 +---
 tools/perf/util/symbol.h |4 ++--
 4 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 3a9c38a..5915947 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -166,7 +166,7 @@ static Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
  * And always look at the original dso, not at debuginfo packages, that
  * have the PLT data stripped out (shdr_rel_plt.sh_type == SHT_NOBITS).
  */
-int dso__synthesize_plt_symbols(struct dso *dso, char *name, struct map *map,
+int dso__synthesize_plt_symbols(struct dso *dso, struct symsrc *ss, struct map 
*map,
symbol_filter_t filter)
 {
uint32_t nr_rel_entries, idx;
@@ -181,21 +181,15 @@ int dso__synthesize_plt_symbols(struct dso *dso, char 
*name, struct map *map,
GElf_Ehdr ehdr;
char sympltname[1024];
Elf *elf;
-   int nr = 0, symidx, fd, err = 0;
+   int nr = 0, symidx, err = 0;
 
-   fd = open(name, O_RDONLY);
-   if (fd < 0)
-   goto out;
-
-   elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL);
-   if (elf == NULL)
-   goto out_close;
+   elf = ss->elf;
+   ehdr = ss->ehdr;
 
-   if (gelf_getehdr(elf, &ehdr) == NULL)
-   goto out_elf_end;
+   scn_dynsym = ss->dynsym;
+   shdr_dynsym = ss->dynshdr;
+   dynsym_idx = ss->dynsym_idx;
 
-   scn_dynsym = elf_section_by_name(elf, &ehdr, &shdr_dynsym,
-".dynsym", &dynsym_idx);
if (scn_dynsym == NULL)
goto out_elf_end;
 
@@ -291,13 +285,8 @@ int dso__synthesize_plt_symbols(struct dso *dso, char 
*name, struct map *map,
 
err = 0;
 out_elf_end:
-   elf_end(elf);
-out_close:
-   close(fd);
-
if (err == 0)
return nr;
-out:
pr_debug("%s: problems reading %s PLT info.\n",
 __func__, dso->long_name);
return 0;
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c
index 1b16c27..cc580c0 100644
--- a/tools/perf/util/symbol-minimal.c
+++ b/tools/perf/util/symbol-minimal.c
@@ -266,7 +266,8 @@ void symsrc__destroy(struct symsrc *ss)
close(ss->fd);
 }
 
-int dso__synthesize_plt_symbols(struct dso *dso __used, char *name __used,
+int dso__synthesize_plt_symbols(struct dso *dso __used,
+   struct symsrc *ss __used,
struct map *map __used,
symbol_filter_t filter __used)
 {
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 2b3495a..f8a3068 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1091,21 +1091,23 @@ restart:
 
ret = dso__load_sym(dso, map, &ss, filter, 0,
want_symtab);
-   symsrc__destroy(&ss);
 
/*
 * Some people seem to have debuginfo files _WITHOUT_ debug
 * info!?!?
 */
-   if (!ret)
+   if (!ret) {
+   symsrc__destroy(&ss);
continue;
+   }
 
if (ret > 0) {
int nr_plt;
 
-   nr_plt = dso__synthesize_plt_symbols(dso, name, map, 
filter);
+   nr_plt = dso__synthesize_plt_symbols(dso, &ss, map, 
filter);
if (nr_plt > 0)
ret += nr_plt;
+   symsrc__destroy(&ss);
break;
}
}
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index dd9e867..2981513 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -370,8 +370,8 @@ ssize_t dso__data_read_addr(struct dso *dso, struct m

[tip:perf/core] perf symbols: Factor want_symtab out of dso__load_sym()

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  d26cd12b46cb6b5595143804b43ba5aa7968551e
Gitweb: http://git.kernel.org/tip/d26cd12b46cb6b5595143804b43ba5aa7968551e
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:23:00 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:37:37 -0300

perf symbols: Factor want_symtab out of dso__load_sym()

Only one callsite of dso__load_sym() uses the want_symtab functionality,
so place the logic at the callsite instead of within dso__load_sym().

This sets us up for removal of want_symtab completely once we keep
multiple elf handles (within symsrc's) around.

Setup for the later patch

"perf symbols: Use both runtime and debug images"

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-15-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c |   21 ++---
 tools/perf/util/symbol-minimal.c |8 ++--
 tools/perf/util/symbol.c |   10 +++---
 tools/perf/util/symbol.h |3 ++-
 4 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 5915947..492ebec 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -525,6 +525,10 @@ static int dso__swap_init(struct dso *dso, unsigned char 
eidata)
return 0;
 }
 
+bool symsrc__has_symtab(struct symsrc *ss)
+{
+   return ss->symtab != NULL;
+}
 
 void symsrc__destroy(struct symsrc *ss)
 {
@@ -616,7 +620,7 @@ out_close:
 }
 
 int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss,
- symbol_filter_t filter, int kmodule, int want_symtab)
+ symbol_filter_t filter, int kmodule)
 {
struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL;
struct map *curr_map = map;
@@ -636,21 +640,16 @@ int dso__load_sym(struct dso *dso, struct map *map, 
struct symsrc *ss,
 
dso->symtab_type = ss->type;
 
+   if (!ss->symtab) {
+   ss->symtab  = ss->dynsym;
+   ss->symshdr = ss->dynshdr;
+   }
+
elf = ss->elf;
ehdr = ss->ehdr;
sec = ss->symtab;
shdr = ss->symshdr;
 
-   if (sec == NULL) {
-   if (want_symtab)
-   goto out_elf_end;
-
-   sec  = ss->dynsym;
-   shdr = ss->dynshdr;
-   if (sec == NULL)
-   goto out_elf_end;
-   }
-
opdsec = ss->opdsec;
opdshdr = ss->opdshdr;
opdidx  = ss->opdidx;
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c
index cc580c0..11c2c60 100644
--- a/tools/perf/util/symbol-minimal.c
+++ b/tools/perf/util/symbol-minimal.c
@@ -260,6 +260,11 @@ out_close:
return -1;
 }
 
+bool symsrc__has_symtab(struct symsrc *ss __used)
+{
+   return false;
+}
+
 void symsrc__destroy(struct symsrc *ss)
 {
free(ss->name);
@@ -275,8 +280,7 @@ int dso__synthesize_plt_symbols(struct dso *dso __used,
 }
 
 int dso__load_sym(struct dso *dso, struct map *map __used, struct symsrc *ss,
- symbol_filter_t filter __used, int kmodule __used,
- int want_symtab __used)
+ symbol_filter_t filter __used, int kmodule __used)
 {
unsigned char *build_id[BUILD_ID_SIZE];
 
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index f8a3068..8e7d74f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1089,8 +1089,12 @@ restart:
if (symsrc__init(&ss, dso, name, symtab_type) < 0)
continue;
 
-   ret = dso__load_sym(dso, map, &ss, filter, 0,
-   want_symtab);
+   if (want_symtab && !symsrc__has_symtab(&ss)) {
+   symsrc__destroy(&ss);
+   continue;
+   }
+
+   ret = dso__load_sym(dso, map, &ss, filter, 0);
 
/*
 * Some people seem to have debuginfo files _WITHOUT_ debug
@@ -1376,7 +1380,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
if (symsrc__init(&ss, dso, symfs_vmlinux, symtab_type))
return -1;
 
-   err = dso__load_sym(dso, map, &ss, filter, 0, 0);
+   err = dso__load_sym(dso, map, &ss, filter, 0);
symsrc__destroy(&ss);
 
if (err > 0) {
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 2981513..fa9f6b1 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -252,6 +252,7 @@ struct symsrc {
 void symsrc__destroy(struct symsrc *ss);
 int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
 enum dso_binary_type type);
+bool symsrc__has_symtab(struct symsrc *ss);
 
 #define DSO__SWAP(dso, type, v

[tip:perf/core] perf symbols: Convert dso__load_syms to take 2 symsrc's

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  261360b6e90a782f0a63d8f61a67683c376c88cf
Gitweb: http://git.kernel.org/tip/261360b6e90a782f0a63d8f61a67683c376c88cf
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:23:01 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:41:33 -0300

perf symbols: Convert dso__load_syms to take 2 symsrc's

To properly handle platforms with an opd section, both a runtime image
(which contains the opd section but possibly lacks symbols) and a symbol
image (which probably lacks an opd section but has symbols).

The next patch ("perf symbol: use both runtime and debug images")
adjusts the callsite in dso__load() to take advantage of being able to
pass both runtime & debug images.

Assumptions made here:

 - The opd section, if it exists in the runtime image, has headers in
   both the runtime image and the debug/syms image.

 - The index of the opd section (again, only if it exists in the runtime
   image) is the same in both the runtime and debug/symbols image.

Both of these are true on RHEL, but it is unclear how accurate they are
in general (on platforms with function descriptors in opd sections).

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-16-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c |   47 +++--
 tools/perf/util/symbol-minimal.c |1 +
 tools/perf/util/symbol.c |4 +-
 tools/perf/util/symbol.h |5 ++-
 4 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 492ebec..36e4a45 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -619,7 +619,8 @@ out_close:
return err;
 }
 
-int dso__load_sym(struct dso *dso, struct map *map, struct symsrc *ss,
+int dso__load_sym(struct dso *dso, struct map *map,
+ struct symsrc *syms_ss, struct symsrc *runtime_ss,
  symbol_filter_t filter, int kmodule)
 {
struct kmap *kmap = dso->kernel ? map__kmap(map) : NULL;
@@ -630,31 +631,27 @@ int dso__load_sym(struct dso *dso, struct map *map, 
struct symsrc *ss,
int err = -1;
uint32_t idx;
GElf_Ehdr ehdr;
-   GElf_Shdr shdr, opdshdr;
+   GElf_Shdr shdr;
Elf_Data *syms, *opddata = NULL;
GElf_Sym sym;
-   Elf_Scn *sec, *sec_strndx, *opdsec;
+   Elf_Scn *sec, *sec_strndx;
Elf *elf;
int nr = 0;
-   size_t opdidx = 0;
 
-   dso->symtab_type = ss->type;
+   dso->symtab_type = syms_ss->type;
 
-   if (!ss->symtab) {
-   ss->symtab  = ss->dynsym;
-   ss->symshdr = ss->dynshdr;
+   if (!syms_ss->symtab) {
+   syms_ss->symtab  = syms_ss->dynsym;
+   syms_ss->symshdr = syms_ss->dynshdr;
}
 
-   elf = ss->elf;
-   ehdr = ss->ehdr;
-   sec = ss->symtab;
-   shdr = ss->symshdr;
+   elf = syms_ss->elf;
+   ehdr = syms_ss->ehdr;
+   sec = syms_ss->symtab;
+   shdr = syms_ss->symshdr;
 
-   opdsec = ss->opdsec;
-   opdshdr = ss->opdshdr;
-   opdidx  = ss->opdidx;
-   if (opdsec)
-   opddata = elf_rawdata(opdsec, NULL);
+   if (runtime_ss->opdsec)
+   opddata = elf_rawdata(runtime_ss->opdsec, NULL);
 
syms = elf_getdata(sec, NULL);
if (syms == NULL)
@@ -679,13 +676,14 @@ int dso__load_sym(struct dso *dso, struct map *map, 
struct symsrc *ss,
nr_syms = shdr.sh_size / shdr.sh_entsize;
 
memset(&sym, 0, sizeof(sym));
-   dso->adjust_symbols = ss->adjust_symbols;
+   dso->adjust_symbols = runtime_ss->adjust_symbols;
elf_symtab__for_each_symbol(syms, nr_syms, idx, sym) {
struct symbol *f;
const char *elf_name = elf_sym__name(&sym, symstrs);
char *demangled = NULL;
int is_label = elf_sym__is_label(&sym);
const char *section_name;
+   bool used_opd = false;
 
if (kmap && kmap->ref_reloc_sym && kmap->ref_reloc_sym->name &&
strcmp(elf_name, kmap->ref_reloc_sym->name) == 0)
@@ -704,14 +702,16 @@ int dso__load_sym(struct dso *dso, struct map *map, 
struct symsrc *ss,
continue;
}
 
-   if (opdsec && sym.st_shndx == opdidx) {
-   u32 offset = sym.st_value - opdshdr.sh_addr;
+   if (runtime_ss->opdsec && sym.st_shndx == runtime_ss->opdidx) {
+   u32 offset = sym.st_value - syms_ss->opdshdr.sh_addr;
u64 *opd = opddata->d_buf + offset;
sym.st_value = DSO__SWAP(dso, u64, *opd);
-   sym.st_shndx = elf_addr_to_index(e

[tip:perf/core] perf symbols: Use both runtime and debug images

2012-08-21 Thread tip-bot for Cody P Schafer
Commit-ID:  3aafe5ae08f2aed378e06d78b207883879d25cbe
Gitweb: http://git.kernel.org/tip/3aafe5ae08f2aed378e06d78b207883879d25cbe
Author: Cody P Schafer 
AuthorDate: Fri, 10 Aug 2012 15:23:02 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Aug 2012 14:46:55 -0300

perf symbols: Use both runtime and debug images

We keep both a 'runtime' elf image as well as a 'debug' elf image around
and generate symbols by looking at both of these.

This eliminates the need for the want_symtab/goto restart mechanism
combined with iterating over and reopening the elf images a second time.

Also give dso__synthsize_plt_symbols() the runtime image (which has
dynsyms) instead of the symbol image (which may only have a symtab and
no dynsyms).

Previously if a debug image was found all runtime images were ignored.

This fixes 2 issues:

 - Symbol resolution to failure on PowerPC systems with debug symbols
   installed, as the debug images lack a '.opd' section which contains
   function descriptors.

 - On all archs, plt synthesis failed when a debug image was loaded and
   that debug image lacks a dynsym section while a runtime image has a
   dynsym section.

Assumptions:

 - If a .opd section exists, it is contained in the highest priority
   image with a dynsym section.

 - This generally implies that the debug image lacks a dynsym section
   (ie: it is marked as NO_BITS).

Signed-off-by: Cody P Schafer 
Cc: David Hansen 
Cc: Ingo Molnar 
Cc: Matt Hellsley 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1344637382-22789-17-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/symbol-elf.c |5 ++
 tools/perf/util/symbol-minimal.c |6 +++
 tools/perf/util/symbol.c |   77 +
 tools/perf/util/symbol.h |1 +
 4 files changed, 56 insertions(+), 33 deletions(-)

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 36e4a45..5b37e13 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -525,6 +525,11 @@ static int dso__swap_init(struct dso *dso, unsigned char 
eidata)
return 0;
 }
 
+bool symsrc__possibly_runtime(struct symsrc *ss)
+{
+   return ss->dynsym || ss->opdsec;
+}
+
 bool symsrc__has_symtab(struct symsrc *ss)
 {
return ss->symtab != NULL;
diff --git a/tools/perf/util/symbol-minimal.c b/tools/perf/util/symbol-minimal.c
index 7747ea6..6738ea1 100644
--- a/tools/perf/util/symbol-minimal.c
+++ b/tools/perf/util/symbol-minimal.c
@@ -260,6 +260,12 @@ out_close:
return -1;
 }
 
+bool symsrc__possibly_runtime(struct symsrc *ss __used)
+{
+   /* Assume all sym sources could be a runtime image. */
+   return true;
+}
+
 bool symsrc__has_symtab(struct symsrc *ss __used)
 {
return false;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 739e5a3..2293a4a 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1026,11 +1026,12 @@ int dso__load(struct dso *dso, struct map *map, 
symbol_filter_t filter)
 {
char *name;
int ret = -1;
-   struct symsrc ss;
u_int i;
struct machine *machine;
char *root_dir = (char *) "";
-   int want_symtab;
+   int ss_pos = 0;
+   struct symsrc ss_[2];
+   struct symsrc *syms_ss = NULL, *runtime_ss = NULL;
 
dso__set_loaded(dso, map->type);
 
@@ -1072,12 +1073,12 @@ int dso__load(struct dso *dso, struct map *map, 
symbol_filter_t filter)
root_dir = machine->root_dir;
 
/* Iterate over candidate debug images.
-* On the first pass, only load images if they have a full symtab.
-* Failing that, do a second pass where we accept .dynsym also
+* Keep track of "interesting" ones (those which have a symtab, dynsym,
+* and/or opd section) for processing.
 */
-   want_symtab = 1;
-restart:
for (i = 0; i < DSO_BINARY_TYPE__SYMTAB_CNT; i++) {
+   struct symsrc *ss = &ss_[ss_pos];
+   bool next_slot = false;
 
enum dso_binary_type symtab_type = binary_type_symtab[i];
 
@@ -1086,45 +1087,55 @@ restart:
continue;
 
/* Name is now the name of the next image to try */
-   if (symsrc__init(&ss, dso, name, symtab_type) < 0)
+   if (symsrc__init(ss, dso, name, symtab_type) < 0)
continue;
 
-   if (want_symtab && !symsrc__has_symtab(&ss)) {
-   symsrc__destroy(&ss);
-   continue;
+   if (!syms_ss && symsrc__has_symtab(ss)) {
+   syms_ss = ss;
+   next_slot = true;
}
 
-   ret = dso__load_sym(dso, map, &ss, &ss, filter, 0);
-
-   /*
-* Some people seem to have debuginfo files _WIT

[tip:perf/core] perf Documentation: Add event parameters

2015-01-28 Thread tip-bot for Cody P Schafer
Commit-ID:  98a43e0e9917059da32db89829b0eb95453a11ee
Gitweb: http://git.kernel.org/tip/98a43e0e9917059da32db89829b0eb95453a11ee
Author: Cody P Schafer 
AuthorDate: Wed, 7 Jan 2015 17:13:52 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 21 Jan 2015 13:24:33 -0300

perf Documentation: Add event parameters

Event parameters are a basic way for partial events to be specified in
sysfs with per-event names given to the fields that need to be filled in
when using a particular event.

It is intended for supporting cases where the single 'cpu' parameter is
insufficient. For example, POWER 8 has events for physical
sockets/cores/cpus that are accessible from with virtual machines. To
keep using the single 'cpu' parameter we'd need to perform a mapping
between Linux's cpus and the physical machine's cpus (in this case Linux
is running under a hypervisor). This isn't possible because bindings
between our cpus and physical cpus may not be fixed, and we probably
won't have a "cpu" on each physical cpu.

Signed-off-by: Cody P Schafer 
Signed-off-by: Sukadev Bhattiprolu 
Acked-by: Jiri Olsa 
Cc: Cody P Schafer 
Cc: Haren Myneni 
Cc: Jiri Olsa 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Cc: linuxppc-...@lists.ozlabs.org
Link: 
http://lkml.kernel.org/r/1420679633-28856-4-git-send-email-suka...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 Documentation/ABI/testing/sysfs-bus-event_source-devices-events | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices-events 
b/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
index 20979f8..505f080 100644
--- a/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
+++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
@@ -52,12 +52,18 @@ Description:Per-pmu performance monitoring events 
specific to the running syste
event=0x2abc
event=0x423,inv,cmask=0x3
domain=0x1,offset=0x8,starting_index=0x
+   domain=0x1,offset=0x8,core=?
 
Each of the assignments indicates a value to be assigned to a
particular set of bits (as defined by the format file
corresponding to the ) in the perf_event structure passed
to the perf_open syscall.
 
+   In the case of the last example, a value replacing "?" would
+   need to be provided by the user selecting the particular event.
+   This is referred to as "event parameterization". Event
+   parameters have the format 'param=?'.
+
 What: /sys/bus/event_source/devices//events/.unit
 Date: 2014/02/24
 Contact:   Linux kernel mailing list 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Extend format_alias() to include event parameters

2015-01-28 Thread tip-bot for Cody P Schafer
Commit-ID:  aaea36174991ff39c7a18044660db86527100c55
Gitweb: http://git.kernel.org/tip/aaea36174991ff39c7a18044660db86527100c55
Author: Cody P Schafer 
AuthorDate: Wed, 7 Jan 2015 17:13:51 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 21 Jan 2015 13:24:33 -0300

perf tools: Extend format_alias() to include event parameters

This causes `perf list pmu` to show parameters for parameterized events
like:

  pmu/event_name,param1=?,param2=?/ [Kernel PMU event]

An example:

  hv_24x7/HPM_TLBIE__PHYS_CORE,core=?/ [Kernel PMU event]

Signed-off-by: Cody P Schafer 
Signed-off-by: Sukadev Bhattiprolu 
Acked-by: Jiri Olsa 
Cc: Cody P Schafer 
Cc: Haren Myneni 
Cc: Jiri Olsa 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: linuxppc-...@lists.ozlabs.org
Link: 
http://lkml.kernel.org/r/1420679633-28856-3-git-send-email-suka...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/pmu.c | 28 +++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index bfbecf7..4841167 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -819,10 +819,36 @@ void perf_pmu__set_format(unsigned long *bits, long from, 
long to)
set_bit(b, bits);
 }
 
+static int sub_non_neg(int a, int b)
+{
+   if (b > a)
+   return 0;
+   return a - b;
+}
+
 static char *format_alias(char *buf, int len, struct perf_pmu *pmu,
  struct perf_pmu_alias *alias)
 {
-   snprintf(buf, len, "%s/%s/", pmu->name, alias->name);
+   struct parse_events_term *term;
+   int used = snprintf(buf, len, "%s/%s", pmu->name, alias->name);
+
+   list_for_each_entry(term, &alias->terms, list) {
+   if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR)
+   used += snprintf(buf + used, sub_non_neg(len, used),
+   ",%s=%s", term->config,
+   term->val.str);
+   }
+
+   if (sub_non_neg(len, used) > 0) {
+   buf[used] = '/';
+   used++;
+   }
+   if (sub_non_neg(len, used) > 0) {
+   buf[used] = '\0';
+   used++;
+   } else
+   buf[len - 1] = '\0';
+
return buf;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Document parameterized and symbolic events

2015-01-28 Thread tip-bot for Cody P Schafer
Commit-ID:  f9ab9c196d015f3bd8f6bd1c30785c5a49542323
Gitweb: http://git.kernel.org/tip/f9ab9c196d015f3bd8f6bd1c30785c5a49542323
Author: Cody P Schafer 
AuthorDate: Wed, 7 Jan 2015 17:13:53 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 21 Jan 2015 13:24:33 -0300

perf tools: Document parameterized and symbolic events

Signed-off-by: Cody P Schafer 
Signed-off-by: Sukadev Bhattiprolu 
Acked-by: Jiri Olsa 
Cc: Cody P Schafer 
Cc: Haren Myneni 
Cc: Jiri Olsa 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: linuxppc-...@lists.ozlabs.org
Link: 
http://lkml.kernel.org/r/1420679633-28856-5-git-send-email-suka...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/Documentation/perf-list.txt   | 13 +
 tools/perf/Documentation/perf-record.txt | 12 
 tools/perf/Documentation/perf-stat.txt   | 20 
 3 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/tools/perf/Documentation/perf-list.txt 
b/tools/perf/Documentation/perf-list.txt
index cbb4f74..3e2aec9 100644
--- a/tools/perf/Documentation/perf-list.txt
+++ b/tools/perf/Documentation/perf-list.txt
@@ -89,6 +89,19 @@ raw encoding of 0x1A8 can be used:
 You should refer to the processor specific documentation for getting these
 details. Some of them are referenced in the SEE ALSO section below.
 
+PARAMETERIZED EVENTS
+
+
+Some pmu events listed by 'perf-list' will be displayed with '?' in them. For
+example:
+
+  hv_gpci/dtbp_ptitc,phys_processor_idx=?/
+
+This means that when provided as an event, a value for '?' must
+also be supplied. For example:
+
+  perf stat -C 0 -e 'hv_gpci/dtbp_ptitc,phys_processor_idx=0x2/' ...
+
 OPTIONS
 ---
 
diff --git a/tools/perf/Documentation/perf-record.txt 
b/tools/perf/Documentation/perf-record.txt
index af9a54e..7d8df2e 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -33,6 +33,18 @@ OPTIONS
 - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
  hexadecimal event descriptor.
 
+   - a symbolically formed PMU event like 'pmu/param1=0x3,param2/' where
+ 'param1', 'param2', etc are defined as formats for the PMU in
+ /sys/bus/event_sources/devices//format/*.
+
+   - a symbolically formed event like 'pmu/config=M,config1=N,config3=K/'
+
+  where M, N, K are numbers (in decimal, hex, octal format). Acceptable
+  values for each of 'config', 'config1' and 'config2' are defined by
+  corresponding entries in 
/sys/bus/event_sources/devices//format/*
+  param1 and param2 are defined as formats for the PMU in:
+  /sys/bus/event_sources/devices//format/*
+
 - a hardware breakpoint event in the form of '\mem:addr[:access]'
   where addr is the address in memory you want to break in.
   Access is the memory access type (read, write, execute) it can
diff --git a/tools/perf/Documentation/perf-stat.txt 
b/tools/perf/Documentation/perf-stat.txt
index 29ee857..04e150d 100644
--- a/tools/perf/Documentation/perf-stat.txt
+++ b/tools/perf/Documentation/perf-stat.txt
@@ -25,10 +25,22 @@ OPTIONS
 
 -e::
 --event=::
-   Select the PMU event. Selection can be a symbolic event name
-   (use 'perf list' to list all events) or a raw PMU
-   event (eventsel+umask) in the form of rNNN where NNN is a
-hexadecimal event descriptor.
+   Select the PMU event. Selection can be:
+
+   - a symbolic event name (use 'perf list' to list all events)
+
+   - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
+ hexadecimal event descriptor.
+
+   - a symbolically formed event like 'pmu/param1=0x3,param2/' where
+ param1 and param2 are defined as formats for the PMU in
+ /sys/bus/event_sources/devices//format/*
+
+   - a symbolically formed event like 'pmu/config=M,config1=N,config2=K/'
+ where M, N, K are numbers (in decimal, hex, octal format).
+ Acceptable values for each of 'config', 'config1' and 'config2'
+ parameters are defined by corresponding entries in
+ /sys/bus/event_sources/devices//format/*
 
 -i::
 --no-inherit::
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Support parsing parameterized events

2015-01-28 Thread tip-bot for Cody P Schafer
Commit-ID:  688d4dfcdd624192cbf03c08402e444d1d11f294
Gitweb: http://git.kernel.org/tip/688d4dfcdd624192cbf03c08402e444d1d11f294
Author: Cody P Schafer 
AuthorDate: Wed, 7 Jan 2015 17:13:50 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 21 Jan 2015 13:24:32 -0300

perf tools: Support parsing parameterized events

Enable event specification like:

pmu/event_name,param1=0x1,param2=0x4/

Assuming that

/sys/bus/event_source/devices/pmu/events/event_name

Contains something like

param2=?,bar=1,param1=?

Signed-off-by: Cody P Schafer 
Signed-off-by: Sukadev Bhattiprolu 
Acked-by: Jiri Olsa 
Cc: Cody P Schafer 
Cc: Haren Myneni 
Cc: Jiri Olsa 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: linuxppc-...@lists.ozlabs.org
Link: 
http://lkml.kernel.org/r/1420679633-28856-2-git-send-email-suka...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/parse-events.h |  1 +
 tools/perf/util/pmu.c  | 74 +++---
 2 files changed, 64 insertions(+), 11 deletions(-)

diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index db2cf78..ca226ce 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -71,6 +71,7 @@ struct parse_events_term {
int type_val;
int type_term;
struct list_head list;
+   bool used;
 };
 
 struct parse_events_evlist {
diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 5c9c494..bfbecf7 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -551,31 +551,68 @@ static void pmu_format_value(unsigned long *format, __u64 
value, __u64 *v,
 }
 
 /*
+ * Term is a string term, and might be a param-term. Try to look up it's value
+ * in the remaining terms.
+ * - We have a term like "base-or-format-term=param-term",
+ * - We need to find the value supplied for "param-term" (with param-term named
+ *   in a config string) later on in the term list.
+ */
+static int pmu_resolve_param_term(struct parse_events_term *term,
+ struct list_head *head_terms,
+ __u64 *value)
+{
+   struct parse_events_term *t;
+
+   list_for_each_entry(t, head_terms, list) {
+   if (t->type_val == PARSE_EVENTS__TERM_TYPE_NUM) {
+   if (!strcmp(t->config, term->config)) {
+   t->used = true;
+   *value = t->val.num;
+   return 0;
+   }
+   }
+   }
+
+   if (verbose)
+   printf("Required parameter '%s' not specified\n", term->config);
+
+   return -1;
+}
+
+/*
  * Setup one of config[12] attr members based on the
  * user input data - term parameter.
  */
 static int pmu_config_term(struct list_head *formats,
   struct perf_event_attr *attr,
   struct parse_events_term *term,
+  struct list_head *head_terms,
   bool zero)
 {
struct perf_pmu_format *format;
__u64 *vp;
+   __u64 val;
+
+   /*
+* If this is a parameter we've already used for parameterized-eval,
+* skip it in normal eval.
+*/
+   if (term->used)
+   return 0;
 
/*
-* Support only for hardcoded and numnerial terms.
 * Hardcoded terms should be already in, so nothing
 * to be done for them.
 */
if (parse_events__is_hardcoded_term(term))
return 0;
 
-   if (term->type_val != PARSE_EVENTS__TERM_TYPE_NUM)
-   return -EINVAL;
-
format = pmu_find_format(formats, term->config);
-   if (!format)
+   if (!format) {
+   if (verbose)
+   printf("Invalid event/parameter '%s'\n", term->config);
return -EINVAL;
+   }
 
switch (format->value) {
case PERF_PMU_FORMAT_VALUE_CONFIG:
@@ -592,11 +629,25 @@ static int pmu_config_term(struct list_head *formats,
}
 
/*
-* XXX If we ever decide to go with string values for
-* non-hardcoded terms, here's the place to translate
-* them into value.
+* Either directly use a numeric term, or try to translate string terms
+* using event parameters.
 */
-   pmu_format_value(format->bits, term->val.num, vp, zero);
+   if (term->type_val == PARSE_EVENTS__TERM_TYPE_NUM)
+   val = term->val.num;
+   else if (term->type_val == PARSE_EVENTS__TERM_TYPE_STR) {
+   if (strcmp(term->val.str, "?")) {
+   if (verbose)
+   pr_info("Invalid sysfs entry %s=%s\n",
+   term->config, term->val.str);
+   return -EINVAL;
+   }
+
+   if (pmu_resolve_param_term

[tip:perf/core] tools perf: Comment typo fix

2014-01-14 Thread tip-bot for Cody P Schafer
Commit-ID:  88aca8d966a1349631a0946ed77c7ed360519ed4
Gitweb: http://git.kernel.org/tip/88aca8d966a1349631a0946ed77c7ed360519ed4
Author: Cody P Schafer 
AuthorDate: Wed, 8 Jan 2014 08:43:51 -0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Mon, 13 Jan 2014 10:06:24 -0300

tools perf: Comment typo fix

s/temr/term/

Signed-off-by: Cody P Schafer 
Cc: Andi Kleen 
Cc: Ingo Molnar 
Cc: Jiri Olsa 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Sukadev Bhattiprolu 
Link: 
http://lkml.kernel.org/r/1389199434-21761-1-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/pmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 0934d64..d9cab4d 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -505,7 +505,7 @@ static __u64 pmu_format_value(unsigned long *format, __u64 
value)
 
 /*
  * Setup one of config[12] attr members based on the
- * user input data - temr parameter.
+ * user input data - term parameter.
  */
 static int pmu_config_term(struct list_head *formats,
   struct perf_event_attr *attr,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf tools: Instead of redirecting flex output, use -o

2014-04-15 Thread tip-bot for Cody P Schafer
Commit-ID:  c9e87a472594fd237b2d19dcbe4a3424297f0b1a
Gitweb: http://git.kernel.org/tip/c9e87a472594fd237b2d19dcbe4a3424297f0b1a
Author: Cody P Schafer 
AuthorDate: Mon, 14 Apr 2014 12:47:01 +0200
Committer:  Jiri Olsa 
CommitDate: Tue, 15 Apr 2014 13:57:21 +0200

perf tools: Instead of redirecting flex output, use -o

This gives us a real filename instead of having '' show up all
over the place when debugging.

Signed-off-by: Cody P Schafer 
Link: 
http://lkml.kernel.org/r/1396652539-2416-1-git-send-email-c...@linux.vnet.ibm.com
Signed-off-by: Jiri Olsa 
---
 tools/perf/Makefile.perf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 50d875d..e969233 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -192,13 +192,13 @@ endif
 export PERL_PATH
 
 $(OUTPUT)util/parse-events-flex.c: util/parse-events.l 
$(OUTPUT)util/parse-events-bison.c
-   $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h 
$(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
+   $(QUIET_FLEX)$(FLEX) -o $@ 
--header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) 
util/parse-events.l
 
 $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
$(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) 
-o $(OUTPUT)util/parse-events-bison.c -p parse_events_
 
 $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
-   $(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t 
util/pmu.l > $(OUTPUT)util/pmu-flex.c
+   $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h 
util/pmu.l
 
 $(OUTPUT)util/pmu-bison.c: util/pmu.y
$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p 
perf_pmu_
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Allow overriding sysfs and proc finding with env var

2014-06-05 Thread tip-bot for Cody P Schafer
Commit-ID:  f2d9627b2b31506204417bb6842a7ea88970b700
Gitweb: http://git.kernel.org/tip/f2d9627b2b31506204417bb6842a7ea88970b700
Author: Cody P Schafer 
AuthorDate: Tue, 27 May 2014 17:21:56 -0700
Committer:  Jiri Olsa 
CommitDate: Tue, 3 Jun 2014 21:34:29 +0200

perf tools: Allow overriding sysfs and proc finding with env var

SYSFS_PATH and PROC_PATH environment variables now let the user override
the detection of sysfs and proc locations for testing purposes.

Signed-off-by: Cody P Schafer 
Cc: Sukadev Bhattiprolu 
Link: http://lkml.kernel.org/r/1401236684-10579-2-git-send-email-...@codyps.com
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 43 ++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 5b5eb78..c1b49c3 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -1,8 +1,10 @@
 /* TODO merge/factor in debugfs.c here */
 
+#include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -96,12 +98,51 @@ static bool fs__check_mounts(struct fs *fs)
return false;
 }
 
+static void mem_toupper(char *f, size_t len)
+{
+   while (len) {
+   *f = toupper(*f);
+   f++;
+   len--;
+   }
+}
+
+/*
+ * Check for "NAME_PATH" environment variable to override fs location (for
+ * testing). This matches the recommendation in Documentation/sysfs-rules.txt
+ * for SYSFS_PATH.
+ */
+static bool fs__env_override(struct fs *fs)
+{
+   char *override_path;
+   size_t name_len = strlen(fs->name);
+   /* name + "_PATH" + '\0' */
+   char upper_name[name_len + 5 + 1];
+   memcpy(upper_name, fs->name, name_len);
+   mem_toupper(upper_name, name_len);
+   strcpy(&upper_name[name_len], "_PATH");
+
+   override_path = getenv(upper_name);
+   if (!override_path)
+   return false;
+
+   fs->found = true;
+   strncpy(fs->path, override_path, sizeof(fs->path));
+   return true;
+}
+
 static const char *fs__get_mountpoint(struct fs *fs)
 {
+   if (fs__env_override(fs))
+   return fs->path;
+
if (fs__check_mounts(fs))
return fs->path;
 
-   return fs__read_mounts(fs) ? fs->path : NULL;
+   if (fs__read_mounts(fs))
+   return fs->path;
+
+   return NULL;
 }
 
 static const char *fs__mountpoint(int idx)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/core] perf tools: Annotate PMU related list_head members with type info

2014-08-18 Thread tip-bot for Cody P Schafer
Commit-ID:  885b5930d6632fc7df55445d9021b87d8bb17a9b
Gitweb: http://git.kernel.org/tip/885b5930d6632fc7df55445d9021b87d8bb17a9b
Author: Cody P Schafer 
AuthorDate: Fri, 15 Aug 2014 00:26:14 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Fri, 15 Aug 2014 10:42:40 -0300

perf tools: Annotate PMU related list_head members with type info

So that we can more readily understand in which list heads structs are
stored into.

Signed-off-by: Cody P Schafer 
Cc: Andi Kleen 
Cc: Anshuman Khandual 
Cc: Cody P Schafer 
Cc: Haren Myneni 
Cc: Jiri Olsa 
Cc: Michael Ellerman 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: linuxppc-...@lists.ozlabs.org
Link: 
http://lkml.kernel.org/r/1408087583-32239-6-git-send-email-suka...@linux.vnet.ibm.com
Signed-off-by: Sukadev Bhattiprolu 
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/pmu.c | 4 ++--
 tools/perf/util/pmu.h | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c
index 7a811eb..9bf5827 100644
--- a/tools/perf/util/pmu.c
+++ b/tools/perf/util/pmu.c
@@ -14,8 +14,8 @@
 
 struct perf_pmu_alias {
char *name;
-   struct list_head terms;
-   struct list_head list;
+   struct list_head terms; /* HEAD struct parse_events_term -> list */
+   struct list_head list;  /* ELEM */
char unit[UNIT_MAX_LEN+1];
double scale;
 };
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index c14a543..1c1e2ee 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -17,9 +17,9 @@ struct perf_pmu {
char *name;
__u32 type;
struct cpu_map *cpus;
-   struct list_head format;
-   struct list_head aliases;
-   struct list_head list;
+   struct list_head format;  /* HEAD struct perf_pmu_format -> list */
+   struct list_head aliases; /* HEAD struct perf_pmu_alias -> list */
+   struct list_head list;/* ELEM */
 };
 
 struct perf_pmu *perf_pmu__find(const char *name);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf Documentation: sysfs events/ interfaces

2014-10-15 Thread tip-bot for Cody P Schafer
Commit-ID:  ed90a4466340e51699139ea83dbe0f4536360e6d
Gitweb: http://git.kernel.org/tip/ed90a4466340e51699139ea83dbe0f4536360e6d
Author: Cody P Schafer 
AuthorDate: Tue, 30 Sep 2014 23:03:19 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 15 Oct 2014 15:54:40 -0300

perf Documentation: sysfs events/ interfaces

Add documentation for the , .scale, and .unit
files in sysfs.

.scale and .unit were undocumented.
 was previously documented only for specific powerpc pmu events.

Signed-off-by: Cody P Schafer 
Signed-off-by: Sukadev Bhattiprolu 
Cc: Andi Kleen 
Cc: Anshuman Khandual 
Cc: Cody P Schafer 
Cc: Haren Myneni 
Cc: Haren Myneni 
Cc: Jiri Olsa 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: linuxppc-...@lists.ozlabs.org
Link: 
http://lkml.kernel.org/r/1412143402-26061-4-git-send-email-suka...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 .../testing/sysfs-bus-event_source-devices-events  | 60 ++
 1 file changed, 60 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices-events 
b/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
index 7b40a3c..a5226f0 100644
--- a/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
+++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
@@ -599,3 +599,63 @@ Description:   POWER-systems specific performance 
monitoring events
Further, multiple terms like 'event=0x' can be specified
and separated with comma. All available terms are defined in
the /sys/bus/event_source/devices//format file.
+
+What: /sys/bus/event_source/devices//events/
+Date: 2014/02/24
+Contact:   Linux kernel mailing list 
+Description:   Per-pmu performance monitoring events specific to the running 
system
+
+   Each file (except for some of those with a '.' in them, '.unit'
+   and '.scale') in the 'events' directory describes a single
+   performance monitoring event supported by the . The name
+   of the file is the name of the event.
+
+   File contents:
+
+   [=][,[=]]...
+
+   Where  is one of the terms listed under
+   /sys/bus/event_source/devices//format/ and  is
+   a number is base-16 format with a '0x' prefix (lowercase only).
+   If a  is specified alone (without an assigned value), it
+   is implied that 0x1 is assigned to that .
+
+   Examples (each of these lines would be in a seperate file):
+
+   event=0x2abc
+   event=0x423,inv,cmask=0x3
+   domain=0x1,offset=0x8,starting_index=0x
+
+   Each of the assignments indicates a value to be assigned to a
+   particular set of bits (as defined by the format file
+   corresponding to the ) in the perf_event structure passed
+   to the perf_open syscall.
+
+What: /sys/bus/event_source/devices//events/.unit
+Date: 2014/02/24
+Contact:   Linux kernel mailing list 
+Description:   Perf event units
+
+   A string specifying the English plural numerical unit that 

+   (once multiplied by .scale) represents.
+
+   Example:
+
+   Joules
+
+What: /sys/bus/event_source/devices//events/.scale
+Date: 2014/02/24
+Contact:   Linux kernel mailing list 
+Description:   Perf event scaling factors
+
+   A string representing a floating point value expressed in
+   scientific notation to be multiplied by the event count
+   recieved from the kernel to match the unit specified in the
+   .unit file.
+
+   Example:
+
+   2.3283064365386962890625e-10
+
+   This is provided to avoid performing floating point arithmetic
+   in the kernel.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf Documentation: Remove Ruplicated docs for powerpc cpu specific events

2014-10-15 Thread tip-bot for Cody P Schafer
Commit-ID:  b56d5beff4825f9f216f1fc4a54a5d07d4b68b71
Gitweb: http://git.kernel.org/tip/b56d5beff4825f9f216f1fc4a54a5d07d4b68b71
Author: Cody P Schafer 
AuthorDate: Tue, 30 Sep 2014 23:03:20 -0700
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 15 Oct 2014 16:00:37 -0300

perf Documentation: Remove Ruplicated docs for powerpc cpu specific events

Listing specific events doesn't actually help us at all here because:
 - these events actually vary between different ppc processors, they
   aren't garunteed to be present.
 - the documentation of the (generic) file contents is now superceded by the
   docs for arbitrary event file contents.

Signed-off-by: Cody P Schafer 
Signed-off-by: Sukadev Bhattiprolu 
Cc: Andi Kleen 
Cc: Anshuman Khandual 
Cc: Haren Myneni 
Cc: Jiri Olsa 
Cc: Michael Ellerman 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: linuxppc-...@lists.ozlabs.org
Link: 
http://lkml.kernel.org/r/1412143402-26061-5-git-send-email-suka...@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 .../testing/sysfs-bus-event_source-devices-events  | 573 -
 1 file changed, 573 deletions(-)

diff --git a/Documentation/ABI/testing/sysfs-bus-event_source-devices-events 
b/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
index a5226f0..20979f8 100644
--- a/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
+++ b/Documentation/ABI/testing/sysfs-bus-event_source-devices-events
@@ -27,579 +27,6 @@ Description:Generic performance monitoring events
"basename".
 
 
-What:  /sys/devices/cpu/events/PM_1PLUS_PPC_CMPL
-   /sys/devices/cpu/events/PM_BRU_FIN
-   /sys/devices/cpu/events/PM_BR_MPRED
-   /sys/devices/cpu/events/PM_CMPLU_STALL
-   /sys/devices/cpu/events/PM_CMPLU_STALL_BRU
-   /sys/devices/cpu/events/PM_CMPLU_STALL_DCACHE_MISS
-   /sys/devices/cpu/events/PM_CMPLU_STALL_DFU
-   /sys/devices/cpu/events/PM_CMPLU_STALL_DIV
-   /sys/devices/cpu/events/PM_CMPLU_STALL_ERAT_MISS
-   /sys/devices/cpu/events/PM_CMPLU_STALL_FXU
-   /sys/devices/cpu/events/PM_CMPLU_STALL_IFU
-   /sys/devices/cpu/events/PM_CMPLU_STALL_LSU
-   /sys/devices/cpu/events/PM_CMPLU_STALL_REJECT
-   /sys/devices/cpu/events/PM_CMPLU_STALL_SCALAR
-   /sys/devices/cpu/events/PM_CMPLU_STALL_SCALAR_LONG
-   /sys/devices/cpu/events/PM_CMPLU_STALL_STORE
-   /sys/devices/cpu/events/PM_CMPLU_STALL_THRD
-   /sys/devices/cpu/events/PM_CMPLU_STALL_VECTOR
-   /sys/devices/cpu/events/PM_CMPLU_STALL_VECTOR_LONG
-   /sys/devices/cpu/events/PM_CYC
-   /sys/devices/cpu/events/PM_GCT_NOSLOT_BR_MPRED
-   /sys/devices/cpu/events/PM_GCT_NOSLOT_BR_MPRED_IC_MISS
-   /sys/devices/cpu/events/PM_GCT_NOSLOT_CYC
-   /sys/devices/cpu/events/PM_GCT_NOSLOT_IC_MISS
-   /sys/devices/cpu/events/PM_GRP_CMPL
-   /sys/devices/cpu/events/PM_INST_CMPL
-   /sys/devices/cpu/events/PM_LD_MISS_L1
-   /sys/devices/cpu/events/PM_LD_REF_L1
-   /sys/devices/cpu/events/PM_RUN_CYC
-   /sys/devices/cpu/events/PM_RUN_INST_CMPL
-   /sys/devices/cpu/events/PM_IC_DEMAND_L2_BR_ALL
-   /sys/devices/cpu/events/PM_GCT_UTIL_7_TO_10_SLOTS
-   /sys/devices/cpu/events/PM_PMC2_SAVED
-   /sys/devices/cpu/events/PM_VSU0_16FLOP
-   /sys/devices/cpu/events/PM_MRK_LSU_DERAT_MISS
-   /sys/devices/cpu/events/PM_MRK_ST_CMPL
-   /sys/devices/cpu/events/PM_NEST_PAIR3_ADD
-   /sys/devices/cpu/events/PM_L2_ST_DISP
-   /sys/devices/cpu/events/PM_L2_CASTOUT_MOD
-   /sys/devices/cpu/events/PM_ISEG
-   /sys/devices/cpu/events/PM_MRK_INST_TIMEO
-   /sys/devices/cpu/events/PM_L2_RCST_DISP_FAIL_ADDR
-   /sys/devices/cpu/events/PM_LSU1_DC_PREF_STREAM_CONFIRM
-   /sys/devices/cpu/events/PM_IERAT_WR_64K
-   /sys/devices/cpu/events/PM_MRK_DTLB_MISS_16M
-   /sys/devices/cpu/events/PM_IERAT_MISS
-   /sys/devices/cpu/events/PM_MRK_PTEG_FROM_LMEM
-   /sys/devices/cpu/events/PM_FLOP
-   /sys/devices/cpu/events/PM_THRD_PRIO_4_5_CYC
-   /sys/devices/cpu/events/PM_BR_PRED_TA
-   /sys/devices/cpu/events/PM_EXT_INT
-   /sys/devices/cpu/events/PM_VSU_FSQRT_FDIV
-   /sys/devices/cpu/events/PM_MRK_LD_MISS_EXPOSED_CYC
-   /sys/devices/cpu/events/PM_LSU1_LDF
-   /sys/devices/cpu/events/PM_IC_WRITE_ALL
-   /sys/devices/cpu/events/PM_LSU0_SRQ_STFWD
-   /sys/devices/cpu/events/PM_PTEG_FROM_RL2L3_MOD
-   /sys/devices/cpu/events/PM_MRK_DATA_FROM_L31_SHR
-