Skip to contentSkip to conversation

perf tool: build and usage hints

PATCH In review David Carrillo-Cisneros 5 participants 25 messages Apr 12, 2017 – Apr 17, 2017 perf events

lore
Share & tools
lore
#0 lore raw

cover perf tool: build and usage hints

Minor build fixes and error condition hints.

David Carrillo-Cisneros (6):
perf tools: pass PYTHON config to feature detection tools build: fix feature detection redefinion of build flags perf util: hint missing file when tool tips fail to load perf report: hint .perfconfig error when invalid sorting key perf tools: disable JVMTI if no ELF support available Revert "perf tools: Fix include of linux/mman.h"

 tools/build/feature/Makefile | 12 ++++++------
 tools/perf/Makefile.config   | 35 +++++++++++++++--------------------
 tools/perf/builtin-report.c  |  5 ++++-
 tools/perf/util/event.c      |  2 +-
 tools/perf/util/util.c       |  2 +-
 5 files changed, 27 insertions(+), 29 deletions(-)
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#1 lore raw

PATCH 1/6 perf tools: pass PYTHON config to feature detection

( This is a rebased version of https://lkml.org/lkml/2017/2/7/662 )

Python's CC and link Makefile variables were not passed to feature detection, causing feature detection to use system's Python rather than PYTHON_CONFIG's one. This created a mismatch between the detected Python support and the one actually used by perf when PYTHON_CONFIG is specified.

Fix it by moving Python's variable initialization to before feature detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's build target.

---
 tools/build/feature/Makefile |  2 +-
 tools/perf/Makefile.config   | 31 ++++++++++++-------------------
 2 files changed, 13 insertions(+), 20 deletions(-)
tools/build/feature/Makefile +1 -1
index 09c9626ea666..523e587fe05f 100644
@@ -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)
tools/perf/Makefile.config +12 -19
index 2b656de99495..cfd6015229a2 100644
@@ -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)
@@ -554,8 +561,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 +608,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.)
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#2 lore raw

[tip:perf/core] perf tools: Pass PYTHON config to feature detection

perf tools: Pass PYTHON config to feature detection
Commit-ID:  7be6b3166ebf2c10c28ef5777d1b31a937ed8f7a
Gitweb:     http://git.kernel.org/tip/7be6b3166ebf2c10c28ef5777d1b31a937ed8f7a
Author:     David Carrillo-Cisneros <[email protected]>
AuthorDate: Tue, 11 Apr 2017 23:49:13 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 12 Apr 2017 10:45:21 -0300

perf tools: Pass PYTHON config to feature detection

( This is a rebased version of https://lkml.org/lkml/2017/2/7/662 )

Python's CC and link Makefile variables were not passed to feature detection, causing feature detection to use system's Python rather than PYTHON_CONFIG's one. This created a mismatch between the detected Python support and the one actually used by perf when PYTHON_CONFIG is specified.

Fix it by moving Python's variable initialization to before feature detection and pass FLAGS_PYTHON_EMBED to Python's feature detection's build target.

---
 tools/build/feature/Makefile |  2 +-
 tools/perf/Makefile.config   | 31 ++++++++++++-------------------
 2 files changed, 13 insertions(+), 20 deletions(-)
tools/build/feature/Makefile +1 -1
index 09c9626..523e587 100644
@@ -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)
tools/perf/Makefile.config +12 -19
index 2b656de..cfd6015 100644
@@ -170,13 +170,20 @@ PYTHON2_CONFIG := \
 override PYTHON_CONFIG := \
   $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON2_CONFIG))
 
-PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
+grep-libs  = $(filter -l%,$(1))
+strip-libs  = $(filter-out -l%,$(1))
 
-PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
-PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
 
-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)
@@ -554,8 +561,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 +608,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.)
#3 lore raw

PATCH 2/6 tools build: fix feature redefine build flags

In reply to David Carrillo-Cisneros

This change is a follow up of https://lkml.org/lkml/2017/2/2/16

The patch above avoided redefining CC, CXX and PKG_CONFIG in feature detection. The patch was not merged due to a unsolved concern with the -MD flag.

