diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-06-20 04:48:44 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-06-20 04:48:44 -0400 |
commit | 2eb0fc9bfe7485fec16030b85ff586e7aaea2b6f (patch) | |
tree | b804e48f8aba794030f3610199b0f20140e6c6a8 /tools/perf | |
parent | d0fabd1cb8b70073a0f44f1cf8b663b5e7241c74 (diff) | |
parent | 41f1830f5a7af77cf5c86359aba3cbd706687e52 (diff) |
Merge tag 'v4.12-rc6' into perf/core, to pick up fixes
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/Documentation/perf-probe.txt | 8 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-script-perl.txt | 2 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-script-python.txt | 23 | ||||
-rw-r--r-- | tools/perf/Makefile.config | 38 | ||||
-rw-r--r-- | tools/perf/Makefile.perf | 2 | ||||
-rw-r--r-- | tools/perf/arch/Build | 2 | ||||
-rw-r--r-- | tools/perf/pmu-events/Build | 4 | ||||
-rw-r--r-- | tools/perf/tests/Build | 2 | ||||
-rw-r--r-- | tools/perf/tests/code-reading.c | 20 | ||||
-rw-r--r-- | tools/perf/tests/task-exit.c | 2 | ||||
-rw-r--r-- | tools/perf/util/annotate.c | 37 | ||||
-rw-r--r-- | tools/perf/util/build-id.c | 45 | ||||
-rw-r--r-- | tools/perf/util/build-id.h | 1 | ||||
-rw-r--r-- | tools/perf/util/dso.c | 85 | ||||
-rw-r--r-- | tools/perf/util/dso.h | 6 | ||||
-rw-r--r-- | tools/perf/util/evsel.c | 12 | ||||
-rw-r--r-- | tools/perf/util/header.c | 2 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 2 | ||||
-rw-r--r-- | tools/perf/util/symbol-elf.c | 38 | ||||
-rw-r--r-- | tools/perf/util/symbol.c | 4 | ||||
-rw-r--r-- | tools/perf/util/unwind-libdw.c | 8 |
21 files changed, 182 insertions, 161 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: | |||
240 | or | 240 | or |
241 | ./perf probe --add='schedule:12 cpu' | 241 | ./perf probe --add='schedule:12 cpu' |
242 | 242 | ||
243 | this will add one or more probes which has the name start with "schedule". | 243 | Add one or more probes which has the name start with "schedule". |
244 | 244 | ||
245 | Add probes on lines in schedule() function which calls update_rq_clock(). | 245 | ./perf probe schedule* |
246 | or | ||
247 | ./perf probe --add='schedule*' | ||
248 | |||
249 | Add probes on lines in schedule() function which calls update_rq_clock(). | ||
246 | 250 | ||
247 | ./perf probe 'schedule;update_rq_clock*' | 251 | ./perf probe 'schedule;update_rq_clock*' |
248 | or | 252 | or |
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 | |||
39 | When perf script is invoked using a trace script, a user-defined | 39 | When perf script is invoked using a trace script, a user-defined |
40 | 'handler function' is called for each event in the trace. If there's | 40 | 'handler function' is called for each event in the trace. If there's |
41 | no handler function defined for a given event type, the event is | 41 | no handler function defined for a given event type, the event is |
42 | ignored (or passed to a 'trace_handled' function, see below) and the | 42 | ignored (or passed to a 'trace_unhandled' function, see below) and the |
43 | next event is processed. | 43 | next event is processed. |
44 | 44 | ||
45 | Most of the event's field values are passed as arguments to the | 45 | 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..51ec2d20068a 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, | |||
149 | print "id=%d, args=%s\n" % \ | 149 | print "id=%d, args=%s\n" % \ |
150 | (id, args), | 150 | (id, args), |
151 | 151 | ||
152 | def trace_unhandled(event_name, context, common_cpu, common_secs, common_nsecs, | 152 | def trace_unhandled(event_name, context, event_fields_dict): |
153 | common_pid, common_comm): | 153 | print ' '.join(['%s=%s'%(k,str(v))for k,v in sorted(event_fields_dict.items())]) |
154 | print_header(event_name, common_cpu, common_secs, common_nsecs, | ||
155 | common_pid, common_comm) | ||
156 | 154 | ||
157 | def print_header(event_name, cpu, secs, nsecs, pid, comm): | 155 | def print_header(event_name, cpu, secs, nsecs, pid, comm): |
158 | print "%-20s %5u %05u.%09u %8u %-20s " % \ | 156 | print "%-20s %5u %05u.%09u %8u %-20s " % \ |
@@ -321,7 +319,7 @@ So those are the essential steps in writing and running a script. The | |||
321 | process can be generalized to any tracepoint or set of tracepoints | 319 | process can be generalized to any tracepoint or set of tracepoints |
322 | you're interested in - basically find the tracepoint(s) you're | 320 | you're interested in - basically find the tracepoint(s) you're |
323 | interested in by looking at the list of available events shown by | 321 | interested in by looking at the list of available events shown by |
324 | 'perf list' and/or look in /sys/kernel/debug/tracing events for | 322 | 'perf list' and/or look in /sys/kernel/debug/tracing/events/ for |
325 | detailed event and field info, record the corresponding trace data | 323 | detailed event and field info, record the corresponding trace data |
326 | using 'perf record', passing it the list of interesting events, | 324 | using 'perf record', passing it the list of interesting events, |
327 | generate a skeleton script using 'perf script -g python' and modify the | 325 | generate a skeleton script using 'perf script -g python' and modify the |
@@ -334,7 +332,7 @@ right place, you can have your script listed alongside the other | |||
334 | scripts listed by the 'perf script -l' command e.g.: | 332 | scripts listed by the 'perf script -l' command e.g.: |
335 | 333 | ||
336 | ---- | 334 | ---- |
337 | root@tropicana:~# perf script -l | 335 | # perf script -l |
338 | List of available trace scripts: | 336 | List of available trace scripts: |
339 | wakeup-latency system-wide min/max/avg wakeup latency | 337 | wakeup-latency system-wide min/max/avg wakeup latency |
340 | rw-by-file <comm> r/w activity for a program, by file | 338 | rw-by-file <comm> r/w activity for a program, by file |
@@ -383,8 +381,6 @@ source tree: | |||
383 | 381 | ||
384 | ---- | 382 | ---- |
385 | # ls -al kernel-source/tools/perf/scripts/python | 383 | # ls -al kernel-source/tools/perf/scripts/python |
386 | |||
387 | root@tropicana:/home/trz/src/tip# ls -al tools/perf/scripts/python | ||
388 | total 32 | 384 | total 32 |
389 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 . | 385 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:30 . |
390 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 .. | 386 | drwxr-xr-x 4 trz trz 4096 2010-01-26 22:29 .. |
@@ -399,7 +395,7 @@ otherwise your script won't show up at run-time), 'perf script -l' | |||
399 | should show a new entry for your script: | 395 | should show a new entry for your script: |
400 | 396 | ||
401 | ---- | 397 | ---- |
402 | root@tropicana:~# perf script -l | 398 | # perf script -l |
403 | List of available trace scripts: | 399 | List of available trace scripts: |
404 | wakeup-latency system-wide min/max/avg wakeup latency | 400 | wakeup-latency system-wide min/max/avg wakeup latency |
405 | rw-by-file <comm> r/w activity for a program, by file | 401 | rw-by-file <comm> r/w activity for a program, by file |
@@ -437,7 +433,7 @@ EVENT HANDLERS | |||
437 | When perf script is invoked using a trace script, a user-defined | 433 | When perf script is invoked using a trace script, a user-defined |
438 | 'handler function' is called for each event in the trace. If there's | 434 | 'handler function' is called for each event in the trace. If there's |
439 | no handler function defined for a given event type, the event is | 435 | no handler function defined for a given event type, the event is |
440 | ignored (or passed to a 'trace_handled' function, see below) and the | 436 | ignored (or passed to a 'trace_unhandled' function, see below) and the |
441 | next event is processed. | 437 | next event is processed. |
442 | 438 | ||
443 | Most of the event's field values are passed as arguments to the | 439 | Most of the event's field values are passed as arguments to the |
@@ -532,7 +528,7 @@ can implement a set of optional functions: | |||
532 | gives scripts a chance to do setup tasks: | 528 | gives scripts a chance to do setup tasks: |
533 | 529 | ||
534 | ---- | 530 | ---- |
535 | def trace_begin: | 531 | def trace_begin(): |
536 | pass | 532 | pass |
537 | ---- | 533 | ---- |
538 | 534 | ||
@@ -541,7 +537,7 @@ def trace_begin: | |||
541 | as display results: | 537 | as display results: |
542 | 538 | ||
543 | ---- | 539 | ---- |
544 | def trace_end: | 540 | def trace_end(): |
545 | pass | 541 | pass |
546 | ---- | 542 | ---- |
547 | 543 | ||
@@ -550,8 +546,7 @@ def trace_end: | |||
550 | of common arguments are passed into it: | 546 | of common arguments are passed into it: |
551 | 547 | ||
552 | ---- | 548 | ---- |
553 | def trace_unhandled(event_name, context, common_cpu, common_secs, | 549 | def trace_unhandled(event_name, context, event_fields_dict): |
554 | common_nsecs, common_pid, common_comm): | ||
555 | pass | 550 | pass |
556 | ---- | 551 | ---- |
557 | 552 | ||
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config index 8354d04b392f..1f4fbc9a3292 100644 --- a/tools/perf/Makefile.config +++ b/tools/perf/Makefile.config | |||
@@ -19,18 +19,18 @@ CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) | |||
19 | 19 | ||
20 | include $(srctree)/tools/scripts/Makefile.arch | 20 | include $(srctree)/tools/scripts/Makefile.arch |
21 | 21 | ||
22 | $(call detected_var,ARCH) | 22 | $(call detected_var,SRCARCH) |
23 | 23 | ||
24 | NO_PERF_REGS := 1 | 24 | NO_PERF_REGS := 1 |
25 | 25 | ||
26 | # Additional ARCH settings for ppc | 26 | # Additional ARCH settings for ppc |
27 | ifeq ($(ARCH),powerpc) | 27 | ifeq ($(SRCARCH),powerpc) |
28 | NO_PERF_REGS := 0 | 28 | NO_PERF_REGS := 0 |
29 | LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 | 29 | LIBUNWIND_LIBS := -lunwind -lunwind-ppc64 |
30 | endif | 30 | endif |
31 | 31 | ||
32 | # Additional ARCH settings for x86 | 32 | # Additional ARCH settings for x86 |
33 | ifeq ($(ARCH),x86) | 33 | ifeq ($(SRCARCH),x86) |
34 | $(call detected,CONFIG_X86) | 34 | $(call detected,CONFIG_X86) |
35 | ifeq (${IS_64_BIT}, 1) | 35 | ifeq (${IS_64_BIT}, 1) |
36 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated | 36 | CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT -DHAVE_SYSCALL_TABLE -I$(OUTPUT)arch/x86/include/generated |
@@ -43,12 +43,12 @@ ifeq ($(ARCH),x86) | |||
43 | NO_PERF_REGS := 0 | 43 | NO_PERF_REGS := 0 |
44 | endif | 44 | endif |
45 | 45 | ||
46 | ifeq ($(ARCH),arm) | 46 | ifeq ($(SRCARCH),arm) |
47 | NO_PERF_REGS := 0 | 47 | NO_PERF_REGS := 0 |
48 | LIBUNWIND_LIBS = -lunwind -lunwind-arm | 48 | LIBUNWIND_LIBS = -lunwind -lunwind-arm |
49 | endif | 49 | endif |
50 | 50 | ||
51 | ifeq ($(ARCH),arm64) | 51 | ifeq ($(SRCARCH),arm64) |
52 | NO_PERF_REGS := 0 | 52 | NO_PERF_REGS := 0 |
53 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 | 53 | LIBUNWIND_LIBS = -lunwind -lunwind-aarch64 |
54 | endif | 54 | endif |
@@ -61,7 +61,7 @@ endif | |||
61 | # Disable it on all other architectures in case libdw unwind | 61 | # Disable it on all other architectures in case libdw unwind |
62 | # support is detected in system. Add supported architectures | 62 | # support is detected in system. Add supported architectures |
63 | # to the check. | 63 | # to the check. |
64 | ifneq ($(ARCH),$(filter $(ARCH),x86 arm)) | 64 | ifneq ($(SRCARCH),$(filter $(SRCARCH),x86 arm)) |
65 | NO_LIBDW_DWARF_UNWIND := 1 | 65 | NO_LIBDW_DWARF_UNWIND := 1 |
66 | endif | 66 | endif |
67 | 67 | ||
@@ -115,9 +115,9 @@ endif | |||
115 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) | 115 | FEATURE_CHECK_CFLAGS-libbabeltrace := $(LIBBABELTRACE_CFLAGS) |
116 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf | 116 | FEATURE_CHECK_LDFLAGS-libbabeltrace := $(LIBBABELTRACE_LDFLAGS) -lbabeltrace-ctf |
117 | 117 | ||
118 | FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi | 118 | FEATURE_CHECK_CFLAGS-bpf = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi -I$(srctree)/tools/include/uapi |
119 | # include ARCH specific config | 119 | # include ARCH specific config |
120 | -include $(src-perf)/arch/$(ARCH)/Makefile | 120 | -include $(src-perf)/arch/$(SRCARCH)/Makefile |
121 | 121 | ||
122 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET | 122 | ifdef PERF_HAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
123 | CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET | 123 | CFLAGS += -DHAVE_ARCH_REGS_QUERY_REGISTER_OFFSET |
@@ -228,12 +228,12 @@ ifeq ($(DEBUG),0) | |||
228 | endif | 228 | endif |
229 | 229 | ||
230 | INC_FLAGS += -I$(src-perf)/util/include | 230 | INC_FLAGS += -I$(src-perf)/util/include |
231 | INC_FLAGS += -I$(src-perf)/arch/$(ARCH)/include | 231 | INC_FLAGS += -I$(src-perf)/arch/$(SRCARCH)/include |
232 | INC_FLAGS += -I$(srctree)/tools/include/uapi | 232 | INC_FLAGS += -I$(srctree)/tools/include/uapi |
233 | INC_FLAGS += -I$(srctree)/tools/include/ | 233 | INC_FLAGS += -I$(srctree)/tools/include/ |
234 | INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/uapi | 234 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi |
235 | INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/include/ | 235 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/ |
236 | INC_FLAGS += -I$(srctree)/tools/arch/$(ARCH)/ | 236 | INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/ |
237 | 237 | ||
238 | # $(obj-perf) for generated common-cmds.h | 238 | # $(obj-perf) for generated common-cmds.h |
239 | # $(obj-perf)/util for generated bison/flex headers | 239 | # $(obj-perf)/util for generated bison/flex headers |
@@ -355,7 +355,7 @@ ifndef NO_LIBELF | |||
355 | 355 | ||
356 | ifndef NO_DWARF | 356 | ifndef NO_DWARF |
357 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) | 357 | ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined) |
358 | msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled); | 358 | msg := $(warning DWARF register mappings have not been defined for architecture $(SRCARCH), DWARF support disabled); |
359 | NO_DWARF := 1 | 359 | NO_DWARF := 1 |
360 | else | 360 | else |
361 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) | 361 | CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS) |
@@ -380,7 +380,7 @@ ifndef NO_LIBELF | |||
380 | CFLAGS += -DHAVE_BPF_PROLOGUE | 380 | CFLAGS += -DHAVE_BPF_PROLOGUE |
381 | $(call detected,CONFIG_BPF_PROLOGUE) | 381 | $(call detected,CONFIG_BPF_PROLOGUE) |
382 | else | 382 | else |
383 | msg := $(warning BPF prologue is not supported by architecture $(ARCH), missing regs_query_register_offset()); | 383 | msg := $(warning BPF prologue is not supported by architecture $(SRCARCH), missing regs_query_register_offset()); |
384 | endif | 384 | endif |
385 | else | 385 | else |
386 | msg := $(warning DWARF support is off, BPF prologue is disabled); | 386 | msg := $(warning DWARF support is off, BPF prologue is disabled); |
@@ -406,7 +406,7 @@ ifdef PERF_HAVE_JITDUMP | |||
406 | endif | 406 | endif |
407 | endif | 407 | endif |
408 | 408 | ||
409 | ifeq ($(ARCH),powerpc) | 409 | ifeq ($(SRCARCH),powerpc) |
410 | ifndef NO_DWARF | 410 | ifndef NO_DWARF |
411 | CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX | 411 | CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX |
412 | endif | 412 | endif |
@@ -487,7 +487,7 @@ else | |||
487 | endif | 487 | endif |
488 | 488 | ||
489 | ifndef NO_LOCAL_LIBUNWIND | 489 | ifndef NO_LOCAL_LIBUNWIND |
490 | ifeq ($(ARCH),$(filter $(ARCH),arm arm64)) | 490 | ifeq ($(SRCARCH),$(filter $(SRCARCH),arm arm64)) |
491 | $(call feature_check,libunwind-debug-frame) | 491 | $(call feature_check,libunwind-debug-frame) |
492 | ifneq ($(feature-libunwind-debug-frame), 1) | 492 | ifneq ($(feature-libunwind-debug-frame), 1) |
493 | msg := $(warning No debug_frame support found in libunwind); | 493 | msg := $(warning No debug_frame support found in libunwind); |
@@ -740,7 +740,7 @@ ifeq (${IS_64_BIT}, 1) | |||
740 | NO_PERF_READ_VDSO32 := 1 | 740 | NO_PERF_READ_VDSO32 := 1 |
741 | endif | 741 | endif |
742 | endif | 742 | endif |
743 | ifneq ($(ARCH), x86) | 743 | ifneq ($(SRCARCH), x86) |
744 | NO_PERF_READ_VDSOX32 := 1 | 744 | NO_PERF_READ_VDSOX32 := 1 |
745 | endif | 745 | endif |
746 | ifndef NO_PERF_READ_VDSOX32 | 746 | ifndef NO_PERF_READ_VDSOX32 |
@@ -769,7 +769,7 @@ ifdef LIBBABELTRACE | |||
769 | endif | 769 | endif |
770 | 770 | ||
771 | ifndef NO_AUXTRACE | 771 | ifndef NO_AUXTRACE |
772 | ifeq ($(ARCH),x86) | 772 | ifeq ($(SRCARCH),x86) |
773 | ifeq ($(feature-get_cpuid), 0) | 773 | ifeq ($(feature-get_cpuid), 0) |
774 | msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); | 774 | msg := $(warning Your gcc lacks the __get_cpuid() builtin, disables support for auxtrace/Intel PT, please install a newer gcc); |
775 | NO_AUXTRACE := 1 | 775 | NO_AUXTRACE := 1 |
@@ -872,7 +872,7 @@ sysconfdir = $(prefix)/etc | |||
872 | ETC_PERFCONFIG = etc/perfconfig | 872 | ETC_PERFCONFIG = etc/perfconfig |
873 | endif | 873 | endif |
874 | ifndef lib | 874 | ifndef lib |
875 | ifeq ($(ARCH)$(IS_64_BIT), x861) | 875 | ifeq ($(SRCARCH)$(IS_64_BIT), x861) |
876 | lib = lib64 | 876 | lib = lib64 |
877 | else | 877 | else |
878 | lib = lib | 878 | lib = lib |
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 79fe31f20a17..5008f51a08a2 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -226,7 +226,7 @@ endif | |||
226 | 226 | ||
227 | ifeq ($(config),0) | 227 | ifeq ($(config),0) |
228 | include $(srctree)/tools/scripts/Makefile.arch | 228 | include $(srctree)/tools/scripts/Makefile.arch |
229 | -include arch/$(ARCH)/Makefile | 229 | -include arch/$(SRCARCH)/Makefile |
230 | endif | 230 | endif |
231 | 231 | ||
232 | # The FEATURE_DUMP_EXPORT holds location of the actual | 232 | # The FEATURE_DUMP_EXPORT holds location of the actual |
diff --git a/tools/perf/arch/Build b/tools/perf/arch/Build index 109eb75cf7de..d9b6af837c7d 100644 --- a/tools/perf/arch/Build +++ b/tools/perf/arch/Build | |||
@@ -1,2 +1,2 @@ | |||
1 | libperf-y += common.o | 1 | libperf-y += common.o |
2 | libperf-y += $(ARCH)/ | 2 | libperf-y += $(SRCARCH)/ |
diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build index 9213a1273697..999a4e878162 100644 --- a/tools/perf/pmu-events/Build +++ b/tools/perf/pmu-events/Build | |||
@@ -2,7 +2,7 @@ hostprogs := jevents | |||
2 | 2 | ||
3 | jevents-y += json.o jsmn.o jevents.o | 3 | jevents-y += json.o jsmn.o jevents.o |
4 | pmu-events-y += pmu-events.o | 4 | pmu-events-y += pmu-events.o |
5 | JDIR = pmu-events/arch/$(ARCH) | 5 | JDIR = pmu-events/arch/$(SRCARCH) |
6 | JSON = $(shell [ -d $(JDIR) ] && \ | 6 | JSON = $(shell [ -d $(JDIR) ] && \ |
7 | find $(JDIR) -name '*.json' -o -name 'mapfile.csv') | 7 | find $(JDIR) -name '*.json' -o -name 'mapfile.csv') |
8 | # | 8 | # |
@@ -10,4 +10,4 @@ JSON = $(shell [ -d $(JDIR) ] && \ | |||
10 | # directory and create tables in pmu-events.c. | 10 | # directory and create tables in pmu-events.c. |
11 | # | 11 | # |
12 | $(OUTPUT)pmu-events/pmu-events.c: $(JSON) $(JEVENTS) | 12 | $(OUTPUT)pmu-events/pmu-events.c: $(JSON) $(JEVENTS) |
13 | $(Q)$(call echo-cmd,gen)$(JEVENTS) $(ARCH) pmu-events/arch $(OUTPUT)pmu-events/pmu-events.c $(V) | 13 | $(Q)$(call echo-cmd,gen)$(JEVENTS) $(SRCARCH) pmu-events/arch $(OUTPUT)pmu-events/pmu-events.c $(V) |
diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build index af58ebc243ef..84222bdb8689 100644 --- a/tools/perf/tests/Build +++ b/tools/perf/tests/Build | |||
@@ -75,7 +75,7 @@ $(OUTPUT)tests/llvm-src-relocation.c: tests/bpf-script-test-relocation.c tests/B | |||
75 | $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@ | 75 | $(Q)sed -e 's/"/\\"/g' -e 's/\(.*\)/"\1\\n"/g' $< >> $@ |
76 | $(Q)echo ';' >> $@ | 76 | $(Q)echo ';' >> $@ |
77 | 77 | ||
78 | ifeq ($(ARCH),$(filter $(ARCH),x86 arm arm64 powerpc)) | 78 | ifeq ($(SRCARCH),$(filter $(SRCARCH),x86 arm arm64 powerpc)) |
79 | perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o | 79 | perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o |
80 | endif | 80 | endif |
81 | 81 | ||
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, | |||
229 | unsigned char buf2[BUFSZ]; | 229 | unsigned char buf2[BUFSZ]; |
230 | size_t ret_len; | 230 | size_t ret_len; |
231 | u64 objdump_addr; | 231 | u64 objdump_addr; |
232 | const char *objdump_name; | ||
233 | char decomp_name[KMOD_DECOMP_LEN]; | ||
232 | int ret; | 234 | int ret; |
233 | 235 | ||
234 | pr_debug("Reading object code for memory address: %#"PRIx64"\n", addr); | 236 | 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, | |||
289 | state->done[state->done_cnt++] = al.map->start; | 291 | state->done[state->done_cnt++] = al.map->start; |
290 | } | 292 | } |
291 | 293 | ||
294 | objdump_name = al.map->dso->long_name; | ||
295 | if (dso__needs_decompress(al.map->dso)) { | ||
296 | if (dso__decompress_kmodule_path(al.map->dso, objdump_name, | ||
297 | decomp_name, | ||
298 | sizeof(decomp_name)) < 0) { | ||
299 | pr_debug("decompression failed\n"); | ||
300 | return -1; | ||
301 | } | ||
302 | |||
303 | objdump_name = decomp_name; | ||
304 | } | ||
305 | |||
292 | /* Read the object code using objdump */ | 306 | /* Read the object code using objdump */ |
293 | objdump_addr = map__rip_2objdump(al.map, al.addr); | 307 | objdump_addr = map__rip_2objdump(al.map, al.addr); |
294 | ret = read_via_objdump(al.map->dso->long_name, objdump_addr, buf2, len); | 308 | ret = read_via_objdump(objdump_name, objdump_addr, buf2, len); |
309 | |||
310 | if (dso__needs_decompress(al.map->dso)) | ||
311 | unlink(objdump_name); | ||
312 | |||
295 | if (ret > 0) { | 313 | if (ret > 0) { |
296 | /* | 314 | /* |
297 | * The kernel maps are inaccurate - assume objdump is right in | 315 | * The kernel maps are inaccurate - assume objdump is right in |
diff --git a/tools/perf/tests/task-exit.c b/tools/perf/tests/task-exit.c index 32873ec91a4e..cf00ebad2ef5 100644 --- a/tools/perf/tests/task-exit.c +++ b/tools/perf/tests/task-exit.c | |||
@@ -83,7 +83,7 @@ int test__task_exit(int subtest __maybe_unused) | |||
83 | 83 | ||
84 | evsel = perf_evlist__first(evlist); | 84 | evsel = perf_evlist__first(evlist); |
85 | evsel->attr.task = 1; | 85 | evsel->attr.task = 1; |
86 | evsel->attr.sample_freq = 0; | 86 | evsel->attr.sample_freq = 1; |
87 | evsel->attr.inherit = 0; | 87 | evsel->attr.inherit = 0; |
88 | evsel->attr.watermark = 0; | 88 | evsel->attr.watermark = 0; |
89 | evsel->attr.wakeup_events = 1; | 89 | evsel->attr.wakeup_events = 1; |
diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c index 1367d7e35242..ddbd56df9187 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 | |||
1321 | char linkname[PATH_MAX]; | 1321 | char linkname[PATH_MAX]; |
1322 | char *build_id_filename; | 1322 | char *build_id_filename; |
1323 | char *build_id_path = NULL; | 1323 | char *build_id_path = NULL; |
1324 | char *pos; | ||
1324 | 1325 | ||
1325 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && | 1326 | if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && |
1326 | !dso__is_kcore(dso)) | 1327 | !dso__is_kcore(dso)) |
@@ -1340,7 +1341,14 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil | |||
1340 | if (!build_id_path) | 1341 | if (!build_id_path) |
1341 | return -1; | 1342 | return -1; |
1342 | 1343 | ||
1343 | dirname(build_id_path); | 1344 | /* |
1345 | * old style build-id cache has name of XX/XXXXXXX.. while | ||
1346 | * new style has XX/XXXXXXX../{elf,kallsyms,vdso}. | ||
1347 | * extract the build-id part of dirname in the new style only. | ||
1348 | */ | ||
1349 | pos = strrchr(build_id_path, '/'); | ||
1350 | if (pos && strlen(pos) < SBUILD_ID_SIZE - 2) | ||
1351 | dirname(build_id_path); | ||
1344 | 1352 | ||
1345 | if (dso__is_kcore(dso) || | 1353 | if (dso__is_kcore(dso) || |
1346 | readlink(build_id_path, linkname, sizeof(linkname)) < 0 || | 1354 | readlink(build_id_path, linkname, sizeof(linkname)) < 0 || |
@@ -1423,31 +1431,10 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na | |||
1423 | sizeof(symfs_filename)); | 1431 | sizeof(symfs_filename)); |
1424 | } | 1432 | } |
1425 | } else if (dso__needs_decompress(dso)) { | 1433 | } else if (dso__needs_decompress(dso)) { |
1426 | char tmp[PATH_MAX]; | 1434 | char tmp[KMOD_DECOMP_LEN]; |
1427 | struct kmod_path m; | ||
1428 | int fd; | ||
1429 | bool ret; | ||
1430 | |||
1431 | if (kmod_path__parse_ext(&m, symfs_filename)) | ||
1432 | goto out; | ||
1433 | |||
1434 | snprintf(tmp, PATH_MAX, "/tmp/perf-kmod-XXXXXX"); | ||
1435 | |||
1436 | fd = mkstemp(tmp); | ||
1437 | if (fd < 0) { | ||
1438 | free(m.ext); | ||
1439 | goto out; | ||
1440 | } | ||
1441 | |||
1442 | ret = decompress_to_file(m.ext, symfs_filename, fd); | ||
1443 | |||
1444 | if (ret) | ||
1445 | pr_err("Cannot decompress %s %s\n", m.ext, symfs_filename); | ||
1446 | |||
1447 | free(m.ext); | ||
1448 | close(fd); | ||
1449 | 1435 | ||
1450 | if (!ret) | 1436 | if (dso__decompress_kmodule_path(dso, symfs_filename, |
1437 | tmp, sizeof(tmp)) < 0) | ||
1451 | goto out; | 1438 | goto out; |
1452 | 1439 | ||
1453 | strcpy(symfs_filename, tmp); | 1440 | strcpy(symfs_filename, tmp); |
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) | |||
278 | return bf; | 278 | return bf; |
279 | } | 279 | } |
280 | 280 | ||
281 | bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size) | ||
282 | { | ||
283 | char *id_name = NULL, *ch; | ||
284 | struct stat sb; | ||
285 | char sbuild_id[SBUILD_ID_SIZE]; | ||
286 | |||
287 | if (!dso->has_build_id) | ||
288 | goto err; | ||
289 | |||
290 | build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); | ||
291 | id_name = build_id_cache__linkname(sbuild_id, NULL, 0); | ||
292 | if (!id_name) | ||
293 | goto err; | ||
294 | if (access(id_name, F_OK)) | ||
295 | goto err; | ||
296 | if (lstat(id_name, &sb) == -1) | ||
297 | goto err; | ||
298 | if ((size_t)sb.st_size > size - 1) | ||
299 | goto err; | ||
300 | if (readlink(id_name, bf, size - 1) < 0) | ||
301 | goto err; | ||
302 | |||
303 | bf[sb.st_size] = '\0'; | ||
304 | |||
305 | /* | ||
306 | * link should be: | ||
307 | * ../../lib/modules/4.4.0-rc4/kernel/net/ipv4/netfilter/nf_nat_ipv4.ko/a09fe3eb3147dafa4e3b31dbd6257e4d696bdc92 | ||
308 | */ | ||
309 | ch = strrchr(bf, '/'); | ||
310 | if (!ch) | ||
311 | goto err; | ||
312 | if (ch - 3 < bf) | ||
313 | goto err; | ||
314 | |||
315 | free(id_name); | ||
316 | return strncmp(".ko", ch - 3, 3) == 0; | ||
317 | err: | ||
318 | pr_err("Invalid build id: %s\n", id_name ? : | ||
319 | dso->long_name ? : | ||
320 | dso->short_name ? : | ||
321 | "[unknown]"); | ||
322 | free(id_name); | ||
323 | return false; | ||
324 | } | ||
325 | |||
326 | #define dsos__for_each_with_build_id(pos, head) \ | 281 | #define dsos__for_each_with_build_id(pos, head) \ |
327 | list_for_each_entry(pos, head, node) \ | 282 | list_for_each_entry(pos, head, node) \ |
328 | if (!pos->has_build_id) \ | 283 | 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, | |||
17 | size_t size); | 17 | size_t size); |
18 | 18 | ||
19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); | 19 | char *dso__build_id_filename(const struct dso *dso, char *bf, size_t size); |
20 | bool dso__build_id_is_kmod(const struct dso *dso, char *bf, size_t size); | ||
21 | 20 | ||
22 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, | 21 | int build_id__mark_dso_hit(struct perf_tool *tool, union perf_event *event, |
23 | struct perf_sample *sample, struct perf_evsel *evsel, | 22 | struct perf_sample *sample, struct perf_evsel *evsel, |
diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index b27d127cdf68..4e7ab611377a 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c | |||
@@ -248,6 +248,64 @@ bool dso__needs_decompress(struct dso *dso) | |||
248 | dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; | 248 | dso->symtab_type == DSO_BINARY_TYPE__GUEST_KMODULE_COMP; |
249 | } | 249 | } |
250 | 250 | ||
251 | static int decompress_kmodule(struct dso *dso, const char *name, char *tmpbuf) | ||
252 | { | ||
253 | int fd = -1; | ||
254 | struct kmod_path m; | ||
255 | |||
256 | if (!dso__needs_decompress(dso)) | ||
257 | return -1; | ||
258 | |||
259 | if (kmod_path__parse_ext(&m, dso->long_name)) | ||
260 | return -1; | ||
261 | |||
262 | if (!m.comp) | ||
263 | goto out; | ||
264 | |||
265 | fd = mkstemp(tmpbuf); | ||
266 | if (fd < 0) { | ||
267 | dso->load_errno = errno; | ||
268 | goto out; | ||
269 | } | ||
270 | |||
271 | if (!decompress_to_file(m.ext, name, fd)) { | ||
272 | dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; | ||
273 | close(fd); | ||
274 | fd = -1; | ||
275 | } | ||
276 | |||
277 | out: | ||
278 | free(m.ext); | ||
279 | return fd; | ||
280 | } | ||
281 | |||
282 | int dso__decompress_kmodule_fd(struct dso *dso, const char *name) | ||
283 | { | ||
284 | char tmpbuf[] = KMOD_DECOMP_NAME; | ||
285 | int fd; | ||
286 | |||
287 | fd = decompress_kmodule(dso, name, tmpbuf); | ||
288 | unlink(tmpbuf); | ||
289 | return fd; | ||
290 | } | ||
291 | |||
292 | int dso__decompress_kmodule_path(struct dso *dso, const char *name, | ||
293 | char *pathname, size_t len) | ||
294 | { | ||
295 | char tmpbuf[] = KMOD_DECOMP_NAME; | ||
296 | int fd; | ||
297 | |||
298 | fd = decompress_kmodule(dso, name, tmpbuf); | ||
299 | if (fd < 0) { | ||
300 | unlink(tmpbuf); | ||
301 | return -1; | ||
302 | } | ||
303 | |||
304 | strncpy(pathname, tmpbuf, len); | ||
305 | close(fd); | ||
306 | return 0; | ||
307 | } | ||
308 | |||
251 | /* | 309 | /* |
252 | * Parses kernel module specified in @path and updates | 310 | * Parses kernel module specified in @path and updates |
253 | * @m argument like: | 311 | * @m argument like: |
@@ -396,7 +454,7 @@ static int do_open(char *name) | |||
396 | 454 | ||
397 | static int __open_dso(struct dso *dso, struct machine *machine) | 455 | static int __open_dso(struct dso *dso, struct machine *machine) |
398 | { | 456 | { |
399 | int fd; | 457 | int fd = -EINVAL; |
400 | char *root_dir = (char *)""; | 458 | char *root_dir = (char *)""; |
401 | char *name = malloc(PATH_MAX); | 459 | char *name = malloc(PATH_MAX); |
402 | 460 | ||
@@ -407,15 +465,30 @@ static int __open_dso(struct dso *dso, struct machine *machine) | |||
407 | root_dir = machine->root_dir; | 465 | root_dir = machine->root_dir; |
408 | 466 | ||
409 | if (dso__read_binary_type_filename(dso, dso->binary_type, | 467 | if (dso__read_binary_type_filename(dso, dso->binary_type, |
410 | root_dir, name, PATH_MAX)) { | 468 | root_dir, name, PATH_MAX)) |
411 | free(name); | 469 | goto out; |
412 | return -EINVAL; | ||
413 | } | ||
414 | 470 | ||
415 | if (!is_regular_file(name)) | 471 | if (!is_regular_file(name)) |
416 | return -EINVAL; | 472 | goto out; |
473 | |||
474 | if (dso__needs_decompress(dso)) { | ||
475 | char newpath[KMOD_DECOMP_LEN]; | ||
476 | size_t len = sizeof(newpath); | ||
477 | |||
478 | if (dso__decompress_kmodule_path(dso, name, newpath, len) < 0) { | ||
479 | fd = -dso->load_errno; | ||
480 | goto out; | ||
481 | } | ||
482 | |||
483 | strcpy(name, newpath); | ||
484 | } | ||
417 | 485 | ||
418 | fd = do_open(name); | 486 | fd = do_open(name); |
487 | |||
488 | if (dso__needs_decompress(dso)) | ||
489 | unlink(name); | ||
490 | |||
491 | out: | ||
419 | free(name); | 492 | free(name); |
420 | return fd; | 493 | return fd; |
421 | } | 494 | } |
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); | |||
244 | bool is_kernel_module(const char *pathname, int cpumode); | 244 | bool is_kernel_module(const char *pathname, int cpumode); |
245 | bool decompress_to_file(const char *ext, const char *filename, int output_fd); | 245 | bool decompress_to_file(const char *ext, const char *filename, int output_fd); |
246 | bool dso__needs_decompress(struct dso *dso); | 246 | bool dso__needs_decompress(struct dso *dso); |
247 | int dso__decompress_kmodule_fd(struct dso *dso, const char *name); | ||
248 | int dso__decompress_kmodule_path(struct dso *dso, const char *name, | ||
249 | char *pathname, size_t len); | ||
250 | |||
251 | #define KMOD_DECOMP_NAME "/tmp/perf-kmod-XXXXXX" | ||
252 | #define KMOD_DECOMP_LEN sizeof(KMOD_DECOMP_NAME) | ||
247 | 253 | ||
248 | struct kmod_path { | 254 | struct kmod_path { |
249 | char *name; | 255 | char *name; |
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index e4f7902d5afa..cda44b0e821c 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
@@ -273,8 +273,20 @@ struct perf_evsel *perf_evsel__new_cycles(void) | |||
273 | struct perf_evsel *evsel; | 273 | struct perf_evsel *evsel; |
274 | 274 | ||
275 | event_attr_init(&attr); | 275 | event_attr_init(&attr); |
276 | /* | ||
277 | * Unnamed union member, not supported as struct member named | ||
278 | * initializer in older compilers such as gcc 4.4.7 | ||
279 | * | ||
280 | * Just for probing the precise_ip: | ||
281 | */ | ||
282 | attr.sample_period = 1; | ||
276 | 283 | ||
277 | perf_event_attr__set_max_precise_ip(&attr); | 284 | perf_event_attr__set_max_precise_ip(&attr); |
285 | /* | ||
286 | * Now let the usual logic to set up the perf_event_attr defaults | ||
287 | * to kick in when we return and before perf_evsel__open() is called. | ||
288 | */ | ||
289 | attr.sample_period = 0; | ||
278 | 290 | ||
279 | evsel = perf_evsel__new(&attr); | 291 | evsel = perf_evsel__new(&attr); |
280 | if (evsel == NULL) | 292 | if (evsel == NULL) |
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 5cac8d5e009a..b5baff3007bb 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -841,7 +841,7 @@ static int write_group_desc(int fd, struct perf_header *h __maybe_unused, | |||
841 | 841 | ||
842 | /* | 842 | /* |
843 | * default get_cpuid(): nothing gets recorded | 843 | * default get_cpuid(): nothing gets recorded |
844 | * actual implementation must be in arch/$(ARCH)/util/header.c | 844 | * actual implementation must be in arch/$(SRCARCH)/util/header.c |
845 | */ | 845 | */ |
846 | int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused) | 846 | int __weak get_cpuid(char *buffer __maybe_unused, size_t sz __maybe_unused) |
847 | { | 847 | { |
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) | |||
1219 | fprintf(ofp, "# be retrieved using Python functions of the form " | 1219 | fprintf(ofp, "# be retrieved using Python functions of the form " |
1220 | "common_*(context).\n"); | 1220 | "common_*(context).\n"); |
1221 | 1221 | ||
1222 | fprintf(ofp, "# See the perf-trace-python Documentation for the list " | 1222 | fprintf(ofp, "# See the perf-script-python Documentation for the list " |
1223 | "of available functions.\n\n"); | 1223 | "of available functions.\n\n"); |
1224 | 1224 | ||
1225 | fprintf(ofp, "import os\n"); | 1225 | fprintf(ofp, "import os\n"); |
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index 1fb2efae4f02..502505cf236a 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) | |||
637 | return 0; | 637 | return 0; |
638 | } | 638 | } |
639 | 639 | ||
640 | static int decompress_kmodule(struct dso *dso, const char *name, | ||
641 | enum dso_binary_type type) | ||
642 | { | ||
643 | int fd = -1; | ||
644 | char tmpbuf[] = "/tmp/perf-kmod-XXXXXX"; | ||
645 | struct kmod_path m; | ||
646 | |||
647 | if (type != DSO_BINARY_TYPE__SYSTEM_PATH_KMODULE_COMP && | ||
648 | type != DSO_BINARY_TYPE__GUEST_KMODULE_COMP && | ||
649 | type != DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
650 | return -1; | ||
651 | |||
652 | if (kmod_path__parse_ext(&m, dso->long_name) || !m.comp) | ||
653 | return -1; | ||
654 | |||
655 | fd = mkstemp(tmpbuf); | ||
656 | if (fd < 0) { | ||
657 | dso->load_errno = errno; | ||
658 | goto out; | ||
659 | } | ||
660 | |||
661 | if (!decompress_to_file(m.ext, name, fd)) { | ||
662 | dso->load_errno = DSO_LOAD_ERRNO__DECOMPRESSION_FAILURE; | ||
663 | close(fd); | ||
664 | fd = -1; | ||
665 | } | ||
666 | |||
667 | unlink(tmpbuf); | ||
668 | |||
669 | out: | ||
670 | free(m.ext); | ||
671 | return fd; | ||
672 | } | ||
673 | |||
674 | bool symsrc__possibly_runtime(struct symsrc *ss) | 640 | bool symsrc__possibly_runtime(struct symsrc *ss) |
675 | { | 641 | { |
676 | return ss->dynsym || ss->opdsec; | 642 | return ss->dynsym || ss->opdsec; |
@@ -702,9 +668,11 @@ int symsrc__init(struct symsrc *ss, struct dso *dso, const char *name, | |||
702 | int fd; | 668 | int fd; |
703 | 669 | ||
704 | if (dso__needs_decompress(dso)) { | 670 | if (dso__needs_decompress(dso)) { |
705 | fd = decompress_kmodule(dso, name, type); | 671 | fd = dso__decompress_kmodule_fd(dso, name); |
706 | if (fd < 0) | 672 | if (fd < 0) |
707 | return -1; | 673 | return -1; |
674 | |||
675 | type = dso->symtab_type; | ||
708 | } else { | 676 | } else { |
709 | fd = open(name, O_RDONLY); | 677 | fd = open(name, O_RDONLY); |
710 | if (fd < 0) { | 678 | if (fd < 0) { |
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) | |||
1562 | if (!runtime_ss && syms_ss) | 1562 | if (!runtime_ss && syms_ss) |
1563 | runtime_ss = syms_ss; | 1563 | runtime_ss = syms_ss; |
1564 | 1564 | ||
1565 | if (syms_ss && syms_ss->type == DSO_BINARY_TYPE__BUILD_ID_CACHE) | ||
1566 | if (dso__build_id_is_kmod(dso, name, PATH_MAX)) | ||
1567 | kmod = true; | ||
1568 | |||
1569 | if (syms_ss) | 1565 | if (syms_ss) |
1570 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); | 1566 | ret = dso__load_sym(dso, map, syms_ss, runtime_ss, kmod); |
1571 | else | 1567 | else |
diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index da45c4be5fb3..7755a5e0fe5e 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c | |||
@@ -178,6 +178,14 @@ frame_callback(Dwfl_Frame *state, void *arg) | |||
178 | Dwarf_Addr pc; | 178 | Dwarf_Addr pc; |
179 | bool isactivation; | 179 | bool isactivation; |
180 | 180 | ||
181 | if (!dwfl_frame_pc(state, &pc, NULL)) { | ||
182 | pr_err("%s", dwfl_errmsg(-1)); | ||
183 | return DWARF_CB_ABORT; | ||
184 | } | ||
185 | |||
186 | // report the module before we query for isactivation | ||
187 | report_module(pc, ui); | ||
188 | |||
181 | if (!dwfl_frame_pc(state, &pc, &isactivation)) { | 189 | if (!dwfl_frame_pc(state, &pc, &isactivation)) { |
182 | pr_err("%s", dwfl_errmsg(-1)); | 190 | pr_err("%s", dwfl_errmsg(-1)); |
183 | return DWARF_CB_ABORT; | 191 | return DWARF_CB_ABORT; |