Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+37 -34
+6 -6
tools/build/feature/Makefile
··· 53 53 54 54 FILES := $(addprefix $(OUTPUT),$(FILES)) 55 55 56 - CC ?= $(CROSS_COMPILE)gcc -MD 57 - CXX ?= $(CROSS_COMPILE)g++ -MD 58 - PKG_CONFIG := $(CROSS_COMPILE)pkg-config 56 + CC ?= $(CROSS_COMPILE)gcc 57 + CXX ?= $(CROSS_COMPILE)g++ 58 + PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config 59 59 LLVM_CONFIG ?= llvm-config 60 60 61 61 all: $(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 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 67 BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1 68 68 69 69 ############################### ··· 175 175 $(BUILD) $(FLAGS_PERL_EMBED) 176 176 177 177 $(OUTPUT)test-libpython.bin: 178 - $(BUILD) 178 + $(BUILD) $(FLAGS_PYTHON_EMBED) 179 179 180 180 $(OUTPUT)test-libpython-version.bin: 181 181 $(BUILD)
+2 -1
tools/perf/Documentation/perf-trace.txt
··· 123 123 major or all pagefaults. Default value is maj. 124 124 125 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 129 --call-graph [mode,type,min[,limit],order[,key][,branch]]:: 129 130 Setup and enable call-graph (stack chain/backtrace) recording.
+15 -20
tools/perf/Makefile.config
··· 170 170 override PYTHON_CONFIG := \ 171 171 $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG)) 172 172 173 + grep-libs = $(filter -l%,$(1)) 174 + strip-libs = $(filter-out -l%,$(1)) 175 + 173 176 PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) 174 177 175 - PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) 176 - PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) 177 - 178 - ifeq ($(CC), clang) 179 - PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) 178 + ifdef PYTHON_CONFIG 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) 180 187 endif 181 188 182 189 FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS) ··· 274 267 NO_LIBUNWIND := 1 275 268 NO_LIBDW_DWARF_UNWIND := 1 276 269 NO_LIBBPF := 1 270 + NO_JVMTI := 1 277 271 else 278 272 ifeq ($(feature-libelf), 0) 279 273 ifeq ($(feature-glibc), 1) ··· 284 276 LIBC_SUPPORT := 1 285 277 endif 286 278 ifeq ($(LIBC_SUPPORT),1) 287 - msg := $(warning No libelf found, disables 'probe' tool and BPF support in 'perf record', please install libelf-dev, libelf-devel or elfutils-libelf-devel); 279 + 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); 288 280 289 281 NO_LIBELF := 1 290 282 NO_DWARF := 1 ··· 292 284 NO_LIBUNWIND := 1 293 285 NO_LIBDW_DWARF_UNWIND := 1 294 286 NO_LIBBPF := 1 287 + NO_JVMTI := 1 295 288 else 296 289 ifneq ($(filter s% -static%,$(LDFLAGS),),) 297 290 msg := $(error No static glibc found, please install glibc-static); ··· 563 554 endif 564 555 endif 565 556 566 - grep-libs = $(filter -l%,$(1)) 567 - strip-libs = $(filter-out -l%,$(1)) 568 557 569 558 ifdef NO_LIBPERL 570 559 CFLAGS += -DNO_LIBPERL ··· 610 603 $(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev) 611 604 else 612 605 613 - PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG)) 614 - 615 - PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null) 616 - PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS)) 617 - PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil 618 - PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null) 619 - ifeq ($(CC), clang) 620 - PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS)) 621 - endif 622 - FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS) 623 - 624 606 ifneq ($(feature-libpython), 1) 625 607 $(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev) 626 608 else 627 - 628 609 ifneq ($(feature-libpython-version), 1) 629 610 $(warning Python 3 is not yet supported; please set) 630 611 $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
+9 -3
tools/perf/builtin-stat.c
··· 312 312 struct perf_counts_values *count; 313 313 314 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 319 return -1; 320 + } 317 321 318 322 if (STAT_RECORD) { 319 323 if (perf_evsel__write_stat_event(counter, cpu, thread, count)) { ··· 342 338 static void read_counters(void) 343 339 { 344 340 struct perf_evsel *counter; 341 + int ret; 345 342 346 343 evlist__for_each_entry(evsel_list, counter) { 347 - if (read_counter(counter)) 344 + ret = read_counter(counter); 345 + if (ret) 348 346 pr_debug("failed to read counter %s\n", counter->name); 349 347 350 - if (perf_stat_process_counter(&stat_config, counter)) 348 + if (ret == 0 && perf_stat_process_counter(&stat_config, counter)) 351 349 pr_warning("failed to process counter %s\n", counter->name); 352 350 } 353 351 }
+1 -1
tools/perf/util/event.c
··· 1 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 3 #include <api/fs/fs.h> 4 4 #include "event.h" 5 5 #include "debug.h"
+2 -2
tools/perf/util/evsel.c
··· 1239 1239 if (FD(evsel, cpu, thread) < 0) 1240 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 1243 return -errno; 1244 1244 1245 1245 return 0; ··· 1257 1257 if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0) 1258 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 1261 return -errno; 1262 1262 1263 1263 perf_evsel__compute_deltas(evsel, cpu, thread, &count);
+2 -1
tools/perf/util/util.c
··· 696 696 697 697 tips = strlist__new("tips.txt", &conf); 698 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 702 if (strlist__nr_entries(tips) == 0) 702 703 goto out;