Later, commit c8c188679c ("tools build: Use the same CC for feature
detection and actual build")
did the change for CC and CXX but not PKG_CONFIG.

This patch makes PKG_CONFIG consistent with CC and CXX and moves the -MD to CFLAGS, as suggested by Jiri in the thread above.

---
 tools/build/feature/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/build/feature/Makefile +5 -5
index 523e587fe05f..e35e4e5ad192 100644
@@ -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
 
 ###############################
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#4 lore raw

Re: [PATCH 2/6] tools build: fix feature redefine build flags

Quoted 1 line · David Carrillo-Cisneros

This change is a follow up of https://lkml.org/lkml/2017/2/2/16

hi,
there's another 2/6 in this patchset with same change but slightly different changelog

jirka

Quoted 47 lines

The patch above avoided redefining CC, CXX and PKG_CONFIG in feature detection. The patch was not merged due to a unsolved concern with the -MD flag.

Later, commit c8c188679c ("tools build: Use the same CC for feature
detection and actual build")
did the change for CC and CXX but not PKG_CONFIG.

This patch makes PKG_CONFIG consistent with CC and CXX and moves the -MD to CFLAGS, as suggested by Jiri in the thread above.

---
 tools/build/feature/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/build/feature/Makefile +5 -5
index 523e587fe05f..e35e4e5ad192 100644
@@ -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
 
 ###############################
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#5 lore raw

Re: [PATCH 2/6] tools build: fix feature redefine build flags

Quoted 7 lines · Jiri Olsa
Quoted 1 line · David Carrillo-Cisneros

This change is a follow up of https://lkml.org/lkml/2017/2/2/16

hi,
there's another 2/6 in this patchset with same change but slightly different changelog

Uups, I did not rm the old version before sending. The other one is the latest version.

Thanks,
David

#6 lore raw

Re: [PATCH 2/6] tools build: fix feature redefine build flags

Em Wed, Apr 12, 2017 at 09:30:05AM -0700, David Carrillo-Cisneros escreveu:

Quoted 5 lines · Jiri Olsa
Quoted 4 lines · David Carrillo-Cisneros
Quoted 1 line

This change is a follow up of https://lkml.org/lkml/2017/2/2/16

Quoted 7 lines
Quoted 3 lines

hi,
there's another 2/6 in this patchset with same change but slightly different changelog

Uups, I did not rm the old version before sending. The other one is the latest version.

Ok, applied the other

#7 lore raw

PATCH 2/6 tools build: fix feature detection redefinion of build flags

In reply to David Carrillo-Cisneros

This change is a follow up of https://lkml.org/lkml/2017/2/2/16

The patch above avoided redefining CC, CXX and PKG_CONFIG in feature detection. The patch was not merged due to a unsolved concern with the -MD flag.

Later, commit c8c188679ccf ("tools build: Use the same CC for feature
detection and actual build")
did the change for CC and CXX but not PKG_CONFIG.

This patch makes PKG_CONFIG consistent with CC and CXX and moves the -MD to CFLAGS, as suggested by Jiri in the thread above.

---
 tools/build/feature/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/build/feature/Makefile +5 -5
index 523e587fe05f..e35e4e5ad192 100644
@@ -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
 
 ###############################
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#8 lore raw

[tip:perf/core] tools build: Fix feature detection redefinion of build flags

tools build: Fix feature detection redefinion of build flags
Commit-ID:  9961aa665b70e47d6c80141c4a2482266010f246
Gitweb:     http://git.kernel.org/tip/9961aa665b70e47d6c80141c4a2482266010f246
Author:     David Carrillo-Cisneros <[email protected]>
AuthorDate: Tue, 11 Apr 2017 23:49:14 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 13 Apr 2017 11:48:48 -0300

tools build: Fix feature detection redefinion of build flags

This change is a follow up of https://lkml.org/lkml/2017/2/2/16

The patch above avoided redefining CC, CXX and PKG_CONFIG in feature detection. The patch was not merged due to a unsolved concern with the -MD flag.

Later, commit c8c188679ccf ("tools build: Use the same CC for feature detection and actual build") did the change for CC and CXX but not PKG_CONFIG.

This patch makes PKG_CONFIG consistent with CC and CXX and moves the -MD to CFLAGS, as suggested by Jiri in the thread above.

---
 tools/build/feature/Makefile | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
tools/build/feature/Makefile +5 -5
index 523e587..e35e4e5 100644
@@ -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
 
 ###############################
#9 lore raw

PATCH 3/6 perf util: hint missing file when tool tips fail to load

In reply to David Carrillo-Cisneros

Besides memory allocation failure, tips.txt may fail to load because the file is not found (a more likely cause).

Communicate that to the user in tips failure warning.

---
 tools/perf/util/util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/util.c +2 -1
index d8b45cea54d0..6097d87429e2 100644
@@ -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;
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#10 lore raw

[tip:perf/core] perf util: Hint missing file when tool tips fail to load

perf util: Hint missing file when tool tips fail to load
Commit-ID:  570eda03213a216a88566c0da7bfe175832cfaa4
Gitweb:     http://git.kernel.org/tip/570eda03213a216a88566c0da7bfe175832cfaa4
Author:     David Carrillo-Cisneros <[email protected]>
AuthorDate: Tue, 11 Apr 2017 23:49:16 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 13 Apr 2017 11:52:51 -0300

perf util: Hint missing file when tool tips fail to load

Besides memory allocation failure, tips.txt may fail to load because the file is not found (a more likely cause).

Communicate that to the user in tips failure warning.

---
 tools/perf/util/util.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/util.c +2 -1
index d8b45ce..6097d87 100644
@@ -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;
#11 lore raw

PATCH 4/6 perf report: hint .perfconfig error when invalid sorting key

In reply to David Carrillo-Cisneros

My fat-fingering of sort keys in .perfconfig was a common cause of perf report silently terminating without apparent error.

This was because 1) error in setup_sorting in cmd_report was ignored and 2) no message was log in UI browser that would prevent UI from exit before user prompt. Fix both.

---
 tools/perf/builtin-report.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tools/perf/builtin-report.c +4 -1
index c18158b83eb1..19a69ca0e9c9 100644
@@ -987,12 +987,15 @@ int cmd_report(int argc, const char **argv)
 	else
 		use_browser = 0;
 
-	if (setup_sorting(session->evlist) < 0) {
+	ret = setup_sorting(session->evlist);
+	if (ret < 0) {
 		if (sort_order)
 			parse_options_usage(report_usage, options, "s", 1);
 		if (field_order)
 			parse_options_usage(sort_order ? NULL : report_usage,
 					    options, "F", 1);
+		if (!sort_order && !field_order)
+			pr_err("Couldn't setup sort order. Is .perfconfig correct?\n");
 		goto error;
 	}
 
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#12 lore raw

Re: [PATCH 4/6] perf report: hint .perfconfig error when invalid sorting key

Quoted 6 lines · David Carrillo-Cisneros

My fat-fingering of sort keys in .perfconfig was a common cause of perf report silently terminating without apparent error.

This was because 1) error in setup_sorting in cmd_report was ignored and 2) no message was log in UI browser that would prevent UI from exit before user prompt. Fix both.

