1
0
Fork 0

perf/core improvements and fixes:

User visible:
 
 - Fix bug 'perf stat' in handling events in error state (Stephane Eranian)
 
 Documentation:
 
 - Add usage of --no-syscalls in 'perf trace' man page (Ravi Bangoria)
 
 Infrastructure:
 
 - 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>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJY787nAAoJENZQFvNTUqpA8+0P/jbf9YKzxKI+/aBAX7VjV0of
 hMcUFUBBo2w5xLmUJAq7n2izTZLuFiVP1O2qtag2IoXVTfF8jnF+TwG9C9eI7Nub
 YhbnB0Mu7NbGqhNaVkvz+VI/IRWpTmAAxsjhNX3ooDvklX7SFPDshuW+AJVSlrDA
 6rAmCu802HwpquAI1tC5b2OZGXrFMwR36DoeRWHQnEg8my+6OkLsYEAcHM8PC9xp
 3wQo9900clT5WYkeOzCwjcDkpgySAsnsH88dmCew5NeiUA0o/GaucZ+r2GbAEtzO
 xUUsc7HlecqeA6Qg4PCN2BgNew7UY2IFflz3oEwVDBC7EgHdC+XQ6gAv56djcHCO
 GCPdmRkzdNAM8iJM9VArUSQP0jMWKLBuXcWlL1luKCkb7+BXanIFSn0Uf/bUMfJm
 ifG/9gDwCDRkIrLFMQj4Utgn3zyfOzgnobKAXaDVc449xsnIjwI6fSwTo7NxQeoN
 XbDCAG6NGDmQrjVArETdzkw5TZFsUfJHi+f062HdwROhp1vtY61mLNU4lhJzY/00
 w4HBw6nRkkKHlbtccASPhM+DLrmjnjhc6pmBbaxTjTUt5v7opsRZFeoLh8D0swxG
 ySIZVqSaIMwkfeFImOlYwELFhATICDNkaLDDiSbceXpZbvfNuVpgwNPyn23we/xa
 rzOQdi3lJ1yuPBciefc0
 =qXes
 -----END PGP SIGNATURE-----

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>
hifive-unleashed-5.1
Ingo Molnar 2017-04-17 10:11:09 +02:00
commit e720c19e0d
7 changed files with 37 additions and 34 deletions

View File

@ -53,17 +53,17 @@ FILES= \
FILES := $(addprefix $(OUTPUT),$(FILES))
CC ?= $(CROSS_COMPILE)gcc -MD
CXX ?= $(CROSS_COMPILE)g++ -MD
PKG_CONFIG := $(CROSS_COMPILE)pkg-config
CC ?= $(CROSS_COMPILE)gcc
CXX ?= $(CROSS_COMPILE)g++
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
LLVM_CONFIG ?= llvm-config
all: $(FILES)
__BUILD = $(CC) $(CFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
__BUILD = $(CC) $(CFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.c,$(@F)) $(LDFLAGS)
BUILD = $(__BUILD) > $(@:.bin=.make.output) 2>&1
__BUILDXX = $(CXX) $(CXXFLAGS) -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
__BUILDXX = $(CXX) $(CXXFLAGS) -MD -Wall -Werror -o $@ $(patsubst %.bin,%.cpp,$(@F)) $(LDFLAGS)
BUILDXX = $(__BUILDXX) > $(@:.bin=.make.output) 2>&1
###############################
@ -175,7 +175,7 @@ $(OUTPUT)test-libperl.bin:
$(BUILD) $(FLAGS_PERL_EMBED)
$(OUTPUT)test-libpython.bin:
$(BUILD)
$(BUILD) $(FLAGS_PYTHON_EMBED)
$(OUTPUT)test-libpython-version.bin:
$(BUILD)

View File

@ -123,7 +123,8 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs.
major or all pagefaults. Default value is maj.
--syscalls::
Trace system calls. This options is enabled by default.
Trace system calls. This options is enabled by default, disable with
--no-syscalls.
--call-graph [mode,type,min[,limit],order[,key][,branch]]::
Setup and enable call-graph (stack chain/backtrace) recording.

View File

@ -170,13 +170,20 @@ PYTHON2_CONFIG := \
override PYTHON_CONFIG := \
$(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
ifeq ($(CC), clang)
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
ifdef PYTHON_CONFIG
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
ifeq ($(CC), clang)
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
endif
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
endif
FEATURE_CHECK_CFLAGS-libpython := $(PYTHON_EMBED_CCOPTS)
@ -267,6 +274,7 @@ ifdef NO_LIBELF
NO_LIBUNWIND := 1
NO_LIBDW_DWARF_UNWIND := 1
NO_LIBBPF := 1
NO_JVMTI := 1
else
ifeq ($(feature-libelf), 0)
ifeq ($(feature-glibc), 1)
@ -276,7 +284,7 @@ else
LIBC_SUPPORT := 1
endif
ifeq ($(LIBC_SUPPORT),1)
msg := $(warning No libelf found, disables 'probe' tool and BPF support in 'perf record', please install libelf-dev, libelf-devel or elfutils-libelf-devel);
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);
NO_LIBELF := 1
NO_DWARF := 1
@ -284,6 +292,7 @@ else
NO_LIBUNWIND := 1
NO_LIBDW_DWARF_UNWIND := 1
NO_LIBBPF := 1
NO_JVMTI := 1
else
ifneq ($(filter s% -static%,$(LDFLAGS),),)
msg := $(error No static glibc found, please install glibc-static);
@ -554,8 +563,6 @@ ifndef NO_GTK2
endif
endif
grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))
ifdef NO_LIBPERL
CFLAGS += -DNO_LIBPERL
@ -603,21 +610,9 @@ else
$(call disable-python,No 'python-config' tool was found: disables Python support - please install python-devel/python-dev)
else
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS)) -lutil
PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
ifeq ($(CC), clang)
PYTHON_EMBED_CCOPTS := $(filter-out -specs=%,$(PYTHON_EMBED_CCOPTS))
endif
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
ifneq ($(feature-libpython), 1)
$(call disable-python,No 'Python.h' (for Python 2.x support) was found: disables Python support - please install python-devel/python-dev)
else
ifneq ($(feature-libpython-version), 1)
$(warning Python 3 is not yet supported; please set)
$(warning PYTHON and/or PYTHON_CONFIG appropriately.)

