* [PATCH 01/15] perf probe: Fix examples section of documentation
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 02/15] perf script: Fix outdated comment for perf-trace-python Arnaldo Carvalho de Melo
` (14 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, SeongJae Park, Peter Zijlstra, Taeung Song,
Arnaldo Carvalho de Melo
From: SeongJae Park <sj38.park@gmail.com>
An example in perf-probe documentation for pattern of function name
based probe addition is not providing example command for that case.
This commit fixes the example to give appropriate example command.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Taeung Song <treeze.taeung@gmail.com>
Fixes: ee391de876ae ("perf probe: Update perf probe document")
Link: http://lkml.kernel.org/r/20170507103642.30560-1-sj38.park@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-probe.txt | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Documentation/perf-probe.txt b/tools/perf/Documentation/perf-probe.txt
index e6c9902c6d82..165c2b1d4317 100644
--- a/tools/perf/Documentation/perf-probe.txt
+++ b/tools/perf/Documentation/perf-probe.txt
@@ -240,9 +240,13 @@ Add a probe on schedule() function 12th line with recording cpu local variable:
or
./perf probe --add='schedule:12 cpu'
- this will add one or more probes which has the name start with "schedule".
+Add one or more probes which has the name start with "schedule".
- Add probes on lines in schedule() function which calls update_rq_clock().
+ ./perf probe schedule*
+ or
+ ./perf probe --add='schedule*'
+
+Add probes on lines in schedule() function which calls update_rq_clock().
./perf probe 'schedule;update_rq_clock*'
or
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 02/15] perf script: Fix outdated comment for perf-trace-python
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 01/15] perf probe: Fix examples section of documentation Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 03/15] perf script: Fix documentation errors Arnaldo Carvalho de Melo
` (13 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, SeongJae Park, Alexander Shishkin, Peter Zijlstra,
Thomas Gleixner, Arnaldo Carvalho de Melo
From: SeongJae Park <sj38.park@gmail.com>
Script generated by the '--gen-script' option contains an outdated
comment. It mentions a 'perf-trace-python' document while it has been
renamed to 'perf-script-python'. Fix it.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 133dc4c39c57 ("perf: Rename 'perf trace' to 'perf script'")
Link: http://lkml.kernel.org/r/20170530111827.21732-2-sj38.park@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/scripting-engines/trace-event-python.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 9d92af7d0718..40de3cb40d21 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -1219,7 +1219,7 @@ static int python_generate_script(struct pevent *pevent, const char *outfile)
fprintf(ofp, "# be retrieved using Python functions of the form "
"common_*(context).\n");
- fprintf(ofp, "# See the perf-trace-python Documentation for the list "
+ fprintf(ofp, "# See the perf-script-python Documentation for the list "
"of available functions.\n\n");
fprintf(ofp, "import os\n");
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 03/15] perf script: Fix documentation errors
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 01/15] perf probe: Fix examples section of documentation Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 02/15] perf script: Fix outdated comment for perf-trace-python Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 04/15] perf script python: Fix wrong code snippets in documentation Arnaldo Carvalho de Melo
` (12 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, SeongJae Park, Alexander Shishkin,
Frederic Weisbecker, Peter Zijlstra, Tom Zanussi,
Arnaldo Carvalho de Melo
From: SeongJae Park <sj38.park@gmail.com>
This commit fixes two errors in documents for perf-script-python and
perf-script-perl as below:
- /sys/kernel/debug/tracing events -> /sys/kernel/debug/tracing/events/
- trace_handled -> trace_unhandled
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Fixes: cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
Link: http://lkml.kernel.org/r/20170530111827.21732-3-sj38.park@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-script-perl.txt | 2 +-
tools/perf/Documentation/perf-script-python.txt | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/perf/Documentation/perf-script-perl.txt b/tools/perf/Documentation/perf-script-perl.txt
index dfbb506d2c34..142606c0ec9c 100644
--- a/tools/perf/Documentation/perf-script-perl.txt
+++ b/tools/perf/Documentation/perf-script-perl.txt
@@ -39,7 +39,7 @@ EVENT HANDLERS
When perf script is invoked using a trace script, a user-defined
'handler function' is called for each event in the trace. If there's
no handler function defined for a given event type, the event is
-ignored (or passed to a 'trace_handled' function, see below) and the
+ignored (or passed to a 'trace_unhandled' function, see below) and the
next event is processed.
Most of the event's field values are passed as arguments to the
diff --git a/tools/perf/Documentation/perf-script-python.txt b/tools/perf/Documentation/perf-script-python.txt
index 54acba221558..087b87c956ba 100644
--- a/tools/perf/Documentation/perf-script-python.txt
+++ b/tools/perf/Documentation/perf-script-python.txt
@@ -321,7 +321,7 @@ So those are the essential steps in writing and running a script. The
process can be generalized to any tracepoint or set of tracepoints
you're interested in - basically find the tracepoint(s) you're
interested in by looking at the list of available events shown by
-'perf list' and/or look in /sys/kernel/debug/tracing events for
+'perf list' and/or look in /sys/kernel/debug/tracing/events/ for
detailed event and field info, record the corresponding trace data
using 'perf record', passing it the list of interesting events,
generate a skeleton script using 'perf script -g python' and modify the
@@ -437,7 +437,7 @@ EVENT HANDLERS
When perf script is invoked using a trace script, a user-defined
'handler function' is called for each event in the trace. If there's
no handler function defined for a given event type, the event is
-ignored (or passed to a 'trace_handled' function, see below) and the
+ignored (or passed to a 'trace_unhandled' function, see below) and the
next event is processed.
Most of the event's field values are passed as arguments to the
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 04/15] perf script python: Fix wrong code snippets in documentation
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (2 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 03/15] perf script: Fix documentation errors Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 05/15] perf script python: Updated trace_unhandled() signature Arnaldo Carvalho de Melo
` (11 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, SeongJae Park, Alexander Shishkin,
Frederic Weisbecker, Peter Zijlstra, Tom Zanussi,
Arnaldo Carvalho de Melo
From: SeongJae Park <sj38.park@gmail.com>
This commit fixes wrong code snippets for trace_begin() and trace_end()
function example definition.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Fixes: cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
Link: http://lkml.kernel.org/r/20170530111827.21732-5-sj38.park@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-script-python.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Documentation/perf-script-python.txt b/tools/perf/Documentation/perf-script-python.txt
index 087b87c956ba..bad6e93cceff 100644
--- a/tools/perf/Documentation/perf-script-python.txt
+++ b/tools/perf/Documentation/perf-script-python.txt
@@ -532,7 +532,7 @@ can implement a set of optional functions:
gives scripts a chance to do setup tasks:
----
-def trace_begin:
+def trace_begin():
pass
----
@@ -541,7 +541,7 @@ def trace_begin:
as display results:
----
-def trace_end:
+def trace_end():
pass
----
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 05/15] perf script python: Updated trace_unhandled() signature
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (3 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 04/15] perf script python: Fix wrong code snippets in documentation Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 06/15] perf script python: Remove dups in documentation examples Arnaldo Carvalho de Melo
` (10 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, SeongJae Park, Alexander Shishkin, Peter Zijlstra,
Pierre Tardy, Arnaldo Carvalho de Melo
From: SeongJae Park <sj38.park@gmail.com>
Default function signature of trace_unhandled() got changed to include a
field dict, but its documentation, perf-script-python.txt has not been
updated. Fix it.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Pierre Tardy <tardyp@gmail.com>
Fixes: c02514850d67 ("perf scripts python: Give field dict to unhandled callback")
Link: http://lkml.kernel.org/r/20170530111827.21732-6-sj38.park@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-script-python.txt | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/tools/perf/Documentation/perf-script-python.txt b/tools/perf/Documentation/perf-script-python.txt
index bad6e93cceff..378783fe2b6b 100644
--- a/tools/perf/Documentation/perf-script-python.txt
+++ b/tools/perf/Documentation/perf-script-python.txt
@@ -149,10 +149,8 @@ def raw_syscalls__sys_enter(event_name, context, common_cpu,
print "id=%d, args=%s\n" % \
(id, args),
-def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs,
- common_pid, common_comm):
- print_header(event_name, common_cpu, common_secs, common_nsecs,
- common_pid, common_comm)
+def trace_unhandled(event_name, context, event_fields_dict):
+ print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())])
def print_header(event_name, cpu, secs, nsecs, pid, comm):
print "%-20s %5u %05u.%09u %8u %-20s " % \
@@ -550,8 +548,7 @@ def trace_end():
of common arguments are passed into it:
----
-def trace_unhandled(event_name, context, common_cpu, common_secs,
- common_nsecs, common_pid, common_comm):
+def trace_unhandled(event_name, context, event_fields_dict):
pass
----
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 06/15] perf script python: Remove dups in documentation examples
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (4 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 05/15] perf script python: Updated trace_unhandled() signature Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 07/15] perf annotate: Fix symbolic link of build-id cache Arnaldo Carvalho de Melo
` (9 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, SeongJae Park, Alexander Shishkin,
Frederic Weisbecker, Peter Zijlstra, Tom Zanussi,
Arnaldo Carvalho de Melo
From: SeongJae Park <sj38.park@gmail.com>
Few shell command examples in perf-script-python.txt has few nitpicks
include:
- tools/perf/scripts/python directory listing command is unnecessarily
repeated.
- few examples contain additional information in command prompt
unnecessarily and inconsistently.
This commit fixes them to enhance readability of the document.
Signed-off-by: SeongJae Park <sj38.park@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
Fixes: cff68e582237 ("perf/scripts: Add perf-trace-python Documentation")
Link: http://lkml.kernel.org/r/20170530111827.21732-4-sj38.park@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Documentation/perf-script-python.txt | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/tools/perf/Documentation/perf-script-python.txt b/tools/perf/Documentation/perf-script-python.txt
index 378783fe2b6b..51ec2d20068a 100644
--- a/tools/perf/Documentation/perf-script-python.txt
+++ b/tools/perf/Documentation/perf-script-python.txt
@@ -332,7 +332,7 @@ right place, you can have your script listed alongside the other
scripts listed by the 'perf script -l' command e.g.:
----
-root@tropicana:~# perf script -l
+# perf script -l
List of available trace scripts:
wakeup-latency system-wide min/max/avg wakeup latency
rw-by-file <comm> r/w activity for a program, by file
@@ -381,8 +381,6 @@ source tree:
----
# ls -al kernel-source/tools/perf/scripts/python
-
-root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python
total 32
drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 .
drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 ..
@@ -397,7 +395,7 @@ otherwise your script won't show up at run-time), 'perf script -l'
should show a new entry for your script:
----
-root@tropicana:~# perf script -l
+# perf script -l
List of available trace scripts:
wakeup-latency system-wide min/max/avg wakeup latency
rw-by-file <comm> r/w activity for a program, by file
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 07/15] perf annotate: Fix symbolic link of build-id cache
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (5 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 06/15] perf script python: Remove dups in documentation examples Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 08/15] perf tools: Fix a memory leak in __open_dso() Arnaldo Carvalho de Melo
` (8 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Adrian Hunter, David Ahern,
Peter Zijlstra, Taeung Song, Wang Nan, kernel-team,
Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
The commit 6ebd2547dd24 ("perf annotate: Fix a bug following symbolic
link of a build-id file") changed to use dirname to follow the symlink.
But it only considers new-style build-id cache names so old names fail
on readlink() and force to use system path which might not available.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Taeung Song <treeze.taeung@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Fixes: 6ebd2547dd24 ("perf annotate: Fix a bug following symbolic link of a build-id file")
Link: http://lkml.kernel.org/r/20170608073109.30699-2-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index 1367d7e35242..df4486c3a2fa 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1321,6 +1321,7 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
char linkname[PATH_MAX];
char *build_id_filename;
char *build_id_path = NULL;
+ char *pos;
if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS &&
!dso__is_kcore(dso))
@@ -1340,7 +1341,14 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
if (!build_id_path)
return -1;
- dirname(build_id_path);
+ /*
+ * old style build-id cache has name of XX/XXXXXXX.. while
+ * new style has XX/XXXXXXX../{elf,kallsyms,vdso}.
+ * extract the build-id part of dirname in the new style only.
+ */
+ pos = strrchr(build_id_path, '/');
+ if (pos && strlen(pos) < SBUILD_ID_SIZE - 2)
+ dirname(build_id_path);
if (dso__is_kcore(dso) ||
readlink(build_id_path, linkname, sizeof(linkname)) < 0 ||
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 08/15] perf tools: Fix a memory leak in __open_dso()
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (6 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 07/15] perf annotate: Fix symbolic link of build-id cache Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 09/15] perf tools: Introduce dso__decompress_kmodule_{fd,path} Arnaldo Carvalho de Melo
` (7 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Adrian Hunter, David Ahern,
Peter Zijlstra, Wang Nan, kernel-team, Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
The 'name' variable should be freed on the error path.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-3-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index b27d127cdf68..1f29e4fe7af0 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -412,8 +412,10 @@ static int __open_dso(struct dso *dso, struct machine *machine)
return -EINVAL;
}
- if (!is_regular_file(name))
+ if (!is_regular_file(name)) {
+ free(name);
return -EINVAL;
+ }
fd = do_open(name);
free(name);
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 09/15] perf tools: Introduce dso__decompress_kmodule_{fd,path}
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (7 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 08/15] perf tools: Fix a memory leak in __open_dso() Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 10/15] perf annotate: Use dso__decompress_kmodule_path() Arnaldo Carvalho de Melo
` (6 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Adrian Hunter, David Ahern,
Peter Zijlstra, Wang Nan, kernel-team, Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
Move decompress_kmodule() to util/dso.c and split it into two functions
returning fd and (decompressed) file path. The existing user only wants
the fd version but the path version will be used soon.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-4-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 58 ++++++++++++++++++++++++++++++++++++++++++++
tools/perf/util/dso.h | 6 +++++
tools/perf/util/symbol-elf.c | 36 +--------------------------
3 files changed, 65 insertions(+), 35 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index 1f29e4fe7af0..b346b8eba65c 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -248,6 +248,64 @@ bool dso__needs_decompress(struct dso *dso)
dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP;
}
+static int decompress_kmodule(struct dso *dso, const char *name, char *tmpbuf)
+{
+ int fd = -1;
+ struct kmod_path m;
+
+ if (!dso__needs_decompress(dso))
+ return -1;
+
+ if (kmod_path__parse_ext(&m, dso->long_name))
+ return -1;
+
+ if (!m.comp)
+ goto out;
+
+ fd = mkstemp(tmpbuf);
+ if (fd < 0) {
+ dso->load_errno = errno;
+ goto out;
+ }
+
+ if (!decompress_to_file(m.ext, name, fd)) {
+ dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE;
+ close(fd);
+ fd = -1;
+ }
+
+out:
+ free(m.ext);
+ return fd;
+}
+
+int dso__decompress_kmodule_fd(struct dso *dso, const char *name)
+{
+ char tmpbuf[] = KMOD_DECOMP_NAME;
+ int fd;
+
+ fd = decompress_kmodule(dso, name, tmpbuf);
+ unlink(tmpbuf);
+ return fd;
+}
+
+int dso__decompress_kmodule_path(struct dso *dso, const char *name,
+ char *pathname, size_t len)
+{
+ char tmpbuf[] = KMOD_DECOMP_NAME;
+ int fd;
+
+ fd = decompress_kmodule(dso, name, tmpbuf);
+ if (fd < 0) {
+ unlink(tmpbuf);
+ return -1;
+ }
+
+ strncpy(pathname, tmpbuf, len);
+ close(fd);
+ return 0;
+}
+
/*
* Parses kernel module specified in @path and updates
* @m argument like:
diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h
index 5fe2ab5877bd..bd061ba7b47c 100644
--- a/tools/perf/util/dso.h
+++ b/tools/perf/util/dso.h
@@ -244,6 +244,12 @@ bool is_supported_compression(const char *ext);
bool is_kernel_module(const char *pathname, int cpumode);
bool decompress_to_file(const char *ext, const char *filename, int output_fd);
bool dso__needs_decompress(struct dso *dso);
+int dso__decompress_kmodule_fd(struct dso *dso, const char *name);
+int dso__decompress_kmodule_path(struct dso *dso, const char *name,
+ char *pathname, size_t len);
+
+#define KMOD_DECOMP_NAME "/tmp/perf-kmod-XXXXXX"
+#define KMOD_DECOMP_LEN sizeof(KMOD_DECOMP_NAME)
struct kmod_path {
char *name;
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 1fb2efae4f02..d342e771dbad 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -637,40 +637,6 @@ static int dso__swap_init(struct dso *dso, unsigned char eidata)
return 0;
}
-static int decompress_kmodule(struct dso *dso, const char *name,
- enum dso_binary_type type)
-{
- int fd = -1;
- char tmpbuf[] = "/tmp/perf-kmod-XXXXXX";
- struct kmod_path m;
-
- if (type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP &&
- type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP &&
- type != DSO_BINARY_TYPE__BUILD_ID_CACHE)
- return -1;
-
- if (kmod_path__parse_ext(&m, dso->long_name) || !m.comp)
- return -1;
-
- fd = mkstemp(tmpbuf);
- if (fd < 0) {
- dso->load_errno = errno;
- goto out;
- }
-
- if (!decompress_to_file(m.ext, name, fd)) {
- dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE;
- close(fd);
- fd = -1;
- }
-
- unlink(tmpbuf);
-
-out:
- free(m.ext);
- return fd;
-}
-
bool symsrc__possibly_runtime(struct symsrc *ss)
{
return ss->dynsym || ss->opdsec;
@@ -702,7 +668,7 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
int fd;
if (dso__needs_decompress(dso)) {
- fd = decompress_kmodule(dso, name, type);
+ fd = dso__decompress_kmodule_fd(dso, name);
if (fd < 0)
return -1;
} else {
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 10/15] perf annotate: Use dso__decompress_kmodule_path()
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (8 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 09/15] perf tools: Introduce dso__decompress_kmodule_{fd,path} Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 11/15] perf tools: Decompress kernel module when reading DSO data Arnaldo Carvalho de Melo
` (5 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Adrian Hunter, David Ahern,
Peter Zijlstra, Wang Nan, kernel-team, Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
Convert open-coded decompress routine to use the function.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-5-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/annotate.c | 27 +++------------------------
1 file changed, 3 insertions(+), 24 deletions(-)
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
index df4486c3a2fa..ddbd56df9187 100644
--- a/tools/perf/util/annotate.c
+++ b/tools/perf/util/annotate.c
@@ -1431,31 +1431,10 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na
sizeof(symfs_filename));
}
} else if (dso__needs_decompress(dso)) {
- char tmp[PATH_MAX];
- struct kmod_path m;
- int fd;
- bool ret;
+ char tmp[KMOD_DECOMP_LEN];
- if (kmod_path__parse_ext(&m, symfs_filename))
- goto out;
-
- snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX");
-
- fd = mkstemp(tmp);
- if (fd < 0) {
- free(m.ext);
- goto out;
- }
-
- ret = decompress_to_file(m.ext, symfs_filename, fd);
-
- if (ret)
- pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename);
-
- free(m.ext);
- close(fd);
-
- if (!ret)
+ if (dso__decompress_kmodule_path(dso, symfs_filename,
+ tmp, sizeof(tmp)) < 0)
goto out;
strcpy(symfs_filename, tmp);
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 11/15] perf tools: Decompress kernel module when reading DSO data
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (9 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 10/15] perf annotate: Use dso__decompress_kmodule_path() Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 12/15] perf tools: Consolidate error path in __open_dso() Arnaldo Carvalho de Melo
` (4 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Adrian Hunter, David Ahern,
Peter Zijlstra, Wang Nan, kernel-team, Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
Currently perf decompresses kernel modules when loading the symbol table
but it missed to do it when reading raw data.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-6-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index b346b8eba65c..c63525d845c5 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -475,7 +475,23 @@ static int __open_dso(struct dso *dso, struct machine *machine)
return -EINVAL;
}
+ if (dso__needs_decompress(dso)) {
+ char newpath[KMOD_DECOMP_LEN];
+ size_t len = sizeof(newpath);
+
+ if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) {
+ free(name);
+ return -dso->load_errno;
+ }
+
+ strcpy(name, newpath);
+ }
+
fd = do_open(name);
+
+ if (dso__needs_decompress(dso))
+ unlink(name);
+
free(name);
return fd;
}
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 12/15] perf tools: Consolidate error path in __open_dso()
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (10 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 11/15] perf tools: Decompress kernel module when reading DSO data Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 13/15] perf tests: Decompress kernel module before objdump Arnaldo Carvalho de Melo
` (3 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Adrian Hunter, David Ahern,
Peter Zijlstra, Wang Nan, kernel-team, Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
On failure, it should free the 'name', so clean up the error path using
goto.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Suggested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-7-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/dso.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index c63525d845c5..4e7ab611377a 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -454,7 +454,7 @@ static int do_open(char *name)
static int __open_dso(struct dso *dso, struct machine *machine)
{
- int fd;
+ int fd = -EINVAL;
char *root_dir = (char *)"";
char *name = malloc(PATH_MAX);
@@ -465,23 +465,19 @@ static int __open_dso(struct dso *dso, struct machine *machine)
root_dir = machine->root_dir;
if (dso__read_binary_type_filename(dso, dso->binary_type,
- root_dir, name, PATH_MAX)) {
- free(name);
- return -EINVAL;
- }
+ root_dir, name, PATH_MAX))
+ goto out;
- if (!is_regular_file(name)) {
- free(name);
- return -EINVAL;
- }
+ if (!is_regular_file(name))
+ goto out;
if (dso__needs_decompress(dso)) {
char newpath[KMOD_DECOMP_LEN];
size_t len = sizeof(newpath);
if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) {
- free(name);
- return -dso->load_errno;
+ fd = -dso->load_errno;
+ goto out;
}
strcpy(name, newpath);
@@ -492,6 +488,7 @@ static int __open_dso(struct dso *dso, struct machine *machine)
if (dso__needs_decompress(dso))
unlink(name);
+out:
free(name);
return fd;
}
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 13/15] perf tests: Decompress kernel module before objdump
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (11 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 12/15] perf tools: Consolidate error path in __open_dso() Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 14/15] perf symbols: Keep DSO->symtab_type after decompress Arnaldo Carvalho de Melo
` (2 subsequent siblings)
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, David Ahern, Peter Zijlstra,
Wang Nan, kernel-team, Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
If a kernel modules is compressed, it should be decompressed before
running objdump to parse binary data correctly. This fixes a failure of
object code reading test for me.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-8-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/tests/code-reading.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 1f14e7612cbb..94b7c7b02bde 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -229,6 +229,8 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
unsigned char buf2[BUFSZ];
size_t ret_len;
u64 objdump_addr;
+ const char *objdump_name;
+ char decomp_name[KMOD_DECOMP_LEN];
int ret;
pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr);
@@ -289,9 +291,25 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
state->done[state->done_cnt++] = al.map->start;
}
+ objdump_name = al.map->dso->long_name;
+ if (dso__needs_decompress(al.map->dso)) {
+ if (dso__decompress_kmodule_path(al.map->dso, objdump_name,
+ decomp_name,
+ sizeof(decomp_name)) < 0) {
+ pr_debug("decompression failed\n");
+ return -1;
+ }
+
+ objdump_name = decomp_name;
+ }
+
/* Read the object code using objdump */
objdump_addr = map__rip_2objdump(al.map, al.addr);
- ret = read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len);
+ ret = read_via_objdump(objdump_name, objdump_addr, buf2, len);
+
+ if (dso__needs_decompress(al.map->dso))
+ unlink(objdump_name);
+
if (ret > 0) {
/*
* The kernel maps are inaccurate - assume objdump is right in
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 14/15] perf symbols: Keep DSO->symtab_type after decompress
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (12 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 13/15] perf tests: Decompress kernel module before objdump Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 21:59 ` [PATCH 15/15] perf symbols: Kill dso__build_id_is_kmod() Arnaldo Carvalho de Melo
2017-06-08 22:42 ` [GIT PULL 00/15] perf/urgent fixes Ingo Molnar
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Adrian Hunter, David Ahern,
Peter Zijlstra, Wang Nan, kernel-team, Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
The symsrc__init() overwrites dso->symtab_type as symsrc->type in
dso__load_sym(). But for compressed kernel modules in the build-id
cache, it should have original symtab type to be decompressed as needed.
This fixes perf annotate to show disassembly of the function properly.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-9-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/symbol-elf.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index d342e771dbad..502505cf236a 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -671,6 +671,8 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name,
fd = dso__decompress_kmodule_fd(dso, name);
if (fd < 0)
return -1;
+
+ type = dso->symtab_type;
} else {
fd = open(name, O_RDONLY);
if (fd < 0) {
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 15/15] perf symbols: Kill dso__build_id_is_kmod()
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (13 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 14/15] perf symbols: Keep DSO->symtab_type after decompress Arnaldo Carvalho de Melo
@ 2017-06-08 21:59 ` Arnaldo Carvalho de Melo
2017-06-08 22:42 ` [GIT PULL 00/15] perf/urgent fixes Ingo Molnar
15 siblings, 0 replies; 17+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-06-08 21:59 UTC (permalink / raw)
To: Ingo Molnar
Cc: linux-kernel, Namhyung Kim, Adrian Hunter, David Ahern,
Peter Zijlstra, Wang Nan, kernel-team, Arnaldo Carvalho de Melo
From: Namhyung Kim <namhyung@kernel.org>
The commit e7ee40475760 ("perf symbols: Fix symbols searching for module
in buildid-cache") added the function to check kernel modules reside in
the build-id cache. This was because there's no way to identify a DSO
which is actually a kernel module. So it searched linkname of the file
and find ".ko" suffix.
But this does not work for compressed kernel modules and now such DSOs
hCcave correct symtab_type now. So no need to check it anymore. This
patch essentially reverts the commit.
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: kernel-team@lge.com
Link: http://lkml.kernel.org/r/20170608073109.30699-10-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/build-id.c | 45 ---------------------------------------------
tools/perf/util/build-id.h | 1 -
tools/perf/util/symbol.c | 4 ----
3 files changed, 50 deletions(-)
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 168cc49654e7..e0148b081bdf 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -278,51 +278,6 @@ char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size)
return bf;
}
-bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size)
-{
- char *id_name = NULL, *ch;
- struct stat sb;
- char sbuild_id[SBUILD_ID_SIZE];
-
- if (!dso->has_build_id)
- goto err;
-
- build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id);
- id_name = build_id_cache__linkname(sbuild_id, NULL, 0);
- if (!id_name)
- goto err;
- if (access(id_name, F_OK))
- goto err;
- if (lstat(id_name, &sb) == -1)
- goto err;
- if ((size_t)sb.st_size > size - 1)
- goto err;
- if (readlink(id_name, bf, size - 1) < 0)
- goto err;
-
- bf[sb.st_size] = '\0';
-
- /*
- * link should be:
- * ../../lib/modules/4.4.0-rc4/kernel/net/ipv4/netfilter/nf_nat_ipv4.ko/a09fe3eb3147dafa4e3b31dbd6257e4d696bdc92
- */
- ch = strrchr(bf, '/');
- if (!ch)
- goto err;
- if (ch - 3 < bf)
- goto err;
-
- free(id_name);
- return strncmp(".ko", ch - 3, 3) == 0;
-err:
- pr_err("Invalid build id: %s\n", id_name ? :
- dso->long_name ? :
- dso->short_name ? :
- "[unknown]");
- free(id_name);
- return false;
-}
-
#define dsos__for_each_with_build_id(pos, head) \
list_for_each_entry(pos, head, node) \
if (!pos->has_build_id) \
diff --git a/tools/perf/util/build-id.h b/tools/perf/util/build-id.h
index 8a89b195c1fc..96690a55c62c 100644
--- a/tools/perf/util/build-id.h
+++ b/tools/perf/util/build-id.h
@@ -17,7 +17,6 @@ char *build_id_cache__kallsyms_path(const char *sbuild_id, char *bf,
size_t size);
char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size);
-bool dso__build_id_is_kmod(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/symbol.c b/tools/perf/util/symbol.c
index 8f2b068ff756..e7a98dbd2aed 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1562,10 +1562,6 @@ int dso__load(struct dso *dso, struct map *map)
if (!runtime_ss && syms_ss)
runtime_ss = syms_ss;
- if (syms_ss && syms_ss->type == DSO_BINARY_TYPE__BUILD_ID_CACHE)
- if (dso__build_id_is_kmod(dso, name, PATH_MAX))
- kmod = true;
-
if (syms_ss)
ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod);
else
--
2.9.4
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [GIT PULL 00/15] perf/urgent fixes
2017-06-08 21:59 [GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo
` (14 preceding siblings ...)
2017-06-08 21:59 ` [PATCH 15/15] perf symbols: Kill dso__build_id_is_kmod() Arnaldo Carvalho de Melo
@ 2017-06-08 22:42 ` Ingo Molnar
15 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2017-06-08 22:42 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: linux-kernel, Adrian Hunter, Alexander Shishkin, David Ahern,
Frederic Weisbecker, Jiri Olsa, kernel-team, Masami Hiramatsu,
Namhyung Kim, Peter Zijlstra, Pierre Tardy, SeongJae Park,
Taeung Song, Thomas Gleixner, Tom Zanussi, Wang Nan,
Arnaldo Carvalho de Melo
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> Hi Ingo,
>
> Please consider pulling,
>
> - Arnaldo
>
> Test results at the end of this message, as usual.
>
> The following changes since commit 3e411b0ee7c7bf0cbe2bd5961f84a02f0451ad57:
>
> Merge tag 'perf-urgent-for-mingo-4.12-20170606' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2017-06-07 17:50:19 +0200)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo-4.12-20170608
>
> for you to fetch changes up to b89fe63fbafe307fb72546f7a2320380bf41bdd4:
>
> perf symbols: Kill dso__build_id_is_kmod() (2017-06-08 15:39:34 -0300)
>
> ----------------------------------------------------------------
> perf/urgent fixes:
>
> - Fixes for handling compressed kernel modules (Namhyung Kim)
>
> - Fix handling old style build-id cache ($HOME/.debug/) (Namhyung Kim)
>
> - 'perf script' python/perl documentation fixes: outdated comments,
> invalid code snippets, etc (SeongJae Park)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Namhyung Kim (9):
> perf annotate: Fix symbolic link of build-id cache
> perf tools: Fix a memory leak in __open_dso()
> perf tools: Introduce dso__decompress_kmodule_{fd,path}
> perf annotate: Use dso__decompress_kmodule_path()
> perf tools: Decompress kernel module when reading DSO data
> perf tools: Consolidate error path in __open_dso()
> perf tests: Decompress kernel module before objdump
> perf symbols: Keep DSO->symtab_type after decompress
> perf symbols: Kill dso__build_id_is_kmod()
>
> SeongJae Park (6):
> perf probe: Fix examples section of documentation
> perf script: Fix outdated comment for perf-trace-python
> perf script: Fix documentation errors
> perf script python: Fix wrong code snippets in documentation
> perf script python: Updated trace_unhandled() signature
> perf script python: Remove dups in documentation examples
>
> tools/perf/Documentation/perf-probe.txt | 8 +-
> tools/perf/Documentation/perf-script-perl.txt | 2 +-
> tools/perf/Documentation/perf-script-python.txt | 23 +++---
> tools/perf/tests/code-reading.c | 20 ++++-
> tools/perf/util/annotate.c | 37 +++-------
> tools/perf/util/build-id.c | 45 ------------
> tools/perf/util/build-id.h | 1 -
> tools/perf/util/dso.c | 85 ++++++++++++++++++++--
> tools/perf/util/dso.h | 6 ++
> .../util/scripting-engines/trace-event-python.c | 2 +-
> tools/perf/util/symbol-elf.c | 38 +---------
> tools/perf/util/symbol.c | 4 -
> 12 files changed, 136 insertions(+), 135 deletions(-)
Pulled, thanks a lot Arnaldo!
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread