diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-07-02 04:48:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-07-02 04:48:16 -0400 |
commit | b9df84fd7c05cc300d6d14f022b8a00773ebcf8c (patch) | |
tree | b7a3346416c6d1229ff79ade4fe8646c95125dd8 | |
parent | 93472aff802fd7b61f2209335207e9bd793012f7 (diff) | |
parent | 5ef7bbb09f7b91ef06524c72e1ab1fc48e0d6682 (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/core fixes from Arnaldo Carvalho de Melo:
Build fixes:
- Create config.detected into OUTPUT directory, fixing parallel
builds sharing the same source directory (Aaro Kiskinen)
- Allow to specify custom linker command, fixing some MIPS64
builds. (Aaro Kiskinen)
Infrastructure fixes:
- Add missing break for PERF_RECORD_ITRACE_START, which caused those events
samples to be parsed as well as PERF_RECORD_LOST_SAMPLES. ITRACE_START only
appears when Intel PT or BTS are present, so (Jiri Olsa)
- Call the perf_session destructor when bailing out in the inject, kmem, report,
kvm and mem tools (Taeung Song)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | tools/build/Makefile.build | 2 | ||||
-rw-r--r-- | tools/perf/Makefile.perf | 4 | ||||
-rw-r--r-- | tools/perf/builtin-inject.c | 7 | ||||
-rw-r--r-- | tools/perf/builtin-kmem.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-kvm.c | 14 | ||||
-rw-r--r-- | tools/perf/builtin-mem.c | 16 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 6 | ||||
-rw-r--r-- | tools/perf/config/Makefile | 6 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 3 |
9 files changed, 33 insertions, 29 deletions
diff --git a/tools/build/Makefile.build b/tools/build/Makefile.build index a51244a8022f..faca2bf6a430 100644 --- a/tools/build/Makefile.build +++ b/tools/build/Makefile.build | |||
@@ -25,7 +25,7 @@ build-dir := $(srctree)/tools/build | |||
25 | include $(build-dir)/Build.include | 25 | include $(build-dir)/Build.include |
26 | 26 | ||
27 | # do not force detected configuration | 27 | # do not force detected configuration |
28 | -include .config-detected | 28 | -include $(OUTPUT).config-detected |
29 | 29 | ||
30 | # Init all relevant variables used in build files so | 30 | # Init all relevant variables used in build files so |
31 | # 1) they have correct type | 31 | # 1) they have correct type |
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 1af0cfeb7a57..7a4b549214e3 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
@@ -110,7 +110,7 @@ $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD | |||
110 | $(Q)touch $(OUTPUT)PERF-VERSION-FILE | 110 | $(Q)touch $(OUTPUT)PERF-VERSION-FILE |
111 | 111 | ||
112 | CC = $(CROSS_COMPILE)gcc | 112 | CC = $(CROSS_COMPILE)gcc |
113 | LD = $(CROSS_COMPILE)ld | 113 | LD ?= $(CROSS_COMPILE)ld |
114 | AR = $(CROSS_COMPILE)ar | 114 | AR = $(CROSS_COMPILE)ar |
115 | PKG_CONFIG = $(CROSS_COMPILE)pkg-config | 115 | PKG_CONFIG = $(CROSS_COMPILE)pkg-config |
116 | 116 | ||
@@ -545,7 +545,7 @@ config-clean: | |||
545 | clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean | 545 | clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean |
546 | $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS) | 546 | $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS) |
547 | $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete | 547 | $(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete |
548 | $(Q)$(RM) .config-detected | 548 | $(Q)$(RM) $(OUTPUT).config-detected |
549 | $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 | 549 | $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 |
550 | $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* | 550 | $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* |
551 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean | 551 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean |
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index 52ec66b23607..01b06492bd6a 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -630,12 +630,13 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) | |||
630 | if (inject.session == NULL) | 630 | if (inject.session == NULL) |
631 | return -1; | 631 | return -1; |
632 | 632 | ||
633 | if (symbol__init(&inject.session->header.env) < 0) | 633 | ret = symbol__init(&inject.session->header.env); |
634 | return -1; | 634 | if (ret < 0) |
635 | goto out_delete; | ||
635 | 636 | ||
636 | ret = __cmd_inject(&inject); | 637 | ret = __cmd_inject(&inject); |
637 | 638 | ||
639 | out_delete: | ||
638 | perf_session__delete(inject.session); | 640 | perf_session__delete(inject.session); |
639 | |||
640 | return ret; | 641 | return ret; |
641 | } | 642 | } |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 950f296dfcf7..23b1faaaa4cc 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -1916,7 +1916,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1916 | if (!perf_evlist__find_tracepoint_by_name(session->evlist, | 1916 | if (!perf_evlist__find_tracepoint_by_name(session->evlist, |
1917 | "kmem:kmalloc")) { | 1917 | "kmem:kmalloc")) { |
1918 | pr_err(errmsg, "slab", "slab"); | 1918 | pr_err(errmsg, "slab", "slab"); |
1919 | return -1; | 1919 | goto out_delete; |
1920 | } | 1920 | } |
1921 | } | 1921 | } |
1922 | 1922 | ||
@@ -1927,7 +1927,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1927 | "kmem:mm_page_alloc"); | 1927 | "kmem:mm_page_alloc"); |
1928 | if (evsel == NULL) { | 1928 | if (evsel == NULL) { |
1929 | pr_err(errmsg, "page", "page"); | 1929 | pr_err(errmsg, "page", "page"); |
1930 | return -1; | 1930 | goto out_delete; |
1931 | } | 1931 | } |
1932 | 1932 | ||
1933 | kmem_page_size = pevent_get_page_size(evsel->tp_format->pevent); | 1933 | kmem_page_size = pevent_get_page_size(evsel->tp_format->pevent); |
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 74878cd75078..fc1cffb1b7a2 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -1061,8 +1061,10 @@ static int read_events(struct perf_kvm_stat *kvm) | |||
1061 | 1061 | ||
1062 | symbol__init(&kvm->session->header.env); | 1062 | symbol__init(&kvm->session->header.env); |
1063 | 1063 | ||
1064 | if (!perf_session__has_traces(kvm->session, "kvm record")) | 1064 | if (!perf_session__has_traces(kvm->session, "kvm record")) { |
1065 | return -EINVAL; | 1065 | ret = -EINVAL; |
1066 | goto out_delete; | ||
1067 | } | ||
1066 | 1068 | ||
1067 | /* | 1069 | /* |
1068 | * Do not use 'isa' recorded in kvm_exit tracepoint since it is not | 1070 | * Do not use 'isa' recorded in kvm_exit tracepoint since it is not |
@@ -1070,9 +1072,13 @@ static int read_events(struct perf_kvm_stat *kvm) | |||
1070 | */ | 1072 | */ |
1071 | ret = cpu_isa_config(kvm); | 1073 | ret = cpu_isa_config(kvm); |
1072 | if (ret < 0) | 1074 | if (ret < 0) |
1073 | return ret; | 1075 | goto out_delete; |
1074 | 1076 | ||
1075 | return perf_session__process_events(kvm->session); | 1077 | ret = perf_session__process_events(kvm->session); |
1078 | |||
1079 | out_delete: | ||
1080 | perf_session__delete(kvm->session); | ||
1081 | return ret; | ||
1076 | } | 1082 | } |
1077 | 1083 | ||
1078 | static int parse_target_str(struct perf_kvm_stat *kvm) | 1084 | static int parse_target_str(struct perf_kvm_stat *kvm) |
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index da2ec06f0742..80170aace5d4 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c | |||
@@ -124,7 +124,6 @@ static int report_raw_events(struct perf_mem *mem) | |||
124 | .mode = PERF_DATA_MODE_READ, | 124 | .mode = PERF_DATA_MODE_READ, |
125 | .force = mem->force, | 125 | .force = mem->force, |
126 | }; | 126 | }; |
127 | int err = -EINVAL; | ||
128 | int ret; | 127 | int ret; |
129 | struct perf_session *session = perf_session__new(&file, false, | 128 | struct perf_session *session = perf_session__new(&file, false, |
130 | &mem->tool); | 129 | &mem->tool); |
@@ -135,24 +134,21 @@ static int report_raw_events(struct perf_mem *mem) | |||
135 | if (mem->cpu_list) { | 134 | if (mem->cpu_list) { |
136 | ret = perf_session__cpu_bitmap(session, mem->cpu_list, | 135 | ret = perf_session__cpu_bitmap(session, mem->cpu_list, |
137 | mem->cpu_bitmap); | 136 | mem->cpu_bitmap); |
138 | if (ret) | 137 | if (ret < 0) |
139 | goto out_delete; | 138 | goto out_delete; |
140 | } | 139 | } |
141 | 140 | ||
142 | if (symbol__init(&session->header.env) < 0) | 141 | ret = symbol__init(&session->header.env); |
143 | return -1; | 142 | if (ret < 0) |
143 | goto out_delete; | ||
144 | 144 | ||
145 | printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n"); | 145 | printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n"); |
146 | 146 | ||
147 | err = perf_session__process_events(session); | 147 | ret = perf_session__process_events(session); |
148 | if (err) | ||
149 | return err; | ||
150 | |||
151 | return 0; | ||
152 | 148 | ||
153 | out_delete: | 149 | out_delete: |
154 | perf_session__delete(session); | 150 | perf_session__delete(session); |
155 | return err; | 151 | return ret; |
156 | } | 152 | } |
157 | 153 | ||
158 | static int report_events(int argc, const char **argv, struct perf_mem *mem) | 154 | static int report_events(int argc, const char **argv, struct perf_mem *mem) |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 348bed4a2abf..95a47719aec3 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -839,8 +839,10 @@ repeat: | |||
839 | if (report.header || report.header_only) { | 839 | if (report.header || report.header_only) { |
840 | perf_session__fprintf_info(session, stdout, | 840 | perf_session__fprintf_info(session, stdout, |
841 | report.show_full_info); | 841 | report.show_full_info); |
842 | if (report.header_only) | 842 | if (report.header_only) { |
843 | return 0; | 843 | ret = 0; |
844 | goto error; | ||
845 | } | ||
844 | } else if (use_browser == 0) { | 846 | } else if (use_browser == 0) { |
845 | fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", | 847 | fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n", |
846 | stdout); | 848 | stdout); |
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile index 317001c94660..094ddaee104c 100644 --- a/tools/perf/config/Makefile +++ b/tools/perf/config/Makefile | |||
@@ -11,9 +11,9 @@ ifneq ($(obj-perf),) | |||
11 | obj-perf := $(abspath $(obj-perf))/ | 11 | obj-perf := $(abspath $(obj-perf))/ |
12 | endif | 12 | endif |
13 | 13 | ||
14 | $(shell echo -n > .config-detected) | 14 | $(shell echo -n > $(OUTPUT).config-detected) |
15 | detected = $(shell echo "$(1)=y" >> .config-detected) | 15 | detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected) |
16 | detected_var = $(shell echo "$(1)=$($(1))" >> .config-detected) | 16 | detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected) |
17 | 17 | ||
18 | CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) | 18 | CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS) |
19 | 19 | ||
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 4744673aff1b..7ff682770fdb 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1448,10 +1448,9 @@ int machine__process_event(struct machine *machine, union perf_event *event, | |||
1448 | case PERF_RECORD_AUX: | 1448 | case PERF_RECORD_AUX: |
1449 | ret = machine__process_aux_event(machine, event); break; | 1449 | ret = machine__process_aux_event(machine, event); break; |
1450 | case PERF_RECORD_ITRACE_START: | 1450 | case PERF_RECORD_ITRACE_START: |
1451 | ret = machine__process_itrace_start_event(machine, event); | 1451 | ret = machine__process_itrace_start_event(machine, event); break; |
1452 | case PERF_RECORD_LOST_SAMPLES: | 1452 | case PERF_RECORD_LOST_SAMPLES: |
1453 | ret = machine__process_lost_samples_event(machine, event, sample); break; | 1453 | ret = machine__process_lost_samples_event(machine, event, sample); break; |
1454 | break; | ||
1455 | default: | 1454 | default: |
1456 | ret = -1; | 1455 | ret = -1; |
1457 | break; | 1456 | break; |