there's UI init ahead of this code.. I had to move it below your code to spot any error message

there's other errors further on.. perhaps we should move it even further ;-) or cancel the ui before the error is printed

jirka

---

tools/perf/builtin-report.c +5 -5
index 19a69ca0e9c9..abcf3aadca9e 100644
@@ -982,11 +982,6 @@ int cmd_report(int argc, const char **argv)
 	if (report.header || report.header_only || report.show_threads)
 		use_browser = 0;
 
-	if (strcmp(input_name, "-") != 0)
-		setup_browser(true);
-	else
-		use_browser = 0;
-
 	ret = setup_sorting(session->evlist);
 	if (ret < 0) {
 		if (sort_order)
@@ -999,6 +994,11 @@ int cmd_report(int argc, const char **argv)
 		goto error;
 	}
 
+	if (strcmp(input_name, "-") != 0)
+		setup_browser(true);
+	else
+		use_browser = 0;
+
 	if ((report.header || report.header_only) && !quiet) {
 		perf_session__fprintf_info(session, stdout,
 					   report.show_full_info);
#13 lore raw

Re: [PATCH 4/6] perf report: hint .perfconfig error when invalid sorting key

Quoted 8 lines · David Carrillo-Cisneros
Quoted 6 lines

My fat-fingering of sort keys in .perfconfig was a common cause of perf report silently terminating without apparent error.

This was because 1) error in setup_sorting in cmd_report was ignored and 2) no message was log in UI browser that would prevent UI from exit before user prompt. Fix both.

Quoted 5 lines

there's UI init ahead of this code.. I had to move it below your code to spot any error message

there's other errors further on.. perhaps we should move it even further ;-) or cancel the ui before the error is printed

Probably canceling ui on error is the more robust way to go. I will look into it.

Thanks,
David

Quoted 33 lines

jirka

---

