summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2017-04-17 04:11:09 -0400
committerIngo Molnar <mingo@kernel.org>2017-04-17 04:11:09 -0400
commite720c19e0d5412f45736d62258d21dc7b056c4ad (patch)
tree40f7eb3f85b5c698304f64dcbf3b4b92d7529e4e
parentfd583ad1563bec5f00140e1f2444adbcd331caad (diff)
parent16eb81365b70266c17d1141ef9b32c3110b22d17 (diff)
Merge tag 'perf-core-for-mingo-4.12-20170413' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes Arnaldo Carvalho de Melo: User visible changes: - Fix 'perf stat' bug in handling events in error state (Stephane Eranian) Documentation changes: - Add usage of --no-syscalls in 'perf trace' man page (Ravi Bangoria) Infrastructure changes: - Pass PYTHON config to feature detection (David Carrillo-Cisneros) - Disable JVMTI if no ELF support available (David Carrillo-Cisneros) - Fix feature detection redefinion of build flags (David Carrillo-Cisneros) - Hint missing file when tool tips fail to load (David Carrillo-Cisneros) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--tools/build/feature/Makefile12
-rw-r--r--tools/perf/Documentation/perf-trace.txt3
-rw-r--r--tools/perf/Makefile.config35
-rw-r--r--tools/perf/builtin-stat.c12
-rw-r--r--tools/perf/util/event.c2
-rw-r--r--tools/perf/util/evsel.c4
-rw-r--r--tools/perf/util/util.c3
7 files changed, 37 insertions, 34 deletions
diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index 09c9626ea666..e35e4e5ad192 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -53,17 +53,17 @@ FILES= \
53 53
54FILES := $(addprefix $(OUTPUT),$(FILES)) 54FILES := $(addprefix $(OUTPUT),$(FILES))
55 55
56CC ?= $(CROSS_COMPILE)gcc -MD 56CC ?= $(CROSS_COMPILE)gcc
57CXX ?= $(CROSS_COMPILE)g++ -MD 57CXX ?= $(CROSS_COMPILE)g++
58PKG_CONFIG := $(CROSS_COMPILE)pkg-config 58PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
59LLVM_CONFIG ?= llvm-config 59LLVM_CONFIG ?= llvm-config
60 60
61all: $(FILES) 61all: $(FILES)
62 62
63__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS) 63__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
64 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1 64 BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
65 65
66__BUILDXX = $(CXX) $(CXXFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS) 66__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
67 BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1 67 BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
68 68
69############################### 69###############################
@@ -175,7 +175,7 @@ $(OUTPUT)test-libperl.bin:
175 $(BUILD) $(FLAGS_PERL_EMBED) 175 $(BUILD) $(FLAGS_PERL_EMBED)
176 176
177$(OUTPUT)test-libpython.bin: 177$(OUTPUT)test-libpython.bin:
178 $(BUILD) 178 $(BUILD) $(FLAGS_PYTHON_EMBED)
179 179
180$(OUTPUT)test-libpython-version.bin: 180$(OUTPUT)test-libpython-version.bin:
181 $(BUILD) 181 $(BUILD)
diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt
index afd728672b6f..c1e3288a2dfb 100644
--- a/tools/perf/Documentation/perf-trace.txt
+++ b/tools/perf/Documentation/perf-trace.txt
@@ -123,7 +123,8 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
123 major or all pagefaults. Default value is maj. 123 major or all pagefaults. Default value is maj.
124 124
125--syscalls:: 125--syscalls::
126 Trace system calls. This options is enabled by default. 126 Trace system calls. This options is enabled by default, disable with
127 --no-syscalls.
127 128
128--call-graph [mode,type,min[,limit],order[,key][,branch]]:: 129--call-graph [mode,type,min[,limit],order[,key][,branch]]::
129 Setup and enable call-graph (stack chain/backtrace) recording. 130 Setup and enable call-graph (stack chain/backtrace) recording.
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 2b656de99495..8354d04b392f 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -170,13 +170,20 @@ PYTHON2_CONFIG := \
170override PYTHON_CONFIG := \ 170override PYTHON_CONFIG := \
171 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) 171 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
172 172
173PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) 173grep-libs = $(filter -l%,$(1))
174strip-libs = $(filter-out -l%,$(1))
174 175
175PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) 176PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
176PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
177 177
178ifeq ($(CC), clang) 178ifdef PYTHON_CONFIG
179 PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) 179 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
180 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
181 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
182 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
183 ifeq ($(CC), clang)
184 PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
185 endif
186 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
180endif 187endif
181 188
182FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) 189FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
@@ -267,6 +274,7 @@ ifdef NO_LIBELF
267 NO_LIBUNWIND := 1 274 NO_LIBUNWIND := 1
268 NO_LIBDW_DWARF_UNWIND := 1 275 NO_LIBDW_DWARF_UNWIND := 1
269 NO_LIBBPF := 1 276 NO_LIBBPF := 1
277 NO_JVMTI := 1
270else 278else
271 ifeq ($(feature-libelf), 0) 279 ifeq ($(feature-libelf), 0)
272 ifeq ($(feature-glibc), 1) 280 ifeq ($(feature-glibc), 1)
@@ -276,7 +284,7 @@ else
276 LIBC_SUPPORT := 1 284 LIBC_SUPPORT := 1
277 endif 285 endif
278 ifeq ($(LIBC_SUPPORT),1) 286 ifeq ($(LIBC_SUPPORT),1)
279 msg := $(warning No libelf found, disables 'probe' tool and BPF support in 'perf record', please install libelf-dev, libelf-devel or elfutils-libelf-devel); 287 msg := $(warning No libelf found. Disables 'probe' tool, jvmti and BPF support in 'perf record'. Please install libelf-dev, libelf-devel or elfutils-libelf-devel);
280 288
281 NO_LIBELF := 1 289 NO_LIBELF := 1
282 NO_DWARF := 1 290 NO_DWARF := 1
@@ -284,6 +292,7 @@ else
284 NO_LIBUNWIND := 1 292 NO_LIBUNWIND := 1
285 NO_LIBDW_DWARF_UNWIND := 1 293 NO_LIBDW_DWARF_UNWIND := 1
286 NO_LIBBPF := 1 294 NO_LIBBPF := 1
295 NO_JVMTI := 1
287 else 296 else
288 ifneq ($(filter s% -static%,$(LDFLAGS),),) 297 ifneq ($(filter s% -static%,$(LDFLAGS),),)
289 msg := $(error No static glibc found, please install glibc-static); 298 msg := $(error No static glibc found, please install glibc-static);
@@ -554,8 +563,6 @@ ifndef NO_GTK2
554 endif 563 endif
555endif 564endif
556 565
557grep-libs = $(filter -l%,$(1))
558strip-libs = $(filter-out -l%,$(1))
559 566
560ifdef NO_LIBPERL 567ifdef NO_LIBPERL
561 CFLAGS += -DNO_LIBPERL 568 CFLAGS += -DNO_LIBPERL
@@ -603,21 +610,9 @@ else
603 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) 610 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
604 else 611 else
605 612
606 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
607
608 PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
609 PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
610 PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
611 PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
612 ifeq ($(CC), clang)
613 PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
614 endif
615 FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
616
617 ifneq ($(feature-libpython), 1) 613 ifneq ($(feature-libpython), 1)
618 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) 614 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
619 else 615 else
620
621 ifneq ($(feature-libpython-version), 1) 616 ifneq ($(feature-libpython-version), 1)
622 $(warning Python 3 is not yet supported; please set) 617 $(warning Python 3 is not yet supported; please set)
623 $(warning PYTHON and/or PYTHON_CONFIG appropriately.) 618 $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 868e086a6b59..610225b6326e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -312,8 +312,12 @@ static int read_counter(struct perf_evsel *counter)
312 struct perf_counts_values *count; 312 struct perf_counts_values *count;
313 313
314 count = perf_counts(counter->counts, cpu, thread); 314 count = perf_counts(counter->counts, cpu, thread);
315 if (perf_evsel__read(counter, cpu, thread, count)) 315 if (perf_evsel__read(counter, cpu, thread, count)) {
316 counter->counts->scaled = -1;
317 perf_counts(counter->counts, cpu, thread)->ena = 0;
318 perf_counts(counter->counts, cpu, thread)->run = 0;
316 return -1; 319 return -1;
320 }
317 321
318 if (STAT_RECORD) { 322 if (STAT_RECORD) {
319 if (perf_evsel__write_stat_event(counter, cpu, thread, count)) { 323 if (perf_evsel__write_stat_event(counter, cpu, thread, count)) {
@@ -338,12 +342,14 @@ static int read_counter(struct perf_evsel *counter)
338static void read_counters(void) 342static void read_counters(void)
339{ 343{
340 struct perf_evsel *counter; 344 struct perf_evsel *counter;
345 int ret;
341 346
342 evlist__for_each_entry(evsel_list, counter) { 347 evlist__for_each_entry(evsel_list, counter) {
343 if (read_counter(counter)) 348 ret = read_counter(counter);
349 if (ret)
344 pr_debug("failed to read counter %s\n", counter->name); 350 pr_debug("failed to read counter %s\n", counter->name);
345 351
346 if (perf_stat_process_counter(&stat_config, counter)) 352 if (ret == 0 && perf_stat_process_counter(&stat_config, counter))
347 pr_warning("failed to process counter %s\n", counter->name); 353 pr_warning("failed to process counter %s\n", counter->name);
348 } 354 }
349} 355}
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 8255a26ac255..4d7e65fa9d86 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1,5 +1,5 @@
1#include <linux/types.h> 1#include <linux/types.h>
2#include <linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */ 2#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
3#include <api/fs/fs.h> 3#include <api/fs/fs.h>
4#include "event.h" 4#include "event.h"
5#include "debug.h" 5#include "debug.h"
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 8f5d86bd3501..3779b9f3f134 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1239,7 +1239,7 @@ int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread,
1239 if (FD(evsel, cpu, thread) < 0) 1239 if (FD(evsel, cpu, thread) < 0)
1240 return -EINVAL; 1240 return -EINVAL;
1241 1241
1242 if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) < 0) 1242 if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) <= 0)
1243 return -errno; 1243 return -errno;
1244 1244
1245 return 0; 1245 return 0;
@@ -1257,7 +1257,7 @@ int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
1257 if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0) 1257 if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0)
1258 return -ENOMEM; 1258 return -ENOMEM;
1259 1259
1260 if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) < 0) 1260 if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0)
1261 return -errno; 1261 return -errno;
1262 1262
1263 perf_evsel__compute_deltas(evsel, cpu, thread, &count); 1263 perf_evsel__compute_deltas(evsel, cpu, thread, &count);
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index d8b45cea54d0..6097d87429e2 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -696,7 +696,8 @@ const char *perf_tip(const char *dirpath)
696 696
697 tips = strlist__new("tips.txt", &conf); 697 tips = strlist__new("tips.txt", &conf);
698 if (tips == NULL) 698 if (tips == NULL)
699 return errno == ENOENT ? NULL : "Tip: get more memory! ;-p"; 699 return errno == ENOENT ? NULL :
700 "Tip: check path of tips.txt or get more memory! ;-p";
700 701
701 if (strlist__nr_entries(tips) == 0) 702 if (strlist__nr_entries(tips) == 0)
702 goto out; 703 goto out;