View File

@ -312,8 +312,12 @@ static int read_counter(struct perf_evsel *counter)
struct perf_counts_values *count;
count = perf_counts(counter->counts, cpu, thread);
if (perf_evsel__read(counter, cpu, thread, count))
if (perf_evsel__read(counter, cpu, thread, count)) {
counter->counts->scaled = -1;
perf_counts(counter->counts, cpu, thread)->ena = 0;
perf_counts(counter->counts, cpu, thread)->run = 0;
return -1;
}
if (STAT_RECORD) {
if (perf_evsel__write_stat_event(counter, cpu, thread, count)) {
@ -338,12 +342,14 @@ static int read_counter(struct perf_evsel *counter)
static void read_counters(void)
{
struct perf_evsel *counter;
int ret;
evlist__for_each_entry(evsel_list, counter) {
if (read_counter(counter))
ret = read_counter(counter);
if (ret)
pr_debug("failed to read counter %s\n", counter->name);
if (perf_stat_process_counter(&stat_config, counter))
if (ret == 0 && perf_stat_process_counter(&stat_config, counter))
pr_warning("failed to process counter %s\n", counter->name);
}
}

View File

@ -1,5 +1,5 @@
#include <linux/types.h>
#include <linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
#include <uapi/linux/mman.h> /* To get things like MAP_HUGETLB even on older libc headers */
#include <api/fs/fs.h>
#include "event.h"
#include "debug.h"

View File

@ -1239,7 +1239,7 @@ int perf_evsel__read(struct perf_evsel *evsel, int cpu, int thread,
if (FD(evsel, cpu, thread) < 0)
return -EINVAL;
if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) < 0)
if (readn(FD(evsel, cpu, thread), count, sizeof(*count)) <= 0)
return -errno;
return 0;
@ -1257,7 +1257,7 @@ int __perf_evsel__read_on_cpu(struct perf_evsel *evsel,
if (evsel->counts == NULL && perf_evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0)
return -ENOMEM;
if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) < 0)
if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0)
return -errno;
perf_evsel__compute_deltas(evsel, cpu, thread, &count);

View File

@ -696,7 +696,8 @@ const char *perf_tip(const char *dirpath)
tips = strlist__new("tips.txt", &conf);
if (tips == NULL)
return errno == ENOENT ? NULL : "Tip: get more memory! ;-p";
return errno == ENOENT ? NULL :
"Tip: check path of tips.txt or get more memory! ;-p";
if (strlist__nr_entries(tips) == 0)
goto out;