tools/perf/builtin-report.c +5 -5
index 19a69ca0e9c9..abcf3aadca9e 100644
@@ -982,11 +982,6 @@ int cmd_report(int argc, const char **argv)
        if (report.header || report.header_only || report.show_threads)
                use_browser = 0;
 
-       if (strcmp(input_name, "-") != 0)
-               setup_browser(true);
-       else
-               use_browser = 0;
-
        ret = setup_sorting(session->evlist);
        if (ret < 0) {
                if (sort_order)
@@ -999,6 +994,11 @@ int cmd_report(int argc, const char **argv)
                goto error;
        }
 
+       if (strcmp(input_name, "-") != 0)
+               setup_browser(true);
+       else
+               use_browser = 0;
+
        if ((report.header || report.header_only) && !quiet) {
                perf_session__fprintf_info(session, stdout,
                                           report.show_full_info);
#14 lore raw

Re: [PATCH 4/6] perf report: hint .perfconfig error when invalid sorting key

Em Wed, Apr 12, 2017 at 09:34:37AM -0700, David Carrillo-Cisneros escreveu:

Quoted 8 lines
Quoted 8 lines · David Carrillo-Cisneros
Quoted 6 lines

My fat-fingering of sort keys in .perfconfig was a common cause of perf report silently terminating without apparent error.

This was because 1) error in setup_sorting in cmd_report was ignored and 2) no message was log in UI browser that would prevent UI from exit before user prompt. Fix both.

Quoted 8 lines
Quoted 5 lines

there's UI init ahead of this code.. I had to move it below your code to spot any error message

there's other errors further on.. perhaps we should move it even further ;-) or cancel the ui before the error is printed

Probably canceling ui on error is the more robust way to go. I will look into it.

So I'll wait for a v2 for this specific patch.

#15 lore raw

PATCH 5/6 perf tools: disable JVMTI if no ELF support available

In reply to David Carrillo-Cisneros

The build of JVMTI depends on LIBELF (-lelf). Make Makefile.conf check this dependendancy and notify user when not present.

---
 tools/perf/Makefile.config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +3 -1
index cfd6015229a2..279c303b2c22 100644
@@ -274,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)
@@ -283,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
@@ -291,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);
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#16 lore raw

Re: [PATCH 5/6] perf tools: disable JVMTI if no ELF support available

Quoted 21 lines · David Carrillo-Cisneros

The build of JVMTI depends on LIBELF (-lelf). Make Makefile.conf check this dependendancy and notify user when not present.

---
 tools/perf/Makefile.config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +1 -0
index cfd6015229a2..279c303b2c22 100644
@@ -274,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)

tools/perf/Makefile.config else · line 287

Quoted 5 lines
tools/perf/Makefile.config +1 -1
@@ -283,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);

nitpick ;-)

s/jvmti,/jvmti /

jirka

#17 lore raw

PATCH 5/6 perf tools: disable JVMTI if no ELF support available

The build of JVMTI depends on LIBELF (-lelf). Make Makefile.conf check this dependendancy and notify user when not present.

v2: Comma nitpicking.

---
 tools/perf/Makefile.config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +3 -1
index cfd6015229a2..279c303b2c22 100644
@@ -274,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)
@@ -283,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
@@ -291,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);
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#18 lore raw

Re: [PATCH 5/6] perf tools: disable JVMTI if no ELF support available

Quoted 4 lines · David Carrillo-Cisneros

The build of JVMTI depends on LIBELF (-lelf). Make Makefile.conf check this dependendancy and notify user when not present.

v2: Comma nitpicking.

I think Arnaldo would change that.. but thanks! ;-)

jirka

Quoted 38 lines
---
 tools/perf/Makefile.config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +3 -1
index cfd6015229a2..279c303b2c22 100644
@@ -274,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)
@@ -283,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
@@ -291,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);
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#19 lore raw

Re: [PATCH 5/6] perf tools: disable JVMTI if no ELF support available

Em Wed, Apr 12, 2017 at 07:33:22PM +0200, Jiri Olsa escreveu:

Quoted 7 lines · David Carrillo-Cisneros
Quoted 4 lines

The build of JVMTI depends on LIBELF (-lelf). Make Makefile.conf check this dependendancy and notify user when not present.

v2: Comma nitpicking.

I think Arnaldo would change that.. but thanks! ;-)

But its so great that you guys offloaded that nitpicking part from me... ;-)

Thanks, applied, together with Kim's Tested-by.

- Arnaldo

Quoted 40 lines

jirka

