* [GIT PULL 00/34] perf/core improvements and fixes
@ 2013-12-10 20:31 Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 21/34 v2] perf report: Add --header/--header-only options Arnaldo Carvalho de Melo
` (14 more replies)
0 siblings, 15 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter, Andi Kleen,
Ben Cheng, Corey Ashford, David Ahern, Dongsheng Yang,
Frederic Weisbecker, Jean Pihet, Jiri Olsa, linaro-kernel,
Mike Galbraith, Namhyung Kim, patches, Paul Mackerras,
Peter Zijlstra, Stephane Eranian, Steven Rostedt, Will Deacon,
Arnaldo Carvalho de Melo
From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Hi Ingo,
The first 20 patches in this series are the same as in the previous
one, so I'm not reposting them now.
This series has the code style/constification changes you suggested in
the symbols code and then a reworked fix to the basename problem plus some
more patches not present in the previous series.
Please let me know if you find any further problems,
Best Regards,
- Arnaldo
The following changes since commit 6d65894bc028d0342829ea1e64c9e9efad571124:
tools lib traceevent: Update kvm plugin with is_writable_pte helper (2013-12-04 15:38:14 -0300)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
for you to fetch changes up to 1448fef40af6079de38380c3a81bcf9994a1037d:
perf unwinding: Use the per-feature check flags (2013-12-10 16:51:12 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
. Add an option in 'perf script' to print the source line number, from Adrian Hunter
. Add --header/--header-only options to 'script' and 'report', the default is not
tho show the header info, but as this has been the default for some time,
leave a single line explaining how to obtain that information, from Jiri Olsa.
. Fix symoff printing in callchains in 'perf script', from Adrian Hunter.
. Assorted mmap_pages handling fixes, from Adrian Hunter.
. Fix summary percentage when processing files in 'perf trace', fom David Ahern.
. Handle old kernels where the "raw_syscalls" tracepoints were called plan "syscalls",
in 'perf trace', from David Ahern.
. Several man pages typo fixes from Dongsheng Yang.
. Add '-v' option to 'perf kvm', from Dongsheng Yang.
. Make perf kvm diff support --guestmount, from Dongsheng Yang.
. Get rid of several die() calls in libtraceevent, from Namhyung Kim.
. Use basename() in a more robust way, to avoid problems related to different
system library implementations for that function, from Stephane Eranian.
. Remove open coded management of short_name_allocated member, from Adrian Hunter
. Several cleanups in the "dso" methods, constifying some parameters and
renaming some fields to clarify its purpose.
. Add per-feature check flags, fixing libunwind related build problems on some
architectures, from Jean Pihet.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Adrian Hunter (7):
perf script: Fix symoff printing in callchains
perf script: Add an option to print the source line number
perf record: Fix display of incorrect mmap pages
perf evlist: Remove unnecessary parentheses
perf evlist: Fix max mmap_pages
perf evlist: Fix mmap pages rounding to power of 2
perf symbols: Remove open coded management of short_name_allocated member
Arnaldo Carvalho de Melo (8):
perf symbols: Rename [sl]name_alloc to match the members they refer to
perf machine: Don't open code assign dso->short_name
perf symbols: Set alloc flag close to setting the long_name
perf symbols: Remove open coded management of long_name_allocated member
perf symbols: Constify dso->long_name
perf symbols: Set freed members to NULL in dso destructor
perf symbols: Constify some DSO methods parameters
perf symbols: Rename filename argument
David Ahern (2):
perf trace: Add support for syscalls vs raw_syscalls
perf trace: Fix summary percentage when processing files
Dongsheng Yang (6):
perf kvm: Introduce option -v for perf kvm command.
perf kvm: Fix bug in 'stat report'
perf archive: Remove duplicated 'runs' in man page
perf annotate: Fix typo
perf kvm: Move code to generate filename for perf-kvm to function.
perf kvm: Make perf kvm diff support --guestmount.
Jean Pihet (2):
perf tools: Add per-feature check flags
perf unwinding: Use the per-feature check flags
Jiri Olsa (2):
perf report: Add --header/--header-only options
perf script: Add --header/--header-only options
Namhyung Kim (5):
tools lib traceevent: Get rid of malloc_or_die() in pevent_filter_alloc()
tools lib traceevent: Get rid of malloc_or_die() in add_event()
tools lib traceevent: Get rid of die() in create_arg_item()
tools lib traceevent: Get rid of malloc_or_die() in pevent_filter_add_filter_str()
tools lib traceevent: Get rid of die() in pevent_filter_clear_trivial()
Stephane Eranian (1):
perf symbols: Fix bug in usage of the basename() function
Steven Rostedt (1):
tools lib traceevent: Report better error message on bad function args
tools/lib/traceevent/event-parse.c | 28 +++++---
tools/lib/traceevent/event-parse.h | 2 +-
tools/lib/traceevent/parse-filter.c | 57 +++++++++++----
tools/perf/Documentation/perf-archive.txt | 6 +-
tools/perf/Documentation/perf-kvm.txt | 7 +-
tools/perf/Documentation/perf-report.txt | 9 +++
tools/perf/Documentation/perf-script.txt | 8 ++-
tools/perf/builtin-annotate.c | 2 +-
tools/perf/builtin-diff.c | 3 +-
tools/perf/builtin-kvm.c | 11 ++-
tools/perf/builtin-record.c | 2 +-
tools/perf/builtin-report.c | 22 +++++-
tools/perf/builtin-script.c | 23 +++++-
tools/perf/builtin-trace.c | 32 ++++++++-
tools/perf/config/Makefile | 52 ++++++++------
tools/perf/config/feature-checks/Makefile | 8 +--
tools/perf/util/annotate.c | 2 +-
tools/perf/util/build-id.c | 2 +-
tools/perf/util/build-id.h | 2 +-
tools/perf/util/dso.c | 112 ++++++++++++++++++++----------
tools/perf/util/dso.h | 16 ++---
tools/perf/util/evlist.c | 10 +--
tools/perf/util/header.c | 6 +-
tools/perf/util/machine.c | 6 +-
tools/perf/util/map.c | 17 +++++
tools/perf/util/map.h | 2 +
tools/perf/util/probe-event.c | 2 +-
tools/perf/util/session.c | 15 +++-
tools/perf/util/session.h | 1 +
tools/perf/util/srcline.c | 2 +-
tools/perf/util/symbol.c | 38 ++++------
tools/perf/util/symbol.h | 3 +-
tools/perf/util/util.c | 14 ++++
tools/perf/util/util.h | 14 ++++
tools/perf/util/vdso.c | 2 +-
35 files changed, 375 insertions(+), 163 deletions(-)
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 21/34 v2] perf report: Add --header/--header-only options
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 22/34] perf script: " Arnaldo Carvalho de Melo
` (13 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
Peter Zijlstra, Stephane Eranian, Arnaldo Carvalho de Melo
From: Jiri Olsa <jolsa@redhat.com>
Currently the perf.data header is always displayed for stdio output,
which is no always useful.
Disabling header information by default and adding following options to
control header output:
--header - display header information (old default)
--header-only - display header information only w/o further
processing, forces stdio output
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386583370-1699-2-git-send-email-jolsa@redhat.com
[ Added single line explaining talking about the new --header* options,
to address David Ahern comment; better man page entry for the new options,
from Namhyung Kim ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-report.txt | 9 +++++++++
tools/perf/builtin-report.c | 22 +++++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 10a279871251..8eab8a4bdeb8 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -237,6 +237,15 @@ OPTIONS
Do not show entries which have an overhead under that percent.
(Default: 0).
+--header::
+ Show header information in the perf.data file. This includes
+ various information like hostname, OS and perf version, cpu/mem
+ info, perf command line, event list and so on. Currently only
+ --stdio output supports this feature.
+
+--header-only::
+ Show only perf.data header (forces --stdio).
+
SEE ALSO
--------
linkperf:perf-stat[1], linkperf:perf-annotate[1]
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 8cf8e66ba594..3a14dbed387c 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -49,6 +49,8 @@ struct perf_report {
bool show_threads;
bool inverted_callchain;
bool mem_mode;
+ bool header;
+ bool header_only;
int max_stack;
struct perf_read_values show_threads_values;
const char *pretty_printing_style;
@@ -514,9 +516,6 @@ static int __cmd_report(struct perf_report *rep)
return ret;
}
- if (use_browser <= 0)
- perf_session__fprintf_info(session, stdout, rep->show_full_info);
-
if (rep->show_threads)
perf_read_values_init(&rep->show_threads_values);
@@ -820,6 +819,9 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN(0, "gtk", &report.use_gtk, "Use the GTK2 interface"),
OPT_BOOLEAN(0, "stdio", &report.use_stdio,
"Use the stdio interface"),
+ OPT_BOOLEAN(0, "header", &report.header, "Show data header."),
+ OPT_BOOLEAN(0, "header-only", &report.header_only,
+ "Show only data header."),
OPT_STRING('s', "sort", &sort_order, "key[,key2...]",
"sort by key(s): pid, comm, dso, symbol, parent, cpu, srcline,"
" dso_to, dso_from, symbol_to, symbol_from, mispredict,"
@@ -963,6 +965,10 @@ repeat:
goto error;
}
+ /* Force tty output for header output. */
+ if (report.header || report.header_only)
+ use_browser = 0;
+
if (strcmp(input_name, "-") != 0)
setup_browser(true);
else {
@@ -970,6 +976,16 @@ repeat:
perf_hpp__init();
}
+ if (report.header || report.header_only) {
+ perf_session__fprintf_info(session, stdout,
+ report.show_full_info);
+ if (report.header_only)
+ return 0;
+ } else if (use_browser == 0) {
+ fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
+ stdout);
+ }
+
/*
* Only in the TUI browser we are doing integrated annotation,
* so don't allocate extra space that won't be used in the stdio
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 22/34] perf script: Add --header/--header-only options
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 21/34 v2] perf report: Add --header/--header-only options Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 23/34] perf symbols: Rename [sl]name_alloc to match the members they refer to Arnaldo Carvalho de Melo
` (12 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jiri Olsa, Corey Ashford, David Ahern,
Frederic Weisbecker, Ingo Molnar, Namhyung Kim, Paul Mackerras,
Peter Zijlstra, Stephane Eranian, Arnaldo Carvalho de Melo
From: Jiri Olsa <jolsa@redhat.com>
Currently the perf.data header is always displayed for stdio output,
which is no always useful.
Disabling header information by default and adding following options to
control header output:
--header - display header information
--header-only - display header information only w/o further
processing
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386583370-1699-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-script.txt | 6 ++++++
tools/perf/builtin-script.c | 13 ++++++++++---
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt
index c2a5071cf8f8..05f9a0a6784c 100644
--- a/tools/perf/Documentation/perf-script.txt
+++ b/tools/perf/Documentation/perf-script.txt
@@ -209,6 +209,12 @@ OPTIONS
--show-mmap-events
Display mmap related events (e.g. MMAP, MMAP2).
+--header
+ Show perf.data header.
+
+--header-only
+ Show only perf.data header.
+
SEE ALSO
--------
linkperf:perf-record[1], linkperf:perf-script-perl[1],
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 7a571fb7eb8a..f8ab125aac48 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1494,6 +1494,8 @@ static int have_cmd(int argc, const char **argv)
int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
{
bool show_full_info = false;
+ bool header = false;
+ bool header_only = false;
char *rec_script_path = NULL;
char *rep_script_path = NULL;
struct perf_session *session;
@@ -1532,6 +1534,8 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_STRING('i', "input", &input_name, "file", "input file name"),
OPT_BOOLEAN('d', "debug-mode", &debug_mode,
"do various checks like samples ordering and lost events"),
+ OPT_BOOLEAN(0, "header", &header, "Show data header."),
+ OPT_BOOLEAN(0, "header-only", &header_only, "Show only data header."),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name,
@@ -1748,6 +1752,12 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
if (session == NULL)
return -ENOMEM;
+ if (header || header_only) {
+ perf_session__fprintf_info(session, stdout, show_full_info);
+ if (header_only)
+ return 0;
+ }
+
script.session = session;
if (cpu_list) {
@@ -1755,9 +1765,6 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused)
return -1;
}
- if (!script_name && !generate_script_lang)
- perf_session__fprintf_info(session, stdout, show_full_info);
-
if (!no_callchain)
symbol_conf.use_callchain = true;
else
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 23/34] perf symbols: Rename [sl]name_alloc to match the members they refer to
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 21/34 v2] perf report: Add --header/--header-only options Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 22/34] perf script: " Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 24/34] perf machine: Don't open code assign dso->short_name Arnaldo Carvalho de Melo
` (11 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
So we now have:
dso->short_name
dso->short_name_len
dso->short_name_allocated
Ditto for the 'long variants. To more quickly grasp what they refer to.
Suggested-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-nu228f8vlp9w0lr7c0q77dqi@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 4 ++--
tools/perf/util/dso.h | 4 ++--
tools/perf/util/machine.c | 4 ++--
tools/perf/util/symbol.c | 6 +++---
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index a0c7c591f4b2..55c983586b05 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -465,9 +465,9 @@ void dso__delete(struct dso *dso)
int i;
for (i = 0; i < MAP__NR_TYPES; ++i)
symbols__delete(&dso->symbols[i]);
- if (dso->sname_alloc)
+ if (dso->short_name_allocated)
free((char *)dso->short_name);
- if (dso->lname_alloc)
+ if (dso->long_name_allocated)
free(dso->long_name);
dso_cache__free(&dso->cache);
dso__free_a2l(dso);
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 384f2d97e38e..00a232d89607 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -89,8 +89,8 @@ struct dso {
u8 has_srcline:1;
u8 hit:1;
u8 annotate_warned:1;
- u8 sname_alloc:1;
- u8 lname_alloc:1;
+ u8 short_name_allocated:1;
+ u8 long_name_allocated:1;
u8 sorted_by_name;
u8 loaded;
u8 rel;
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index bac817ab2068..f66f309a091a 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -764,7 +764,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
goto out;
}
dso__set_long_name(map->dso, long_name);
- map->dso->lname_alloc = 1;
+ map->dso->long_name_allocated = 1;
dso__kernel_module_get_build_id(map->dso, "");
}
}
@@ -936,7 +936,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
goto out_problem;
map->dso->short_name = name;
- map->dso->sname_alloc = 1;
+ map->dso->short_name_allocated = 1;
map->end = map->start + event->mmap.len;
} else if (is_kernel_mmap) {
const char *symbol_name = (event->mmap.filename +
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index de87dbac50a0..265a149bc43f 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1458,7 +1458,7 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map,
if (filename != NULL) {
err = dso__load_vmlinux(dso, map, filename, filter);
if (err > 0) {
- dso->lname_alloc = 1;
+ dso->long_name_allocated = 1;
goto out;
}
free(filename);
@@ -1468,7 +1468,7 @@ int dso__load_vmlinux_path(struct dso *dso, struct map *map,
err = dso__load_vmlinux(dso, map, vmlinux_path[i], filter);
if (err > 0) {
dso__set_long_name(dso, strdup(vmlinux_path[i]));
- dso->lname_alloc = 1;
+ dso->long_name_allocated = 1;
break;
}
}
@@ -1612,7 +1612,7 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map,
if (err > 0) {
dso__set_long_name(dso,
strdup(symbol_conf.vmlinux_name));
- dso->lname_alloc = 1;
+ dso->long_name_allocated = 1;
return err;
}
return err;
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 24/34] perf machine: Don't open code assign dso->short_name
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 23/34] perf symbols: Rename [sl]name_alloc to match the members they refer to Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 25/34] perf symbols: Remove open coded management of short_name_allocated member Arnaldo Carvalho de Melo
` (10 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Use dso__set_short_name instead, as it will release any previously,
possibly allocated, short name.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-1v39elw7v6nxczpntpp7ljwr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/machine.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index f66f309a091a..f85da9a9a5d9 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -935,7 +935,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
if (name == NULL)
goto out_problem;
- map->dso->short_name = name;
+ dso__set_short_name(map->dso, name);
map->dso->short_name_allocated = 1;
map->end = map->start + event->mmap.len;
} else if (is_kernel_mmap) {
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 25/34] perf symbols: Remove open coded management of short_name_allocated member
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 24/34] perf machine: Don't open code assign dso->short_name Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 26/34] perf symbols: Set alloc flag close to setting the long_name Arnaldo Carvalho de Melo
` (9 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Adrian Hunter, Andi Kleen, David Ahern,
Dongsheng Yang, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian,
Steven Rostedt, Arnaldo Carvalho de Melo
From: Adrian Hunter <adrian.hunter@intel.com>
Instead of expecting callers to set this member accodingly so that later
at dso destruction it can, if needed, be correctly free()d, make it a
requirement by passing it as a parameter to dso__set_short_name.
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
CC: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Link: http://lkml.kernel.org/r/52A707A2.5020802@intel.com
[ Renamed the 'allocated' parameter to clearly indicate to which variable it refers to. ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 17 +++++++++++------
tools/perf/util/dso.h | 2 +-
tools/perf/util/machine.c | 3 +--
3 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 55c983586b05..f8c849767c4d 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -379,7 +379,7 @@ struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
* processing we had no idea this was the kernel dso.
*/
if (dso != NULL) {
- dso__set_short_name(dso, short_name);
+ dso__set_short_name(dso, short_name, false);
dso->kernel = dso_type;
}
@@ -394,17 +394,22 @@ void dso__set_long_name(struct dso *dso, char *name)
dso->long_name_len = strlen(name);
}
-void dso__set_short_name(struct dso *dso, const char *name)
+void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)
{
if (name == NULL)
return;
- dso->short_name = name;
- dso->short_name_len = strlen(name);
+
+ if (dso->short_name_allocated)
+ free((char *)dso->short_name);
+
+ dso->short_name = name;
+ dso->short_name_len = strlen(name);
+ dso->short_name_allocated = name_allocated;
}
static void dso__set_basename(struct dso *dso)
{
- dso__set_short_name(dso, basename(dso->long_name));
+ dso__set_short_name(dso, basename(dso->long_name), false);
}
int dso__name_len(const struct dso *dso)
@@ -440,7 +445,7 @@ struct dso *dso__new(const char *name)
int i;
strcpy(dso->name, name);
dso__set_long_name(dso, dso->name);
- dso__set_short_name(dso, dso->name);
+ dso__set_short_name(dso, dso->name, false);
for (i = 0; i < MAP__NR_TYPES; ++i)
dso->symbols[i] = dso->symbol_names[i] = RB_ROOT;
dso->cache = RB_ROOT;
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 00a232d89607..8eceab78088f 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -110,7 +110,7 @@ static inline void dso__set_loaded(struct dso *dso, enum map_type type)
struct dso *dso__new(const char *name);
void dso__delete(struct dso *dso);
-void dso__set_short_name(struct dso *dso, const char *name);
+void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated);
void dso__set_long_name(struct dso *dso, char *name);
int dso__name_len(const struct dso *dso);
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index f85da9a9a5d9..09d5c66d4087 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -935,8 +935,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
if (name == NULL)
goto out_problem;
- dso__set_short_name(map->dso, name);
- map->dso->short_name_allocated = 1;
+ dso__set_short_name(map->dso, name, true);
map->end = map->start + event->mmap.len;
} else if (is_kernel_mmap) {
const char *symbol_name = (event->mmap.filename +
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 26/34] perf symbols: Set alloc flag close to setting the long_name
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 25/34] perf symbols: Remove open coded management of short_name_allocated member Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 27/34] perf symbols: Remove open coded management of long_name_allocated member Arnaldo Carvalho de Melo
` (8 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
This is a preparatory patch to do with dso__set_long_name what was done
with the short name variant.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-mb7eqhkyejq1qcf3p22wz2x7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/probe-event.c | 2 +-
tools/perf/util/symbol.c | 31 +++++++++++--------------------
tools/perf/util/symbol.h | 3 ++-
3 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 9c6989ca2bea..d7cff57945c2 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -154,7 +154,7 @@ static struct dso *kernel_get_module_dso(const char *module)
vmlinux_name = symbol_conf.vmlinux_name;
if (vmlinux_name) {
- if (dso__load_vmlinux(dso, map, vmlinux_name, NULL) <= 0)
+ if (dso__load_vmlinux(dso, map, vmlinux_name, false, NULL) <= 0)
return NULL;
} else {
if (dso__load_vmlinux_path(dso, map, NULL) <= 0) {
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 265a149bc43f..9a5de8837d6d 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1408,7 +1408,8 @@ struct map *map_groups__find_by_name(struct map_groups *mg,
}
int dso__load_vmlinux(struct dso *dso, struct map *map,
- const char *vmlinux, symbol_filter_t filter)
+ const char *vmlinux, bool vmlinux_allocated,
+ symbol_filter_t filter)
{
int err = -1;
struct symsrc ss;
@@ -1438,6 +1439,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
else
dso->data_type = DSO_BINARY_TYPE__VMLINUX;
dso__set_long_name(dso, (char *)vmlinux);
+ dso->long_name_allocated = vmlinux_allocated;
dso__set_loaded(dso, map->type);
pr_debug("Using %s for symbols\n", symfs_vmlinux);
}
@@ -1456,21 +1458,16 @@ 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->long_name_allocated = 1;
+ err = dso__load_vmlinux(dso, map, filename, true, filter);
+ if (err > 0)
goto out;
- }
free(filename);
}
for (i = 0; i < vmlinux_path__nr_entries; ++i) {
- err = dso__load_vmlinux(dso, map, vmlinux_path[i], filter);
- if (err > 0) {
- dso__set_long_name(dso, strdup(vmlinux_path[i]));
- dso->long_name_allocated = 1;
+ err = dso__load_vmlinux(dso, map, vmlinux_path[i], false, filter);
+ if (err > 0)
break;
- }
}
out:
return err;
@@ -1607,15 +1604,8 @@ static int dso__load_kernel_sym(struct dso *dso, struct map *map,
}
if (!symbol_conf.ignore_vmlinux && symbol_conf.vmlinux_name != NULL) {
- err = dso__load_vmlinux(dso, map,
- symbol_conf.vmlinux_name, filter);
- if (err > 0) {
- dso__set_long_name(dso,
- strdup(symbol_conf.vmlinux_name));
- dso->long_name_allocated = 1;
- return err;
- }
- return err;
+ return dso__load_vmlinux(dso, map, symbol_conf.vmlinux_name,
+ false, filter);
}
if (!symbol_conf.ignore_vmlinux && vmlinux_path != NULL) {
@@ -1671,7 +1661,8 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map,
*/
if (symbol_conf.default_guest_vmlinux_name != NULL) {
err = dso__load_vmlinux(dso, map,
- symbol_conf.default_guest_vmlinux_name, filter);
+ symbol_conf.default_guest_vmlinux_name,
+ false, filter);
return err;
}
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index f1031a1358a1..6de9c2b8a601 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -206,7 +206,8 @@ bool symsrc__possibly_runtime(struct symsrc *ss);
int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter);
int dso__load_vmlinux(struct dso *dso, struct map *map,
- const char *vmlinux, symbol_filter_t filter);
+ const char *vmlinux, bool vmlinux_allocated,
+ symbol_filter_t filter);
int dso__load_vmlinux_path(struct dso *dso, struct map *map,
symbol_filter_t filter);
int dso__load_kallsyms(struct dso *dso, const char *filename, struct map *map,
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 27/34] perf symbols: Remove open coded management of long_name_allocated member
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (5 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 26/34] perf symbols: Set alloc flag close to setting the long_name Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 28/34] perf symbols: Constify dso->long_name Arnaldo Carvalho de Melo
` (7 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Instead of expecting callers to set this member accodingly so that later
at dso destruction it can, if needed, be correctly free()d, make it a
requirement by passing it as a parameter to dso__set_long_name.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-na7t1tqim22vuqkt4zq5n4ri@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 13 +++++++++----
tools/perf/util/dso.h | 2 +-
tools/perf/util/machine.c | 3 +--
tools/perf/util/symbol.c | 9 ++++-----
tools/perf/util/vdso.c | 2 +-
5 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index f8c849767c4d..ecb37d62f814 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -386,12 +386,17 @@ struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
return dso;
}
-void dso__set_long_name(struct dso *dso, char *name)
+void dso__set_long_name(struct dso *dso, char *name, bool name_allocated)
{
if (name == NULL)
return;
- dso->long_name = name;
- dso->long_name_len = strlen(name);
+
+ if (dso->long_name_allocated)
+ free(dso->long_name);
+
+ dso->long_name = name;
+ dso->long_name_len = strlen(name);
+ dso->long_name_allocated = name_allocated;
}
void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)
@@ -444,7 +449,7 @@ struct dso *dso__new(const char *name)
if (dso != NULL) {
int i;
strcpy(dso->name, name);
- dso__set_long_name(dso, dso->name);
+ dso__set_long_name(dso, dso->name, false);
dso__set_short_name(dso, dso->name, false);
for (i = 0; i < MAP__NR_TYPES; ++i)
dso->symbols[i] = dso->symbol_names[i] = RB_ROOT;
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 8eceab78088f..7b434691525a 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -111,7 +111,7 @@ struct dso *dso__new(const char *name);
void dso__delete(struct dso *dso);
void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated);
-void dso__set_long_name(struct dso *dso, char *name);
+void dso__set_long_name(struct dso *dso, char *name, bool name_allocated);
int dso__name_len(const struct dso *dso);
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 09d5c66d4087..751454bcde69 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -763,8 +763,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *mg,
ret = -1;
goto out;
}
- dso__set_long_name(map->dso, long_name);
- map->dso->long_name_allocated = 1;
+ dso__set_long_name(map->dso, long_name, true);
dso__kernel_module_get_build_id(map->dso, "");
}
}
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 9a5de8837d6d..5029ee1a9421 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1159,7 +1159,7 @@ static int dso__load_kcore(struct dso *dso, struct map *map,
dso->data_type = DSO_BINARY_TYPE__GUEST_KCORE;
else
dso->data_type = DSO_BINARY_TYPE__KCORE;
- dso__set_long_name(dso, strdup(kcore_filename));
+ dso__set_long_name(dso, strdup(kcore_filename), true);
close(fd);
@@ -1438,8 +1438,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
dso->data_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
else
dso->data_type = DSO_BINARY_TYPE__VMLINUX;
- dso__set_long_name(dso, (char *)vmlinux);
- dso->long_name_allocated = vmlinux_allocated;
+ dso__set_long_name(dso, (char *)vmlinux, vmlinux_allocated);
dso__set_loaded(dso, map->type);
pr_debug("Using %s for symbols\n", symfs_vmlinux);
}
@@ -1631,7 +1630,7 @@ do_kallsyms:
free(kallsyms_allocated_filename);
if (err > 0 && !dso__is_kcore(dso)) {
- dso__set_long_name(dso, strdup("[kernel.kallsyms]"));
+ dso__set_long_name(dso, strdup("[kernel.kallsyms]"), true);
map__fixup_start(map);
map__fixup_end(map);
}
@@ -1679,7 +1678,7 @@ static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map,
pr_debug("Using %s for symbols\n", kallsyms_filename);
if (err > 0 && !dso__is_kcore(dso)) {
machine__mmap_name(machine, path, sizeof(path));
- dso__set_long_name(dso, strdup(path));
+ dso__set_long_name(dso, strdup(path), true);
map__fixup_start(map);
map__fixup_end(map);
}
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index 39159822d58f..0ddb3b8a89ec 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -103,7 +103,7 @@ struct dso *vdso__dso_findnew(struct list_head *head)
dso = dso__new(VDSO__MAP_NAME);
if (dso != NULL) {
dsos__add(head, dso);
- dso__set_long_name(dso, file);
+ dso__set_long_name(dso, file, false);
}
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 28/34] perf symbols: Constify dso->long_name
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (6 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 27/34] perf symbols: Remove open coded management of long_name_allocated member Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 29/34] perf symbols: Set freed members to NULL in dso destructor Arnaldo Carvalho de Melo
` (6 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Same reason as for dso->short_name, it may point to a const string, and
in most places it is treated as const, i.e. it is just accessed for
using its contents as a key or to show it on reports.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-nf7mxf33zt5qw207pbxxryot@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.c | 2 +-
tools/perf/util/dso.c | 10 +++++-----
tools/perf/util/dso.h | 4 ++--
| 6 +++---
tools/perf/util/srcline.c | 2 +-
tools/perf/util/symbol.c | 4 ++--
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index cf6242c92ee2..0fcd81ea31ae 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -900,7 +900,7 @@ fallback:
* cache, or is just a kallsyms file, well, lets hope that this
* DSO is the same as when 'perf record' ran.
*/
- filename = dso->long_name;
+ filename = (char *)dso->long_name;
snprintf(symfs_filename, sizeof(symfs_filename), "%s%s",
symbol_conf.symfs, filename);
free_filename = false;
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index ecb37d62f814..2c7e1899a735 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -67,7 +67,7 @@ int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
case DSO_BINARY_TYPE__OPENEMBEDDED_DEBUGINFO:
{
- char *last_slash;
+ const char *last_slash;
size_t len;
size_t dir_size;
@@ -386,13 +386,13 @@ struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
return dso;
}
-void dso__set_long_name(struct dso *dso, char *name, bool name_allocated)
+void dso__set_long_name(struct dso *dso, const char *name, bool name_allocated)
{
if (name == NULL)
return;
if (dso->long_name_allocated)
- free(dso->long_name);
+ free((char *)dso->long_name);
dso->long_name = name;
dso->long_name_len = strlen(name);
@@ -414,7 +414,7 @@ void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)
static void dso__set_basename(struct dso *dso)
{
- dso__set_short_name(dso, basename(dso->long_name), false);
+ dso__set_short_name(dso, basename((char *)dso->long_name), false);
}
int dso__name_len(const struct dso *dso)
@@ -478,7 +478,7 @@ void dso__delete(struct dso *dso)
if (dso->short_name_allocated)
free((char *)dso->short_name);
if (dso->long_name_allocated)
- free(dso->long_name);
+ free((char *)dso->long_name);
dso_cache__free(&dso->cache);
dso__free_a2l(dso);
free(dso->symsrc_filename);
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 7b434691525a..a2d71292f746 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -96,7 +96,7 @@ struct dso {
u8 rel;
u8 build_id[BUILD_ID_SIZE];
const char *short_name;
- char *long_name;
+ const char *long_name;
u16 long_name_len;
u16 short_name_len;
char name[0];
@@ -111,7 +111,7 @@ struct dso *dso__new(const char *name);
void dso__delete(struct dso *dso);
void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated);
-void dso__set_long_name(struct dso *dso, char *name, bool name_allocated);
+void dso__set_long_name(struct dso *dso, const char *name, bool name_allocated);
int dso__name_len(const struct dso *dso);
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 125cdc9250ee..0bb830f6b49c 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -177,7 +177,7 @@ perf_header__set_cmdline(int argc, const char **argv)
continue; \
else
-static int write_buildid(char *name, size_t name_len, u8 *build_id,
+static int write_buildid(const char *name, size_t name_len, u8 *build_id,
pid_t pid, u16 misc, int fd)
{
int err;
@@ -209,7 +209,7 @@ static int __dsos__write_buildid_table(struct list_head *head,
dsos__for_each_with_build_id(pos, head) {
int err;
- char *name;
+ const char *name;
size_t name_len;
if (!pos->hit)
@@ -387,7 +387,7 @@ static int dso__cache_build_id(struct dso *dso, struct machine *machine,
{
bool is_kallsyms = dso->kernel && dso->long_name[0] != '/';
bool is_vdso = is_vdso_map(dso->short_name);
- char *name = dso->long_name;
+ const char *name = dso->long_name;
char nm[PATH_MAX];
if (dso__is_kcore(dso)) {
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index 0c075560ad46..58b2bd8f38c9 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -255,7 +255,7 @@ char *get_srcline(struct dso *dso, unsigned long addr)
char *file = NULL;
unsigned line = 0;
char *srcline;
- char *dso_name;
+ const char *dso_name;
if (!dso->has_srcline)
return SRCLINE_UNKNOWN;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 5029ee1a9421..e377c2e96191 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1438,7 +1438,7 @@ int dso__load_vmlinux(struct dso *dso, struct map *map,
dso->data_type = DSO_BINARY_TYPE__GUEST_VMLINUX;
else
dso->data_type = DSO_BINARY_TYPE__VMLINUX;
- dso__set_long_name(dso, (char *)vmlinux, vmlinux_allocated);
+ dso__set_long_name(dso, vmlinux, vmlinux_allocated);
dso__set_loaded(dso, map->type);
pr_debug("Using %s for symbols\n", symfs_vmlinux);
}
@@ -1630,7 +1630,7 @@ do_kallsyms:
free(kallsyms_allocated_filename);
if (err > 0 && !dso__is_kcore(dso)) {
- dso__set_long_name(dso, strdup("[kernel.kallsyms]"), true);
+ dso__set_long_name(dso, "[kernel.kallsyms]", false);
map__fixup_start(map);
map__fixup_end(map);
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 29/34] perf symbols: Set freed members to NULL in dso destructor
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (7 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 28/34] perf symbols: Constify dso->long_name Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 30/34] perf symbols: Constify some DSO methods parameters Arnaldo Carvalho de Melo
` (5 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To help in debugging use after free bugs.
Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-3ckwsob2g1q23s77nuhexrq7@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 2c7e1899a735..19babb0d365d 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -475,13 +475,23 @@ void dso__delete(struct dso *dso)
int i;
for (i = 0; i < MAP__NR_TYPES; ++i)
symbols__delete(&dso->symbols[i]);
- if (dso->short_name_allocated)
+
+ if (dso->short_name_allocated) {
free((char *)dso->short_name);
- if (dso->long_name_allocated)
+ dso->short_name = NULL;
+ dso->short_name_allocated = false;
+ }
+
+ if (dso->long_name_allocated) {
free((char *)dso->long_name);
+ dso->long_name = NULL;
+ dso->long_name_allocated = false;
+ }
+
dso_cache__free(&dso->cache);
dso__free_a2l(dso);
free(dso->symsrc_filename);
+ dso->symsrc_filename = NULL;
free(dso);
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 30/34] perf symbols: Constify some DSO methods parameters
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (8 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 29/34] perf symbols: Set freed members to NULL in dso destructor Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 31/34] perf symbols: Rename filename argument Arnaldo Carvalho de Melo
` (4 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
Those methods are not supposed to change the data structures they
manipulate, so make that clearer by using the const qualifier in the
function signature and in some variables.
Suggested-by: Ingo Molnar <mingo@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-j7oyakex7zy3r82h33rdw25x@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/build-id.c | 2 +-
tools/perf/util/build-id.h | 2 +-
tools/perf/util/dso.c | 11 +++++------
tools/perf/util/dso.h | 4 ++--
4 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index a92770c98cc7..6baabe63182b 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -89,7 +89,7 @@ int build_id__sprintf(const u8 *build_id, int len, char *bf)
return raw - build_id;
}
-char *dso__build_id_filename(struct dso *dso, char *bf, size_t size)
+char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size)
{
char build_id_hex[BUILD_ID_SIZE * 2 + 1];
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index 929f28a7c14d..845ef865eced 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -10,7 +10,7 @@ extern struct perf_tool build_id__mark_dso_hit_ops;
struct dso;
int build_id__sprintf(const u8 *build_id, int len, char *bf);
-char *dso__build_id_filename(struct dso *dso, char *bf, size_t size);
+char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size);
int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event,
struct perf_sample *sample, struct perf_evsel *evsel,
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 19babb0d365d..fbc66fde6b30 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -28,7 +28,7 @@ char dso__symtab_origin(const struct dso *dso)
return origin[dso->symtab_type];
}
-int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
+int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
char *root_dir, char *file, size_t size)
{
char build_id_hex[BUILD_ID_SIZE * 2 + 1];
@@ -200,11 +200,10 @@ dso_cache__free(struct rb_root *root)
}
}
-static struct dso_cache*
-dso_cache__find(struct rb_root *root, u64 offset)
+static struct dso_cache *dso_cache__find(const struct rb_root *root, u64 offset)
{
- struct rb_node **p = &root->rb_node;
- struct rb_node *parent = NULL;
+ struct rb_node * const *p = &root->rb_node;
+ const struct rb_node *parent = NULL;
struct dso_cache *cache;
while (*p != NULL) {
@@ -566,7 +565,7 @@ void dsos__add(struct list_head *head, struct dso *dso)
list_add_tail(&dso->node, head);
}
-struct dso *dsos__find(struct list_head *head, const char *name, bool cmp_short)
+struct dso *dsos__find(const struct list_head *head, const char *name, bool cmp_short)
{
struct dso *pos;
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index a2d71292f746..99f3c647d683 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -128,7 +128,7 @@ void dso__read_running_kernel_build_id(struct dso *dso,
int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir);
char dso__symtab_origin(const struct dso *dso);
-int dso__binary_type_file(struct dso *dso, enum dso_binary_type type,
+int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
char *root_dir, char *file, size_t size);
int dso__data_fd(struct dso *dso, struct machine *machine);
@@ -143,7 +143,7 @@ struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
const char *short_name, int dso_type);
void dsos__add(struct list_head *head, struct dso *dso);
-struct dso *dsos__find(struct list_head *head, const char *name,
+struct dso *dsos__find(const struct list_head *head, const char *name,
bool cmp_short);
struct dso *__dsos__findnew(struct list_head *head, const char *name);
bool __dsos__read_build_ids(struct list_head *head, bool with_hits);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 31/34] perf symbols: Rename filename argument
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (9 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 30/34] perf symbols: Constify some DSO methods parameters Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 32/34 v3] perf symbols: Fix bug in usage of the basename() function Arnaldo Carvalho de Melo
` (3 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
David Ahern, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian
From: Arnaldo Carvalho de Melo <acme@redhat.com>
The 'file' is more commonly associated with a file descriptor of
some sort, rename it to 'filename' as this is the more common idiom
for a file name argument.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-0ehaawv5xc83w6ag03c5hi10@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 32 ++++++++++++++++----------------
tools/perf/util/dso.h | 2 +-
2 files changed, 17 insertions(+), 17 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index fbc66fde6b30..582b5d344aa3 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -29,7 +29,7 @@ char dso__symtab_origin(const struct dso *dso)
}
int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
- char *root_dir, char *file, size_t size)
+ char *root_dir, char *filename, size_t size)
{
char build_id_hex[BUILD_ID_SIZE * 2 + 1];
int ret = 0;
@@ -38,30 +38,30 @@ int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
case DSO_BINARY_TYPE__DEBUGLINK: {
char *debuglink;
- strncpy(file, dso->long_name, size);
- debuglink = file + dso->long_name_len;
- while (debuglink != file && *debuglink != '/')
+ strncpy(filename, dso->long_name, size);
+ debuglink = filename + dso->long_name_len;
+ while (debuglink != filename && *debuglink != '/')
debuglink--;
if (*debuglink == '/')
debuglink++;
filename__read_debuglink(dso->long_name, debuglink,
- size - (debuglink - file));
+ size - (debuglink - filename));
}
break;
case DSO_BINARY_TYPE__BUILD_ID_CACHE:
/* skip the locally configured cache if a symfs is given */
if (symbol_conf.symfs[0] ||
- (dso__build_id_filename(dso, file, size) == NULL))
+ (dso__build_id_filename(dso, filename, size) == NULL))
ret = -1;
break;
case DSO_BINARY_TYPE__FEDORA_DEBUGINFO:
- snprintf(file, size, "%s/usr/lib/debug%s.debug",
+ snprintf(filename, size, "%s/usr/lib/debug%s.debug",
symbol_conf.symfs, dso->long_name);
break;
case DSO_BINARY_TYPE__UBUNTU_DEBUGINFO:
- snprintf(file, size, "%s/usr/lib/debug%s",
+ snprintf(filename, size, "%s/usr/lib/debug%s",
symbol_conf.symfs, dso->long_name);
break;
@@ -75,14 +75,14 @@ int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
while (last_slash != dso->long_name && *last_slash != '/')
last_slash--;
- len = scnprintf(file, size, "%s", symbol_conf.symfs);
+ len = scnprintf(filename, size, "%s", symbol_conf.symfs);
dir_size = last_slash - dso->long_name + 2;
if (dir_size > (size - len)) {
ret = -1;
break;
}
- len += scnprintf(file + len, dir_size, "%s", dso->long_name);
- len += scnprintf(file + len , size - len, ".debug%s",
+ len += scnprintf(filename + len, dir_size, "%s", dso->long_name);
+ len += scnprintf(filename + len , size - len, ".debug%s",
last_slash);
break;
}
@@ -96,7 +96,7 @@ int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
build_id__sprintf(dso->build_id,
sizeof(dso->build_id),
build_id_hex);
- snprintf(file, size,
+ snprintf(filename, size,
"%s/usr/lib/debug/.build-id/%.2s/%s.debug",
symbol_conf.symfs, build_id_hex, build_id_hex + 2);
break;
@@ -104,23 +104,23 @@ int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
case DSO_BINARY_TYPE__VMLINUX:
case DSO_BINARY_TYPE__GUEST_VMLINUX:
case DSO_BINARY_TYPE__SYSTEM_PATH_DSO:
- snprintf(file, size, "%s%s",
+ snprintf(filename, size, "%s%s",
symbol_conf.symfs, dso->long_name);
break;
case DSO_BINARY_TYPE__GUEST_KMODULE:
- snprintf(file, size, "%s%s%s", symbol_conf.symfs,
+ snprintf(filename, size, "%s%s%s", symbol_conf.symfs,
root_dir, dso->long_name);
break;
case DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE:
- snprintf(file, size, "%s%s", symbol_conf.symfs,
+ snprintf(filename, size, "%s%s", symbol_conf.symfs,
dso->long_name);
break;
case DSO_BINARY_TYPE__KCORE:
case DSO_BINARY_TYPE__GUEST_KCORE:
- snprintf(file, size, "%s", dso->long_name);
+ snprintf(filename, size, "%s", dso->long_name);
break;
default:
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 99f3c647d683..e1cc50698137 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -129,7 +129,7 @@ int dso__kernel_module_get_build_id(struct dso *dso, const char *root_dir);
char dso__symtab_origin(const struct dso *dso);
int dso__binary_type_file(const struct dso *dso, enum dso_binary_type type,
- char *root_dir, char *file, size_t size);
+ char *root_dir, char *filename, size_t size);
int dso__data_fd(struct dso *dso, struct machine *machine);
ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine,
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 32/34 v3] perf symbols: Fix bug in usage of the basename() function
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (10 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 31/34] perf symbols: Rename filename argument Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 33/34] perf tools: Add per-feature check flags Arnaldo Carvalho de Melo
` (2 subsequent siblings)
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Stephane Eranian, Ben Cheng, David Ahern, Jiri Olsa,
Peter Zijlstra, Arnaldo Carvalho de Melo
From: Stephane Eranian <eranian@google.com>
The basename() implementation varies a lot between systems.
The Linux man page says: "basename may modify the content of the path,
so it may be desirable to pass a copy when calling the function".
On some other systems, the returned address may come from an internal
buffer which can be reused in subsequent calls, thus the results should
also be copied.
The dso__set_basename() function was not doing this causing problems
on some systems with wrong library names being shown by perf report,
such as on Android systems.
This patch fixes the problem.
The patch is relative to tip.git.
In v2, we clean up the comments based on Ingo's feedback.
Reported-by: Ben Cheng <bccheng@google.com>
Signed-off-by: Stephane Eranian <eranian@google.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Ben Cheng <bccheng@google.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20131205182642.GA14614@quad
[ v3: Fixed up wrt allocated flag now being set in dso__set_short_name ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 582b5d344aa3..436922f1f9d9 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -413,7 +413,28 @@ void dso__set_short_name(struct dso *dso, const char *name, bool name_allocated)
static void dso__set_basename(struct dso *dso)
{
- dso__set_short_name(dso, basename((char *)dso->long_name), false);
+ /*
+ * basename() may modify path buffer, so we must pass
+ * a copy.
+ */
+ char *base, *lname = strdup(dso->long_name);
+
+ if (!lname)
+ return;
+
+ /*
+ * basename() may return a pointer to internal
+ * storage which is reused in subsequent calls
+ * so copy the result.
+ */
+ base = strdup(basename(lname));
+
+ free(lname);
+
+ if (!base)
+ return;
+
+ dso__set_short_name(dso, base, true);
}
int dso__name_len(const struct dso *dso)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 33/34] perf tools: Add per-feature check flags
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (11 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 32/34 v3] perf symbols: Fix bug in usage of the basename() function Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 34/34] perf unwinding: Use the " Arnaldo Carvalho de Melo
2013-12-11 11:01 ` [GIT PULL 00/34] perf/core improvements and fixes Ingo Molnar
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jean Pihet, Jiri Olsa, Will Deacon, linaro-kernel,
patches, Arnaldo Carvalho de Melo
From: Jean Pihet <jean.pihet@linaro.org>
Add CFLAGS and LDFLAGS for each feature to be checked. This allows to
pass flags and parameters to the feature checks compilation. Also
simplifies the feature check makefile, to come in a subsequent patch.
Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linaro-kernel@lists.linaro.org
Cc: patches@linaro.org
Link: http://lkml.kernel.org/r/1386678244-13535-2-git-send-email-jean.pihet@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/config/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index bae10720a136..2afb132db51a 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -102,7 +102,7 @@ endif
feature_check = $(eval $(feature_check_code))
define feature_check_code
- feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS="$(LDFLAGS)" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
+ feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
endef
feature_set = $(eval $(feature_set_code))
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 34/34] perf unwinding: Use the per-feature check flags
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (12 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 33/34] perf tools: Add per-feature check flags Arnaldo Carvalho de Melo
@ 2013-12-10 20:31 ` Arnaldo Carvalho de Melo
2013-12-11 11:01 ` [GIT PULL 00/34] perf/core improvements and fixes Ingo Molnar
14 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-10 20:31 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Jean Pihet, Jiri Olsa, Will Deacon, linaro-kernel,
patches, Arnaldo Carvalho de Melo
From: Jean Pihet <jean.pihet@linaro.org>
Use the per-feature check flags for the unwinding feature in order to
correctly compile the test-all, libunwind and libunwind-debug-frame
feature checks.
Tested on x86_64, ARMv7 and ARMv8 with and without LIBUNWIND_DIR set in
'make -C tools/perf'
Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linaro-kernel@lists.linaro.org
Cc: patches@linaro.org
Link: http://lkml.kernel.org/r/1386678244-13535-3-git-send-email-jean.pihet@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/config/Makefile | 52 ++++++++++++++++++-------------
tools/perf/config/feature-checks/Makefile | 8 ++---
2 files changed, 34 insertions(+), 26 deletions(-)
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 2afb132db51a..5a1f4df3c3a8 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -36,6 +36,30 @@ ifeq ($(ARCH),arm)
LIBUNWIND_LIBS = -lunwind -lunwind-arm
endif
+ifeq ($(LIBUNWIND_LIBS),)
+ NO_LIBUNWIND := 1
+else
+ #
+ # For linking with debug library, run like:
+ #
+ # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
+ #
+ ifdef LIBUNWIND_DIR
+ LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
+ LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
+ endif
+ LIBUNWIND_LDFLAGS += $(LIBUNWIND_LIBS)
+
+ # Set per-feature check compilation flags
+ FEATURE_CHECK_CFLAGS-libunwind = $(LIBUNWIND_CFLAGS)
+ FEATURE_CHECK_LDFLAGS-libunwind = $(LIBUNWIND_LDFLAGS)
+ FEATURE_CHECK_CFLAGS-libunwind-debug-frame = $(LIBUNWIND_CFLAGS)
+ FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
+ # and the flags for the test-all case
+ FEATURE_CHECK_CFLAGS-all += $(LIBUNWIND_CFLAGS)
+ FEATURE_CHECK_LDFLAGS-all += $(LIBUNWIND_LDFLAGS)
+endif
+
ifeq ($(NO_PERF_REGS),0)
CFLAGS += -DHAVE_PERF_REGS_SUPPORT
endif
@@ -102,7 +126,7 @@ endif
feature_check = $(eval $(feature_check_code))
define feature_check_code
- feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" LIBUNWIND_LIBS="$(LIBUNWIND_LIBS)" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
+ feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1 >/dev/null 2>/dev/null && echo 1 || echo 0)
endef
feature_set = $(eval $(feature_set_code))
@@ -305,21 +329,7 @@ ifndef NO_LIBELF
endif # NO_DWARF
endif # NO_LIBELF
-ifeq ($(LIBUNWIND_LIBS),)
- NO_LIBUNWIND := 1
-endif
-
ifndef NO_LIBUNWIND
- #
- # For linking with debug library, run like:
- #
- # make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
- #
- ifdef LIBUNWIND_DIR
- LIBUNWIND_CFLAGS := -I$(LIBUNWIND_DIR)/include
- LIBUNWIND_LDFLAGS := -L$(LIBUNWIND_DIR)/lib
- endif
-
ifneq ($(feature-libunwind), 1)
msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
NO_LIBUNWIND := 1
@@ -334,14 +344,12 @@ ifndef NO_LIBUNWIND
# non-ARM has no dwarf_find_debug_frame() function:
CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
endif
- endif
-endif
-ifndef NO_LIBUNWIND
- CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
- EXTLIBS += $(LIBUNWIND_LIBS)
- CFLAGS += $(LIBUNWIND_CFLAGS)
- LDFLAGS += $(LIBUNWIND_LDFLAGS)
+ CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
+ EXTLIBS += $(LIBUNWIND_LIBS)
+ CFLAGS += $(LIBUNWIND_CFLAGS)
+ LDFLAGS += $(LIBUNWIND_LDFLAGS)
+ endif # ifneq ($(feature-libunwind), 1)
endif
ifndef NO_LIBAUDIT
diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
index b8bb749c3392..bc86462e80a2 100644
--- a/tools/perf/config/feature-checks/Makefile
+++ b/tools/perf/config/feature-checks/Makefile
@@ -32,12 +32,12 @@ CC := $(CC) -MD
all: $(FILES)
-BUILD = $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTPUT)$@ $@.c
+BUILD = $(CC) $(CFLAGS) -o $(OUTPUT)$@ $@.c $(LDFLAGS)
###############################
test-all:
- $(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma $(LIBUNWIND_LIBS) -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl
+ $(BUILD) -Werror -fstack-protector-all -O2 -Werror -D_FORTIFY_SOURCE=2 -ldw -lelf -lnuma -lelf -laudit -I/usr/include/slang -lslang $(shell pkg-config --libs --cflags gtk+-2.0 2>/dev/null) $(FLAGS_PERL_EMBED) $(FLAGS_PYTHON_EMBED) -DPACKAGE='"perf"' -lbfd -ldl
test-hello:
$(BUILD)
@@ -70,10 +70,10 @@ test-libnuma:
$(BUILD) -lnuma
test-libunwind:
- $(BUILD) $(LIBUNWIND_LIBS) -lelf
+ $(BUILD) -lelf
test-libunwind-debug-frame:
- $(BUILD) $(LIBUNWIND_LIBS) -lelf
+ $(BUILD) -lelf
test-libaudit:
$(BUILD) -laudit
--
1.8.1.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [GIT PULL 00/34] perf/core improvements and fixes
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
` (13 preceding siblings ...)
2013-12-10 20:31 ` [PATCH 34/34] perf unwinding: Use the " Arnaldo Carvalho de Melo
@ 2013-12-11 11:01 ` Ingo Molnar
14 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2013-12-11 11:01 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter, Andi Kleen,
Ben Cheng, Corey Ashford, David Ahern, Dongsheng Yang,
Frederic Weisbecker, Jean Pihet, Jiri Olsa, linaro-kernel,
Mike Galbraith, Namhyung Kim, patches, Paul Mackerras,
Peter Zijlstra, Stephane Eranian, Steven Rostedt, Will Deacon,
Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
>
> Hi Ingo,
>
> The first 20 patches in this series are the same as in the previous
> one, so I'm not reposting them now.
>
> This series has the code style/constification changes you suggested in
> the symbols code and then a reworked fix to the basename problem plus some
> more patches not present in the previous series.
>
> Please let me know if you find any further problems,
>
> Best Regards,
>
> - Arnaldo
>
> The following changes since commit 6d65894bc028d0342829ea1e64c9e9efad571124:
>
> tools lib traceevent: Update kvm plugin with is_writable_pte helper (2013-12-04 15:38:14 -0300)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
>
> for you to fetch changes up to 1448fef40af6079de38380c3a81bcf9994a1037d:
>
> perf unwinding: Use the per-feature check flags (2013-12-10 16:51:12 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> . Add an option in 'perf script' to print the source line number, from Adrian Hunter
>
> . Add --header/--header-only options to 'script' and 'report', the default is not
> tho show the header info, but as this has been the default for some time,
> leave a single line explaining how to obtain that information, from Jiri Olsa.
>
> . Fix symoff printing in callchains in 'perf script', from Adrian Hunter.
>
> . Assorted mmap_pages handling fixes, from Adrian Hunter.
>
> . Fix summary percentage when processing files in 'perf trace', fom David Ahern.
>
> . Handle old kernels where the "raw_syscalls" tracepoints were called plan "syscalls",
> in 'perf trace', from David Ahern.
>
> . Several man pages typo fixes from Dongsheng Yang.
>
> . Add '-v' option to 'perf kvm', from Dongsheng Yang.
>
> . Make perf kvm diff support --guestmount, from Dongsheng Yang.
>
> . Get rid of several die() calls in libtraceevent, from Namhyung Kim.
>
> . Use basename() in a more robust way, to avoid problems related to different
> system library implementations for that function, from Stephane Eranian.
>
> . Remove open coded management of short_name_allocated member, from Adrian Hunter
>
> . Several cleanups in the "dso" methods, constifying some parameters and
> renaming some fields to clarify its purpose.
>
> . Add per-feature check flags, fixing libunwind related build problems on some
> architectures, from Jean Pihet.
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Adrian Hunter (7):
> perf script: Fix symoff printing in callchains
> perf script: Add an option to print the source line number
> perf record: Fix display of incorrect mmap pages
> perf evlist: Remove unnecessary parentheses
> perf evlist: Fix max mmap_pages
> perf evlist: Fix mmap pages rounding to power of 2
> perf symbols: Remove open coded management of short_name_allocated member
>
> Arnaldo Carvalho de Melo (8):
> perf symbols: Rename [sl]name_alloc to match the members they refer to
> perf machine: Don't open code assign dso->short_name
> perf symbols: Set alloc flag close to setting the long_name
> perf symbols: Remove open coded management of long_name_allocated member
> perf symbols: Constify dso->long_name
> perf symbols: Set freed members to NULL in dso destructor
> perf symbols: Constify some DSO methods parameters
> perf symbols: Rename filename argument
>
> David Ahern (2):
> perf trace: Add support for syscalls vs raw_syscalls
> perf trace: Fix summary percentage when processing files
>
> Dongsheng Yang (6):
> perf kvm: Introduce option -v for perf kvm command.
> perf kvm: Fix bug in 'stat report'
> perf archive: Remove duplicated 'runs' in man page
> perf annotate: Fix typo
> perf kvm: Move code to generate filename for perf-kvm to function.
> perf kvm: Make perf kvm diff support --guestmount.
>
> Jean Pihet (2):
> perf tools: Add per-feature check flags
> perf unwinding: Use the per-feature check flags
>
> Jiri Olsa (2):
> perf report: Add --header/--header-only options
> perf script: Add --header/--header-only options
>
> Namhyung Kim (5):
> tools lib traceevent: Get rid of malloc_or_die() in pevent_filter_alloc()
> tools lib traceevent: Get rid of malloc_or_die() in add_event()
> tools lib traceevent: Get rid of die() in create_arg_item()
> tools lib traceevent: Get rid of malloc_or_die() in pevent_filter_add_filter_str()
> tools lib traceevent: Get rid of die() in pevent_filter_clear_trivial()
>
> Stephane Eranian (1):
> perf symbols: Fix bug in usage of the basename() function
>
> Steven Rostedt (1):
> tools lib traceevent: Report better error message on bad function args
>
> tools/lib/traceevent/event-parse.c | 28 +++++---
> tools/lib/traceevent/event-parse.h | 2 +-
> tools/lib/traceevent/parse-filter.c | 57 +++++++++++----
> tools/perf/Documentation/perf-archive.txt | 6 +-
> tools/perf/Documentation/perf-kvm.txt | 7 +-
> tools/perf/Documentation/perf-report.txt | 9 +++
> tools/perf/Documentation/perf-script.txt | 8 ++-
> tools/perf/builtin-annotate.c | 2 +-
> tools/perf/builtin-diff.c | 3 +-
> tools/perf/builtin-kvm.c | 11 ++-
> tools/perf/builtin-record.c | 2 +-
> tools/perf/builtin-report.c | 22 +++++-
> tools/perf/builtin-script.c | 23 +++++-
> tools/perf/builtin-trace.c | 32 ++++++++-
> tools/perf/config/Makefile | 52 ++++++++------
> tools/perf/config/feature-checks/Makefile | 8 +--
> tools/perf/util/annotate.c | 2 +-
> tools/perf/util/build-id.c | 2 +-
> tools/perf/util/build-id.h | 2 +-
> tools/perf/util/dso.c | 112 ++++++++++++++++++++----------
> tools/perf/util/dso.h | 16 ++---
> tools/perf/util/evlist.c | 10 +--
> tools/perf/util/header.c | 6 +-
> tools/perf/util/machine.c | 6 +-
> tools/perf/util/map.c | 17 +++++
> tools/perf/util/map.h | 2 +
> tools/perf/util/probe-event.c | 2 +-
> tools/perf/util/session.c | 15 +++-
> tools/perf/util/session.h | 1 +
> tools/perf/util/srcline.c | 2 +-
> tools/perf/util/symbol.c | 38 ++++------
> tools/perf/util/symbol.h | 3 +-
> tools/perf/util/util.c | 14 ++++
> tools/perf/util/util.h | 14 ++++
> tools/perf/util/vdso.c | 2 +-
> 35 files changed, 375 insertions(+), 163 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* [GIT PULL 00/34] perf/core improvements and fixes
@ 2017-12-14 17:42 Arnaldo Carvalho de Melo
0 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-14 17:42 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
Adrian Hunter, Alexander Shishkin, Andi Kleen, bhargavb,
Cheng Jian, Christian Borntraeger, David Ahern, David S . Miller,
Greg Kroah-Hartman, Heiko Carstens, Hendrik Brueckner, Jin Yao,
Jiri Olsa, Jonathan Hermann, Kan Liang, Li Bin, linux-rt-users,
linux s390 list, Martin Schwidefsky, Masami Hiramatsu,
Mengting Zhang, Michael Petlan, Namhyung Kim, Paul Clarke,
Peter Zijlstra, Pravin Shedge, Ravi Bangoria, Rudolf Marek,
Steven Rostedt, Thomas Gleixner, Thomas Richter, Wang Nan,
Arnaldo Carvalho de Melo
Hi Ingo,
Please consider pulling,
- Arnaldo
Test results at the end of this message, as usual.
The following changes since commit 10c91577d5e631773a6394e14cf60125389b71ae:
x86/tools: Standardize output format of insn_decode_test (2017-12-12 13:27:47 +0100)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.16-20171214
for you to fetch changes up to 64b86173c3f90de348a5f010e2e504168fddc01e:
perf evsel: Enable ignore_missing_thread for pid option (2017-12-13 18:07:01 -0300)
----------------------------------------------------------------
perf/core improvements and fixes:
- Allow system wide 'perf stat --per-thread', sorting the result (Jin Yao)
E.g.:
[root@jouet ~]# perf stat --per-thread --metrics IPC
^C
Performance counter stats for 'system wide':
make-22229 23,012,094,032 inst_retired.any # 0.8 IPC
cc1-22419 692,027,497 inst_retired.any # 0.8 IPC
gcc-22418 328,231,855 inst_retired.any # 0.9 IPC
cc1-22509 220,853,647 inst_retired.any # 0.8 IPC
gcc-22486 199,874,810 inst_retired.any # 1.0 IPC
as-22466 177,896,365 inst_retired.any # 0.9 IPC
cc1-22465 150,732,374 inst_retired.any # 0.8 IPC
gcc-22508 112,555,593 inst_retired.any # 0.9 IPC
cc1-22487 108,964,079 inst_retired.any # 0.7 IPC
qemu-system-x86-2697 21,330,550 inst_retired.any # 0.3 IPC
systemd-journal-551 20,642,951 inst_retired.any # 0.4 IPC
docker-containe-17651 9,552,892 inst_retired.any # 0.5 IPC
dockerd-current-9809 7,528,586 inst_retired.any # 0.5 IPC
make-22153 12,504,194,380 inst_retired.any # 0.8 IPC
python2-22429 12,081,290,954 inst_retired.any # 0.8 IPC
<SNIP>
python2-22429 15,026,328,103 cpu_clk_unhalted.thread
cc1-22419 826,660,193 cpu_clk_unhalted.thread
gcc-22418 365,321,295 cpu_clk_unhalted.thread
cc1-22509 279,169,362 cpu_clk_unhalted.thread
gcc-22486 210,156,950 cpu_clk_unhalted.thread
<SNIP>
5.638075538 seconds time elapsed
[root@jouet ~]#
- Ignore threads when they vanish after procfs based enumeration and
before we try to use them with sys_perf_event_open(), i.e. just remove
them from the thread_map and continue with the rest. This makes, among
other cases, the previous new feature (perf stat --per-thread for system
wide, albeit that not seeming to be the motivation for this patch) more
robust. (Mengting Zhang)
- Generate s390 syscall table from asm/unistd.h, doing like x86,
removing the dependency on audit-libs to do this id->string translation,
speeding up the support for newly introducted syscalls (Hendrik Brueckner)
- Fix 'perf test' on filesystems where readdir() returns d_type == DT_UNKNOWN,
such as XFS (Jiri Olsa)
- Fix PERF_SAMPLE_RAW_DATA endianity handling for cross-arch tracepoint
processing (Jiri Olsa)
- Add __return suffix for return events in 'perf probe', streamlining
entry/exit tracing (Masami Hiramatsu)
- Improve support for versioned symbols in 'perf probe" (Masami Hiramatsu)
- Clarify error message about invalid 'perf probe' event names (Masami Hiramatsu)
- Fix check open filename arg using 'perf trace' in a 'perf test' entry for
systems using glibc >= 2.26, such as some ARM and s390 distros (Michael Petlan)
- Make method for obtaining the (normalized) architecture id for a
perf.data file or for the running system used by the annotation routines
generally available, next user will be for generating per arch errno
string tables to allow for pretty printing errno codes recorded in a
perf.data file in architecture A to be properly decoded on hardware
archictecture B. (Arnaldo Carvalho de Melo)
- Synchronize KVM and x86 ABI headers with the kernel sources (Arnaldo Carvalho de Melo)
- Remove duplicate includes, found using scripts/checkincludes.pl (Pravin Shedge)
- s390 needs -fPIC, enable it, also revert a patch that supposedly did
that but instead enabled -fPIC for x86 (Hendrik Brueckner, Arnaldo Carvalho de Melo)
- Grab a copy of arch/s390/include/uapi/asm/perf_regs.h from the kernel
sources, use it in the libdw support for this arch instead of using
the kernel sources directly, which breaks the build when using
detached perf tarballs, i.e. not building perf hosted in the kernel
sources (Arnaldo Carvalho de Melo)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
----------------------------------------------------------------
Arnaldo Carvalho de Melo (7):
perf annotate: Get the cpuid from evsel->evlist->env in symbol__annotate()
perf annotate: Use perf_env when obtaining the arch name
perf env: Adopt perf_env__arch() from the annotate code
tools headers: Synchronize KVM arch ABI headers
tools headers: Synchronize kernel x86 UAPI headers
tools arch s390: Do not include header files from the kernel sources
Revert "perf s390: Always build with -fPIC"
Hendrik Brueckner (4):
tools include s390: Grab a copy of arch/s390/include/uapi/asm/unistd.h
perf s390: Generate system call table from asm/unistd.h
perf trace: Use generated syscall table on s390 too
perf s390: Always build with -fPIC
Jin Yao (11):
perf stat: Define a structure for per-thread shadow stats
perf stat: Extend rbtree to support per-thread shadow stats
perf stat: Create the runtime_stat init/exit function
perf stat: Update per-thread shadow stats
perf stat: Print per-thread shadow stats
perf stat: Remove a set of shadow stats static variables
perf stat: Allocate shadow stats buffer for threads
perf stat: Update or print per-thread stats
perf thread_map: Enumerate all threads from /proc
perf stat: Remove --per-thread pid/tid limitation
perf stat: Resort '--per-thread' result
Jiri Olsa (3):
perf utils: Move is_directory() to path.h
perf test: Handle properly readdir DT_UNKNOWN
perf evsel: Fix swap for samples with raw data
Masami Hiramatsu (6):
perf probe: Add warning message if there is unexpected event name
perf probe: Cut off the version suffix from event name
perf probe: Add __return suffix for return events
perf probe: Find versioned symbols from map
perf string: Add {strdup,strpbrk}_esc()
perf probe: Support escaped character in parser
Mengting Zhang (1):
perf evsel: Enable ignore_missing_thread for pid option
Michael Petlan (1):
perf test shell: Fix check open filename arg using 'perf trace'
Pravin Shedge (1):
perf perf: Remove duplicate includes
tools/arch/s390/include/uapi/asm/perf_regs.h | 44 +++
tools/arch/s390/include/uapi/asm/unistd.h | 412 ++++++++++++++++++++
tools/arch/x86/include/asm/cpufeatures.h | 1 +
tools/include/uapi/linux/kvm.h | 4 +-
tools/perf/Documentation/perf-probe.txt | 18 +-
tools/perf/Makefile.config | 11 +-
tools/perf/arch/common.c | 44 +--
tools/perf/arch/common.h | 1 -
tools/perf/arch/powerpc/util/sym-handling.c | 8 +
tools/perf/arch/s390/Makefile | 21 ++
tools/perf/arch/s390/entry/syscalls/mksyscalltbl | 36 ++
tools/perf/arch/s390/include/perf_regs.h | 2 +-
tools/perf/bench/futex-hash.c | 1 -
tools/perf/builtin-c2c.c | 3 -
tools/perf/builtin-record.c | 5 +-
tools/perf/builtin-script.c | 20 +-
tools/perf/builtin-stat.c | 168 +++++++--
tools/perf/builtin-top.c | 2 +-
tools/perf/check-headers.sh | 2 +
tools/perf/tests/builtin-test.c | 10 +-
tools/perf/tests/parse-events.c | 1 -
tools/perf/tests/shell/trace+probe_vfs_getname.sh | 7 +-
tools/perf/tests/thread-map.c | 2 +-
tools/perf/ui/browsers/annotate.c | 4 +-
tools/perf/ui/gtk/annotate.c | 2 +-
tools/perf/util/annotate.c | 26 +-
tools/perf/util/annotate.h | 2 +-
tools/perf/util/auxtrace.c | 3 -
tools/perf/util/env.c | 47 +++
tools/perf/util/env.h | 2 +
tools/perf/util/evlist.c | 3 +-
tools/perf/util/evsel.c | 80 +++-
tools/perf/util/evsel.h | 3 +-
tools/perf/util/header.c | 2 -
tools/perf/util/metricgroup.c | 2 -
tools/perf/util/path.c | 14 +
tools/perf/util/path.h | 3 +
tools/perf/util/probe-event.c | 85 +++--
tools/perf/util/python-ext-sources | 1 +
.../util/scripting-engines/trace-event-python.c | 1 -
tools/perf/util/stat-shadow.c | 416 ++++++++++++---------
tools/perf/util/stat.c | 15 +-
tools/perf/util/stat.h | 63 +++-
tools/perf/util/string.c | 46 +++
tools/perf/util/string2.h | 2 +
tools/perf/util/symbol.c | 5 +
tools/perf/util/symbol.h | 1 +
tools/perf/util/syscalltbl.c | 4 +
tools/perf/util/target.h | 7 +
tools/perf/util/thread_map.c | 5 +-
tools/perf/util/thread_map.h | 2 +-
tools/perf/util/unwind-libunwind.c | 4 +-
52 files changed, 1311 insertions(+), 362 deletions(-)
create mode 100644 tools/arch/s390/include/uapi/asm/perf_regs.h
create mode 100644 tools/arch/s390/include/uapi/asm/unistd.h
create mode 100755 tools/perf/arch/s390/entry/syscalls/mksyscalltbl
Test results:
The first ones are container (docker) based builds of tools/perf with and
without libelf support. Where clang is available, it is also used to build
perf with/without libelf.
The objtool and samples/bpf/ builds are disabled now that I'm switching from
using the sources in a local volume to fetching them from a http server to
build it inside the container, to make it easier to build in a container cluster.
Those will come back later.
Several are cross builds, the ones with -x-ARCH and the android one, and those
may not have all the features built, due to lack of multi-arch devel packages,
available and being used so far on just a few, like
debian:experimental-x-{arm64,mipsel}.
The 'perf test' one will perform a variety of tests exercising
tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands
with a variety of command line event specifications to then intercept the
sys_perf_event syscall to check that the perf_event_attr fields are set up as
expected, among a variety of other unit tests.
Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/
with a variety of feature sets, exercising the build with an incomplete set of
features as well as with a complete one. It is planned to have it run on each
of the containers mentioned above, using some container orchestration
infrastructure. Get in contact if interested in helping having this in place.
# dm
1 alpine:3.4 : Ok gcc (Alpine 5.3.0) 5.3.0
2 alpine:3.5 : Ok gcc (Alpine 6.2.1) 6.2.1 20160822
3 alpine:3.6 : Ok gcc (Alpine 6.3.0) 6.3.0
4 alpine:edge : Ok gcc (Alpine 6.4.0) 6.4.0
5 android-ndk:r12b-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
6 android-ndk:r15c-arm : Ok arm-linux-androideabi-gcc (GCC) 4.9.x 20150123 (prerelease)
7 centos:5 : Ok gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
8 centos:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
9 centos:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
10 debian:7 : Ok gcc (Debian 4.7.2-5) 4.7.2
11 debian:8 : Ok gcc (Debian 4.9.2-10) 4.9.2
12 debian:9 : Ok gcc (Debian 6.3.0-18) 6.3.0 20170516
13 debian:experimental : Ok gcc (Debian 7.2.0-17) 7.2.1 20171205
14 debian:experimental-x-arm64 : Ok aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
15 debian:experimental-x-mips : Ok mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
16 debian:experimental-x-mips64 : Ok mips64-linux-gnuabi64-gcc (Debian 7.2.0-11) 7.2.0
17 debian:experimental-x-mipsel : Ok mipsel-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
18 fedora:20 : Ok gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
19 fedora:21 : Ok gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6)
20 fedora:22 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
21 fedora:23 : Ok gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
22 fedora:24 : Ok gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
23 fedora:24-x-ARC-uClibc : Ok arc-linux-gcc (ARCompact ISA Linux uClibc toolchain 2017.09-rc2) 7.1.1 20170710
24 fedora:25 : Ok gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
25 fedora:26 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
26 fedora:27 : Ok gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2)
27 fedora:rawhide : Ok gcc (GCC) 7.2.1 20170829 (Red Hat 7.2.1-1)
28 gentoo-stage3-amd64:latest : Ok gcc (Gentoo 6.4.0 p1.1) 6.4.0
29 mageia:5 : Ok gcc (GCC) 4.9.2
30 mageia:6 : Ok gcc (Mageia 5.4.0-5.mga6) 5.4.0
31 opensuse:42.1 : Ok gcc (SUSE Linux) 4.8.5
32 opensuse:42.2 : Ok gcc (SUSE Linux) 4.8.5
33 opensuse:42.3 : Ok gcc (SUSE Linux) 4.8.5
34 opensuse:tumbleweed : Ok gcc (SUSE Linux) 7.2.1 20171020 [gcc-7-branch revision 253932]
35 oraclelinux:6 : Ok gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
36 oraclelinux:7 : Ok gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
37 ubuntu:12.04.5 : Ok gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
38 ubuntu:14.04.4 : Ok gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
39 ubuntu:14.04.4-x-linaro-arm64 : Ok aarch64-linux-gnu-gcc (Linaro GCC 5.4-2017.05) 5.4.1 20170404
40 ubuntu:15.04 : Ok gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2
41 ubuntu:16.04 : Ok gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609
42 ubuntu:16.04-x-arm : Ok arm-linux-gnueabihf-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
43 ubuntu:16.04-x-arm64 : Ok aarch64-linux-gnu-gcc (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
44 ubuntu:16.04-x-powerpc : Ok powerpc-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
45 ubuntu:16.04-x-powerpc64 : Ok powerpc64-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.1) 5.4.0 20160609
46 ubuntu:16.04-x-powerpc64el : Ok powerpc64le-linux-gnu-gcc (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
47 ubuntu:16.04-x-s390 : Ok s390x-linux-gnu-gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
48 ubuntu:16.10 : Ok gcc (Ubuntu 6.2.0-5ubuntu12) 6.2.0 20161005
49 ubuntu:17.04 : Ok gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
50 ubuntu:17.10 : Ok gcc (Ubuntu 7.2.0-8ubuntu3) 7.2.0
51 ubuntu:18.04 : Ok gcc (Ubuntu 7.2.0-16ubuntu1) 7.2.0
# uname -a
Linux jouet 4.15.0-rc3+ #3 SMP Wed Dec 13 10:14:18 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
# perf test
1: vmlinux symtab matches kallsyms : Ok
2: Detect openat syscall event : Ok
3: Detect openat syscall event on all cpus : Ok
4: Read samples using the mmap interface : Ok
5: Test data source output : Ok
6: Parse event definition strings : Ok
7: Simple expression parser : Ok
8: PERF_RECORD_* events & perf_sample fields : Ok
9: Parse perf pmu format : Ok
10: DSO data read : Ok
11: DSO data cache : Ok
12: DSO data reopen : Ok
13: Roundtrip evsel->name : Ok
14: Parse sched tracepoints fields : Ok
15: syscalls:sys_enter_openat event fields : Ok
16: Setup struct perf_event_attr : Ok
17: Match and link multiple hists : Ok
18: 'import perf' in python : Ok
19: Breakpoint overflow signal handler : Ok
20: Breakpoint overflow sampling : Ok
21: Number of exit events of a simple workload : Ok
22: Software clock events period values : Ok
23: Object code reading : Ok
24: Sample parsing : Ok
25: Use a dummy software event to keep tracking : Ok
26: Parse with no sample_id_all bit set : Ok
27: Filter hist entries : Ok
28: Lookup mmap thread : Ok
29: Share thread mg : Ok
30: Sort output of hist entries : Ok
31: Cumulate child hist entries : Ok
32: Track with sched_switch : Ok
33: Filter fds with revents mask in a fdarray : Ok
34: Add fd to a fdarray, making it autogrow : Ok
35: kmod_path__parse : Ok
36: Thread map : Ok
37: LLVM search and compile :
37.1: Basic BPF llvm compile : Ok
37.2: kbuild searching : Ok
37.3: Compile source for BPF prologue generation : Ok
37.4: Compile source for BPF relocation : Ok
38: Session topology : Ok
39: BPF filter :
39.1: Basic BPF filtering : Ok
39.2: BPF pinning : Ok
39.3: BPF prologue generation : Ok
39.4: BPF relocation checker : Ok
40: Synthesize thread map : Ok
41: Remove thread map : Ok
42: Synthesize cpu map : Ok
43: Synthesize stat config : Ok
44: Synthesize stat : Ok
45: Synthesize stat round : Ok
46: Synthesize attr update : Ok
47: Event times : Ok
48: Read backward ring buffer : Ok
49: Print cpu map : Ok
50: Probe SDT events : Ok
51: is_printable_array : Ok
52: Print bitmap : Ok
53: perf hooks : Ok
54: builtin clang support : Skip (not compiled in)
55: unit_number__scnprintf : Ok
56: x86 rdpmc : Ok
57: Convert perf time to TSC : Ok
58: DWARF unwind : Ok
59: x86 instruction decoder - new instructions : Ok
60: Use vfs_getname probe to get syscall args filenames : Ok
61: probe libc's inet_pton & backtrace it with ping : Ok
62: Check open filename arg using perf trace + vfs_getname: Ok
63: Add vfs_getname probe to get syscall args filenames : Ok
#
$ make -C tools/perf build-test
make: Entering directory '/home/acme/git/perf/tools/perf'
- tarpkg: ./tests/perf-targz-src-pkg .
make_doc_O: make doc
make_help_O: make help
make_no_libbionic_O: make NO_LIBBIONIC=1
make_util_map_o_O: make util/map.o
make_no_newt_O: make NO_NEWT=1
make_no_libaudit_O: make NO_LIBAUDIT=1
make_pure_O: make
make_install_prefix_slash_O: make install prefix=/tmp/krava/
make_no_demangle_O: make NO_DEMANGLE=1
make_no_libunwind_O: make NO_LIBUNWIND=1
make_no_auxtrace_O: make NO_AUXTRACE=1
make_install_bin_O: make install-bin
make_no_libbpf_O: make NO_LIBBPF=1
make_install_prefix_O: make install prefix=/tmp/krava
make_install_O: make install
make_no_slang_O: make NO_SLANG=1
make_with_babeltrace_O: make LIBBABELTRACE=1
make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
make_perf_o_O: make perf.o
make_no_backtrace_O: make NO_BACKTRACE=1
make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
make_static_O: make LDFLAGS=-static
make_no_libpython_O: make NO_LIBPYTHON=1
make_no_libelf_O: make NO_LIBELF=1
make_no_libperl_O: make NO_LIBPERL=1
make_util_pmu_bison_o_O: make util/pmu-bison.o
make_no_gtk2_O: make NO_GTK2=1
make_debug_O: make DEBUG=1
make_no_libnuma_O: make NO_LIBNUMA=1
make_with_clangllvm_O: make LIBCLANGLLVM=1
make_tags_O: make tags
make_clean_all_O: make clean all
make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
OK
make: Leaving directory '/home/acme/git/perf/tools/perf'
$
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2017-12-14 17:53 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-10 20:31 [GIT PULL 00/34] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 21/34 v2] perf report: Add --header/--header-only options Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 22/34] perf script: " Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 23/34] perf symbols: Rename [sl]name_alloc to match the members they refer to Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 24/34] perf machine: Don't open code assign dso->short_name Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 25/34] perf symbols: Remove open coded management of short_name_allocated member Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 26/34] perf symbols: Set alloc flag close to setting the long_name Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 27/34] perf symbols: Remove open coded management of long_name_allocated member Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 28/34] perf symbols: Constify dso->long_name Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 29/34] perf symbols: Set freed members to NULL in dso destructor Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 30/34] perf symbols: Constify some DSO methods parameters Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 31/34] perf symbols: Rename filename argument Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 32/34 v3] perf symbols: Fix bug in usage of the basename() function Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 33/34] perf tools: Add per-feature check flags Arnaldo Carvalho de Melo
2013-12-10 20:31 ` [PATCH 34/34] perf unwinding: Use the " Arnaldo Carvalho de Melo
2013-12-11 11:01 ` [GIT PULL 00/34] perf/core improvements and fixes Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2017-12-14 17:42 Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).