Quoted 38 lines
---
 tools/perf/Makefile.config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +3 -1
index cfd6015229a2..279c303b2c22 100644
@@ -274,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)
@@ -283,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
@@ -291,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);
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#20 lore raw

[tip:perf/core] perf tools: Disable JVMTI if no ELF support available

In reply to David Carrillo-Cisneros
perf tools: Disable JVMTI if no ELF support available
Commit-ID:  e5e992a7c184c2121adf37bdf292a516af81dbbb
Gitweb:     http://git.kernel.org/tip/e5e992a7c184c2121adf37bdf292a516af81dbbb
Author:     David Carrillo-Cisneros <[email protected]>
AuthorDate: Wed, 12 Apr 2017 10:07:45 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 13 Apr 2017 11:47:43 -0300

perf tools: Disable JVMTI if no ELF support available

The build of JVMTI depends on LIBELF (-lelf). Make Makefile.conf check this dependendancy and notify user when not present.

v2: Comma nitpicking.

---
 tools/perf/Makefile.config | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tools/perf/Makefile.config +3 -1
index cfd6015..8354d04 100644
@@ -274,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)
@@ -283,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
@@ -291,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);
Tested-by on v1 5/6
#21 lore raw

Re: [PATCH 5/6] perf tools: disable JVMTI if no ELF support available

In reply to David Carrillo-Cisneros
Quoted 5 lines · On Tue, 11 Apr 2017 23:49:18 -0700 David Carrillo-Cisneros…

The build of JVMTI depends on LIBELF (-lelf). Make Makefile.conf check this dependendancy and notify user when not present.

---

This fixes cross-building perf for arm64 on Ubuntu, as well as native. Before this patch this error:

LINK libperf-jvmti.so
/usr/lib/gcc-cross/aarch64-linux-gnu/6/../../../../aarch64-linux-gnu/bin/ld: cannot find -lelf
collect2: error: ld returned 1 exit status

was avoided with make NO_JVMTI=1.

So for this and the rest of the series, FWIW:

Thanks,

Kim

#22 lore raw

PATCH 6/6 Revert "perf tools: Fix include of linux/mman.h"

In reply to David Carrillo-Cisneros

In https://lkml.org/lkml/2017/2/2/16 I reported a build error that I believed was caused by wrong uapi includes. The synthom
was fixed by Arnaldo in:

commit 2f7db5557994 ("perf tools: Fix include of linux/mman.h")

but I was wrong attributing the problem to the uapi include. The root cause was that I was using ARCH=x86_64, hence using the wrong uapi include path. This explains why no one else ran into this build problem.

---
 tools/perf/util/event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/event.c +1 -1
index 76b9c6bc8369..1046a1a83f81 100644
@@ -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"
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#23 lore raw

[tip:perf/core] Revert "perf tools: Fix include of linux/mman.h"

Revert "perf tools: Fix include of linux/mman.h"
Commit-ID:  16eb81365b70266c17d1141ef9b32c3110b22d17
Gitweb:     http://git.kernel.org/tip/16eb81365b70266c17d1141ef9b32c3110b22d17
Author:     David Carrillo-Cisneros <[email protected]>
AuthorDate: Tue, 11 Apr 2017 23:49:19 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 13 Apr 2017 11:54:46 -0300

Revert "perf tools: Fix include of linux/mman.h"

In https://lkml.org/lkml/2017/2/2/16 I reported a build error that I believed was caused by wrong uapi includes. The synthom was fixed by Arnaldo in:

commit 2f7db5557994 ("perf tools: Fix include of linux/mman.h")

but I was wrong attributing the problem to the uapi include.

The root cause was that I was using ARCH=x86_64, hence using the wrong uapi include path. This explains why no one else ran into this build problem.

---
 tools/perf/util/event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/event.c +1 -1
index 8255a26..4d7e65f 100644
@@ -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"
Acked-by on the v1 series
#24 lore raw
In reply to David Carrillo-Cisneros
Quoted 9 lines · David Carrillo-Cisneros

Minor build fixes and error condition hints.

David Carrillo-Cisneros (6):
perf tools: pass PYTHON config to feature detection tools build: fix feature detection redefinion of build flags perf util: hint missing file when tool tips fail to load perf report: hint .perfconfig error when invalid sorting key perf tools: disable JVMTI if no ELF support available Revert "perf tools: Fix include of linux/mman.h"

apart from patch 4/6 for series:

thanks,
jirka