All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 00/20] perf/core improvements and fixes
@ 2013-12-13 15:11 Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 01/20] tools lib symbol: Start carving out symbol parsing routines from perf Arnaldo Carvalho de Melo
                   ` (20 more replies)
  0 siblings, 21 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andi Kleen, Borislav Petkov, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Ramkumar Ramachandra, Stephane Eranian,
	Steven Rostedt, Arnaldo Carvalho de Melo

From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>

Hi Ingo,

	Please consider pulling,

Regards,

- Arnaldo

The following changes since commit c7f2e3cd6c1f4932ccc4135d050eae3f7c7aef63:

  perf: Optimize ring-buffer write by depending on control dependencies (2013-12-11 15:53:22 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo

for you to fetch changes up to 41e12e580a7b0c151199f927193548b84d3e874c:

  tools lib traceevent: Refactor pevent_filter_match() to get rid of die() (2013-12-13 10:30:22 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

Fixes:

. Fix inverted error verification bug in thread__fork, from David Ahern.

New features:

. Shell completion for 'perf kvm', from Ramkumar Ramachandra.

Refactorings:

. Get rid of panic() like calls in libtraceevent, from Namyung Kim.

. Start carving out symbol parsing routines from perf, just moving routines to
  topic files in tools/lib/symbol/, tools that want to use it need to integrate
  it directly, i.e. no tools/lib/symbol/Makefile is provided.

. Assorted refactoring patches, moving code around and adding
  utility evlist methods that will be used in the IPT patchset,
  from Adrian Hunter.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (5):
      perf tools: Add perf_event_paranoid()
      perf header: Allow header->data_offset to be predetermined
      perf evlist: Add can_select_event() method
      perf tools: Move mem_bswap32/64 to util.c
      perf evlist: Add perf_evlist__to_front()

Arnaldo Carvalho de Melo (1):
      tools lib symbol: Start carving out symbol parsing routines from perf

David Ahern (1):
      perf tools: Fix inverted error verification bug in thread__fork

Namhyung Kim (12):
      tools lib traceevent: Get rid of malloc_or_die() in show_error()
      tools lib traceevent: Get rid of die in add_filter_type()
      tools lib traceevent: Get rid of malloc_or_die() allocate_arg()
      tools lib traceevent: Get rid of malloc_or_die() in read_token()
      tools lib traceevent: Get rid of malloc_or_die() in find_event()
      tools lib traceevent: Get rid of die() in add_right()
      tools lib traceevent: Make add_left() return pevent_errno
      tools lib traceevent: Get rid of die() in reparent_op_arg()
      tools lib traceevent: Refactor create_arg_item()
      tools lib traceevent: Refactor process_filter()
      tools lib traceevent: Make pevent_filter_add_filter_str() return pevent_errno
      tools lib traceevent: Refactor pevent_filter_match() to get rid of die()

Ramkumar Ramachandra (1):
      perf completion: Complete 'perf kvm'

 tools/lib/symbol/kallsyms.c         |  58 +++++
 tools/lib/symbol/kallsyms.h         |  24 ++
 tools/lib/traceevent/event-parse.h  |  43 ++-
 tools/lib/traceevent/parse-filter.c | 507 ++++++++++++++++++++++--------------
 tools/perf/MANIFEST                 |   2 +
 tools/perf/Makefile.perf            |   5 +
 tools/perf/perf-completion.sh       |   4 +
 tools/perf/util/event.c             |   1 +
 tools/perf/util/evlist.c            |  20 +-
 tools/perf/util/evlist.h            |   5 +
 tools/perf/util/header.c            |   3 +-
 tools/perf/util/machine.c           |   1 +
 tools/perf/util/record.c            |  37 +++
 tools/perf/util/session.c           |  21 --
 tools/perf/util/session.h           |   2 -
 tools/perf/util/symbol-elf.c        |   1 +
 tools/perf/util/symbol.c            |  69 +----
 tools/perf/util/symbol.h            |   3 -
 tools/perf/util/thread.c            |   2 +-
 tools/perf/util/util.c              |  41 +++
 tools/perf/util/util.h              |   4 +
 21 files changed, 550 insertions(+), 303 deletions(-)
 create mode 100644 tools/lib/symbol/kallsyms.c
 create mode 100644 tools/lib/symbol/kallsyms.h

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [PATCH 01/20] tools lib symbol: Start carving out symbol parsing routines from perf
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 02/20] perf tools: Add perf_event_paranoid() Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, David Ahern, Frederic Weisbecker, Jiri Olsa,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Eventually this should be useful to other tools/ living utilities.

For now don't try to build any .a, just trying the minimal approach of
separating existing code into multiple .c files that can then be
included wherever they are needed, using whatever build machinery
already in place.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-pfa8i5zpf4bf9rcccryi0lt3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/symbol/kallsyms.c  | 58 +++++++++++++++++++++++++++++++++++++
 tools/lib/symbol/kallsyms.h  | 24 +++++++++++++++
 tools/perf/MANIFEST          |  2 ++
 tools/perf/Makefile.perf     |  5 ++++
 tools/perf/util/event.c      |  1 +
 tools/perf/util/machine.c    |  1 +
 tools/perf/util/symbol-elf.c |  1 +
 tools/perf/util/symbol.c     | 69 +-------------------------------------------
 tools/perf/util/symbol.h     |  3 --
 9 files changed, 93 insertions(+), 71 deletions(-)
 create mode 100644 tools/lib/symbol/kallsyms.c
 create mode 100644 tools/lib/symbol/kallsyms.h

diff --git a/tools/lib/symbol/kallsyms.c b/tools/lib/symbol/kallsyms.c
new file mode 100644
index 000000000000..18bc271a4bbc
--- /dev/null
+++ b/tools/lib/symbol/kallsyms.c
@@ -0,0 +1,58 @@
+#include "symbol/kallsyms.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+int kallsyms__parse(const char *filename, void *arg,
+		    int (*process_symbol)(void *arg, const char *name,
+					  char type, u64 start))
+{
+	char *line = NULL;
+	size_t n;
+	int err = -1;
+	FILE *file = fopen(filename, "r");
+
+	if (file == NULL)
+		goto out_failure;
+
+	err = 0;
+
+	while (!feof(file)) {
+		u64 start;
+		int line_len, len;
+		char symbol_type;
+		char *symbol_name;
+
+		line_len = getline(&line, &n, file);
+		if (line_len < 0 || !line)
+			break;
+
+		line[--line_len] = '\0'; /* \n */
+
+		len = hex2u64(line, &start);
+
+		len++;
+		if (len + 2 >= line_len)
+			continue;
+
+		symbol_type = line[len];
+		len += 2;
+		symbol_name = line + len;
+		len = line_len - len;
+
+		if (len >= KSYM_NAME_LEN) {
+			err = -1;
+			break;
+		}
+
+		err = process_symbol(arg, symbol_name, symbol_type, start);
+		if (err)
+			break;
+	}
+
+	free(line);
+	fclose(file);
+	return err;
+
+out_failure:
+	return -1;
+}
diff --git a/tools/lib/symbol/kallsyms.h b/tools/lib/symbol/kallsyms.h
new file mode 100644
index 000000000000..6084f5e18b3c
--- /dev/null
+++ b/tools/lib/symbol/kallsyms.h
@@ -0,0 +1,24 @@
+#ifndef __TOOLS_KALLSYMS_H_
+#define __TOOLS_KALLSYMS_H_ 1
+
+#include <elf.h>
+#include <linux/ctype.h>
+#include <linux/types.h>
+
+#ifndef KSYM_NAME_LEN
+#define KSYM_NAME_LEN 256
+#endif
+
+static inline u8 kallsyms2elf_type(char type)
+{
+	if (type == 'W')
+		return STB_WEAK;
+
+	return isupper(type) ? STB_GLOBAL : STB_LOCAL;
+}
+
+int kallsyms__parse(const char *filename, void *arg,
+		    int (*process_symbol)(void *arg, const char *name,
+					  char type, u64 start));
+
+#endif /* __TOOLS_KALLSYMS_H_ */
diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 025de796067c..3170a7ff5782 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -2,6 +2,8 @@ tools/perf
 tools/scripts
 tools/lib/traceevent
 tools/lib/lk
+tools/lib/symbol/kallsyms.c
+tools/lib/symbol/kallsyms.h
 include/linux/const.h
 include/linux/perf_event.h
 include/linux/rbtree.h
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9a8cf376f874..fad61079e795 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -202,6 +202,7 @@ $(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
 
 LIB_FILE=$(OUTPUT)libperf.a
 
+LIB_H += ../lib/symbol/kallsyms.h
 LIB_H += ../../include/uapi/linux/perf_event.h
 LIB_H += ../../include/linux/rbtree.h
 LIB_H += ../../include/linux/list.h
@@ -312,6 +313,7 @@ LIB_OBJS += $(OUTPUT)util/evlist.o
 LIB_OBJS += $(OUTPUT)util/evsel.o
 LIB_OBJS += $(OUTPUT)util/exec_cmd.o
 LIB_OBJS += $(OUTPUT)util/help.o
+LIB_OBJS += $(OUTPUT)util/kallsyms.o
 LIB_OBJS += $(OUTPUT)util/levenshtein.o
 LIB_OBJS += $(OUTPUT)util/parse-options.o
 LIB_OBJS += $(OUTPUT)util/parse-events.o
@@ -672,6 +674,9 @@ $(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
 $(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
 
+$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c $(OUTPUT)PERF-CFLAGS
+	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
+
 $(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
 	$(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
 
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index c77814bf01e1..694876877ae2 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -7,6 +7,7 @@
 #include "strlist.h"
 #include "thread.h"
 #include "thread_map.h"
+#include "symbol/kallsyms.h"
 
 static const char *perf_event__names[] = {
 	[0]					= "TOTAL",
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 751454bcde69..c78cc84f433e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -9,6 +9,7 @@
 #include "strlist.h"
 #include "thread.h"
 #include <stdbool.h>
+#include <symbol/kallsyms.h>
 #include "unwind.h"
 
 int machine__init(struct machine *machine, const char *root_dir, pid_t pid)
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index eed0b96302af..bf0ce29567b6 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -6,6 +6,7 @@
 #include <inttypes.h>
 
 #include "symbol.h"
+#include <symbol/kallsyms.h>
 #include "debug.h"
 
 #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index e377c2e96191..61eb1cddf01a 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -18,12 +18,9 @@
 
 #include <elf.h>
 #include <limits.h>
+#include <symbol/kallsyms.h>
 #include <sys/utsname.h>
 
-#ifndef KSYM_NAME_LEN
-#define KSYM_NAME_LEN 256
-#endif
-
 static int dso__load_kernel_sym(struct dso *dso, struct map *map,
 				symbol_filter_t filter);
 static int dso__load_guest_kernel_sym(struct dso *dso, struct map *map,
@@ -446,62 +443,6 @@ size_t dso__fprintf_symbols_by_name(struct dso *dso,
 	return ret;
 }
 
-int kallsyms__parse(const char *filename, void *arg,
-		    int (*process_symbol)(void *arg, const char *name,
-					  char type, u64 start))
-{
-	char *line = NULL;
-	size_t n;
-	int err = -1;
-	FILE *file = fopen(filename, "r");
-
-	if (file == NULL)
-		goto out_failure;
-
-	err = 0;
-
-	while (!feof(file)) {
-		u64 start;
-		int line_len, len;
-		char symbol_type;
-		char *symbol_name;
-
-		line_len = getline(&line, &n, file);
-		if (line_len < 0 || !line)
-			break;
-
-		line[--line_len] = '\0'; /* \n */
-
-		len = hex2u64(line, &start);
-
-		len++;
-		if (len + 2 >= line_len)
-			continue;
-
-		symbol_type = line[len];
-		len += 2;
-		symbol_name = line + len;
-		len = line_len - len;
-
-		if (len >= KSYM_NAME_LEN) {
-			err = -1;
-			break;
-		}
-
-		err = process_symbol(arg, symbol_name,
-				     symbol_type, start);
-		if (err)
-			break;
-	}
-
-	free(line);
-	fclose(file);
-	return err;
-
-out_failure:
-	return -1;
-}
-
 int modules__parse(const char *filename, void *arg,
 		   int (*process_module)(void *arg, const char *name,
 					 u64 start))
@@ -565,14 +506,6 @@ struct process_kallsyms_args {
 	struct dso *dso;
 };
 
-static u8 kallsyms2elf_type(char type)
-{
-	if (type == 'W')
-		return STB_WEAK;
-
-	return isupper(type) ? STB_GLOBAL : STB_LOCAL;
-}
-
 bool symbol__is_idle(struct symbol *sym)
 {
 	const char * const idle_symbols[] = {
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 6de9c2b8a601..8a9d910c5345 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -221,9 +221,6 @@ struct symbol *dso__first_symbol(struct dso *dso, enum map_type type);
 
 int filename__read_build_id(const char *filename, void *bf, size_t size);
 int sysfs__read_build_id(const char *filename, void *bf, size_t size);
-int kallsyms__parse(const char *filename, void *arg,
-		    int (*process_symbol)(void *arg, const char *name,
-					  char type, u64 start));
 int modules__parse(const char *filename, void *arg,
 		   int (*process_module)(void *arg, const char *name,
 					 u64 start));
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 02/20] perf tools: Add perf_event_paranoid()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 01/20] tools lib symbol: Start carving out symbol parsing routines from perf Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 03/20] perf header: Allow header->data_offset to be predetermined Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, David Ahern,
	Frederic Weisbecker, Ingo Molnar, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Add a function to return the value of
/proc/sys/kernel/perf_event_paranoid.

This will be used to determine default values for mmap size because perf
is not subject to mmap limits when perf_event_paranoid is less than
zero.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386765443-26966-12-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c |  3 +--
 tools/perf/util/util.c   | 19 +++++++++++++++++++
 tools/perf/util/util.h   |  1 +
 3 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index af250556b33f..2eb7378e4c40 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1191,8 +1191,7 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist __maybe_unused,
 				    "Error:\t%s.\n"
 				    "Hint:\tCheck /proc/sys/kernel/perf_event_paranoid setting.", emsg);
 
-		if (filename__read_int("/proc/sys/kernel/perf_event_paranoid", &value))
-			break;
+		value = perf_event_paranoid();
 
 		printed += scnprintf(buf + printed, size - printed, "\nHint:\t");
 
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 4a57609c0b43..8f63dba212d7 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -1,5 +1,6 @@
 #include "../perf.h"
 #include "util.h"
+#include "fs.h"
 #include <sys/mman.h>
 #ifdef HAVE_BACKTRACE_SUPPORT
 #include <execinfo.h>
@@ -8,6 +9,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
+#include <limits.h>
 #include <linux/kernel.h>
 
 /*
@@ -496,3 +498,20 @@ const char *get_filename_for_perf_kvm(void)
 
 	return filename;
 }
+
+int perf_event_paranoid(void)
+{
+	char path[PATH_MAX];
+	const char *procfs = procfs__mountpoint();
+	int value;
+
+	if (!procfs)
+		return INT_MAX;
+
+	scnprintf(path, PATH_MAX, "%s/sys/kernel/perf_event_paranoid", procfs);
+
+	if (filename__read_int(path, &value))
+		return INT_MAX;
+
+	return value;
+}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 0171213d1d4d..1e7d4136cc82 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -321,6 +321,7 @@ void free_srcline(char *srcline);
 
 int filename__read_int(const char *filename, int *value);
 int filename__read_str(const char *filename, char **buf, size_t *sizep);
+int perf_event_paranoid(void);
 
 const char *get_filename_for_perf_kvm(void);
 #endif /* GIT_COMPAT_UTIL_H */
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 03/20] perf header: Allow header->data_offset to be predetermined
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 01/20] tools lib symbol: Start carving out symbol parsing routines from perf Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 02/20] perf tools: Add perf_event_paranoid() Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 04/20] perf evlist: Add can_select_event() method Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, David Ahern,
	Frederic Weisbecker, Ingo Molnar, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

It will be necessary to predetermine header->data_offset to allow space
for attributes that are added later.  Consequently, do not change
header->data_offset if it is non-zero.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386765443-26966-17-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/header.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 0bb830f6b49c..61c54213704b 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2327,7 +2327,8 @@ int perf_session__write_header(struct perf_session *session,
 		}
 	}
 
-	header->data_offset = lseek(fd, 0, SEEK_CUR);
+	if (!header->data_offset)
+		header->data_offset = lseek(fd, 0, SEEK_CUR);
 	header->feat_offset = header->data_offset + header->data_size;
 
 	if (at_exit) {
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 04/20] perf evlist: Add can_select_event() method
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 03/20] perf header: Allow header->data_offset to be predetermined Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 05/20] perf tools: Move mem_bswap32/64 to util.c Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, David Ahern,
	Frederic Weisbecker, Ingo Molnar, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Add a function to determine whether an event can be selected.

This function is needed to allow a tool to automatically select
additional events, but only if they are available.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386765443-26966-18-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.h |  2 ++
 tools/perf/util/record.c | 37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 649d6ea98a84..8a04aae95a18 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -193,4 +193,6 @@ static inline void perf_mmap__write_tail(struct perf_mmap *md,
 	pc->data_tail = tail;
 }
 
+bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str);
+
 #endif /* __PERF_EVLIST_H */
diff --git a/tools/perf/util/record.c b/tools/perf/util/record.c
index c8845b107f60..e5104538c354 100644
--- a/tools/perf/util/record.c
+++ b/tools/perf/util/record.c
@@ -177,3 +177,40 @@ int perf_record_opts__config(struct perf_record_opts *opts)
 {
 	return perf_record_opts__config_freq(opts);
 }
+
+bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str)
+{
+	struct perf_evlist *temp_evlist;
+	struct perf_evsel *evsel;
+	int err, fd, cpu;
+	bool ret = false;
+
+	temp_evlist = perf_evlist__new();
+	if (!temp_evlist)
+		return false;
+
+	err = parse_events(temp_evlist, str);
+	if (err)
+		goto out_delete;
+
+	evsel = perf_evlist__last(temp_evlist);
+
+	if (!evlist || cpu_map__empty(evlist->cpus)) {
+		struct cpu_map *cpus = cpu_map__new(NULL);
+
+		cpu =  cpus ? cpus->map[0] : 0;
+		cpu_map__delete(cpus);
+	} else {
+		cpu = evlist->cpus->map[0];
+	}
+
+	fd = sys_perf_event_open(&evsel->attr, -1, cpu, -1, 0);
+	if (fd >= 0) {
+		close(fd);
+		ret = true;
+	}
+
+out_delete:
+	perf_evlist__delete(temp_evlist);
+	return ret;
+}
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 05/20] perf tools: Move mem_bswap32/64 to util.c
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 04/20] perf evlist: Add can_select_event() method Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 06/20] perf tools: Fix inverted error verification bug in thread__fork Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, David Ahern,
	Frederic Weisbecker, Ingo Molnar, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Move functions mem_bswap_32() and mem_bswap_64() so they can be reused.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386765443-26966-21-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c | 21 ---------------------
 tools/perf/util/session.h |  2 --
 tools/perf/util/util.c    | 22 ++++++++++++++++++++++
 tools/perf/util/util.h    |  3 +++
 4 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index e748f29c53cf..989b2e377626 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -247,27 +247,6 @@ void perf_tool__fill_defaults(struct perf_tool *tool)
 	}
 }
  
-void mem_bswap_32(void *src, int byte_size)
-{
-	u32 *m = src;
-	while (byte_size > 0) {
-		*m = bswap_32(*m);
-		byte_size -= sizeof(u32);
-		++m;
-	}
-}
-
-void mem_bswap_64(void *src, int byte_size)
-{
-	u64 *m = src;
-
-	while (byte_size > 0) {
-		*m = bswap_64(*m);
-		byte_size -= sizeof(u64);
-		++m;
-	}
-}
-
 static void swap_sample_id_all(union perf_event *event, void *data)
 {
 	void *end = (void *) event + event->header.size;
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 2a3955ea4fd8..9c25d49900af 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -74,8 +74,6 @@ int perf_session__resolve_callchain(struct perf_session *session,
 
 bool perf_session__has_traces(struct perf_session *session, const char *msg);
 
-void mem_bswap_64(void *src, int byte_size);
-void mem_bswap_32(void *src, int byte_size);
 void perf_event__attr_swap(struct perf_event_attr *attr);
 
 int perf_session__create_kernel_maps(struct perf_session *session);
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 8f63dba212d7..42ad667bb317 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -10,6 +10,7 @@
 #include <string.h>
 #include <errno.h>
 #include <limits.h>
+#include <byteswap.h>
 #include <linux/kernel.h>
 
 /*
@@ -515,3 +516,24 @@ int perf_event_paranoid(void)
 
 	return value;
 }
+
+void mem_bswap_32(void *src, int byte_size)
+{
+	u32 *m = src;
+	while (byte_size > 0) {
+		*m = bswap_32(*m);
+		byte_size -= sizeof(u32);
+		++m;
+	}
+}
+
+void mem_bswap_64(void *src, int byte_size)
+{
+	u64 *m = src;
+
+	while (byte_size > 0) {
+		*m = bswap_64(*m);
+		byte_size -= sizeof(u64);
+		++m;
+	}
+}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 1e7d4136cc82..a1eea3e809a3 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -323,5 +323,8 @@ int filename__read_int(const char *filename, int *value);
 int filename__read_str(const char *filename, char **buf, size_t *sizep);
 int perf_event_paranoid(void);
 
+void mem_bswap_64(void *src, int byte_size);
+void mem_bswap_32(void *src, int byte_size);
+
 const char *get_filename_for_perf_kvm(void);
 #endif /* GIT_COMPAT_UTIL_H */
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 06/20] perf tools: Fix inverted error verification bug in thread__fork
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 05/20] perf tools: Move mem_bswap32/64 to util.c Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 07/20] perf evlist: Add perf_evlist__to_front() Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, David Ahern, Frederic Weisbecker, Arnaldo Carvalho de Melo

From: David Ahern <dsahern@gmail.com>

Commit 1902efe7f for the new comm infra added the wrong check for return
code on thread__set_comm. err == 0 is normal, so don't return at that
point unless err != 0.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Link: http://lkml.kernel.org/r/1386736538-23525-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c
index 49eaf1d7d89d..e3948612543e 100644
--- a/tools/perf/util/thread.c
+++ b/tools/perf/util/thread.c
@@ -126,7 +126,7 @@ int thread__fork(struct thread *thread, struct thread *parent, u64 timestamp)
 		if (!comm)
 			return -ENOMEM;
 		err = thread__set_comm(thread, comm, timestamp);
-		if (!err)
+		if (err)
 			return err;
 		thread->comm_set = true;
 	}
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 07/20] perf evlist: Add perf_evlist__to_front()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 06/20] perf tools: Fix inverted error verification bug in thread__fork Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 08/20] perf completion: Complete 'perf kvm' Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, David Ahern,
	Frederic Weisbecker, Ingo Molnar, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Paul Mackerras, Peter Zijlstra, Stephane Eranian,
	Arnaldo Carvalho de Melo

From: Adrian Hunter <adrian.hunter@intel.com>

Add a function to move a selected event to the
front of the list.

This is needed because it is not possible
to use the PERF_EVENT_IOC_SET_OUTPUT IOCTL
from an Instruction Tracing event to a
non-Instruction Tracing event.  Thus the
Instruction Tracing event must come first.

Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1386765443-26966-24-git-send-email-alexander.shishkin@linux.intel.com
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 17 +++++++++++++++++
 tools/perf/util/evlist.h |  3 +++
 2 files changed, 20 insertions(+)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 2eb7378e4c40..0b31cee34874 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1212,3 +1212,20 @@ int perf_evlist__strerror_open(struct perf_evlist *evlist __maybe_unused,
 
 	return 0;
 }
+
+void perf_evlist__to_front(struct perf_evlist *evlist,
+			   struct perf_evsel *move_evsel)
+{
+	struct perf_evsel *evsel, *n;
+	LIST_HEAD(move);
+
+	if (move_evsel == perf_evlist__first(evlist))
+		return;
+
+	list_for_each_entry_safe(evsel, n, &evlist->entries, node) {
+		if (evsel->leader == move_evsel->leader)
+			list_move_tail(&evsel->node, &move);
+	}
+
+	list_splice(&move, &evlist->entries);
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 8a04aae95a18..9f64ede3ecbd 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -194,5 +194,8 @@ static inline void perf_mmap__write_tail(struct perf_mmap *md,
 }
 
 bool perf_evlist__can_select_event(struct perf_evlist *evlist, const char *str);
+void perf_evlist__to_front(struct perf_evlist *evlist,
+			   struct perf_evsel *move_evsel);
+
 
 #endif /* __PERF_EVLIST_H */
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 08/20] perf completion: Complete 'perf kvm'
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 07/20] perf evlist: Add perf_evlist__to_front() Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 09/20] tools lib traceevent: Get rid of malloc_or_die() in show_error() Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Ramkumar Ramachandra, Arnaldo Carvalho de Melo

From: Ramkumar Ramachandra <artagnon@gmail.com>

Currently, there is no way to enumerate the subcommands under 'perf
kvm', so hardcode them.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Link: http://lkml.kernel.org/r/1386758056-24618-2-git-send-email-artagnon@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf-completion.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 49494882d9bb..496e2abb5482 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -121,6 +121,10 @@ __perf_main ()
 	elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
 		evts=$($cmd list --raw-dump)
 		__perfcomp_colon "$evts" "$cur"
+	# List subcommands for 'perf kvm'
+	elif [[ $prev == "kvm" ]]; then
+		subcmds="top record report diff buildid-list stat"
+		__perfcomp_colon "$subcmds" "$cur"
 	# List long option names
 	elif [[ $cur == --* ]];  then
 		subcmd=${words[1]}
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 09/20] tools lib traceevent: Get rid of malloc_or_die() in show_error()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 08/20] perf completion: Complete 'perf kvm' Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 10/20] tools lib traceevent: Get rid of die in add_filter_type() Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/parse-filter.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index ab402fb2dcf7..d4b0bac80dc8 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -56,7 +56,21 @@ static void show_error(char **error_str, const char *fmt, ...)
 	index = pevent_get_input_buf_ptr();
 	len = input ? strlen(input) : 0;
 
-	error = malloc_or_die(MAX_ERR_STR_SIZE + (len*2) + 3);
+	error = malloc(MAX_ERR_STR_SIZE + (len*2) + 3);
+	if (error == NULL) {
+		/*
+		 * Maybe it's due to len is too long.
+		 * Retry without the input buffer part.
+		 */
+		len = 0;
+
+		error = malloc(MAX_ERR_STR_SIZE);
+		if (error == NULL) {
+			/* no memory */
+			*error_str = NULL;
+			return;
+		}
+	}
 
 	if (len) {
 		strcpy(error, input);
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 10/20] tools lib traceevent: Get rid of die in add_filter_type()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 09/20] tools lib traceevent: Get rid of malloc_or_die() in show_error() Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 11/20] tools lib traceevent: Get rid of malloc_or_die() allocate_arg() Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

The realloc() should check return value and not to overwrite previous
pointer in case of error.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-3-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/parse-filter.c | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index d4b0bac80dc8..767de4f1e8ee 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -161,11 +161,13 @@ add_filter_type(struct event_filter *filter, int id)
 	if (filter_type)
 		return filter_type;
 
-	filter->event_filters =	realloc(filter->event_filters,
-					sizeof(*filter->event_filters) *
-					(filter->filters + 1));
-	if (!filter->event_filters)
-		die("Could not allocate filter");
+	filter_type = realloc(filter->event_filters,
+			      sizeof(*filter->event_filters) *
+			      (filter->filters + 1));
+	if (!filter_type)
+		return NULL;
+
+	filter->event_filters = filter_type;
 
 	for (i = 0; i < filter->filters; i++) {
 		if (filter->event_filters[i].event_id > id)
@@ -1180,6 +1182,12 @@ static int filter_event(struct event_filter *filter,
 	}
 
 	filter_type = add_filter_type(filter, event->id);
+	if (filter_type == NULL) {
+		show_error(error_str, "failed to add a new filter: %s",
+			   filter_str ? filter_str : "true");
+		return -1;
+	}
+
 	if (filter_type->filter)
 		free_arg(filter_type->filter);
 	filter_type->filter = arg;
@@ -1417,6 +1425,9 @@ static int copy_filter_type(struct event_filter *filter,
 			arg->boolean.value = 0;
 
 		filter_type = add_filter_type(filter, event->id);
+		if (filter_type == NULL)
+			return -1;
+
 		filter_type->filter = arg;
 
 		free(str);
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 11/20] tools lib traceevent: Get rid of malloc_or_die() allocate_arg()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 10/20] tools lib traceevent: Get rid of die in add_filter_type() Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 12/20] tools lib traceevent: Get rid of malloc_or_die() in read_token() Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Also check return value and handle it.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-4-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/parse-filter.c | 48 ++++++++++++++++++++++++++++++-------
 1 file changed, 40 insertions(+), 8 deletions(-)

diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 767de4f1e8ee..ab9cefe320b4 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -211,12 +211,7 @@ struct event_filter *pevent_filter_alloc(struct pevent *pevent)
 
 static struct filter_arg *allocate_arg(void)
 {
-	struct filter_arg *arg;
-
-	arg = malloc_or_die(sizeof(*arg));
-	memset(arg, 0, sizeof(*arg));
-
-	return arg;
+	return calloc(1, sizeof(struct filter_arg));
 }
 
 static void free_arg(struct filter_arg *arg)
@@ -369,6 +364,10 @@ create_arg_item(struct event_format *event, const char *token,
 	struct filter_arg *arg;
 
 	arg = allocate_arg();
+	if (arg == NULL) {
+		show_error(error_str, "failed to allocate filter arg");
+		return NULL;
+	}
 
 	switch (type) {
 
@@ -422,6 +421,9 @@ create_arg_op(enum filter_op_type btype)
 	struct filter_arg *arg;
 
 	arg = allocate_arg();
+	if (!arg)
+		return NULL;
+
 	arg->type = FILTER_ARG_OP;
 	arg->op.type = btype;
 
@@ -434,6 +436,9 @@ create_arg_exp(enum filter_exp_type etype)
 	struct filter_arg *arg;
 
 	arg = allocate_arg();
+	if (!arg)
+		return NULL;
+
 	arg->type = FILTER_ARG_EXP;
 	arg->op.type = etype;
 
@@ -446,6 +451,9 @@ create_arg_cmp(enum filter_exp_type etype)
 	struct filter_arg *arg;
 
 	arg = allocate_arg();
+	if (!arg)
+		return NULL;
+
 	/* Use NUM and change if necessary */
 	arg->type = FILTER_ARG_NUM;
 	arg->op.type = etype;
@@ -909,8 +917,10 @@ static struct filter_arg *collapse_tree(struct filter_arg *arg)
 	case FILTER_VAL_FALSE:
 		free_arg(arg);
 		arg = allocate_arg();
-		arg->type = FILTER_ARG_BOOLEAN;
-		arg->boolean.value = ret == FILTER_VAL_TRUE;
+		if (arg) {
+			arg->type = FILTER_ARG_BOOLEAN;
+			arg->boolean.value = ret == FILTER_VAL_TRUE;
+		}
 	}
 
 	return arg;
@@ -1057,6 +1067,8 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 			switch (op_type) {
 			case OP_BOOL:
 				arg = create_arg_op(btype);
+				if (arg == NULL)
+					goto fail_alloc;
 				if (current_op)
 					ret = add_left(arg, current_op);
 				else
@@ -1067,6 +1079,8 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 
 			case OP_NOT:
 				arg = create_arg_op(btype);
+				if (arg == NULL)
+					goto fail_alloc;
 				if (current_op)
 					ret = add_right(current_op, arg, error_str);
 				if (ret < 0)
@@ -1086,6 +1100,8 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 					arg = create_arg_exp(etype);
 				else
 					arg = create_arg_cmp(ctype);
+				if (arg == NULL)
+					goto fail_alloc;
 
 				if (current_op)
 					ret = add_right(current_op, arg, error_str);
@@ -1119,11 +1135,16 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 		current_op = current_exp;
 
 	current_op = collapse_tree(current_op);
+	if (current_op == NULL)
+		goto fail_alloc;
 
 	*parg = current_op;
 
 	return 0;
 
+ fail_alloc:
+	show_error(error_str, "failed to allocate filter arg");
+	goto fail;
  fail_print:
 	show_error(error_str, "Syntax error");
  fail:
@@ -1154,6 +1175,10 @@ process_event(struct event_format *event, const char *filter_str,
 	/* If parg is NULL, then make it into FALSE */
 	if (!*parg) {
 		*parg = allocate_arg();
+		if (*parg == NULL) {
+			show_error(error_str, "failed to allocate filter arg");
+			return -1;
+		}
 		(*parg)->type = FILTER_ARG_BOOLEAN;
 		(*parg)->boolean.value = FILTER_FALSE;
 	}
@@ -1177,6 +1202,10 @@ static int filter_event(struct event_filter *filter,
 	} else {
 		/* just add a TRUE arg */
 		arg = allocate_arg();
+		if (arg == NULL) {
+			show_error(error_str, "failed to allocate filter arg");
+			return -1;
+		}
 		arg->type = FILTER_ARG_BOOLEAN;
 		arg->boolean.value = FILTER_TRUE;
 	}
@@ -1418,6 +1447,9 @@ static int copy_filter_type(struct event_filter *filter,
 	if (strcmp(str, "TRUE") == 0 || strcmp(str, "FALSE") == 0) {
 		/* Add trivial event */
 		arg = allocate_arg();
+		if (arg == NULL)
+			return -1;
+
 		arg->type = FILTER_ARG_BOOLEAN;
 		if (strcmp(str, "TRUE") == 0)
 			arg->boolean.value = 1;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 12/20] tools lib traceevent: Get rid of malloc_or_die() in read_token()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 11/20] tools lib traceevent: Get rid of malloc_or_die() allocate_arg() Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:11 ` [PATCH 13/20] tools lib traceevent: Get rid of malloc_or_die() in find_event() Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-5-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/parse-filter.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index ab9cefe320b4..246ee81e1f93 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -109,7 +109,11 @@ static enum event_type read_token(char **tok)
 	    (strcmp(token, "=") == 0 || strcmp(token, "!") == 0) &&
 	    pevent_peek_char() == '~') {
 		/* append it */
-		*tok = malloc_or_die(3);
+		*tok = malloc(3);
+		if (*tok == NULL) {
+			free_token(token);
+			return EVENT_ERROR;
+		}
 		sprintf(*tok, "%c%c", *token, '~');
 		free_token(token);
 		/* Now remove the '~' from the buffer */
@@ -1123,6 +1127,8 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 			break;
 		case EVENT_NONE:
 			break;
+		case EVENT_ERROR:
+			goto fail_alloc;
 		default:
 			goto fail_print;
 		}
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 13/20] tools lib traceevent: Get rid of malloc_or_die() in find_event()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 12/20] tools lib traceevent: Get rid of malloc_or_die() in read_token() Arnaldo Carvalho de Melo
@ 2013-12-13 15:11 ` Arnaldo Carvalho de Melo
  2013-12-13 15:12 ` [PATCH 14/20] tools lib traceevent: Get rid of die() in add_right() Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:11 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Make it return pevent_errno to distinguish malloc allocation failure.
Since it'll be returned to user later, add more error code.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-6-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.h  |  4 +++-
 tools/lib/traceevent/parse-filter.c | 27 +++++++++++++++++++--------
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 6e23f197175f..abdfd3c606ed 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -356,7 +356,9 @@ enum pevent_flag {
 	_PE(READ_FORMAT_FAILED,	"failed to read event format"),		      \
 	_PE(READ_PRINT_FAILED,	"failed to read event print fmt"), 	      \
 	_PE(OLD_FTRACE_ARG_FAILED,"failed to allocate field name for ftrace"),\
-	_PE(INVALID_ARG_TYPE,	"invalid argument type")
+	_PE(INVALID_ARG_TYPE,	"invalid argument type"),		      \
+	_PE(INVALID_EVENT_NAME,	"invalid event name"),			      \
+	_PE(EVENT_NOT_FOUND,	"No event found")
 
 #undef _PE
 #define _PE(__code, __str) PEVENT_ERRNO__ ## __code
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 246ee81e1f93..a0ab040e8f71 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -287,7 +287,7 @@ static int event_match(struct event_format *event,
 		!regexec(ereg, event->name, 0, NULL, 0);
 }
 
-static int
+static enum pevent_errno
 find_event(struct pevent *pevent, struct event_list **events,
 	   char *sys_name, char *event_name)
 {
@@ -306,23 +306,31 @@ find_event(struct pevent *pevent, struct event_list **events,
 		sys_name = NULL;
 	}
 
-	reg = malloc_or_die(strlen(event_name) + 3);
+	reg = malloc(strlen(event_name) + 3);
+	if (reg == NULL)
+		return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+
 	sprintf(reg, "^%s$", event_name);
 
 	ret = regcomp(&ereg, reg, REG_ICASE|REG_NOSUB);
 	free(reg);
 
 	if (ret)
-		return -1;
+		return PEVENT_ERRNO__INVALID_EVENT_NAME;
 
 	if (sys_name) {
-		reg = malloc_or_die(strlen(sys_name) + 3);
+		reg = malloc(strlen(sys_name) + 3);
+		if (reg == NULL) {
+			regfree(&ereg);
+			return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+		}
+
 		sprintf(reg, "^%s$", sys_name);
 		ret = regcomp(&sreg, reg, REG_ICASE|REG_NOSUB);
 		free(reg);
 		if (ret) {
 			regfree(&ereg);
-			return -1;
+			return PEVENT_ERRNO__INVALID_EVENT_NAME;
 		}
 	}
 
@@ -342,9 +350,9 @@ find_event(struct pevent *pevent, struct event_list **events,
 		regfree(&sreg);
 
 	if (!match)
-		return -1;
+		return PEVENT_ERRNO__EVENT_NOT_FOUND;
 	if (fail)
-		return -2;
+		return PEVENT_ERRNO__MEM_ALLOC_FAILED;
 
 	return 0;
 }
@@ -1312,7 +1320,10 @@ int pevent_filter_add_filter_str(struct event_filter *filter,
 		/* Find this event */
 		ret = find_event(pevent, &events, strim(sys_name), strim(event_name));
 		if (ret < 0) {
-			if (event_name)
+			if (ret == PEVENT_ERRNO__MEM_ALLOC_FAILED)
+				show_error(error_str,
+					   "Memory allocation failure");
+			else if (event_name)
 				show_error(error_str,
 					   "No event found under '%s.%s'",
 					   sys_name, event_name);
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 14/20] tools lib traceevent: Get rid of die() in add_right()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2013-12-13 15:11 ` [PATCH 13/20] tools lib traceevent: Get rid of malloc_or_die() in find_event() Arnaldo Carvalho de Melo
@ 2013-12-13 15:12 ` Arnaldo Carvalho de Melo
  2013-12-13 15:12 ` [PATCH 15/20] tools lib traceevent: Make add_left() return pevent_errno Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

Refactor it to return appropriate pevent_errno value.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-7-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.h  |  8 +++++++-
 tools/lib/traceevent/parse-filter.c | 34 +++++++++++++++++++---------------
 2 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index abdfd3c606ed..89e4dfd40db6 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -358,7 +358,13 @@ enum pevent_flag {
 	_PE(OLD_FTRACE_ARG_FAILED,"failed to allocate field name for ftrace"),\
 	_PE(INVALID_ARG_TYPE,	"invalid argument type"),		      \
 	_PE(INVALID_EVENT_NAME,	"invalid event name"),			      \
-	_PE(EVENT_NOT_FOUND,	"No event found")
+	_PE(EVENT_NOT_FOUND,	"no event found"),			      \
+	_PE(SYNTAX_ERROR,	"syntax error"),			      \
+	_PE(ILLEGAL_RVALUE,	"illegal rvalue"),			      \
+	_PE(ILLEGAL_LVALUE,	"illegal lvalue for string comparison"),      \
+	_PE(INVALID_REGEX,	"regex did not compute"),		      \
+	_PE(ILLEGAL_STRING_CMP,	"illegal comparison for string"), 	      \
+	_PE(ILLEGAL_INTEGER_CMP,"illegal comparison for integer")
 
 #undef _PE
 #define _PE(__code, __str) PEVENT_ERRNO__ ## __code
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index a0ab040e8f71..c08ce594cabe 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -473,8 +473,8 @@ create_arg_cmp(enum filter_exp_type etype)
 	return arg;
 }
 
-static int add_right(struct filter_arg *op, struct filter_arg *arg,
-		     char **error_str)
+static enum pevent_errno
+add_right(struct filter_arg *op, struct filter_arg *arg, char **error_str)
 {
 	struct filter_arg *left;
 	char *str;
@@ -505,9 +505,8 @@ static int add_right(struct filter_arg *op, struct filter_arg *arg,
 		case FILTER_ARG_FIELD:
 			break;
 		default:
-			show_error(error_str,
-				   "Illegal rvalue");
-			return -1;
+			show_error(error_str, "Illegal rvalue");
+			return PEVENT_ERRNO__ILLEGAL_RVALUE;
 		}
 
 		/*
@@ -554,7 +553,7 @@ static int add_right(struct filter_arg *op, struct filter_arg *arg,
 			if (left->type != FILTER_ARG_FIELD) {
 				show_error(error_str,
 					   "Illegal lvalue for string comparison");
-				return -1;
+				return PEVENT_ERRNO__ILLEGAL_LVALUE;
 			}
 
 			/* Make sure this is a valid string compare */
@@ -573,25 +572,31 @@ static int add_right(struct filter_arg *op, struct filter_arg *arg,
 					show_error(error_str,
 						   "RegEx '%s' did not compute",
 						   str);
-					return -1;
+					return PEVENT_ERRNO__INVALID_REGEX;
 				}
 				break;
 			default:
 				show_error(error_str,
 					   "Illegal comparison for string");
-				return -1;
+				return PEVENT_ERRNO__ILLEGAL_STRING_CMP;
 			}
 
 			op->type = FILTER_ARG_STR;
 			op->str.type = op_type;
 			op->str.field = left->field.field;
 			op->str.val = strdup(str);
-			if (!op->str.val)
-				die("malloc string");
+			if (!op->str.val) {
+				show_error(error_str, "Failed to allocate string filter");
+				return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+			}
 			/*
 			 * Need a buffer to copy data for tests
 			 */
-			op->str.buffer = malloc_or_die(op->str.field->size + 1);
+			op->str.buffer = malloc(op->str.field->size + 1);
+			if (!op->str.buffer) {
+				show_error(error_str, "Failed to allocate string filter");
+				return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+			}
 			/* Null terminate this buffer */
 			op->str.buffer[op->str.field->size] = 0;
 
@@ -609,7 +614,7 @@ static int add_right(struct filter_arg *op, struct filter_arg *arg,
 			case FILTER_CMP_NOT_REGEX:
 				show_error(error_str,
 					   "Op not allowed with integers");
-				return -1;
+				return PEVENT_ERRNO__ILLEGAL_INTEGER_CMP;
 
 			default:
 				break;
@@ -629,9 +634,8 @@ static int add_right(struct filter_arg *op, struct filter_arg *arg,
 	return 0;
 
  out_fail:
-	show_error(error_str,
-		   "Syntax error");
-	return -1;
+	show_error(error_str, "Syntax error");
+	return PEVENT_ERRNO__SYNTAX_ERROR;
 }
 
 static struct filter_arg *
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 15/20] tools lib traceevent: Make add_left() return pevent_errno
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2013-12-13 15:12 ` [PATCH 14/20] tools lib traceevent: Get rid of die() in add_right() Arnaldo Carvalho de Melo
@ 2013-12-13 15:12 ` Arnaldo Carvalho de Melo
  2013-12-13 15:12 ` [PATCH 16/20] tools lib traceevent: Get rid of die() in reparent_op_arg() Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Frederic Weisbecker,
	Jiri Olsa, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung.kim@lge.com>

So that it can propagate error properly.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-8-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/parse-filter.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index c08ce594cabe..774c3e4c1d9f 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -648,7 +648,7 @@ rotate_op_right(struct filter_arg *a, struct filter_arg *b)
 	return arg;
 }
 
-static int add_left(struct filter_arg *op, struct filter_arg *arg)
+static enum pevent_errno add_left(struct filter_arg *op, struct filter_arg *arg)
 {
 	switch (op->type) {
 	case FILTER_ARG_EXP:
@@ -667,11 +667,11 @@ static int add_left(struct filter_arg *op, struct filter_arg *arg)
 		/* left arg of compares must be a field */
 		if (arg->type != FILTER_ARG_FIELD &&
 		    arg->type != FILTER_ARG_BOOLEAN)
-			return -1;
+			return PEVENT_ERRNO__INVALID_ARG_TYPE;
 		op->num.left = arg;
 		break;
 	default:
-		return -1;
+		return PEVENT_ERRNO__INVALID_ARG_TYPE;
 	}
 	return 0;
 }
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 16/20] tools lib traceevent: Get rid of die() in reparent_op_arg()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2013-12-13 15:12 ` [PATCH 15/20] tools lib traceevent: Make add_left() return pevent_errno Arnaldo Carvalho de Melo
@ 2013-12-13 15:12 ` Arnaldo Carvalho de Melo
  2013-12-13 15:12 ` [PATCH 17/20] tools lib traceevent: Refactor create_arg_item() Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

To do that, make the function returns the error code.  Also pass
error_str so that it can set proper error message when error occurred.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-9-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.h  |  5 +-
 tools/lib/traceevent/parse-filter.c | 94 +++++++++++++++++++++++--------------
 2 files changed, 64 insertions(+), 35 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 89e4dfd40db6..5e4392d8e2d4 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -364,7 +364,10 @@ enum pevent_flag {
 	_PE(ILLEGAL_LVALUE,	"illegal lvalue for string comparison"),      \
 	_PE(INVALID_REGEX,	"regex did not compute"),		      \
 	_PE(ILLEGAL_STRING_CMP,	"illegal comparison for string"), 	      \
-	_PE(ILLEGAL_INTEGER_CMP,"illegal comparison for integer")
+	_PE(ILLEGAL_INTEGER_CMP,"illegal comparison for integer"), 	      \
+	_PE(REPARENT_NOT_OP,	"cannot reparent other than OP"),	      \
+	_PE(REPARENT_FAILED,	"failed to reparent filter OP"),	      \
+	_PE(BAD_FILTER_ARG,	"bad arg in filter tree")
 
 #undef _PE
 #define _PE(__code, __str) PEVENT_ERRNO__ ## __code
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 774c3e4c1d9f..9b05892566e0 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -784,15 +784,18 @@ enum filter_vals {
 	FILTER_VAL_TRUE,
 };
 
-void reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
-		  struct filter_arg *arg)
+static enum pevent_errno
+reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
+		struct filter_arg *arg, char **error_str)
 {
 	struct filter_arg *other_child;
 	struct filter_arg **ptr;
 
 	if (parent->type != FILTER_ARG_OP &&
-	    arg->type != FILTER_ARG_OP)
-		die("can not reparent other than OP");
+	    arg->type != FILTER_ARG_OP) {
+		show_error(error_str, "can not reparent other than OP");
+		return PEVENT_ERRNO__REPARENT_NOT_OP;
+	}
 
 	/* Get the sibling */
 	if (old_child->op.right == arg) {
@@ -801,8 +804,10 @@ void reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
 	} else if (old_child->op.left == arg) {
 		ptr = &old_child->op.left;
 		other_child = old_child->op.right;
-	} else
-		die("Error in reparent op, find other child");
+	} else {
+		show_error(error_str, "Error in reparent op, find other child");
+		return PEVENT_ERRNO__REPARENT_FAILED;
+	}
 
 	/* Detach arg from old_child */
 	*ptr = NULL;
@@ -813,23 +818,29 @@ void reparent_op_arg(struct filter_arg *parent, struct filter_arg *old_child,
 		*parent = *arg;
 		/* Free arg without recussion */
 		free(arg);
-		return;
+		return 0;
 	}
 
 	if (parent->op.right == old_child)
 		ptr = &parent->op.right;
 	else if (parent->op.left == old_child)
 		ptr = &parent->op.left;
-	else
-		die("Error in reparent op");
+	else {
+		show_error(error_str, "Error in reparent op");
+		return PEVENT_ERRNO__REPARENT_FAILED;
+	}
+
 	*ptr = arg;
 
 	free_arg(old_child);
+	return 0;
 }
 
-enum filter_vals test_arg(struct filter_arg *parent, struct filter_arg *arg)
+/* Returns either filter_vals (success) or pevent_errno (failfure) */
+static int test_arg(struct filter_arg *parent, struct filter_arg *arg,
+		    char **error_str)
 {
-	enum filter_vals lval, rval;
+	int lval, rval;
 
 	switch (arg->type) {
 
@@ -844,63 +855,68 @@ enum filter_vals test_arg(struct filter_arg *parent, struct filter_arg *arg)
 		return FILTER_VAL_NORM;
 
 	case FILTER_ARG_EXP:
-		lval = test_arg(arg, arg->exp.left);
+		lval = test_arg(arg, arg->exp.left, error_str);
 		if (lval != FILTER_VAL_NORM)
 			return lval;
-		rval = test_arg(arg, arg->exp.right);
+		rval = test_arg(arg, arg->exp.right, error_str);
 		if (rval != FILTER_VAL_NORM)
 			return rval;
 		return FILTER_VAL_NORM;
 
 	case FILTER_ARG_NUM:
-		lval = test_arg(arg, arg->num.left);
+		lval = test_arg(arg, arg->num.left, error_str);
 		if (lval != FILTER_VAL_NORM)
 			return lval;
-		rval = test_arg(arg, arg->num.right);
+		rval = test_arg(arg, arg->num.right, error_str);
 		if (rval != FILTER_VAL_NORM)
 			return rval;
 		return FILTER_VAL_NORM;
 
 	case FILTER_ARG_OP:
 		if (arg->op.type != FILTER_OP_NOT) {
-			lval = test_arg(arg, arg->op.left);
+			lval = test_arg(arg, arg->op.left, error_str);
 			switch (lval) {
 			case FILTER_VAL_NORM:
 				break;
 			case FILTER_VAL_TRUE:
 				if (arg->op.type == FILTER_OP_OR)
 					return FILTER_VAL_TRUE;
-				rval = test_arg(arg, arg->op.right);
+				rval = test_arg(arg, arg->op.right, error_str);
 				if (rval != FILTER_VAL_NORM)
 					return rval;
 
-				reparent_op_arg(parent, arg, arg->op.right);
-				return FILTER_VAL_NORM;
+				return reparent_op_arg(parent, arg, arg->op.right,
+						       error_str);
 
 			case FILTER_VAL_FALSE:
 				if (arg->op.type == FILTER_OP_AND)
 					return FILTER_VAL_FALSE;
-				rval = test_arg(arg, arg->op.right);
+				rval = test_arg(arg, arg->op.right, error_str);
 				if (rval != FILTER_VAL_NORM)
 					return rval;
 
-				reparent_op_arg(parent, arg, arg->op.right);
-				return FILTER_VAL_NORM;
+				return reparent_op_arg(parent, arg, arg->op.right,
+						       error_str);
+
+			default:
+				return lval;
 			}
 		}
 
-		rval = test_arg(arg, arg->op.right);
+		rval = test_arg(arg, arg->op.right, error_str);
 		switch (rval) {
 		case FILTER_VAL_NORM:
+		default:
 			break;
+
 		case FILTER_VAL_TRUE:
 			if (arg->op.type == FILTER_OP_OR)
 				return FILTER_VAL_TRUE;
 			if (arg->op.type == FILTER_OP_NOT)
 				return FILTER_VAL_FALSE;
 
-			reparent_op_arg(parent, arg, arg->op.left);
-			return FILTER_VAL_NORM;
+			return reparent_op_arg(parent, arg, arg->op.left,
+					       error_str);
 
 		case FILTER_VAL_FALSE:
 			if (arg->op.type == FILTER_OP_AND)
@@ -908,26 +924,27 @@ enum filter_vals test_arg(struct filter_arg *parent, struct filter_arg *arg)
 			if (arg->op.type == FILTER_OP_NOT)
 				return FILTER_VAL_TRUE;
 
-			reparent_op_arg(parent, arg, arg->op.left);
-			return FILTER_VAL_NORM;
+			return reparent_op_arg(parent, arg, arg->op.left,
+					       error_str);
 		}
 
-		return FILTER_VAL_NORM;
+		return rval;
 	default:
-		die("bad arg in filter tree");
+		show_error(error_str, "bad arg in filter tree");
+		return PEVENT_ERRNO__BAD_FILTER_ARG;
 	}
 	return FILTER_VAL_NORM;
 }
 
 /* Remove any unknown event fields */
-static struct filter_arg *collapse_tree(struct filter_arg *arg)
+static struct filter_arg *collapse_tree(struct filter_arg *arg, char **error_str)
 {
 	enum filter_vals ret;
 
-	ret = test_arg(arg, arg);
+	ret = test_arg(arg, arg, error_str);
 	switch (ret) {
 	case FILTER_VAL_NORM:
-		return arg;
+		break;
 
 	case FILTER_VAL_TRUE:
 	case FILTER_VAL_FALSE:
@@ -936,7 +953,16 @@ static struct filter_arg *collapse_tree(struct filter_arg *arg)
 		if (arg) {
 			arg->type = FILTER_ARG_BOOLEAN;
 			arg->boolean.value = ret == FILTER_VAL_TRUE;
+		} else {
+			show_error(error_str, "Failed to allocate filter arg");
 		}
+		break;
+
+	default:
+		/* test_arg() already set the error_str */
+		free_arg(arg);
+		arg = NULL;
+		break;
 	}
 
 	return arg;
@@ -1152,9 +1178,9 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 	if (!current_op)
 		current_op = current_exp;
 
-	current_op = collapse_tree(current_op);
+	current_op = collapse_tree(current_op, error_str);
 	if (current_op == NULL)
-		goto fail_alloc;
+		goto fail;
 
 	*parg = current_op;
 
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 17/20] tools lib traceevent: Refactor create_arg_item()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2013-12-13 15:12 ` [PATCH 16/20] tools lib traceevent: Get rid of die() in reparent_op_arg() Arnaldo Carvalho de Melo
@ 2013-12-13 15:12 ` Arnaldo Carvalho de Melo
  2013-12-13 15:12 ` [PATCH 18/20] tools lib traceevent: Refactor process_filter() Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Frederic Weisbecker,
	Jiri Olsa, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung.kim@lge.com>

So that it can return a proper pevent_errno value.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-10-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.h  |  3 ++-
 tools/lib/traceevent/parse-filter.c | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 5e4392d8e2d4..57b66aed8122 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -367,7 +367,8 @@ enum pevent_flag {
 	_PE(ILLEGAL_INTEGER_CMP,"illegal comparison for integer"), 	      \
 	_PE(REPARENT_NOT_OP,	"cannot reparent other than OP"),	      \
 	_PE(REPARENT_FAILED,	"failed to reparent filter OP"),	      \
-	_PE(BAD_FILTER_ARG,	"bad arg in filter tree")
+	_PE(BAD_FILTER_ARG,	"bad arg in filter tree"),		      \
+	_PE(UNEXPECTED_TYPE,	"unexpected type (not a value)")
 
 #undef _PE
 #define _PE(__code, __str) PEVENT_ERRNO__ ## __code
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 9b05892566e0..8d71208f0131 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -368,9 +368,9 @@ static void free_events(struct event_list *events)
 	}
 }
 
-static struct filter_arg *
+static enum pevent_errno
 create_arg_item(struct event_format *event, const char *token,
-		enum event_type type, char **error_str)
+		enum event_type type, struct filter_arg **parg, char **error_str)
 {
 	struct format_field *field;
 	struct filter_arg *arg;
@@ -378,7 +378,7 @@ create_arg_item(struct event_format *event, const char *token,
 	arg = allocate_arg();
 	if (arg == NULL) {
 		show_error(error_str, "failed to allocate filter arg");
-		return NULL;
+		return PEVENT_ERRNO__MEM_ALLOC_FAILED;
 	}
 
 	switch (type) {
@@ -392,7 +392,7 @@ create_arg_item(struct event_format *event, const char *token,
 		if (!arg->value.str) {
 			free_arg(arg);
 			show_error(error_str, "failed to allocate string filter arg");
-			return NULL;
+			return PEVENT_ERRNO__MEM_ALLOC_FAILED;
 		}
 		break;
 	case EVENT_ITEM:
@@ -420,11 +420,11 @@ create_arg_item(struct event_format *event, const char *token,
 		break;
 	default:
 		free_arg(arg);
-		show_error(error_str, "expected a value but found %s",
-			   token);
-		return NULL;
+		show_error(error_str, "expected a value but found %s", token);
+		return PEVENT_ERRNO__UNEXPECTED_TYPE;
 	}
-	return arg;
+	*parg = arg;
+	return 0;
 }
 
 static struct filter_arg *
@@ -993,8 +993,8 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 		case EVENT_SQUOTE:
 		case EVENT_DQUOTE:
 		case EVENT_ITEM:
-			arg = create_arg_item(event, token, type, error_str);
-			if (!arg)
+			ret = create_arg_item(event, token, type, &arg, error_str);
+			if (ret < 0)
 				goto fail;
 			if (!left_item)
 				left_item = arg;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 18/20] tools lib traceevent: Refactor process_filter()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2013-12-13 15:12 ` [PATCH 17/20] tools lib traceevent: Refactor create_arg_item() Arnaldo Carvalho de Melo
@ 2013-12-13 15:12 ` Arnaldo Carvalho de Melo
  2013-12-13 15:12 ` [PATCH 19/20] tools lib traceevent: Make pevent_filter_add_filter_str() return pevent_errno Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Frederic Weisbecker,
	Jiri Olsa, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung.kim@lge.com>

So that it can return a proper pevent_errno value.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-11-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.h  |  6 +++-
 tools/lib/traceevent/parse-filter.c | 64 +++++++++++++++++++++----------------
 2 files changed, 42 insertions(+), 28 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 57b66aed8122..da942d59cc3a 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -368,7 +368,11 @@ enum pevent_flag {
 	_PE(REPARENT_NOT_OP,	"cannot reparent other than OP"),	      \
 	_PE(REPARENT_FAILED,	"failed to reparent filter OP"),	      \
 	_PE(BAD_FILTER_ARG,	"bad arg in filter tree"),		      \
-	_PE(UNEXPECTED_TYPE,	"unexpected type (not a value)")
+	_PE(UNEXPECTED_TYPE,	"unexpected type (not a value)"),	      \
+	_PE(ILLEGAL_TOKEN,	"illegal token"),			      \
+	_PE(INVALID_PAREN,	"open parenthesis cannot come here"), 	      \
+	_PE(UNBALANCED_PAREN,	"unbalanced number of parenthesis"),	      \
+	_PE(UNKNOWN_TOKEN,	"unknown token")
 
 #undef _PE
 #define _PE(__code, __str) PEVENT_ERRNO__ ## __code
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 8d71208f0131..5aa5012a17ee 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -937,9 +937,10 @@ static int test_arg(struct filter_arg *parent, struct filter_arg *arg,
 }
 
 /* Remove any unknown event fields */
-static struct filter_arg *collapse_tree(struct filter_arg *arg, char **error_str)
+static int collapse_tree(struct filter_arg *arg,
+			 struct filter_arg **arg_collapsed, char **error_str)
 {
-	enum filter_vals ret;
+	int ret;
 
 	ret = test_arg(arg, arg, error_str);
 	switch (ret) {
@@ -955,6 +956,7 @@ static struct filter_arg *collapse_tree(struct filter_arg *arg, char **error_str
 			arg->boolean.value = ret == FILTER_VAL_TRUE;
 		} else {
 			show_error(error_str, "Failed to allocate filter arg");
+			ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
 		}
 		break;
 
@@ -965,10 +967,11 @@ static struct filter_arg *collapse_tree(struct filter_arg *arg, char **error_str
 		break;
 	}
 
-	return arg;
+	*arg_collapsed = arg;
+	return ret;
 }
 
-static int
+static enum pevent_errno
 process_filter(struct event_format *event, struct filter_arg **parg,
 	       char **error_str, int not)
 {
@@ -982,7 +985,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 	enum filter_op_type btype;
 	enum filter_exp_type etype;
 	enum filter_cmp_type ctype;
-	int ret;
+	enum pevent_errno ret;
 
 	*parg = NULL;
 
@@ -1007,20 +1010,20 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 				if (not) {
 					arg = NULL;
 					if (current_op)
-						goto fail_print;
+						goto fail_syntax;
 					free(token);
 					*parg = current_exp;
 					return 0;
 				}
 			} else
-				goto fail_print;
+				goto fail_syntax;
 			arg = NULL;
 			break;
 
 		case EVENT_DELIM:
 			if (*token == ',') {
-				show_error(error_str,
-					   "Illegal token ','");
+				show_error(error_str, "Illegal token ','");
+				ret = PEVENT_ERRNO__ILLEGAL_TOKEN;
 				goto fail;
 			}
 
@@ -1028,19 +1031,23 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 				if (left_item) {
 					show_error(error_str,
 						   "Open paren can not come after item");
+					ret = PEVENT_ERRNO__INVALID_PAREN;
 					goto fail;
 				}
 				if (current_exp) {
 					show_error(error_str,
 						   "Open paren can not come after expression");
+					ret = PEVENT_ERRNO__INVALID_PAREN;
 					goto fail;
 				}
 
 				ret = process_filter(event, &arg, error_str, 0);
-				if (ret != 1) {
-					if (ret == 0)
+				if (ret != PEVENT_ERRNO__UNBALANCED_PAREN) {
+					if (ret == 0) {
 						show_error(error_str,
 							   "Unbalanced number of '('");
+						ret = PEVENT_ERRNO__UNBALANCED_PAREN;
+					}
 					goto fail;
 				}
 				ret = 0;
@@ -1048,7 +1055,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 				/* A not wants just one expression */
 				if (not) {
 					if (current_op)
-						goto fail_print;
+						goto fail_syntax;
 					*parg = arg;
 					return 0;
 				}
@@ -1063,19 +1070,19 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 
 			} else { /* ')' */
 				if (!current_op && !current_exp)
-					goto fail_print;
+					goto fail_syntax;
 
 				/* Make sure everything is finished at this level */
 				if (current_exp && !check_op_done(current_exp))
-					goto fail_print;
+					goto fail_syntax;
 				if (current_op && !check_op_done(current_op))
-					goto fail_print;
+					goto fail_syntax;
 
 				if (current_op)
 					*parg = current_op;
 				else
 					*parg = current_exp;
-				return 1;
+				return PEVENT_ERRNO__UNBALANCED_PAREN;
 			}
 			break;
 
@@ -1087,21 +1094,22 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 			case OP_BOOL:
 				/* Logic ops need a left expression */
 				if (!current_exp && !current_op)
-					goto fail_print;
+					goto fail_syntax;
 				/* fall through */
 			case OP_NOT:
 				/* logic only processes ops and exp */
 				if (left_item)
-					goto fail_print;
+					goto fail_syntax;
 				break;
 			case OP_EXP:
 			case OP_CMP:
 				if (!left_item)
-					goto fail_print;
+					goto fail_syntax;
 				break;
 			case OP_NONE:
 				show_error(error_str,
 					   "Unknown op token %s", token);
+				ret = PEVENT_ERRNO__UNKNOWN_TOKEN;
 				goto fail;
 			}
 
@@ -1152,7 +1160,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 				ret = add_left(arg, left_item);
 				if (ret < 0) {
 					arg = NULL;
-					goto fail_print;
+					goto fail_syntax;
 				}
 				current_exp = arg;
 				break;
@@ -1161,25 +1169,25 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 			}
 			arg = NULL;
 			if (ret < 0)
-				goto fail_print;
+				goto fail_syntax;
 			break;
 		case EVENT_NONE:
 			break;
 		case EVENT_ERROR:
 			goto fail_alloc;
 		default:
-			goto fail_print;
+			goto fail_syntax;
 		}
 	} while (type != EVENT_NONE);
 
 	if (!current_op && !current_exp)
-		goto fail_print;
+		goto fail_syntax;
 
 	if (!current_op)
 		current_op = current_exp;
 
-	current_op = collapse_tree(current_op, error_str);
-	if (current_op == NULL)
+	ret = collapse_tree(current_op, parg, error_str);
+	if (ret < 0)
 		goto fail;
 
 	*parg = current_op;
@@ -1188,15 +1196,17 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 
  fail_alloc:
 	show_error(error_str, "failed to allocate filter arg");
+	ret = PEVENT_ERRNO__MEM_ALLOC_FAILED;
 	goto fail;
- fail_print:
+ fail_syntax:
 	show_error(error_str, "Syntax error");
+	ret = PEVENT_ERRNO__SYNTAX_ERROR;
  fail:
 	free_arg(current_op);
 	free_arg(current_exp);
 	free_arg(arg);
 	free(token);
-	return -1;
+	return ret;
 }
 
 static int
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 19/20] tools lib traceevent: Make pevent_filter_add_filter_str() return pevent_errno
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2013-12-13 15:12 ` [PATCH 18/20] tools lib traceevent: Refactor process_filter() Arnaldo Carvalho de Melo
@ 2013-12-13 15:12 ` Arnaldo Carvalho de Melo
  2013-12-13 15:12 ` [PATCH 20/20] tools lib traceevent: Refactor pevent_filter_match() to get rid of die() Arnaldo Carvalho de Melo
  2013-12-16 13:54 ` [GIT PULL 00/20] perf/core improvements and fixes Ingo Molnar
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Namhyung Kim, Frederic Weisbecker,
	Jiri Olsa, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung.kim@lge.com>

Refactor the pevent_filter_add_filter_str() to return a proper error
code and get rid of the third error_str argument.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-12-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.h  |  8 ++--
 tools/lib/traceevent/parse-filter.c | 78 +++++++++++--------------------------
 2 files changed, 27 insertions(+), 59 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index da942d59cc3a..089964e56ed4 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -372,7 +372,8 @@ enum pevent_flag {
 	_PE(ILLEGAL_TOKEN,	"illegal token"),			      \
 	_PE(INVALID_PAREN,	"open parenthesis cannot come here"), 	      \
 	_PE(UNBALANCED_PAREN,	"unbalanced number of parenthesis"),	      \
-	_PE(UNKNOWN_TOKEN,	"unknown token")
+	_PE(UNKNOWN_TOKEN,	"unknown token"),			      \
+	_PE(FILTER_NOT_FOUND,	"no filter found")
 
 #undef _PE
 #define _PE(__code, __str) PEVENT_ERRNO__ ## __code
@@ -863,9 +864,8 @@ enum filter_trivial_type {
 	FILTER_TRIVIAL_BOTH,
 };
 
-int pevent_filter_add_filter_str(struct event_filter *filter,
-				 const char *filter_str,
-				 char **error_str);
+enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
+					       const char *filter_str);
 
 
 int pevent_filter_match(struct event_filter *filter,
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 5aa5012a17ee..78440d73e0ad 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -1209,7 +1209,7 @@ process_filter(struct event_format *event, struct filter_arg **parg,
 	return ret;
 }
 
-static int
+static enum pevent_errno
 process_event(struct event_format *event, const char *filter_str,
 	      struct filter_arg **parg, char **error_str)
 {
@@ -1218,21 +1218,15 @@ process_event(struct event_format *event, const char *filter_str,
 	pevent_buffer_init(filter_str, strlen(filter_str));
 
 	ret = process_filter(event, parg, error_str, 0);
-	if (ret == 1) {
-		show_error(error_str,
-			   "Unbalanced number of ')'");
-		return -1;
-	}
 	if (ret < 0)
 		return ret;
 
 	/* If parg is NULL, then make it into FALSE */
 	if (!*parg) {
 		*parg = allocate_arg();
-		if (*parg == NULL) {
-			show_error(error_str, "failed to allocate filter arg");
-			return -1;
-		}
+		if (*parg == NULL)
+			return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+
 		(*parg)->type = FILTER_ARG_BOOLEAN;
 		(*parg)->boolean.value = FILTER_FALSE;
 	}
@@ -1240,13 +1234,13 @@ process_event(struct event_format *event, const char *filter_str,
 	return 0;
 }
 
-static int filter_event(struct event_filter *filter,
-			struct event_format *event,
-			const char *filter_str, char **error_str)
+static enum pevent_errno
+filter_event(struct event_filter *filter, struct event_format *event,
+	     const char *filter_str, char **error_str)
 {
 	struct filter_type *filter_type;
 	struct filter_arg *arg;
-	int ret;
+	enum pevent_errno ret;
 
 	if (filter_str) {
 		ret = process_event(event, filter_str, &arg, error_str);
@@ -1256,20 +1250,16 @@ static int filter_event(struct event_filter *filter,
 	} else {
 		/* just add a TRUE arg */
 		arg = allocate_arg();
-		if (arg == NULL) {
-			show_error(error_str, "failed to allocate filter arg");
-			return -1;
-		}
+		if (arg == NULL)
+			return PEVENT_ERRNO__MEM_ALLOC_FAILED;
+
 		arg->type = FILTER_ARG_BOOLEAN;
 		arg->boolean.value = FILTER_TRUE;
 	}
 
 	filter_type = add_filter_type(filter, event->id);
-	if (filter_type == NULL) {
-		show_error(error_str, "failed to add a new filter: %s",
-			   filter_str ? filter_str : "true");
-		return -1;
-	}
+	if (filter_type == NULL)
+		return PEVENT_ERRNO__MEM_ALLOC_FAILED;
 
 	if (filter_type->filter)
 		free_arg(filter_type->filter);
@@ -1282,18 +1272,12 @@ static int filter_event(struct event_filter *filter,
  * pevent_filter_add_filter_str - add a new filter
  * @filter: the event filter to add to
  * @filter_str: the filter string that contains the filter
- * @error_str: string containing reason for failed filter
- *
- * Returns 0 if the filter was successfully added
- *   -1 if there was an error.
  *
- * On error, if @error_str points to a string pointer,
- * it is set to the reason that the filter failed.
- * This string must be freed with "free".
+ * Returns 0 if the filter was successfully added or a
+ * negative error code.
  */
-int pevent_filter_add_filter_str(struct event_filter *filter,
-				 const char *filter_str,
-				 char **error_str)
+enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
+					       const char *filter_str)
 {
 	struct pevent *pevent = filter->pevent;
 	struct event_list *event;
@@ -1304,23 +1288,20 @@ int pevent_filter_add_filter_str(struct event_filter *filter,
 	char *event_name = NULL;
 	char *sys_name = NULL;
 	char *sp;
-	int rtn = 0;
+	enum pevent_errno rtn = 0; /* PEVENT_ERRNO__SUCCESS */
 	int len;
 	int ret;
+	char *error_str = NULL;
 
 	/* clear buffer to reset show error */
 	pevent_buffer_init("", 0);
 
-	if (error_str)
-		*error_str = NULL;
-
 	filter_start = strchr(filter_str, ':');
 	if (filter_start)
 		len = filter_start - filter_str;
 	else
 		len = strlen(filter_str);
 
-
 	do {
 		next_event = strchr(filter_str, ',');
 		if (next_event &&
@@ -1333,10 +1314,9 @@ int pevent_filter_add_filter_str(struct event_filter *filter,
 
 		this_event = malloc(len + 1);
 		if (this_event == NULL) {
-			show_error(error_str, "Memory allocation failure");
 			/* This can only happen when events is NULL, but still */
 			free_events(events);
-			return -1;
+			return PEVENT_ERRNO__MEM_ALLOC_FAILED;
 		}
 		memcpy(this_event, filter_str, len);
 		this_event[len] = 0;
@@ -1350,30 +1330,18 @@ int pevent_filter_add_filter_str(struct event_filter *filter,
 		event_name = strtok_r(NULL, "/", &sp);
 
 		if (!sys_name) {
-			show_error(error_str, "No filter found");
 			/* This can only happen when events is NULL, but still */
 			free_events(events);
 			free(this_event);
-			return -1;
+			return PEVENT_ERRNO__FILTER_NOT_FOUND;
 		}
 
 		/* Find this event */
 		ret = find_event(pevent, &events, strim(sys_name), strim(event_name));
 		if (ret < 0) {
-			if (ret == PEVENT_ERRNO__MEM_ALLOC_FAILED)
-				show_error(error_str,
-					   "Memory allocation failure");
-			else if (event_name)
-				show_error(error_str,
-					   "No event found under '%s.%s'",
-					   sys_name, event_name);
-			else
-				show_error(error_str,
-					   "No event found under '%s'",
-					   sys_name);
 			free_events(events);
 			free(this_event);
-			return -1;
+			return ret;
 		}
 		free(this_event);
 	} while (filter_str);
@@ -1385,7 +1353,7 @@ int pevent_filter_add_filter_str(struct event_filter *filter,
 	/* filter starts here */
 	for (event = events; event; event = event->next) {
 		ret = filter_event(filter, event->event, filter_start,
-				   error_str);
+				   &error_str);
 		/* Failures are returned if a parse error happened */
 		if (ret < 0)
 			rtn = ret;
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* [PATCH 20/20] tools lib traceevent: Refactor pevent_filter_match() to get rid of die()
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2013-12-13 15:12 ` [PATCH 19/20] tools lib traceevent: Make pevent_filter_add_filter_str() return pevent_errno Arnaldo Carvalho de Melo
@ 2013-12-13 15:12 ` Arnaldo Carvalho de Melo
  2013-12-16 13:54 ` [GIT PULL 00/20] perf/core improvements and fixes Ingo Molnar
  20 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2013-12-13 15:12 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Namhyung Kim <namhyung@kernel.org>

The test_filter() function is for testing given filter is matched to a
given record.  However it doesn't handle error cases properly so add a
new argument err to save error info during the test and also pass it to
internal test functions.

The return value of pevent_filter_match() also converted to pevent_errno
to indicate an exact error case.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1386833777-3790-13-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.h  |  21 ++++--
 tools/lib/traceevent/parse-filter.c | 135 +++++++++++++++++++++++-------------
 2 files changed, 99 insertions(+), 57 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 089964e56ed4..3ad784f5f647 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -357,6 +357,8 @@ enum pevent_flag {
 	_PE(READ_PRINT_FAILED,	"failed to read event print fmt"), 	      \
 	_PE(OLD_FTRACE_ARG_FAILED,"failed to allocate field name for ftrace"),\
 	_PE(INVALID_ARG_TYPE,	"invalid argument type"),		      \
+	_PE(INVALID_EXP_TYPE,	"invalid expression type"),		      \
+	_PE(INVALID_OP_TYPE,	"invalid operator type"),		      \
 	_PE(INVALID_EVENT_NAME,	"invalid event name"),			      \
 	_PE(EVENT_NOT_FOUND,	"no event found"),			      \
 	_PE(SYNTAX_ERROR,	"syntax error"),			      \
@@ -373,12 +375,16 @@ enum pevent_flag {
 	_PE(INVALID_PAREN,	"open parenthesis cannot come here"), 	      \
 	_PE(UNBALANCED_PAREN,	"unbalanced number of parenthesis"),	      \
 	_PE(UNKNOWN_TOKEN,	"unknown token"),			      \
-	_PE(FILTER_NOT_FOUND,	"no filter found")
+	_PE(FILTER_NOT_FOUND,	"no filter found"),			      \
+	_PE(NOT_A_NUMBER,	"must have number field"),		      \
+	_PE(NO_FILTER,		"no filters exists"),			      \
+	_PE(FILTER_MISS,	"record does not match to filter")
 
 #undef _PE
 #define _PE(__code, __str) PEVENT_ERRNO__ ## __code
 enum pevent_errno {
 	PEVENT_ERRNO__SUCCESS			= 0,
+	PEVENT_ERRNO__FILTER_MATCH		= PEVENT_ERRNO__SUCCESS,
 
 	/*
 	 * Choose an arbitrary negative big number not to clash with standard
@@ -853,10 +859,11 @@ struct event_filter {
 
 struct event_filter *pevent_filter_alloc(struct pevent *pevent);
 
-#define FILTER_NONE		-2
-#define FILTER_NOEXIST		-1
-#define FILTER_MISS		0
-#define FILTER_MATCH		1
+/* for backward compatibility */
+#define FILTER_NONE		PEVENT_ERRNO__FILTER_NOT_FOUND
+#define FILTER_NOEXIST		PEVENT_ERRNO__NO_FILTER
+#define FILTER_MISS		PEVENT_ERRNO__FILTER_MISS
+#define FILTER_MATCH		PEVENT_ERRNO__FILTER_MATCH
 
 enum filter_trivial_type {
 	FILTER_TRIVIAL_FALSE,
@@ -868,8 +875,8 @@ enum pevent_errno pevent_filter_add_filter_str(struct event_filter *filter,
 					       const char *filter_str);
 
 
-int pevent_filter_match(struct event_filter *filter,
-			struct pevent_record *record);
+enum pevent_errno pevent_filter_match(struct event_filter *filter,
+				      struct pevent_record *record);
 
 int pevent_event_filtered(struct event_filter *filter,
 			  int event_id);
diff --git a/tools/lib/traceevent/parse-filter.c b/tools/lib/traceevent/parse-filter.c
index 78440d73e0ad..9303c55128db 100644
--- a/tools/lib/traceevent/parse-filter.c
+++ b/tools/lib/traceevent/parse-filter.c
@@ -1678,8 +1678,8 @@ int pevent_filter_event_has_trivial(struct event_filter *filter,
 	}
 }
 
-static int test_filter(struct event_format *event,
-		       struct filter_arg *arg, struct pevent_record *record);
+static int test_filter(struct event_format *event, struct filter_arg *arg,
+		       struct pevent_record *record, enum pevent_errno *err);
 
 static const char *
 get_comm(struct event_format *event, struct pevent_record *record)
@@ -1725,15 +1725,24 @@ get_value(struct event_format *event,
 }
 
 static unsigned long long
-get_arg_value(struct event_format *event, struct filter_arg *arg, struct pevent_record *record);
+get_arg_value(struct event_format *event, struct filter_arg *arg,
+	      struct pevent_record *record, enum pevent_errno *err);
 
 static unsigned long long
-get_exp_value(struct event_format *event, struct filter_arg *arg, struct pevent_record *record)
+get_exp_value(struct event_format *event, struct filter_arg *arg,
+	      struct pevent_record *record, enum pevent_errno *err)
 {
 	unsigned long long lval, rval;
 
-	lval = get_arg_value(event, arg->exp.left, record);
-	rval = get_arg_value(event, arg->exp.right, record);
+	lval = get_arg_value(event, arg->exp.left, record, err);
+	rval = get_arg_value(event, arg->exp.right, record, err);
+
+	if (*err) {
+		/*
+		 * There was an error, no need to process anymore.
+		 */
+		return 0;
+	}
 
 	switch (arg->exp.type) {
 	case FILTER_EXP_ADD:
@@ -1768,39 +1777,51 @@ get_exp_value(struct event_format *event, struct filter_arg *arg, struct pevent_
 
 	case FILTER_EXP_NOT:
 	default:
-		die("error in exp");
+		if (!*err)
+			*err = PEVENT_ERRNO__INVALID_EXP_TYPE;
 	}
 	return 0;
 }
 
 static unsigned long long
-get_arg_value(struct event_format *event, struct filter_arg *arg, struct pevent_record *record)
+get_arg_value(struct event_format *event, struct filter_arg *arg,
+	      struct pevent_record *record, enum pevent_errno *err)
 {
 	switch (arg->type) {
 	case FILTER_ARG_FIELD:
 		return get_value(event, arg->field.field, record);
 
 	case FILTER_ARG_VALUE:
-		if (arg->value.type != FILTER_NUMBER)
-			die("must have number field!");
+		if (arg->value.type != FILTER_NUMBER) {
+			if (!*err)
+				*err = PEVENT_ERRNO__NOT_A_NUMBER;
+		}
 		return arg->value.val;
 
 	case FILTER_ARG_EXP:
-		return get_exp_value(event, arg, record);
+		return get_exp_value(event, arg, record, err);
 
 	default:
-		die("oops in filter");
+		if (!*err)
+			*err = PEVENT_ERRNO__INVALID_ARG_TYPE;
 	}
 	return 0;
 }
 
-static int test_num(struct event_format *event,
-		    struct filter_arg *arg, struct pevent_record *record)
+static int test_num(struct event_format *event, struct filter_arg *arg,
+		    struct pevent_record *record, enum pevent_errno *err)
 {
 	unsigned long long lval, rval;
 
-	lval = get_arg_value(event, arg->num.left, record);
-	rval = get_arg_value(event, arg->num.right, record);
+	lval = get_arg_value(event, arg->num.left, record, err);
+	rval = get_arg_value(event, arg->num.right, record, err);
+
+	if (*err) {
+		/*
+		 * There was an error, no need to process anymore.
+		 */
+		return 0;
+	}
 
 	switch (arg->num.type) {
 	case FILTER_CMP_EQ:
@@ -1822,7 +1843,8 @@ static int test_num(struct event_format *event,
 		return lval <= rval;
 
 	default:
-		/* ?? */
+		if (!*err)
+			*err = PEVENT_ERRNO__ILLEGAL_INTEGER_CMP;
 		return 0;
 	}
 }
@@ -1869,8 +1891,8 @@ static const char *get_field_str(struct filter_arg *arg, struct pevent_record *r
 	return val;
 }
 
-static int test_str(struct event_format *event,
-		    struct filter_arg *arg, struct pevent_record *record)
+static int test_str(struct event_format *event, struct filter_arg *arg,
+		    struct pevent_record *record, enum pevent_errno *err)
 {
 	const char *val;
 
@@ -1894,48 +1916,57 @@ static int test_str(struct event_format *event,
 		return regexec(&arg->str.reg, val, 0, NULL, 0);
 
 	default:
-		/* ?? */
+		if (!*err)
+			*err = PEVENT_ERRNO__ILLEGAL_STRING_CMP;
 		return 0;
 	}
 }
 
-static int test_op(struct event_format *event,
-		   struct filter_arg *arg, struct pevent_record *record)
+static int test_op(struct event_format *event, struct filter_arg *arg,
+		   struct pevent_record *record, enum pevent_errno *err)
 {
 	switch (arg->op.type) {
 	case FILTER_OP_AND:
-		return test_filter(event, arg->op.left, record) &&
-			test_filter(event, arg->op.right, record);
+		return test_filter(event, arg->op.left, record, err) &&
+			test_filter(event, arg->op.right, record, err);
 
 	case FILTER_OP_OR:
-		return test_filter(event, arg->op.left, record) ||
-			test_filter(event, arg->op.right, record);
+		return test_filter(event, arg->op.left, record, err) ||
+			test_filter(event, arg->op.right, record, err);
 
 	case FILTER_OP_NOT:
-		return !test_filter(event, arg->op.right, record);
+		return !test_filter(event, arg->op.right, record, err);
 
 	default:
-		/* ?? */
+		if (!*err)
+			*err = PEVENT_ERRNO__INVALID_OP_TYPE;
 		return 0;
 	}
 }
 
-static int test_filter(struct event_format *event,
-		       struct filter_arg *arg, struct pevent_record *record)
+static int test_filter(struct event_format *event, struct filter_arg *arg,
+		       struct pevent_record *record, enum pevent_errno *err)
 {
+	if (*err) {
+		/*
+		 * There was an error, no need to process anymore.
+		 */
+		return 0;
+	}
+
 	switch (arg->type) {
 	case FILTER_ARG_BOOLEAN:
 		/* easy case */
 		return arg->boolean.value;
 
 	case FILTER_ARG_OP:
-		return test_op(event, arg, record);
+		return test_op(event, arg, record, err);
 
 	case FILTER_ARG_NUM:
-		return test_num(event, arg, record);
+		return test_num(event, arg, record, err);
 
 	case FILTER_ARG_STR:
-		return test_str(event, arg, record);
+		return test_str(event, arg, record, err);
 
 	case FILTER_ARG_EXP:
 	case FILTER_ARG_VALUE:
@@ -1944,11 +1975,11 @@ static int test_filter(struct event_format *event,
 		 * Expressions, fields and values evaluate
 		 * to true if they return non zero
 		 */
-		return !!get_arg_value(event, arg, record);
+		return !!get_arg_value(event, arg, record, err);
 
 	default:
-		die("oops!");
-		/* ?? */
+		if (!*err)
+			*err = PEVENT_ERRNO__INVALID_ARG_TYPE;
 		return 0;
 	}
 }
@@ -1961,8 +1992,7 @@ static int test_filter(struct event_format *event,
  * Returns 1 if filter found for @event_id
  *   otherwise 0;
  */
-int pevent_event_filtered(struct event_filter *filter,
-			  int event_id)
+int pevent_event_filtered(struct event_filter *filter, int event_id)
 {
 	struct filter_type *filter_type;
 
@@ -1979,31 +2009,36 @@ int pevent_event_filtered(struct event_filter *filter,
  * @filter: filter struct with filter information
  * @record: the record to test against the filter
  *
- * Returns:
- *  1 - filter found for event and @record matches
- *  0 - filter found for event and @record does not match
- * -1 - no filter found for @record's event
- * -2 - if no filters exist
+ * Returns: match result or error code (prefixed with PEVENT_ERRNO__)
+ * FILTER_MATCH - filter found for event and @record matches
+ * FILTER_MISS  - filter found for event and @record does not match
+ * FILTER_NOT_FOUND - no filter found for @record's event
+ * NO_FILTER - if no filters exist
+ * otherwise - error occurred during test
  */
-int pevent_filter_match(struct event_filter *filter,
-			struct pevent_record *record)
+enum pevent_errno pevent_filter_match(struct event_filter *filter,
+				      struct pevent_record *record)
 {
 	struct pevent *pevent = filter->pevent;
 	struct filter_type *filter_type;
 	int event_id;
+	int ret;
+	enum pevent_errno err = 0;
 
 	if (!filter->filters)
-		return FILTER_NONE;
+		return PEVENT_ERRNO__NO_FILTER;
 
 	event_id = pevent_data_type(pevent, record);
 
 	filter_type = find_filter_type(filter, event_id);
-
 	if (!filter_type)
-		return FILTER_NOEXIST;
+		return PEVENT_ERRNO__FILTER_NOT_FOUND;
+
+	ret = test_filter(filter_type->event, filter_type->filter, record, &err);
+	if (err)
+		return err;
 
-	return test_filter(filter_type->event, filter_type->filter, record) ?
-		FILTER_MATCH : FILTER_MISS;
+	return ret ? PEVENT_ERRNO__FILTER_MATCH : PEVENT_ERRNO__FILTER_MISS;
 }
 
 static char *op_to_str(struct event_filter *filter, struct filter_arg *arg)
-- 
1.8.1.4


^ permalink raw reply related	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2013-12-13 15:12 ` [PATCH 20/20] tools lib traceevent: Refactor pevent_filter_match() to get rid of die() Arnaldo Carvalho de Melo
@ 2013-12-16 13:54 ` Ingo Molnar
  20 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2013-12-16 13:54 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andi Kleen, Borislav Petkov, David Ahern, Frederic Weisbecker,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Ramkumar Ramachandra, Stephane Eranian,
	Steven Rostedt, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> 
> Hi Ingo,
> 
> 	Please consider pulling,
> 
> Regards,
> 
> - Arnaldo
> 
> The following changes since commit c7f2e3cd6c1f4932ccc4135d050eae3f7c7aef63:
> 
>   perf: Optimize ring-buffer write by depending on control dependencies (2013-12-11 15:53:22 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
> 
> for you to fetch changes up to 41e12e580a7b0c151199f927193548b84d3e874c:
> 
>   tools lib traceevent: Refactor pevent_filter_match() to get rid of die() (2013-12-13 10:30:22 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> Fixes:
> 
> . Fix inverted error verification bug in thread__fork, from David Ahern.
> 
> New features:
> 
> . Shell completion for 'perf kvm', from Ramkumar Ramachandra.
> 
> Refactorings:
> 
> . Get rid of panic() like calls in libtraceevent, from Namyung Kim.
> 
> . Start carving out symbol parsing routines from perf, just moving routines to
>   topic files in tools/lib/symbol/, tools that want to use it need to integrate
>   it directly, i.e. no tools/lib/symbol/Makefile is provided.
> 
> . Assorted refactoring patches, moving code around and adding
>   utility evlist methods that will be used in the IPT patchset,
>   from Adrian Hunter.
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (5):
>       perf tools: Add perf_event_paranoid()
>       perf header: Allow header->data_offset to be predetermined
>       perf evlist: Add can_select_event() method
>       perf tools: Move mem_bswap32/64 to util.c
>       perf evlist: Add perf_evlist__to_front()
> 
> Arnaldo Carvalho de Melo (1):
>       tools lib symbol: Start carving out symbol parsing routines from perf
> 
> David Ahern (1):
>       perf tools: Fix inverted error verification bug in thread__fork
> 
> Namhyung Kim (12):
>       tools lib traceevent: Get rid of malloc_or_die() in show_error()
>       tools lib traceevent: Get rid of die in add_filter_type()
>       tools lib traceevent: Get rid of malloc_or_die() allocate_arg()
>       tools lib traceevent: Get rid of malloc_or_die() in read_token()
>       tools lib traceevent: Get rid of malloc_or_die() in find_event()
>       tools lib traceevent: Get rid of die() in add_right()
>       tools lib traceevent: Make add_left() return pevent_errno
>       tools lib traceevent: Get rid of die() in reparent_op_arg()
>       tools lib traceevent: Refactor create_arg_item()
>       tools lib traceevent: Refactor process_filter()
>       tools lib traceevent: Make pevent_filter_add_filter_str() return pevent_errno
>       tools lib traceevent: Refactor pevent_filter_match() to get rid of die()
> 
> Ramkumar Ramachandra (1):
>       perf completion: Complete 'perf kvm'
> 
>  tools/lib/symbol/kallsyms.c         |  58 +++++
>  tools/lib/symbol/kallsyms.h         |  24 ++
>  tools/lib/traceevent/event-parse.h  |  43 ++-
>  tools/lib/traceevent/parse-filter.c | 507 ++++++++++++++++++++++--------------
>  tools/perf/MANIFEST                 |   2 +
>  tools/perf/Makefile.perf            |   5 +
>  tools/perf/perf-completion.sh       |   4 +
>  tools/perf/util/event.c             |   1 +
>  tools/perf/util/evlist.c            |  20 +-
>  tools/perf/util/evlist.h            |   5 +
>  tools/perf/util/header.c            |   3 +-
>  tools/perf/util/machine.c           |   1 +
>  tools/perf/util/record.c            |  37 +++
>  tools/perf/util/session.c           |  21 --
>  tools/perf/util/session.h           |   2 -
>  tools/perf/util/symbol-elf.c        |   1 +
>  tools/perf/util/symbol.c            |  69 +----
>  tools/perf/util/symbol.h            |   3 -
>  tools/perf/util/thread.c            |   2 +-
>  tools/perf/util/util.c              |  41 +++
>  tools/perf/util/util.h              |   4 +
>  21 files changed, 550 insertions(+), 303 deletions(-)
>  create mode 100644 tools/lib/symbol/kallsyms.c
>  create mode 100644 tools/lib/symbol/kallsyms.h

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2017-03-28  1:38 Arnaldo Carvalho de Melo
@ 2017-03-28  5:45 ` Ingo Molnar
  0 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2017-03-28  5:45 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin, Andi Kleen,
	David Ahern, Jiri Olsa, Kan Liang, Masami Hiramatsu,
	Milian Wolff, Namhyung Kim, Peter Zijlstra, Ravi Bangoria,
	Sukadev Bhattiprolu, Taeung Song, Tommi Rantala, Wang Nan,
	Yao Jin, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit e3a6a62400520452fe39740dca90a1d0b94b8f92:
> 
>   Merge tag 'perf-core-for-mingo-4.12-20170324' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-03-24 19:37:40 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170327
> 
> for you to fetch changes up to 55f77128e7652e537d6c226d5b56821cdb5c22de:
> 
>   perf utils: Readlink /proc/self/exe to find the perf binary (2017-03-27 15:37:54 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> New features:
> 
> - Handle inline functions in callchains (Jin Yao)
> 
> - Enable sorting by srcline as key (Milian Wolff)
> 
> Fixes:
> 
> - Fix no_size logic in addr_filter__resolve_kernel_syms() in the
>   auxtrace code (Adrian Hunter)
> 
> - Fix some thread refcount leaks in 'perf trace' (Arnaldo Carvalho de Melo)
> 
> - Fix divide by zero when calculating percent for an event in a group in
>   the annotate by source line code (Taeung Song)
> 
> - build-id files now aren't anymore symlinks, their parent directories
>   are, so readlink the later (Taeung Song)
> 
> - Assorted fixes for null termination problems, mostly related to
>   readlink, detected by valgrind (Tommi Rantala)
> 
> Infrastructure:
> 
> - Make vfs_getname probe point logic in 'perf trace' more robust
>   wrt length of pathname (Arnaldo Carvalho de Melo)
> 
> - Remove unused 'prefix' parameter from builtins main functions (Arnaldo Carvalho de Melo)
> 
> - Show 'perf list sdt' option in man page (Ravi Bangoria)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (1):
>       perf auxtrace: Fix no_size logic in addr_filter__resolve_kernel_syms()
> 
> Arnaldo Carvalho de Melo (4):
>       perf trace: Check for vfs_getname.pathname length
>       perf trace: Fix up error path indentation
>       perf trace: Fixup thread refcounting
>       perf tools: Remove unused 'prefix' from builtin functions
> 
> Jin Yao (5):
>       perf report: Refactor common code in srcline.c
>       perf report: Find the inline stack for a given address
>       perf report: Introduce --inline option
>       perf report: Show inline stack for stdio mode
>       perf report: Show inline stack for browser mode
> 
> Milian Wolff (1):
>       perf report: Enable sorting by srcline as key
> 
> Ravi Bangoria (1):
>       perf list sdt: Show option in man page
> 
> Taeung Song (2):
>       perf annotate: Fix a bug following symbolic link of a build-id file
>       perf annotate: Fix a bug of division by zero when calculating percent
> 
> Tommi Rantala (6):
>       perf buildid: Do not update SDT cache with null filename
>       perf buildid: Do not assume that readlink() returns a null terminated string
>       perf tests: Do not assume that readlink() returns a null terminated string
>       perf utils: use sizeof(buf) - 1 in readlink() call
>       perf utils: Null terminate buf in read_ftrace_printk()
>       perf utils: Readlink /proc/self/exe to find the perf binary
> 
>  tools/perf/Documentation/perf-list.txt   |   4 +-
>  tools/perf/Documentation/perf-report.txt |   5 +
>  tools/perf/bench/bench.h                 |  20 +--
>  tools/perf/bench/futex-hash.c            |   3 +-
>  tools/perf/bench/futex-lock-pi.c         |   3 +-
>  tools/perf/bench/futex-requeue.c         |   3 +-
>  tools/perf/bench/futex-wake-parallel.c   |   3 +-
>  tools/perf/bench/futex-wake.c            |   3 +-
>  tools/perf/bench/mem-functions.c         |   4 +-
>  tools/perf/bench/numa.c                  |   2 +-
>  tools/perf/bench/sched-messaging.c       |   3 +-
>  tools/perf/bench/sched-pipe.c            |   2 +-
>  tools/perf/builtin-annotate.c            |   2 +-
>  tools/perf/builtin-bench.c               |  12 +-
>  tools/perf/builtin-buildid-cache.c       |   3 +-
>  tools/perf/builtin-buildid-list.c        |   3 +-
>  tools/perf/builtin-c2c.c                 |   4 +-
>  tools/perf/builtin-config.c              |   2 +-
>  tools/perf/builtin-data.c                |   9 +-
>  tools/perf/builtin-diff.c                |   2 +-
>  tools/perf/builtin-evlist.c              |   2 +-
>  tools/perf/builtin-ftrace.c              |   2 +-
>  tools/perf/builtin-help.c                |   2 +-
>  tools/perf/builtin-inject.c              |   2 +-
>  tools/perf/builtin-kallsyms.c            |   2 +-
>  tools/perf/builtin-kmem.c                |   4 +-
>  tools/perf/builtin-kvm.c                 |  16 +-
>  tools/perf/builtin-list.c                |   2 +-
>  tools/perf/builtin-lock.c                |   6 +-
>  tools/perf/builtin-mem.c                 |   6 +-
>  tools/perf/builtin-probe.c               |   6 +-
>  tools/perf/builtin-record.c              |   2 +-
>  tools/perf/builtin-report.c              |   4 +-
>  tools/perf/builtin-sched.c               |   6 +-
>  tools/perf/builtin-script.c              |   4 +-
>  tools/perf/builtin-stat.c                |   2 +-
>  tools/perf/builtin-timechart.c           |   7 +-
>  tools/perf/builtin-top.c                 |   2 +-
>  tools/perf/builtin-trace.c               |  25 ++--
>  tools/perf/builtin-version.c             |   3 +-
>  tools/perf/builtin.h                     |  58 ++++----
>  tools/perf/perf.c                        |  11 +-
>  tools/perf/tests/builtin-test.c          |   2 +-
>  tools/perf/tests/sdt.c                   |   2 +-
>  tools/perf/ui/browsers/hists.c           | 181 ++++++++++++++++++++++-
>  tools/perf/ui/stdio/hist.c               |  86 ++++++++++-
>  tools/perf/util/annotate.c               |  23 ++-
>  tools/perf/util/auxtrace.c               |   4 +-
>  tools/perf/util/build-id.c               |   8 +-
>  tools/perf/util/callchain.c              |  52 ++++++-
>  tools/perf/util/callchain.h              |   3 +-
>  tools/perf/util/header.c                 |   8 +-
>  tools/perf/util/hist.c                   |   5 +
>  tools/perf/util/map.c                    |   3 +-
>  tools/perf/util/sort.c                   |  16 +-
>  tools/perf/util/sort.h                   |   1 +
>  tools/perf/util/srcline.c                | 246 +++++++++++++++++++++++++++----
>  tools/perf/util/symbol-elf.c             |   5 +
>  tools/perf/util/symbol-minimal.c         |   7 +
>  tools/perf/util/symbol.h                 |   5 +-
>  tools/perf/util/trace-event-read.c       |   4 +-
>  tools/perf/util/util.h                   |  20 ++-
>  62 files changed, 739 insertions(+), 208 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2017-03-28  1:38 Arnaldo Carvalho de Melo
  2017-03-28  5:45 ` Ingo Molnar
  0 siblings, 1 reply; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-03-28  1:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Andi Kleen, David Ahern, Jiri Olsa,
	Kan Liang, Masami Hiramatsu, Milian Wolff, Namhyung Kim,
	Peter Zijlstra, Ravi Bangoria, Sukadev Bhattiprolu, Taeung Song,
	Tommi Rantala, Wang Nan, Yao Jin, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit e3a6a62400520452fe39740dca90a1d0b94b8f92:

  Merge tag 'perf-core-for-mingo-4.12-20170324' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-03-24 19:37:40 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170327

for you to fetch changes up to 55f77128e7652e537d6c226d5b56821cdb5c22de:

  perf utils: Readlink /proc/self/exe to find the perf binary (2017-03-27 15:37:54 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

New features:

- Handle inline functions in callchains (Jin Yao)

- Enable sorting by srcline as key (Milian Wolff)

Fixes:

- Fix no_size logic in addr_filter__resolve_kernel_syms() in the
  auxtrace code (Adrian Hunter)

- Fix some thread refcount leaks in 'perf trace' (Arnaldo Carvalho de Melo)

- Fix divide by zero when calculating percent for an event in a group in
  the annotate by source line code (Taeung Song)

- build-id files now aren't anymore symlinks, their parent directories
  are, so readlink the later (Taeung Song)

- Assorted fixes for null termination problems, mostly related to
  readlink, detected by valgrind (Tommi Rantala)

Infrastructure:

- Make vfs_getname probe point logic in 'perf trace' more robust
  wrt length of pathname (Arnaldo Carvalho de Melo)

- Remove unused 'prefix' parameter from builtins main functions (Arnaldo Carvalho de Melo)

- Show 'perf list sdt' option in man page (Ravi Bangoria)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (1):
      perf auxtrace: Fix no_size logic in addr_filter__resolve_kernel_syms()

Arnaldo Carvalho de Melo (4):
      perf trace: Check for vfs_getname.pathname length
      perf trace: Fix up error path indentation
      perf trace: Fixup thread refcounting
      perf tools: Remove unused 'prefix' from builtin functions

Jin Yao (5):
      perf report: Refactor common code in srcline.c
      perf report: Find the inline stack for a given address
      perf report: Introduce --inline option
      perf report: Show inline stack for stdio mode
      perf report: Show inline stack for browser mode

Milian Wolff (1):
      perf report: Enable sorting by srcline as key

Ravi Bangoria (1):
      perf list sdt: Show option in man page

Taeung Song (2):
      perf annotate: Fix a bug following symbolic link of a build-id file
      perf annotate: Fix a bug of division by zero when calculating percent

Tommi Rantala (6):
      perf buildid: Do not update SDT cache with null filename
      perf buildid: Do not assume that readlink() returns a null terminated string
      perf tests: Do not assume that readlink() returns a null terminated string
      perf utils: use sizeof(buf) - 1 in readlink() call
      perf utils: Null terminate buf in read_ftrace_printk()
      perf utils: Readlink /proc/self/exe to find the perf binary

 tools/perf/Documentation/perf-list.txt   |   4 +-
 tools/perf/Documentation/perf-report.txt |   5 +
 tools/perf/bench/bench.h                 |  20 +--
 tools/perf/bench/futex-hash.c            |   3 +-
 tools/perf/bench/futex-lock-pi.c         |   3 +-
 tools/perf/bench/futex-requeue.c         |   3 +-
 tools/perf/bench/futex-wake-parallel.c   |   3 +-
 tools/perf/bench/futex-wake.c            |   3 +-
 tools/perf/bench/mem-functions.c         |   4 +-
 tools/perf/bench/numa.c                  |   2 +-
 tools/perf/bench/sched-messaging.c       |   3 +-
 tools/perf/bench/sched-pipe.c            |   2 +-
 tools/perf/builtin-annotate.c            |   2 +-
 tools/perf/builtin-bench.c               |  12 +-
 tools/perf/builtin-buildid-cache.c       |   3 +-
 tools/perf/builtin-buildid-list.c        |   3 +-
 tools/perf/builtin-c2c.c                 |   4 +-
 tools/perf/builtin-config.c              |   2 +-
 tools/perf/builtin-data.c                |   9 +-
 tools/perf/builtin-diff.c                |   2 +-
 tools/perf/builtin-evlist.c              |   2 +-
 tools/perf/builtin-ftrace.c              |   2 +-
 tools/perf/builtin-help.c                |   2 +-
 tools/perf/builtin-inject.c              |   2 +-
 tools/perf/builtin-kallsyms.c            |   2 +-
 tools/perf/builtin-kmem.c                |   4 +-
 tools/perf/builtin-kvm.c                 |  16 +-
 tools/perf/builtin-list.c                |   2 +-
 tools/perf/builtin-lock.c                |   6 +-
 tools/perf/builtin-mem.c                 |   6 +-
 tools/perf/builtin-probe.c               |   6 +-
 tools/perf/builtin-record.c              |   2 +-
 tools/perf/builtin-report.c              |   4 +-
 tools/perf/builtin-sched.c               |   6 +-
 tools/perf/builtin-script.c              |   4 +-
 tools/perf/builtin-stat.c                |   2 +-
 tools/perf/builtin-timechart.c           |   7 +-
 tools/perf/builtin-top.c                 |   2 +-
 tools/perf/builtin-trace.c               |  25 ++--
 tools/perf/builtin-version.c             |   3 +-
 tools/perf/builtin.h                     |  58 ++++----
 tools/perf/perf.c                        |  11 +-
 tools/perf/tests/builtin-test.c          |   2 +-
 tools/perf/tests/sdt.c                   |   2 +-
 tools/perf/ui/browsers/hists.c           | 181 ++++++++++++++++++++++-
 tools/perf/ui/stdio/hist.c               |  86 ++++++++++-
 tools/perf/util/annotate.c               |  23 ++-
 tools/perf/util/auxtrace.c               |   4 +-
 tools/perf/util/build-id.c               |   8 +-
 tools/perf/util/callchain.c              |  52 ++++++-
 tools/perf/util/callchain.h              |   3 +-
 tools/perf/util/header.c                 |   8 +-
 tools/perf/util/hist.c                   |   5 +
 tools/perf/util/map.c                    |   3 +-
 tools/perf/util/sort.c                   |  16 +-
 tools/perf/util/sort.h                   |   1 +
 tools/perf/util/srcline.c                | 246 +++++++++++++++++++++++++++----
 tools/perf/util/symbol-elf.c             |   5 +
 tools/perf/util/symbol-minimal.c         |   7 +
 tools/perf/util/symbol.h                 |   5 +-
 tools/perf/util/trace-event-read.c       |   4 +-
 tools/perf/util/util.h                   |  20 ++-
 62 files changed, 739 insertions(+), 208 deletions(-)

Test results:

The first ones are container (docker) based builds of tools/perf with and
without libelf support, objtool where it is supported and samples/bpf/, ditto.
Where clang is available, it is also used to build perf with/without libelf.

Several are cross builds, the ones with -x-ARCH, and the android one, and those
may not have all the features built, due to lack of multi-arch devel packages,
available and being used so far on just a few, like
debian:experimental-x-{arm64,mipsel}.

The 'perf test' one will perform a variety of tests exercising
tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands
with a variety of command line event specifications to then intercept the
sys_perf_event syscall to check that the perf_event_attr fields are set up as
expected, among a variety of other unit tests.

Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/
with a variety of feature sets, exercising the build with an incomplete set of
features as well as with a complete one. It is planned to have it run on each
of the containers mentioned above, using some container orchestration
infrastructure. Get in contact if interested in helping having this in place.

  # dm
   1 alpine:3.4: Ok
   2 alpine:3.5: Ok
   3 alpine:edge: Ok
   4 android-ndk:r12b-arm: Ok
   5 archlinux:latest: Ok
   6 centos:5: Ok
   7 centos:6: Ok
   8 centos:7: Ok
   9 debian:7: Ok
  10 debian:8: Ok
  11 debian:9: Ok
  12 debian:experimental: Ok
  13 debian:experimental-x-arm64: Ok
  14 debian:experimental-x-mips: Ok
  15 debian:experimental-x-mips64: Ok
  16 debian:experimental-x-mipsel: Ok
  17 fedora:20: Ok
  18 fedora:21: Ok
  19 fedora:22: Ok
  20 fedora:23: Ok
  21 fedora:24: Ok
  22 fedora:24-x-ARC-uClibc: Ok
  23 fedora:25: Ok
  24 fedora:rawhide: Ok
  25 mageia:5: Ok
  26 opensuse:13.2: Ok
  27 opensuse:42.1: Ok
  28 opensuse:tumbleweed: Ok
  29 ubuntu:12.04.5: Ok
  30 ubuntu:14.04.4: Ok
  31 ubuntu:14.04.4-x-linaro-arm64: Ok
  32 ubuntu:15.10: Ok
  33 ubuntu:16.04: Ok
  34 ubuntu:16.04-x-arm: Ok
  35 ubuntu:16.04-x-arm64: Ok
  36 ubuntu:16.04-x-powerpc: Ok
  37 ubuntu:16.04-x-powerpc64: Ok
  38 ubuntu:16.04-x-s390: Ok
  39 ubuntu:16.10: Ok
  40 ubuntu:17.04: Ok
  # 
  # uname -a
  Linux jouet 4.11.0-rc2+ #5 SMP Mon Mar 20 18:12:29 -03 2017 x86_64 x86_64 x86_64 GNU/Linux
  # This kernel lacks the fix by peterz for 'perf test tsc'
  #
  # perf test
   1: vmlinux symtab matches kallsyms            : Ok
   2: Detect openat syscall event                : Ok
   3: Detect openat syscall event on all cpus    : Ok
   4: Read samples using the mmap interface      : Ok
   5: Parse event definition strings             : Ok
   6: Simple expression parser                   : Ok
   7: PERF_RECORD_* events & perf_sample fields  : Ok
   8: Parse perf pmu format                      : Ok
   9: DSO data read                              : Ok
  10: DSO data cache                             : Ok
  11: DSO data reopen                            : Ok
  12: Roundtrip evsel->name                      : Ok
  13: Parse sched tracepoints fields             : Ok
  14: syscalls:sys_enter_openat event fields     : Ok
  15: Setup struct perf_event_attr               : Ok
  16: Match and link multiple hists              : Ok
  17: 'import perf' in python                    : Ok
  18: Breakpoint overflow signal handler         : Ok
  19: Breakpoint overflow sampling               : Ok
  20: Number of exit events of a simple workload : Ok
  21: Software clock events period values        : Ok
  22: Object code reading                        : Ok
  23: Sample parsing                             : Ok
  24: Use a dummy software event to keep tracking: Ok
  25: Parse with no sample_id_all bit set        : Ok
  26: Filter hist entries                        : Ok
  27: Lookup mmap thread                         : Ok
  28: Share thread mg                            : Ok
  29: Sort output of hist entries                : Ok
  30: Cumulate child hist entries                : Ok
  31: Track with sched_switch                    : Ok
  32: Filter fds with revents mask in a fdarray  : Ok
  33: Add fd to a fdarray, making it autogrow    : Ok
  34: kmod_path__parse                           : Ok
  35: Thread map                                 : Ok
  36: LLVM search and compile                    :
  36.1: Basic BPF llvm compile                    : Ok
  36.2: kbuild searching                          : Ok
  36.3: Compile source for BPF prologue generation: Ok
  36.4: Compile source for BPF relocation         : Ok
  37: Session topology                           : Ok
  38: BPF filter                                 :
  38.1: Basic BPF filtering                      : Ok
  38.2: BPF pinning                              : Ok
  38.3: BPF prologue generation                  : Ok
  38.4: BPF relocation checker                   : Ok
  39: Synthesize thread map                      : Ok
  40: Remove thread map                          : Ok
  41: Synthesize cpu map                         : Ok
  42: Synthesize stat config                     : Ok
  43: Synthesize stat                            : Ok
  44: Synthesize stat round                      : Ok
  45: Synthesize attr update                     : Ok
  46: Event times                                : Ok
  47: Read backward ring buffer                  : Ok
  48: Print cpu map                              : Ok
  49: Probe SDT events                           : Ok
  50: is_printable_array                         : Ok
  51: Print bitmap                               : Ok
  52: perf hooks                                 : Ok
  53: builtin clang support                      : Skip (not compiled in)
  54: unit_number__scnprintf                     : Ok
  55: x86 rdpmc                                  : Ok
  56: Convert perf time to TSC                   : FAILED!
  57: DWARF unwind                               : Ok
  58: x86 instruction decoder - new instructions : Ok
  59: Intel cqm nmi context read                 : Skip
  #

  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
              make_clean_all_O: make clean all 
       make_util_pmu_bison_o_O: make util/pmu-bison.o 
           make_no_backtrace_O: make NO_BACKTRACE=1 
                make_install_O: make install 
            make_no_libaudit_O: make NO_LIBAUDIT=1 
         make_with_clangllvm_O: make LIBCLANGLLVM=1 
                   make_tags_O: make tags 
               make_no_slang_O: make NO_SLANG=1 
   make_install_prefix_slash_O: make install prefix=/tmp/krava/ 
                   make_pure_O: make 
         make_install_prefix_O: make install prefix=/tmp/krava 
            make_no_demangle_O: make NO_DEMANGLE=1 
                    make_doc_O: make doc 
                make_no_gtk2_O: make NO_GTK2=1 
                   make_help_O: make help 
                 make_static_O: make LDFLAGS=-static 
           make_no_libunwind_O: make NO_LIBUNWIND=1 
             make_util_map_o_O: make util/map.o 
           make_no_libpython_O: make NO_LIBPYTHON=1 
           make_no_libbionic_O: make NO_LIBBIONIC=1 
              make_no_libelf_O: make NO_LIBELF=1 
                  make_debug_O: make DEBUG=1 
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1 
                 make_perf_o_O: make perf.o 
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 
            make_no_auxtrace_O: make NO_AUXTRACE=1 
             make_no_libperl_O: make NO_LIBPERL=1 
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 
              make_no_libbpf_O: make NO_LIBBPF=1 
                make_no_newt_O: make NO_NEWT=1 
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1 
             make_no_libnuma_O: make NO_LIBNUMA=1 
        make_with_babeltrace_O: make LIBBABELTRACE=1 
            make_install_bin_O: make install-bin 
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2017-03-24 14:57 ` Arnaldo Carvalho de Melo
@ 2017-03-24 18:39   ` Ingo Molnar
  -1 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2017-03-24 18:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin,
	Alexis Berlemont, Andi Kleen, David Ahern, Hanjun Guo,
	Hemant Kumar, Jiri Olsa, John Shortt, Kefeng Wang,
	Madhavan Srinivasan, Masami Hiramatsu, Michael Ellerman,
	Namhyung Kim, Naveen N . Rao, Peter Zijlstra, Ravi Bangoria,
	Taeung Song, Wang Nan, linux-perf-users,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 267dd0a07eefbb37264fcfad984fffc8856898ad:
> 
>   Merge tag 'perf-core-for-mingo-4.12-20170320' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-03-21 07:41:29 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170324
> 
> for you to fetch changes up to bf874fcf9f2fed58510dc83abcee388cee2b427e:
> 
>   perf list: Move extra details printing to new option (2017-03-23 11:42:31 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Allow suppressing 'uncore_' when specifying PMU events (Andi Kleen)
> 
> - Collapse identically named PMU events in 'perf stat', allow
>   not merging it via --no-merge (Andi Kleen)
> 
> Fixes:
> 
> - Use more precise 'grep -v' to suppress unwanted 'objdump -dS'
>   disassembly output to not ditch line:number lines needed by
>   'perf annotate --print-lines' logic (Taeung Song)
> 
> Infrastructure:
> 
> - SDT (Statically Defined Tracing)/uprobes_events arguments improvements
>   (Alexis Berlemont, Ravi Bangoria)
> 
> - Improvements for the handling of JSON described vendor events,
>   including having an expression parser to calculate metrics
>   from multiple vendor events (Andi Kleen)
> 
> - Update Intel JSON vendor event files (Andi Kleen)
> 
> - Restore error reporting in 'perf probe -d' when none of the events
>   requested to be deleted exist. (Kefeng Wang)
> 
> - Bump MAX_CMDLEN in 'perf probe' to match what the kernel accepts
>   (Ravi Bangoria)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Alexis Berlemont (2):
>       perf sdt: Add scanning of sdt probes arguments
>       perf probe: Add sdt probes arguments into the uprobe cmd string
> 
> Andi Kleen (13):
>       perf stat: Factor out callback for collecting event values
>       perf stat: Collapse identically named events
>       perf stat: Handle partially bad results with merging
>       perf tools: Factor out PMU matching in parser
>       perf pmu: Expand PMU events by prefix match
>       perf pmu: Special case uncore_ prefix
>       perf tools: Add a simple expression parser for JSON
>       perf vendor events intel: Update Intel uncore JSON event files
>       perf pmu: Support MetricExpr header in JSON event list
>       perf stat: Output JSON MetricExpr metric
>       perf list: Support printing MetricExpr with --debug
>       perf pmu: Add support for MetricName JSON attribute
>       perf list: Move extra details printing to new option
> 
> Arnaldo Carvalho de Melo (1):
>       perf annotate: Add comment clarifying how the source code line is parsed
> 
> Kefeng Wang (1):
>       perf probe: Return errno when not hitting any event
> 
> Ravi Bangoria (2):
>       perf probe: Change MAX_CMDLEN
>       perf sdt x86: Add renaming logic for rNN and other registers
> 
> Taeung Song (1):
>       perf annotate: More exactly grep -v of the objdump command
> 
>  tools/perf/Documentation/perf-list.txt             |   4 +
>  tools/perf/Documentation/perf-stat.txt             |   3 +
>  tools/perf/arch/x86/util/perf_regs.c               | 103 +++++++++++
>  tools/perf/builtin-list.c                          |  14 +-
>  tools/perf/builtin-probe.c                         |   6 +-
>  tools/perf/builtin-stat.c                          | 146 ++++++++++++---
>  .../arch/x86/broadwellde/uncore-cache.json         |  28 +--
>  .../arch/x86/broadwellde/uncore-memory.json        |  26 ++-
>  .../arch/x86/broadwellde/uncore-power.json         |  26 ++-
>  .../arch/x86/broadwellx/uncore-cache.json          |  28 +--
>  .../arch/x86/broadwellx/uncore-interconnect.json   |   6 +-
>  .../arch/x86/broadwellx/uncore-memory.json         |  21 ++-
>  .../arch/x86/broadwellx/uncore-power.json          |  26 ++-
>  .../pmu-events/arch/x86/haswellx/uncore-cache.json |  28 +--
>  .../arch/x86/haswellx/uncore-interconnect.json     |   6 +-
>  .../arch/x86/haswellx/uncore-memory.json           |  21 ++-
>  .../pmu-events/arch/x86/haswellx/uncore-power.json |  26 ++-
>  .../pmu-events/arch/x86/ivytown/uncore-cache.json  |  22 +--
>  .../arch/x86/ivytown/uncore-interconnect.json      |  12 +-
>  .../pmu-events/arch/x86/ivytown/uncore-memory.json |  19 +-
>  .../pmu-events/arch/x86/ivytown/uncore-power.json  |  53 ++++--
>  .../pmu-events/arch/x86/jaketown/uncore-cache.json |  13 +-
>  .../arch/x86/jaketown/uncore-interconnect.json     |  12 +-
>  .../arch/x86/jaketown/uncore-memory.json           |  21 ++-
>  .../pmu-events/arch/x86/jaketown/uncore-power.json |  53 ++++--
>  tools/perf/pmu-events/jevents.c                    |  26 ++-
>  tools/perf/pmu-events/jevents.h                    |   3 +-
>  tools/perf/pmu-events/pmu-events.h                 |   2 +
>  tools/perf/tests/Build                             |   1 +
>  tools/perf/tests/builtin-test.c                    |   4 +
>  tools/perf/tests/expr.c                            |  56 ++++++
>  tools/perf/tests/tests.h                           |   1 +
>  tools/perf/util/Build                              |   6 +
>  tools/perf/util/annotate.c                         |   8 +-
>  tools/perf/util/evsel.c                            |   4 +
>  tools/perf/util/evsel.h                            |   5 +
>  tools/perf/util/expr.h                             |  25 +++
>  tools/perf/util/expr.y                             | 173 ++++++++++++++++++
>  tools/perf/util/parse-events.c                     |  78 +++++++-
>  tools/perf/util/parse-events.h                     |  10 +-
>  tools/perf/util/parse-events.y                     |  73 ++++----
>  tools/perf/util/perf_regs.c                        |   6 +
>  tools/perf/util/perf_regs.h                        |   6 +
>  tools/perf/util/pmu.c                              |  32 +++-
>  tools/perf/util/pmu.h                              |   6 +-
>  tools/perf/util/probe-event.c                      |   1 -
>  tools/perf/util/probe-file.c                       | 173 +++++++++++++++++-
>  tools/perf/util/stat-shadow.c                      | 197 +++++++++++++++++++++
>  tools/perf/util/stat.h                             |   2 +
>  tools/perf/util/symbol-elf.c                       |  25 ++-
>  tools/perf/util/symbol.h                           |   1 +
>  51 files changed, 1370 insertions(+), 277 deletions(-)
>  create mode 100644 tools/perf/tests/expr.c
>  create mode 100644 tools/perf/util/expr.h
>  create mode 100644 tools/perf/util/expr.y

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
@ 2017-03-24 18:39   ` Ingo Molnar
  0 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2017-03-24 18:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin,
	Alexis Berlemont, Andi Kleen, David Ahern, Hanjun Guo,
	Hemant Kumar, Jiri Olsa, John Shortt, Kefeng Wang,
	Madhavan Srinivasan, Masami Hiramatsu, Michael Ellerman,
	Namhyung Kim, Naveen N . Rao, Peter Zijlstra, Ravi Bangoria,
	Taeung Song


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 267dd0a07eefbb37264fcfad984fffc8856898ad:
> 
>   Merge tag 'perf-core-for-mingo-4.12-20170320' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-03-21 07:41:29 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170324
> 
> for you to fetch changes up to bf874fcf9f2fed58510dc83abcee388cee2b427e:
> 
>   perf list: Move extra details printing to new option (2017-03-23 11:42:31 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Allow suppressing 'uncore_' when specifying PMU events (Andi Kleen)
> 
> - Collapse identically named PMU events in 'perf stat', allow
>   not merging it via --no-merge (Andi Kleen)
> 
> Fixes:
> 
> - Use more precise 'grep -v' to suppress unwanted 'objdump -dS'
>   disassembly output to not ditch line:number lines needed by
>   'perf annotate --print-lines' logic (Taeung Song)
> 
> Infrastructure:
> 
> - SDT (Statically Defined Tracing)/uprobes_events arguments improvements
>   (Alexis Berlemont, Ravi Bangoria)
> 
> - Improvements for the handling of JSON described vendor events,
>   including having an expression parser to calculate metrics
>   from multiple vendor events (Andi Kleen)
> 
> - Update Intel JSON vendor event files (Andi Kleen)
> 
> - Restore error reporting in 'perf probe -d' when none of the events
>   requested to be deleted exist. (Kefeng Wang)
> 
> - Bump MAX_CMDLEN in 'perf probe' to match what the kernel accepts
>   (Ravi Bangoria)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Alexis Berlemont (2):
>       perf sdt: Add scanning of sdt probes arguments
>       perf probe: Add sdt probes arguments into the uprobe cmd string
> 
> Andi Kleen (13):
>       perf stat: Factor out callback for collecting event values
>       perf stat: Collapse identically named events
>       perf stat: Handle partially bad results with merging
>       perf tools: Factor out PMU matching in parser
>       perf pmu: Expand PMU events by prefix match
>       perf pmu: Special case uncore_ prefix
>       perf tools: Add a simple expression parser for JSON
>       perf vendor events intel: Update Intel uncore JSON event files
>       perf pmu: Support MetricExpr header in JSON event list
>       perf stat: Output JSON MetricExpr metric
>       perf list: Support printing MetricExpr with --debug
>       perf pmu: Add support for MetricName JSON attribute
>       perf list: Move extra details printing to new option
> 
> Arnaldo Carvalho de Melo (1):
>       perf annotate: Add comment clarifying how the source code line is parsed
> 
> Kefeng Wang (1):
>       perf probe: Return errno when not hitting any event
> 
> Ravi Bangoria (2):
>       perf probe: Change MAX_CMDLEN
>       perf sdt x86: Add renaming logic for rNN and other registers
> 
> Taeung Song (1):
>       perf annotate: More exactly grep -v of the objdump command
> 
>  tools/perf/Documentation/perf-list.txt             |   4 +
>  tools/perf/Documentation/perf-stat.txt             |   3 +
>  tools/perf/arch/x86/util/perf_regs.c               | 103 +++++++++++
>  tools/perf/builtin-list.c                          |  14 +-
>  tools/perf/builtin-probe.c                         |   6 +-
>  tools/perf/builtin-stat.c                          | 146 ++++++++++++---
>  .../arch/x86/broadwellde/uncore-cache.json         |  28 +--
>  .../arch/x86/broadwellde/uncore-memory.json        |  26 ++-
>  .../arch/x86/broadwellde/uncore-power.json         |  26 ++-
>  .../arch/x86/broadwellx/uncore-cache.json          |  28 +--
>  .../arch/x86/broadwellx/uncore-interconnect.json   |   6 +-
>  .../arch/x86/broadwellx/uncore-memory.json         |  21 ++-
>  .../arch/x86/broadwellx/uncore-power.json          |  26 ++-
>  .../pmu-events/arch/x86/haswellx/uncore-cache.json |  28 +--
>  .../arch/x86/haswellx/uncore-interconnect.json     |   6 +-
>  .../arch/x86/haswellx/uncore-memory.json           |  21 ++-
>  .../pmu-events/arch/x86/haswellx/uncore-power.json |  26 ++-
>  .../pmu-events/arch/x86/ivytown/uncore-cache.json  |  22 +--
>  .../arch/x86/ivytown/uncore-interconnect.json      |  12 +-
>  .../pmu-events/arch/x86/ivytown/uncore-memory.json |  19 +-
>  .../pmu-events/arch/x86/ivytown/uncore-power.json  |  53 ++++--
>  .../pmu-events/arch/x86/jaketown/uncore-cache.json |  13 +-
>  .../arch/x86/jaketown/uncore-interconnect.json     |  12 +-
>  .../arch/x86/jaketown/uncore-memory.json           |  21 ++-
>  .../pmu-events/arch/x86/jaketown/uncore-power.json |  53 ++++--
>  tools/perf/pmu-events/jevents.c                    |  26 ++-
>  tools/perf/pmu-events/jevents.h                    |   3 +-
>  tools/perf/pmu-events/pmu-events.h                 |   2 +
>  tools/perf/tests/Build                             |   1 +
>  tools/perf/tests/builtin-test.c                    |   4 +
>  tools/perf/tests/expr.c                            |  56 ++++++
>  tools/perf/tests/tests.h                           |   1 +
>  tools/perf/util/Build                              |   6 +
>  tools/perf/util/annotate.c                         |   8 +-
>  tools/perf/util/evsel.c                            |   4 +
>  tools/perf/util/evsel.h                            |   5 +
>  tools/perf/util/expr.h                             |  25 +++
>  tools/perf/util/expr.y                             | 173 ++++++++++++++++++
>  tools/perf/util/parse-events.c                     |  78 +++++++-
>  tools/perf/util/parse-events.h                     |  10 +-
>  tools/perf/util/parse-events.y                     |  73 ++++----
>  tools/perf/util/perf_regs.c                        |   6 +
>  tools/perf/util/perf_regs.h                        |   6 +
>  tools/perf/util/pmu.c                              |  32 +++-
>  tools/perf/util/pmu.h                              |   6 +-
>  tools/perf/util/probe-event.c                      |   1 -
>  tools/perf/util/probe-file.c                       | 173 +++++++++++++++++-
>  tools/perf/util/stat-shadow.c                      | 197 +++++++++++++++++++++
>  tools/perf/util/stat.h                             |   2 +
>  tools/perf/util/symbol-elf.c                       |  25 ++-
>  tools/perf/util/symbol.h                           |   1 +
>  51 files changed, 1370 insertions(+), 277 deletions(-)
>  create mode 100644 tools/perf/tests/expr.c
>  create mode 100644 tools/perf/util/expr.h
>  create mode 100644 tools/perf/util/expr.y

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2017-03-24 14:57 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-03-24 14:57 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Alexis Berlemont, Andi Kleen, David Ahern,
	Hanjun Guo, Hemant Kumar, Jiri Olsa, John Shortt, Kefeng Wang,
	Madhavan Srinivasan, Masami Hiramatsu, Michael Ellerman,
	Namhyung Kim, Naveen N . Rao, Peter Zijlstra, Ravi Bangoria,
	Taeung Song, Wang Nan, linux-perf-users,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit 267dd0a07eefbb37264fcfad984fffc8856898ad:

  Merge tag 'perf-core-for-mingo-4.12-20170320' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-03-21 07:41:29 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170324

for you to fetch changes up to bf874fcf9f2fed58510dc83abcee388cee2b427e:

  perf list: Move extra details printing to new option (2017-03-23 11:42:31 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Allow suppressing 'uncore_' when specifying PMU events (Andi Kleen)

- Collapse identically named PMU events in 'perf stat', allow
  not merging it via --no-merge (Andi Kleen)

Fixes:

- Use more precise 'grep -v' to suppress unwanted 'objdump -dS'
  disassembly output to not ditch line:number lines needed by
  'perf annotate --print-lines' logic (Taeung Song)

Infrastructure:

- SDT (Statically Defined Tracing)/uprobes_events arguments improvements
  (Alexis Berlemont, Ravi Bangoria)

- Improvements for the handling of JSON described vendor events,
  including having an expression parser to calculate metrics
  from multiple vendor events (Andi Kleen)

- Update Intel JSON vendor event files (Andi Kleen)

- Restore error reporting in 'perf probe -d' when none of the events
  requested to be deleted exist. (Kefeng Wang)

- Bump MAX_CMDLEN in 'perf probe' to match what the kernel accepts
  (Ravi Bangoria)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Alexis Berlemont (2):
      perf sdt: Add scanning of sdt probes arguments
      perf probe: Add sdt probes arguments into the uprobe cmd string

Andi Kleen (13):
      perf stat: Factor out callback for collecting event values
      perf stat: Collapse identically named events
      perf stat: Handle partially bad results with merging
      perf tools: Factor out PMU matching in parser
      perf pmu: Expand PMU events by prefix match
      perf pmu: Special case uncore_ prefix
      perf tools: Add a simple expression parser for JSON
      perf vendor events intel: Update Intel uncore JSON event files
      perf pmu: Support MetricExpr header in JSON event list
      perf stat: Output JSON MetricExpr metric
      perf list: Support printing MetricExpr with --debug
      perf pmu: Add support for MetricName JSON attribute
      perf list: Move extra details printing to new option

Arnaldo Carvalho de Melo (1):
      perf annotate: Add comment clarifying how the source code line is parsed

Kefeng Wang (1):
      perf probe: Return errno when not hitting any event

Ravi Bangoria (2):
      perf probe: Change MAX_CMDLEN
      perf sdt x86: Add renaming logic for rNN and other registers

Taeung Song (1):
      perf annotate: More exactly grep -v of the objdump command

 tools/perf/Documentation/perf-list.txt             |   4 +
 tools/perf/Documentation/perf-stat.txt             |   3 +
 tools/perf/arch/x86/util/perf_regs.c               | 103 +++++++++++
 tools/perf/builtin-list.c                          |  14 +-
 tools/perf/builtin-probe.c                         |   6 +-
 tools/perf/builtin-stat.c                          | 146 ++++++++++++---
 .../arch/x86/broadwellde/uncore-cache.json         |  28 +--
 .../arch/x86/broadwellde/uncore-memory.json        |  26 ++-
 .../arch/x86/broadwellde/uncore-power.json         |  26 ++-
 .../arch/x86/broadwellx/uncore-cache.json          |  28 +--
 .../arch/x86/broadwellx/uncore-interconnect.json   |   6 +-
 .../arch/x86/broadwellx/uncore-memory.json         |  21 ++-
 .../arch/x86/broadwellx/uncore-power.json          |  26 ++-
 .../pmu-events/arch/x86/haswellx/uncore-cache.json |  28 +--
 .../arch/x86/haswellx/uncore-interconnect.json     |   6 +-
 .../arch/x86/haswellx/uncore-memory.json           |  21 ++-
 .../pmu-events/arch/x86/haswellx/uncore-power.json |  26 ++-
 .../pmu-events/arch/x86/ivytown/uncore-cache.json  |  22 +--
 .../arch/x86/ivytown/uncore-interconnect.json      |  12 +-
 .../pmu-events/arch/x86/ivytown/uncore-memory.json |  19 +-
 .../pmu-events/arch/x86/ivytown/uncore-power.json  |  53 ++++--
 .../pmu-events/arch/x86/jaketown/uncore-cache.json |  13 +-
 .../arch/x86/jaketown/uncore-interconnect.json     |  12 +-
 .../arch/x86/jaketown/uncore-memory.json           |  21 ++-
 .../pmu-events/arch/x86/jaketown/uncore-power.json |  53 ++++--
 tools/perf/pmu-events/jevents.c                    |  26 ++-
 tools/perf/pmu-events/jevents.h                    |   3 +-
 tools/perf/pmu-events/pmu-events.h                 |   2 +
 tools/perf/tests/Build                             |   1 +
 tools/perf/tests/builtin-test.c                    |   4 +
 tools/perf/tests/expr.c                            |  56 ++++++
 tools/perf/tests/tests.h                           |   1 +
 tools/perf/util/Build                              |   6 +
 tools/perf/util/annotate.c                         |   8 +-
 tools/perf/util/evsel.c                            |   4 +
 tools/perf/util/evsel.h                            |   5 +
 tools/perf/util/expr.h                             |  25 +++
 tools/perf/util/expr.y                             | 173 ++++++++++++++++++
 tools/perf/util/parse-events.c                     |  78 +++++++-
 tools/perf/util/parse-events.h                     |  10 +-
 tools/perf/util/parse-events.y                     |  73 ++++----
 tools/perf/util/perf_regs.c                        |   6 +
 tools/perf/util/perf_regs.h                        |   6 +
 tools/perf/util/pmu.c                              |  32 +++-
 tools/perf/util/pmu.h                              |   6 +-
 tools/perf/util/probe-event.c                      |   1 -
 tools/perf/util/probe-file.c                       | 173 +++++++++++++++++-
 tools/perf/util/stat-shadow.c                      | 197 +++++++++++++++++++++
 tools/perf/util/stat.h                             |   2 +
 tools/perf/util/symbol-elf.c                       |  25 ++-
 tools/perf/util/symbol.h                           |   1 +
 51 files changed, 1370 insertions(+), 277 deletions(-)
 create mode 100644 tools/perf/tests/expr.c
 create mode 100644 tools/perf/util/expr.h
 create mode 100644 tools/perf/util/expr.y

Test results:

The first ones are container (docker) based builds of tools/perf with and
without libelf support, objtool where it is supported and samples/bpf/, ditto.
Where clang is available, it is also used to build perf with/without libelf.

Several are cross builds, the ones with -x-ARCH, and the android one, and those
may not have all the features built, due to lack of multi-arch devel packages,
available and being used so far on just a few, like
debian:experimental-x-{arm64,mipsel}.

The 'perf test' one will perform a variety of tests exercising
tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands
with a variety of command line event specifications to then intercept the
sys_perf_event syscall to check that the perf_event_attr fields are set up as
expected, among a variety of other unit tests.

Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/
with a variety of feature sets, exercising the build with an incomplete set of
features as well as with a complete one. It is planned to have it run on each
of the containers mentioned above, using some container orchestration
infrastructure. Get in contact if interested in helping having this in place.

  # dm
   1 alpine:3.4: Ok
   2 alpine:3.5: Ok
   3 alpine:edge: Ok
   4 android-ndk:r12b-arm: Ok
   5 archlinux:latest: Ok
   6 centos:5: Ok
   7 centos:6: Ok
   8 centos:7: Ok
   9 debian:7: Ok
  10 debian:8: Ok
  11 debian:experimental: Ok
  12 debian:experimental-x-arm64: Ok
  13 debian:experimental-x-mips: Ok
  14 debian:experimental-x-mips64: Ok
  15 debian:experimental-x-mipsel: Ok
  16 fedora:20: Ok
  17 fedora:21: Ok
  18 fedora:22: Ok
  19 fedora:23: Ok
  20 fedora:24: Ok
  21 fedora:24-x-ARC-uClibc: Ok
  22 fedora:25: Ok
  23 fedora:rawhide: Ok
  24 mageia:5: Ok
  25 opensuse:13.2: Ok
  26 opensuse:42.1: Ok
  27 opensuse:tumbleweed: Ok
  28 ubuntu:12.04.5: Ok
  29 ubuntu:14.04.4: Ok
  30 ubuntu:14.04.4-x-linaro-arm64: Ok
  31 ubuntu:15.10: Ok
  32 ubuntu:16.04: Ok
  33 ubuntu:16.04-x-arm: Ok
  34 ubuntu:16.04-x-arm64: Ok
  35 ubuntu:16.04-x-powerpc: Ok
  36 ubuntu:16.04-x-powerpc64: Ok
  37 ubuntu:16.04-x-s390: Ok
  38 ubuntu:16.10: Ok
  39 ubuntu:17.04: Ok
  #

  # uname -a
  Linux felicio.ghostprotocols.net 4.11.0-rc3+ #1 SMP Thu Mar 23 14:32:00 BRT 2017 x86_64 x86_64 x86_64 GNU/Linux
  # Has peterz's fix for 'perf test tsc'
  # perf test
   1: vmlinux symtab matches kallsyms            : Ok
   2: Detect openat syscall event                : Ok
   3: Detect openat syscall event on all cpus    : Ok
   4: Read samples using the mmap interface      : Ok
   5: Parse event definition strings             : Ok
   6: Simple expression parser                   : Ok
   7: PERF_RECORD_* events & perf_sample fields  : Ok
   8: Parse perf pmu format                      : Ok
   9: DSO data read                              : Ok
  10: DSO data cache                             : Ok
  11: DSO data reopen                            : Ok
  12: Roundtrip evsel->name                      : Ok
  13: Parse sched tracepoints fields             : Ok
  14: syscalls:sys_enter_openat event fields     : Ok
  15: Setup struct perf_event_attr               : Ok
  16: Match and link multiple hists              : Ok
  17: 'import perf' in python                    : Ok
  18: Breakpoint overflow signal handler         : Ok
  19: Breakpoint overflow sampling               : Ok
  20: Number of exit events of a simple workload : Ok
  21: Software clock events period values        : Ok
  22: Object code reading                        : Ok
  23: Sample parsing                             : Ok
  24: Use a dummy software event to keep tracking: Ok
  25: Parse with no sample_id_all bit set        : Ok
  26: Filter hist entries                        : Ok
  27: Lookup mmap thread                         : Ok
  28: Share thread mg                            : Ok
  29: Sort output of hist entries                : Ok
  30: Cumulate child hist entries                : Ok
  31: Track with sched_switch                    : Ok
  32: Filter fds with revents mask in a fdarray  : Ok
  33: Add fd to a fdarray, making it autogrow    : Ok
  34: kmod_path__parse                           : Ok
  35: Thread map                                 : Ok
  36: LLVM search and compile                    :
  36.1: Basic BPF llvm compile                    : Ok
  36.2: kbuild searching                          : Ok
  36.3: Compile source for BPF prologue generation: Ok
  36.4: Compile source for BPF relocation         : Ok
  37: Session topology                           : Ok
  38: BPF filter                                 :
  38.1: Basic BPF filtering                      : Ok
  38.2: BPF pinning                              : Ok
  38.3: BPF prologue generation                  : Ok
  38.4: BPF relocation checker                   : Ok
  39: Synthesize thread map                      : Ok
  40: Remove thread map                          : Ok
  41: Synthesize cpu map                         : Ok
  42: Synthesize stat config                     : Ok
  43: Synthesize stat                            : Ok
  44: Synthesize stat round                      : Ok
  45: Synthesize attr update                     : Ok
  46: Event times                                : Ok
  47: Read backward ring buffer                  : Ok
  48: Print cpu map                              : Ok
  49: Probe SDT events                           : Ok
  50: is_printable_array                         : Ok
  51: Print bitmap                               : Ok
  52: perf hooks                                 : Ok
  53: builtin clang support                      : Skip (not compiled in)
  54: unit_number__scnprintf                     : Ok
  55: x86 rdpmc                                  : Ok
  56: Convert perf time to TSC                   : Ok
  57: DWARF unwind                               : Ok
  58: x86 instruction decoder - new instructions : Ok
  59: Intel cqm nmi context read                 : Skip
  #

  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
                make_install_O: make install 
            make_install_bin_O: make install-bin 
         make_with_clangllvm_O: make LIBCLANGLLVM=1 
                   make_pure_O: make 
           make_no_libbionic_O: make NO_LIBBIONIC=1 
           make_no_backtrace_O: make NO_BACKTRACE=1 
                make_no_newt_O: make NO_NEWT=1 
                  make_debug_O: make DEBUG=1 
                    make_doc_O: make doc 
               make_no_slang_O: make NO_SLANG=1 
                 make_static_O: make LDFLAGS=-static 
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 
              make_no_libbpf_O: make NO_LIBBPF=1 
       make_util_pmu_bison_o_O: make util/pmu-bison.o 
                 make_perf_o_O: make perf.o 
             make_no_libnuma_O: make NO_LIBNUMA=1 
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1 
            make_no_demangle_O: make NO_DEMANGLE=1 
            make_no_auxtrace_O: make NO_AUXTRACE=1 
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1 
                   make_help_O: make help 
             make_util_map_o_O: make util/map.o 
             make_no_libperl_O: make NO_LIBPERL=1 
                make_no_gtk2_O: make NO_GTK2=1 
         make_install_prefix_O: make install prefix=/tmp/krava 
              make_clean_all_O: make clean all 
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 
           make_no_libunwind_O: make NO_LIBUNWIND=1 
           make_no_libpython_O: make NO_LIBPYTHON=1 
            make_no_libaudit_O: make NO_LIBAUDIT=1 
                   make_tags_O: make tags 
        make_with_babeltrace_O: make LIBBABELTRACE=1 
              make_no_libelf_O: make NO_LIBELF=1 
   make_install_prefix_slash_O: make install prefix=/tmp/krava/ 
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2017-03-24 14:57 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-03-24 14:57 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Alexis Berlemont, Andi Kleen, David Ahern,
	Hanjun Guo, Hemant Kumar, Jiri Olsa, John Shortt, Kefeng Wang,
	Madhavan Srinivasan, Masami Hiramatsu, Michael Ellerman,
	Namhyung Kim, Naveen N . Rao, Peter Zijlstra, Ravi Bangoria

Hi Ingo,

	Please consider pulling,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit 267dd0a07eefbb37264fcfad984fffc8856898ad:

  Merge tag 'perf-core-for-mingo-4.12-20170320' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2017-03-21 07:41:29 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-4.12-20170324

for you to fetch changes up to bf874fcf9f2fed58510dc83abcee388cee2b427e:

  perf list: Move extra details printing to new option (2017-03-23 11:42:31 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Allow suppressing 'uncore_' when specifying PMU events (Andi Kleen)

- Collapse identically named PMU events in 'perf stat', allow
  not merging it via --no-merge (Andi Kleen)

Fixes:

- Use more precise 'grep -v' to suppress unwanted 'objdump -dS'
  disassembly output to not ditch line:number lines needed by
  'perf annotate --print-lines' logic (Taeung Song)

Infrastructure:

- SDT (Statically Defined Tracing)/uprobes_events arguments improvements
  (Alexis Berlemont, Ravi Bangoria)

- Improvements for the handling of JSON described vendor events,
  including having an expression parser to calculate metrics
  from multiple vendor events (Andi Kleen)

- Update Intel JSON vendor event files (Andi Kleen)

- Restore error reporting in 'perf probe -d' when none of the events
  requested to be deleted exist. (Kefeng Wang)

- Bump MAX_CMDLEN in 'perf probe' to match what the kernel accepts
  (Ravi Bangoria)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Alexis Berlemont (2):
      perf sdt: Add scanning of sdt probes arguments
      perf probe: Add sdt probes arguments into the uprobe cmd string

Andi Kleen (13):
      perf stat: Factor out callback for collecting event values
      perf stat: Collapse identically named events
      perf stat: Handle partially bad results with merging
      perf tools: Factor out PMU matching in parser
      perf pmu: Expand PMU events by prefix match
      perf pmu: Special case uncore_ prefix
      perf tools: Add a simple expression parser for JSON
      perf vendor events intel: Update Intel uncore JSON event files
      perf pmu: Support MetricExpr header in JSON event list
      perf stat: Output JSON MetricExpr metric
      perf list: Support printing MetricExpr with --debug
      perf pmu: Add support for MetricName JSON attribute
      perf list: Move extra details printing to new option

Arnaldo Carvalho de Melo (1):
      perf annotate: Add comment clarifying how the source code line is parsed

Kefeng Wang (1):
      perf probe: Return errno when not hitting any event

Ravi Bangoria (2):
      perf probe: Change MAX_CMDLEN
      perf sdt x86: Add renaming logic for rNN and other registers

Taeung Song (1):
      perf annotate: More exactly grep -v of the objdump command

 tools/perf/Documentation/perf-list.txt             |   4 +
 tools/perf/Documentation/perf-stat.txt             |   3 +
 tools/perf/arch/x86/util/perf_regs.c               | 103 +++++++++++
 tools/perf/builtin-list.c                          |  14 +-
 tools/perf/builtin-probe.c                         |   6 +-
 tools/perf/builtin-stat.c                          | 146 ++++++++++++---
 .../arch/x86/broadwellde/uncore-cache.json         |  28 +--
 .../arch/x86/broadwellde/uncore-memory.json        |  26 ++-
 .../arch/x86/broadwellde/uncore-power.json         |  26 ++-
 .../arch/x86/broadwellx/uncore-cache.json          |  28 +--
 .../arch/x86/broadwellx/uncore-interconnect.json   |   6 +-
 .../arch/x86/broadwellx/uncore-memory.json         |  21 ++-
 .../arch/x86/broadwellx/uncore-power.json          |  26 ++-
 .../pmu-events/arch/x86/haswellx/uncore-cache.json |  28 +--
 .../arch/x86/haswellx/uncore-interconnect.json     |   6 +-
 .../arch/x86/haswellx/uncore-memory.json           |  21 ++-
 .../pmu-events/arch/x86/haswellx/uncore-power.json |  26 ++-
 .../pmu-events/arch/x86/ivytown/uncore-cache.json  |  22 +--
 .../arch/x86/ivytown/uncore-interconnect.json      |  12 +-
 .../pmu-events/arch/x86/ivytown/uncore-memory.json |  19 +-
 .../pmu-events/arch/x86/ivytown/uncore-power.json  |  53 ++++--
 .../pmu-events/arch/x86/jaketown/uncore-cache.json |  13 +-
 .../arch/x86/jaketown/uncore-interconnect.json     |  12 +-
 .../arch/x86/jaketown/uncore-memory.json           |  21 ++-
 .../pmu-events/arch/x86/jaketown/uncore-power.json |  53 ++++--
 tools/perf/pmu-events/jevents.c                    |  26 ++-
 tools/perf/pmu-events/jevents.h                    |   3 +-
 tools/perf/pmu-events/pmu-events.h                 |   2 +
 tools/perf/tests/Build                             |   1 +
 tools/perf/tests/builtin-test.c                    |   4 +
 tools/perf/tests/expr.c                            |  56 ++++++
 tools/perf/tests/tests.h                           |   1 +
 tools/perf/util/Build                              |   6 +
 tools/perf/util/annotate.c                         |   8 +-
 tools/perf/util/evsel.c                            |   4 +
 tools/perf/util/evsel.h                            |   5 +
 tools/perf/util/expr.h                             |  25 +++
 tools/perf/util/expr.y                             | 173 ++++++++++++++++++
 tools/perf/util/parse-events.c                     |  78 +++++++-
 tools/perf/util/parse-events.h                     |  10 +-
 tools/perf/util/parse-events.y                     |  73 ++++----
 tools/perf/util/perf_regs.c                        |   6 +
 tools/perf/util/perf_regs.h                        |   6 +
 tools/perf/util/pmu.c                              |  32 +++-
 tools/perf/util/pmu.h                              |   6 +-
 tools/perf/util/probe-event.c                      |   1 -
 tools/perf/util/probe-file.c                       | 173 +++++++++++++++++-
 tools/perf/util/stat-shadow.c                      | 197 +++++++++++++++++++++
 tools/perf/util/stat.h                             |   2 +
 tools/perf/util/symbol-elf.c                       |  25 ++-
 tools/perf/util/symbol.h                           |   1 +
 51 files changed, 1370 insertions(+), 277 deletions(-)
 create mode 100644 tools/perf/tests/expr.c
 create mode 100644 tools/perf/util/expr.h
 create mode 100644 tools/perf/util/expr.y

Test results:

The first ones are container (docker) based builds of tools/perf with and
without libelf support, objtool where it is supported and samples/bpf/, ditto.
Where clang is available, it is also used to build perf with/without libelf.

Several are cross builds, the ones with -x-ARCH, and the android one, and those
may not have all the features built, due to lack of multi-arch devel packages,
available and being used so far on just a few, like
debian:experimental-x-{arm64,mipsel}.

The 'perf test' one will perform a variety of tests exercising
tools/perf/util/, tools/lib/{bpf,traceevent,etc}, as well as run perf commands
with a variety of command line event specifications to then intercept the
sys_perf_event syscall to check that the perf_event_attr fields are set up as
expected, among a variety of other unit tests.

Then there is the 'make -C tools/perf build-test' ones, that build tools/perf/
with a variety of feature sets, exercising the build with an incomplete set of
features as well as with a complete one. It is planned to have it run on each
of the containers mentioned above, using some container orchestration
infrastructure. Get in contact if interested in helping having this in place.

  # dm
   1 alpine:3.4: Ok
   2 alpine:3.5: Ok
   3 alpine:edge: Ok
   4 android-ndk:r12b-arm: Ok
   5 archlinux:latest: Ok
   6 centos:5: Ok
   7 centos:6: Ok
   8 centos:7: Ok
   9 debian:7: Ok
  10 debian:8: Ok
  11 debian:experimental: Ok
  12 debian:experimental-x-arm64: Ok
  13 debian:experimental-x-mips: Ok
  14 debian:experimental-x-mips64: Ok
  15 debian:experimental-x-mipsel: Ok
  16 fedora:20: Ok
  17 fedora:21: Ok
  18 fedora:22: Ok
  19 fedora:23: Ok
  20 fedora:24: Ok
  21 fedora:24-x-ARC-uClibc: Ok
  22 fedora:25: Ok
  23 fedora:rawhide: Ok
  24 mageia:5: Ok
  25 opensuse:13.2: Ok
  26 opensuse:42.1: Ok
  27 opensuse:tumbleweed: Ok
  28 ubuntu:12.04.5: Ok
  29 ubuntu:14.04.4: Ok
  30 ubuntu:14.04.4-x-linaro-arm64: Ok
  31 ubuntu:15.10: Ok
  32 ubuntu:16.04: Ok
  33 ubuntu:16.04-x-arm: Ok
  34 ubuntu:16.04-x-arm64: Ok
  35 ubuntu:16.04-x-powerpc: Ok
  36 ubuntu:16.04-x-powerpc64: Ok
  37 ubuntu:16.04-x-s390: Ok
  38 ubuntu:16.10: Ok
  39 ubuntu:17.04: Ok
  #

  # uname -a
  Linux felicio.ghostprotocols.net 4.11.0-rc3+ #1 SMP Thu Mar 23 14:32:00 BRT 2017 x86_64 x86_64 x86_64 GNU/Linux
  # Has peterz's fix for 'perf test tsc'
  # perf test
   1: vmlinux symtab matches kallsyms            : Ok
   2: Detect openat syscall event                : Ok
   3: Detect openat syscall event on all cpus    : Ok
   4: Read samples using the mmap interface      : Ok
   5: Parse event definition strings             : Ok
   6: Simple expression parser                   : Ok
   7: PERF_RECORD_* events & perf_sample fields  : Ok
   8: Parse perf pmu format                      : Ok
   9: DSO data read                              : Ok
  10: DSO data cache                             : Ok
  11: DSO data reopen                            : Ok
  12: Roundtrip evsel->name                      : Ok
  13: Parse sched tracepoints fields             : Ok
  14: syscalls:sys_enter_openat event fields     : Ok
  15: Setup struct perf_event_attr               : Ok
  16: Match and link multiple hists              : Ok
  17: 'import perf' in python                    : Ok
  18: Breakpoint overflow signal handler         : Ok
  19: Breakpoint overflow sampling               : Ok
  20: Number of exit events of a simple workload : Ok
  21: Software clock events period values        : Ok
  22: Object code reading                        : Ok
  23: Sample parsing                             : Ok
  24: Use a dummy software event to keep tracking: Ok
  25: Parse with no sample_id_all bit set        : Ok
  26: Filter hist entries                        : Ok
  27: Lookup mmap thread                         : Ok
  28: Share thread mg                            : Ok
  29: Sort output of hist entries                : Ok
  30: Cumulate child hist entries                : Ok
  31: Track with sched_switch                    : Ok
  32: Filter fds with revents mask in a fdarray  : Ok
  33: Add fd to a fdarray, making it autogrow    : Ok
  34: kmod_path__parse                           : Ok
  35: Thread map                                 : Ok
  36: LLVM search and compile                    :
  36.1: Basic BPF llvm compile                    : Ok
  36.2: kbuild searching                          : Ok
  36.3: Compile source for BPF prologue generation: Ok
  36.4: Compile source for BPF relocation         : Ok
  37: Session topology                           : Ok
  38: BPF filter                                 :
  38.1: Basic BPF filtering                      : Ok
  38.2: BPF pinning                              : Ok
  38.3: BPF prologue generation                  : Ok
  38.4: BPF relocation checker                   : Ok
  39: Synthesize thread map                      : Ok
  40: Remove thread map                          : Ok
  41: Synthesize cpu map                         : Ok
  42: Synthesize stat config                     : Ok
  43: Synthesize stat                            : Ok
  44: Synthesize stat round                      : Ok
  45: Synthesize attr update                     : Ok
  46: Event times                                : Ok
  47: Read backward ring buffer                  : Ok
  48: Print cpu map                              : Ok
  49: Probe SDT events                           : Ok
  50: is_printable_array                         : Ok
  51: Print bitmap                               : Ok
  52: perf hooks                                 : Ok
  53: builtin clang support                      : Skip (not compiled in)
  54: unit_number__scnprintf                     : Ok
  55: x86 rdpmc                                  : Ok
  56: Convert perf time to TSC                   : Ok
  57: DWARF unwind                               : Ok
  58: x86 instruction decoder - new instructions : Ok
  59: Intel cqm nmi context read                 : Skip
  #

  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
                make_install_O: make install 
            make_install_bin_O: make install-bin 
         make_with_clangllvm_O: make LIBCLANGLLVM=1 
                   make_pure_O: make 
           make_no_libbionic_O: make NO_LIBBIONIC=1 
           make_no_backtrace_O: make NO_BACKTRACE=1 
                make_no_newt_O: make NO_NEWT=1 
                  make_debug_O: make DEBUG=1 
                    make_doc_O: make doc 
               make_no_slang_O: make NO_SLANG=1 
                 make_static_O: make LDFLAGS=-static 
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1 
              make_no_libbpf_O: make NO_LIBBPF=1 
       make_util_pmu_bison_o_O: make util/pmu-bison.o 
                 make_perf_o_O: make perf.o 
             make_no_libnuma_O: make NO_LIBNUMA=1 
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1 
            make_no_demangle_O: make NO_DEMANGLE=1 
            make_no_auxtrace_O: make NO_AUXTRACE=1 
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1 
                   make_help_O: make help 
             make_util_map_o_O: make util/map.o 
             make_no_libperl_O: make NO_LIBPERL=1 
                make_no_gtk2_O: make NO_GTK2=1 
         make_install_prefix_O: make install prefix=/tmp/krava 
              make_clean_all_O: make clean all 
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1 
           make_no_libunwind_O: make NO_LIBUNWIND=1 
           make_no_libpython_O: make NO_LIBPYTHON=1 
            make_no_libaudit_O: make NO_LIBAUDIT=1 
                   make_tags_O: make tags 
        make_with_babeltrace_O: make LIBBABELTRACE=1 
              make_no_libelf_O: make NO_LIBELF=1 
   make_install_prefix_slash_O: make install prefix=/tmp/krava/ 
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2016-12-05 21:37 Arnaldo Carvalho de Melo
@ 2016-12-06  8:17 ` Ingo Molnar
  0 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2016-12-06  8:17 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Alexander Shishkin, Alexei Starovoitov,
	Chris Riyder, David Ahern, He Kuang, Jiri Olsa, Joe Stringer,
	Kim Phillips, linuxppc-dev, Markus Trippelsdorf,
	Masami Hiramatsu, Michael Ellerman, Namhyung Kim, Naveen N . Rao,
	Peter Foley, Peter Zijlstra, Ravi Bangoria, Taeung Song,
	Wang Nan, Zefan Li, pi3orama, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit e7af7b15121ca08c31a0ab9df71a41b4c53365b4:
> 
>   Merge tag 'perf-core-for-mingo-20161201' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-12-02 10:08:03 +0100)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20161205
> 
> for you to fetch changes up to bec60e50af83741cde1786ab475d4bf472aed6f9:
> 
>   perf annotate: Show raw form for jump instruction with indirect target (2016-12-05 17:21:57 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> Fixes:
> 
> - Do not show a bogus target address in 'perf annotate' for targetless powerpc
>   jump instructions such as 'bctr' (Ravi Bangoria)
> 
> - tools/build fixes related to race conditions with the fixdep utility (Jiri Olsa)
> 
> - Fix building objtool with clang (Peter Foley)
> 
> Infrastructure:
> 
> - Support linking perf with clang and LLVM libraries, initially statically, but
>   this limitation will be lifted and shared libraries, when available, will
>   be preferred to the static build, that should, as with other features, be
>   enabled explicitly (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Jiri Olsa (7):
>       tools build: Make fixdep parsing wait for last target
>       tools build: Make the .cmd file more readable
>       tools build: Move tabs to spaces where suitable
>       perf tools: Move install-gtk target into rules area
>       perf tools: Move python/perf.so target into rules area
>       perf tools: Cleanup build directory before each test
>       perf tools: Add non config targets
> 
> Peter Foley (1):
>       tools build: Fix objtool build with clang
> 
> Ravi Bangoria (1):
>       perf annotate: Show raw form for jump instruction with indirect target
> 
> Wang Nan (11):
>       perf tools: Pass context to perf hook functions
>       perf llvm: Extract helpers in llvm-utils.c
>       tools build: Add feature detection for LLVM
>       tools build: Add feature detection for clang
>       perf build: Add clang and llvm compile and linking support
>       perf clang: Add builtin clang support ant test case
>       perf clang: Use real file system for #include
>       perf clang: Allow passing CFLAGS to builtin clang
>       perf clang: Update test case to use real BPF script
>       perf clang: Support compile IR to BPF object and add testcase
>       perf clang: Compile BPF script using builtin clang support
> 
>  tools/build/Build.include          |  20 ++--
>  tools/build/Makefile.feature       | 138 +++++++++++++-------------
>  tools/build/feature/Makefile       | 120 +++++++++++++----------
>  tools/build/feature/test-clang.cpp |  21 ++++
>  tools/build/feature/test-llvm.cpp  |   8 ++
>  tools/build/fixdep.c               |   5 +-
>  tools/perf/Makefile.config         |  62 +++++++++---
>  tools/perf/Makefile.perf           |  56 +++++++----
>  tools/perf/tests/Build             |   1 +
>  tools/perf/tests/builtin-test.c    |   9 ++
>  tools/perf/tests/clang.c           |  46 +++++++++
>  tools/perf/tests/llvm.h            |   7 ++
>  tools/perf/tests/make              |   4 +-
>  tools/perf/tests/perf-hooks.c      |  14 ++-
>  tools/perf/tests/tests.h           |   3 +
>  tools/perf/util/Build              |   2 +
>  tools/perf/util/annotate.c         |   3 +
>  tools/perf/util/bpf-loader.c       |  19 +++-
>  tools/perf/util/c++/Build          |   2 +
>  tools/perf/util/c++/clang-c.h      |  43 ++++++++
>  tools/perf/util/c++/clang-test.cpp |  62 ++++++++++++
>  tools/perf/util/c++/clang.cpp      | 195 +++++++++++++++++++++++++++++++++++++
>  tools/perf/util/c++/clang.h        |  26 +++++
>  tools/perf/util/llvm-utils.c       |  76 +++++++++++----
>  tools/perf/util/llvm-utils.h       |   6 ++
>  tools/perf/util/perf-hooks.c       |  10 +-
>  tools/perf/util/perf-hooks.h       |   6 +-
>  tools/perf/util/util-cxx.h         |  26 +++++
>  28 files changed, 795 insertions(+), 195 deletions(-)
>  create mode 100644 tools/build/feature/test-clang.cpp
>  create mode 100644 tools/build/feature/test-llvm.cpp
>  create mode 100644 tools/perf/tests/clang.c
>  create mode 100644 tools/perf/util/c++/Build
>  create mode 100644 tools/perf/util/c++/clang-c.h
>  create mode 100644 tools/perf/util/c++/clang-test.cpp
>  create mode 100644 tools/perf/util/c++/clang.cpp
>  create mode 100644 tools/perf/util/c++/clang.h
>  create mode 100644 tools/perf/util/util-cxx.h
> 
>   # uname -a
>   Linux jouet 4.8.8-300.fc25.x86_64 #1 SMP Tue Nov 15 18:10:06 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
>   # perf test
>    1: vmlinux symtab matches kallsyms            : Ok
>    2: Detect openat syscall event                : Ok
>    3: Detect openat syscall event on all cpus    : Ok
>    4: Read samples using the mmap interface      : Ok
>    5: Parse event definition strings             : Ok
>    6: PERF_RECORD_* events & perf_sample fields  : Ok
>    7: Parse perf pmu format                      : Ok
>    8: DSO data read                              : Ok
>    9: DSO data cache                             : Ok
>   10: DSO data reopen                            : Ok
>   11: Roundtrip evsel->name                      : Ok
>   12: Parse sched tracepoints fields             : Ok
>   13: syscalls:sys_enter_openat event fields     : Ok
>   14: Setup struct perf_event_attr               : Ok
>   15: Match and link multiple hists              : Ok
>   16: 'import perf' in python                    : Ok
>   17: Breakpoint overflow signal handler         : Ok
>   18: Breakpoint overflow sampling               : Ok
>   19: Number of exit events of a simple workload : Ok
>   20: Software clock events period values        : Ok
>   21: Object code reading                        : Ok
>   22: Sample parsing                             : Ok
>   23: Use a dummy software event to keep tracking: Ok
>   24: Parse with no sample_id_all bit set        : Ok
>   25: Filter hist entries                        : Ok
>   26: Lookup mmap thread                         : Ok
>   27: Share thread mg                            : Ok
>   28: Sort output of hist entries                : Ok
>   29: Cumulate child hist entries                : Ok
>   30: Track with sched_switch                    : Ok
>   31: Filter fds with revents mask in a fdarray  : Ok
>   32: Add fd to a fdarray, making it autogrow    : Ok
>   33: kmod_path__parse                           : Ok
>   34: Thread map                                 : Ok
>   35: LLVM search and compile                    :
>   35.1: Basic BPF llvm compile                    : Ok
>   35.2: kbuild searching                          : Ok
>   35.3: Compile source for BPF prologue generation: Ok
>   35.4: Compile source for BPF relocation         : Ok
>   36: Session topology                           : Ok
>   37: BPF filter                                 :
>   37.1: Basic BPF filtering                      : Ok
>   37.2: BPF prologue generation                  : Ok
>   37.3: BPF relocation checker                   : Ok
>   38: Synthesize thread map                      : Ok
>   39: Synthesize cpu map                         : Ok
>   40: Synthesize stat config                     : Ok
>   41: Synthesize stat                            : Ok
>   42: Synthesize stat round                      : Ok
>   43: Synthesize attr update                     : Ok
>   44: Event times                                : Ok
>   45: Read backward ring buffer                  : Ok
>   46: Print cpu map                              : Ok
>   47: Probe SDT events                           : Ok
>   48: is_printable_array                         : Ok
>   49: Print bitmap                               : Ok
>   50: perf hooks                                 : Ok
>   51: builtin clang support                      : Skip (not compiled in)
>   52: x86 rdpmc                                  : Ok
>   53: Convert perf time to TSC                   : Ok
>   54: DWARF unwind                               : Ok
>   55: x86 instruction decoder - new instructions : Ok
>   56: Intel cqm nmi context read                 : Skip
>   # 
>   # time dm
>    1 alpine:3.4: Ok
>    2 android-ndk:r12b-arm: Ok
>    3 archlinux:latest: Ok
>    4 centos:5: Ok
>    5 centos:6: Ok
>    6 centos:7: Ok
>    7 debian:7: Ok
>    8 debian:8: Ok
>    9 debian:experimental: Ok
>   10 fedora:20: Ok
>   11 fedora:21: Ok
>   12 fedora:22: Ok
>   13 fedora:23: Ok
>   14 fedora:24: Ok
>   15 fedora:24-x-ARC-uClibc: Ok
>   16 fedora:25: Ok
>   17 fedora:rawhide: Ok
>   18 mageia:5: Ok
>   19 opensuse:13.2: Ok
>   20 opensuse:42.1: Ok
>   21 opensuse:tumbleweed: Ok
>   22 ubuntu:12.04.5: Ok
>   23 ubuntu:14.04.4-x-linaro-arm64: Ok
>   24 ubuntu:16.04: Ok
>   25 ubuntu:16.04-x-arm: Ok
>   26 ubuntu:16.04-x-arm64: Ok
>   27 ubuntu:16.04-x-powerpc: Ok
>   28 ubuntu:16.04-x-powerpc64: Ok
>   29 ubuntu:16.04-x-powerpc64el: Ok
>   30 ubuntu:16.04-x-s390: Ok
>   31 ubuntu:16.10: Ok
>   #
>   $ make -C tools/perf build-test
>   make: Entering directory '/home/acme/git/linux/tools/perf'
>   - tarpkg: ./tests/perf-targz-src-pkg .
>            make_no_backtrace_O: make NO_BACKTRACE=1
>                 make_no_gtk2_O: make NO_GTK2=1
>                  make_static_O: make LDFLAGS=-static
>              make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
>                   make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
>                  make_perf_o_O: make perf.o
>                make_no_slang_O: make NO_SLANG=1
>          make_install_prefix_O: make install prefix=/tmp/krava
>            make_no_libpython_O: make NO_LIBPYTHON=1
>                 make_no_newt_O: make NO_NEWT=1
>                   make_debug_O: make DEBUG=1
>                    make_tags_O: make tags
>            make_no_libbionic_O: make NO_LIBBIONIC=1
>                    make_help_O: make help
>                 make_install_O: make install
>            make_no_libunwind_O: make NO_LIBUNWIND=1
>                    make_pure_O: make
>                 make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
>              make_no_libperl_O: make NO_LIBPERL=1
>               make_no_libbpf_O: make NO_LIBBPF=1
>   make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
>                     make_doc_O: make doc
>             make_no_libaudit_O: make NO_LIBAUDIT=1
>               make_clean_all_O: make clean all
>         make_with_babeltrace_O: make LIBBABELTRACE=1
>              make_no_libnuma_O: make NO_LIBNUMA=1
>              make_util_map_o_O: make util/map.o
>             make_install_bin_O: make install-bin
>             make_no_demangle_O: make NO_DEMANGLE=1
>               make_no_libelf_O: make NO_LIBELF=1
>             make_no_auxtrace_O: make NO_AUXTRACE=1
>        make_util_pmu_bison_o_O: make util/pmu-bison.o
>    make_install_prefix_slash_O: make install prefix=/tmp/krava/
>          make_with_clangllvm_O: make LIBCLANGLLVM=1
>   OK
>   make: Leaving directory '/home/acme/git/linux/tools/perf'
>   $

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2016-12-05 21:37 Arnaldo Carvalho de Melo
  2016-12-06  8:17 ` Ingo Molnar
  0 siblings, 1 reply; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-12-05 21:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Alexander Shishkin,
	Alexei Starovoitov, Chris Riyder, David Ahern, He Kuang,
	Jiri Olsa, Joe Stringer, Kim Phillips, linuxppc-dev,
	Markus Trippelsdorf, Masami Hiramatsu, Michael Ellerman,
	Namhyung Kim, Naveen N . Rao, Peter Foley, Peter Zijlstra,
	Ravi Bangoria, Taeung Song, Wang Nan, Zefan Li, pi3orama,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

Test results at the end of this message, as usual.

The following changes since commit e7af7b15121ca08c31a0ab9df71a41b4c53365b4:

  Merge tag 'perf-core-for-mingo-20161201' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-12-02 10:08:03 +0100)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo-20161205

for you to fetch changes up to bec60e50af83741cde1786ab475d4bf472aed6f9:

  perf annotate: Show raw form for jump instruction with indirect target (2016-12-05 17:21:57 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

Fixes:

- Do not show a bogus target address in 'perf annotate' for targetless powerpc
  jump instructions such as 'bctr' (Ravi Bangoria)

- tools/build fixes related to race conditions with the fixdep utility (Jiri Olsa)

- Fix building objtool with clang (Peter Foley)

Infrastructure:

- Support linking perf with clang and LLVM libraries, initially statically, but
  this limitation will be lifted and shared libraries, when available, will
  be preferred to the static build, that should, as with other features, be
  enabled explicitly (Wang Nan)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Jiri Olsa (7):
      tools build: Make fixdep parsing wait for last target
      tools build: Make the .cmd file more readable
      tools build: Move tabs to spaces where suitable
      perf tools: Move install-gtk target into rules area
      perf tools: Move python/perf.so target into rules area
      perf tools: Cleanup build directory before each test
      perf tools: Add non config targets

Peter Foley (1):
      tools build: Fix objtool build with clang

Ravi Bangoria (1):
      perf annotate: Show raw form for jump instruction with indirect target

Wang Nan (11):
      perf tools: Pass context to perf hook functions
      perf llvm: Extract helpers in llvm-utils.c
      tools build: Add feature detection for LLVM
      tools build: Add feature detection for clang
      perf build: Add clang and llvm compile and linking support
      perf clang: Add builtin clang support ant test case
      perf clang: Use real file system for #include
      perf clang: Allow passing CFLAGS to builtin clang
      perf clang: Update test case to use real BPF script
      perf clang: Support compile IR to BPF object and add testcase
      perf clang: Compile BPF script using builtin clang support

 tools/build/Build.include          |  20 ++--
 tools/build/Makefile.feature       | 138 +++++++++++++-------------
 tools/build/feature/Makefile       | 120 +++++++++++++----------
 tools/build/feature/test-clang.cpp |  21 ++++
 tools/build/feature/test-llvm.cpp  |   8 ++
 tools/build/fixdep.c               |   5 +-
 tools/perf/Makefile.config         |  62 +++++++++---
 tools/perf/Makefile.perf           |  56 +++++++----
 tools/perf/tests/Build             |   1 +
 tools/perf/tests/builtin-test.c    |   9 ++
 tools/perf/tests/clang.c           |  46 +++++++++
 tools/perf/tests/llvm.h            |   7 ++
 tools/perf/tests/make              |   4 +-
 tools/perf/tests/perf-hooks.c      |  14 ++-
 tools/perf/tests/tests.h           |   3 +
 tools/perf/util/Build              |   2 +
 tools/perf/util/annotate.c         |   3 +
 tools/perf/util/bpf-loader.c       |  19 +++-
 tools/perf/util/c++/Build          |   2 +
 tools/perf/util/c++/clang-c.h      |  43 ++++++++
 tools/perf/util/c++/clang-test.cpp |  62 ++++++++++++
 tools/perf/util/c++/clang.cpp      | 195 +++++++++++++++++++++++++++++++++++++
 tools/perf/util/c++/clang.h        |  26 +++++
 tools/perf/util/llvm-utils.c       |  76 +++++++++++----
 tools/perf/util/llvm-utils.h       |   6 ++
 tools/perf/util/perf-hooks.c       |  10 +-
 tools/perf/util/perf-hooks.h       |   6 +-
 tools/perf/util/util-cxx.h         |  26 +++++
 28 files changed, 795 insertions(+), 195 deletions(-)
 create mode 100644 tools/build/feature/test-clang.cpp
 create mode 100644 tools/build/feature/test-llvm.cpp
 create mode 100644 tools/perf/tests/clang.c
 create mode 100644 tools/perf/util/c++/Build
 create mode 100644 tools/perf/util/c++/clang-c.h
 create mode 100644 tools/perf/util/c++/clang-test.cpp
 create mode 100644 tools/perf/util/c++/clang.cpp
 create mode 100644 tools/perf/util/c++/clang.h
 create mode 100644 tools/perf/util/util-cxx.h

  # uname -a
  Linux jouet 4.8.8-300.fc25.x86_64 #1 SMP Tue Nov 15 18:10:06 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  # perf test
   1: vmlinux symtab matches kallsyms            : Ok
   2: Detect openat syscall event                : Ok
   3: Detect openat syscall event on all cpus    : Ok
   4: Read samples using the mmap interface      : Ok
   5: Parse event definition strings             : Ok
   6: PERF_RECORD_* events & perf_sample fields  : Ok
   7: Parse perf pmu format                      : Ok
   8: DSO data read                              : Ok
   9: DSO data cache                             : Ok
  10: DSO data reopen                            : Ok
  11: Roundtrip evsel->name                      : Ok
  12: Parse sched tracepoints fields             : Ok
  13: syscalls:sys_enter_openat event fields     : Ok
  14: Setup struct perf_event_attr               : Ok
  15: Match and link multiple hists              : Ok
  16: 'import perf' in python                    : Ok
  17: Breakpoint overflow signal handler         : Ok
  18: Breakpoint overflow sampling               : Ok
  19: Number of exit events of a simple workload : Ok
  20: Software clock events period values        : Ok
  21: Object code reading                        : Ok
  22: Sample parsing                             : Ok
  23: Use a dummy software event to keep tracking: Ok
  24: Parse with no sample_id_all bit set        : Ok
  25: Filter hist entries                        : Ok
  26: Lookup mmap thread                         : Ok
  27: Share thread mg                            : Ok
  28: Sort output of hist entries                : Ok
  29: Cumulate child hist entries                : Ok
  30: Track with sched_switch                    : Ok
  31: Filter fds with revents mask in a fdarray  : Ok
  32: Add fd to a fdarray, making it autogrow    : Ok
  33: kmod_path__parse                           : Ok
  34: Thread map                                 : Ok
  35: LLVM search and compile                    :
  35.1: Basic BPF llvm compile                    : Ok
  35.2: kbuild searching                          : Ok
  35.3: Compile source for BPF prologue generation: Ok
  35.4: Compile source for BPF relocation         : Ok
  36: Session topology                           : Ok
  37: BPF filter                                 :
  37.1: Basic BPF filtering                      : Ok
  37.2: BPF prologue generation                  : Ok
  37.3: BPF relocation checker                   : Ok
  38: Synthesize thread map                      : Ok
  39: Synthesize cpu map                         : Ok
  40: Synthesize stat config                     : Ok
  41: Synthesize stat                            : Ok
  42: Synthesize stat round                      : Ok
  43: Synthesize attr update                     : Ok
  44: Event times                                : Ok
  45: Read backward ring buffer                  : Ok
  46: Print cpu map                              : Ok
  47: Probe SDT events                           : Ok
  48: is_printable_array                         : Ok
  49: Print bitmap                               : Ok
  50: perf hooks                                 : Ok
  51: builtin clang support                      : Skip (not compiled in)
  52: x86 rdpmc                                  : Ok
  53: Convert perf time to TSC                   : Ok
  54: DWARF unwind                               : Ok
  55: x86 instruction decoder - new instructions : Ok
  56: Intel cqm nmi context read                 : Skip
  # 
  # time dm
   1 alpine:3.4: Ok
   2 android-ndk:r12b-arm: Ok
   3 archlinux:latest: Ok
   4 centos:5: Ok
   5 centos:6: Ok
   6 centos:7: Ok
   7 debian:7: Ok
   8 debian:8: Ok
   9 debian:experimental: Ok
  10 fedora:20: Ok
  11 fedora:21: Ok
  12 fedora:22: Ok
  13 fedora:23: Ok
  14 fedora:24: Ok
  15 fedora:24-x-ARC-uClibc: Ok
  16 fedora:25: Ok
  17 fedora:rawhide: Ok
  18 mageia:5: Ok
  19 opensuse:13.2: Ok
  20 opensuse:42.1: Ok
  21 opensuse:tumbleweed: Ok
  22 ubuntu:12.04.5: Ok
  23 ubuntu:14.04.4-x-linaro-arm64: Ok
  24 ubuntu:16.04: Ok
  25 ubuntu:16.04-x-arm: Ok
  26 ubuntu:16.04-x-arm64: Ok
  27 ubuntu:16.04-x-powerpc: Ok
  28 ubuntu:16.04-x-powerpc64: Ok
  29 ubuntu:16.04-x-powerpc64el: Ok
  30 ubuntu:16.04-x-s390: Ok
  31 ubuntu:16.10: Ok
  #
  $ make -C tools/perf build-test
  make: Entering directory '/home/acme/git/linux/tools/perf'
  - tarpkg: ./tests/perf-targz-src-pkg .
           make_no_backtrace_O: make NO_BACKTRACE=1
                make_no_gtk2_O: make NO_GTK2=1
                 make_static_O: make LDFLAGS=-static
             make_no_scripts_O: make NO_LIBPYTHON=1 NO_LIBPERL=1
                  make_no_ui_O: make NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
                 make_perf_o_O: make perf.o
               make_no_slang_O: make NO_SLANG=1
         make_install_prefix_O: make install prefix=/tmp/krava
           make_no_libpython_O: make NO_LIBPYTHON=1
                make_no_newt_O: make NO_NEWT=1
                  make_debug_O: make DEBUG=1
                   make_tags_O: make tags
           make_no_libbionic_O: make NO_LIBBIONIC=1
                   make_help_O: make help
                make_install_O: make install
           make_no_libunwind_O: make NO_LIBUNWIND=1
                   make_pure_O: make
                make_minimal_O: make NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1 NO_LIBDW_DWARF_UNWIND=1 NO_AUXTRACE=1 NO_LIBBPF=1 NO_LIBCRYPTO=1 NO_SDT=1 NO_JVMTI=1
             make_no_libperl_O: make NO_LIBPERL=1
              make_no_libbpf_O: make NO_LIBBPF=1
  make_no_libdw_dwarf_unwind_O: make NO_LIBDW_DWARF_UNWIND=1
                    make_doc_O: make doc
            make_no_libaudit_O: make NO_LIBAUDIT=1
              make_clean_all_O: make clean all
        make_with_babeltrace_O: make LIBBABELTRACE=1
             make_no_libnuma_O: make NO_LIBNUMA=1
             make_util_map_o_O: make util/map.o
            make_install_bin_O: make install-bin
            make_no_demangle_O: make NO_DEMANGLE=1
              make_no_libelf_O: make NO_LIBELF=1
            make_no_auxtrace_O: make NO_AUXTRACE=1
       make_util_pmu_bison_o_O: make util/pmu-bison.o
   make_install_prefix_slash_O: make install prefix=/tmp/krava/
         make_with_clangllvm_O: make LIBCLANGLLVM=1
  OK
  make: Leaving directory '/home/acme/git/linux/tools/perf'
  $

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2015-03-10 14:03   ` Arnaldo Carvalho de Melo
@ 2015-03-10 14:37     ` Ingo Molnar
  0 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2015-03-10 14:37 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Adrian Hunter,
	Andi Kleen, Borislav Petkov, David Ahern, Don Zickus,
	Frederic Weisbecker, He Kuang, H . Peter Anvin, Jiri Olsa,
	Kaixu Xia, Kan Liang, Masami Hiramatsu, Namhyung Kim,
	Naohiro Aota, Peter Zijlstra, Stephane Eranian,
	Suzuki K . Poulose, Thomas Gleixner


* Arnaldo Carvalho de Melo <acme@redhat.com> wrote:

> Em Tue, Mar 10, 2015 at 11:03:31AM +0100, Ingo Molnar escreveu:
> > So I got this error today:
> > 
> >   ┌─Warning:───────────────────────────┐
> >   │The vmlinux file can't be used.     │
> >   │Kernel samples will not be resolved.│
> >   │                                    │
> >   │                                    │
> >   │Press any key...                    │
> >   └────────────────────────────────────┘
> > 
> > ... and sadly perf is being passive-aggressive again: being negative 
> > but refusing to say why! :-)
> 
> > Is there a way to figure out why it did not like the vmlinux?
> 
> I'll check and improve the message.
> 
> But you must've noticed that perf is going to a therapist, aka 
> improving error messages... ;-)

Absolutely! ;-)

Also, on the positive side, today I was able to build and run perf on 
ancient user-space: a Fedora Core 6 installation, with very few hacks 
(see the attached hacks).

The HAVE_NEW_FLAX hack results in a non-working -e option.

Thanks,

	Ingo

Index: tip/tools/perf/util/parse-events.c
===================================================================
--- tip.orig/tools/perf/util/parse-events.c
+++ tip/tools/perf/util/parse-events.c
@@ -968,6 +968,13 @@ perf_pmu__parse_check(const char *name)
 	return r ? r->type : PMU_EVENT_SYMBOL_ERR;
 }
 
+#ifndef HAVE_NEW_FLEX
+static int parse_events_lex_init_extra(int start_token __maybe_unused, void **scanner __maybe_unused)
+{
+	return -1;
+}
+#endif
+
 static int parse_events__scanner(const char *str, void *data, int start_token)
 {
 	YY_BUFFER_STATE buffer;
Index: tip/tools/perf/util/symbol-elf.c
===================================================================
--- tip.orig/tools/perf/util/symbol-elf.c
+++ tip/tools/perf/util/symbol-elf.c
@@ -53,6 +53,13 @@ static int elf_getphdrnum(Elf *elf, size
 }
 #endif
 
+#ifndef HAVE_ELF_GETPHDRNUM
+static int elf_getphdrnum (Elf *__elf __maybe_unused, size_t *__dst __maybe_unused)
+{
+	return 1;
+}
+#endif
+
 #ifndef NT_GNU_BUILD_ID
 #define NT_GNU_BUILD_ID 3
 #endif

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2015-03-10 10:03 ` Ingo Molnar
@ 2015-03-10 14:03   ` Arnaldo Carvalho de Melo
  2015-03-10 14:37     ` Ingo Molnar
  0 siblings, 1 reply; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-10 14:03 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Adrian Hunter,
	Andi Kleen, Borislav Petkov, David Ahern, Don Zickus,
	Frederic Weisbecker, He Kuang, H . Peter Anvin, Jiri Olsa,
	Kaixu Xia, Kan Liang, Masami Hiramatsu, Namhyung Kim,
	Naohiro Aota, Peter Zijlstra, Stephane Eranian,
	Suzuki K . Poulose, Thomas Gleixner

Em Tue, Mar 10, 2015 at 11:03:31AM +0100, Ingo Molnar escreveu:
> So I got this error today:
> 
>   ┌─Warning:───────────────────────────┐
>   │The vmlinux file can't be used.     │
>   │Kernel samples will not be resolved.│
>   │                                    │
>   │                                    │
>   │Press any key...                    │
>   └────────────────────────────────────┘
> 
> ... and sadly perf is being passive-aggressive again: being negative 
> but refusing to say why! :-)

> Is there a way to figure out why it did not like the vmlinux?

I'll check and improve the message.

But you must've noticed that perf is going to a therapist, aka improving
error messages... ;-)

- Arnaldo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2015-03-03  3:25 Arnaldo Carvalho de Melo
  2015-03-03  6:20 ` Ingo Molnar
@ 2015-03-10 10:03 ` Ingo Molnar
  2015-03-10 14:03   ` Arnaldo Carvalho de Melo
  1 sibling, 1 reply; 43+ messages in thread
From: Ingo Molnar @ 2015-03-10 10:03 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, Borislav Petkov,
	David Ahern, Don Zickus, Frederic Weisbecker, He Kuang,
	H . Peter Anvin, Jiri Olsa, Kaixu Xia, Kan Liang,
	Masami Hiramatsu, Namhyung Kim, Naohiro Aota, Peter Zijlstra,
	Stephane Eranian, Suzuki K . Poulose, Thomas Gleixner,
	Arnaldo Carvalho de Melo


So I got this error today:


                                                                  ┌─Warning:───────────────────────────┐
                                                                  │The vmlinux file can't be used.     │
                                                                  │Kernel samples will not be resolved.│
                                                                  │                                    │
                                                                  │                                    │
                                                                  │Press any key...                    │
                                                                  └────────────────────────────────────┘

... and sadly perf is being passive-aggressive again: being negative 
but refusing to say why! :-)

Is there a way to figure out why it did not like the vmlinux?

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2015-03-03  3:25 Arnaldo Carvalho de Melo
@ 2015-03-03  6:20 ` Ingo Molnar
  2015-03-10 10:03 ` Ingo Molnar
  1 sibling, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2015-03-03  6:20 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, Borislav Petkov,
	David Ahern, Don Zickus, Frederic Weisbecker, He Kuang,
	H . Peter Anvin, Jiri Olsa, Kaixu Xia, Kan Liang,
	Masami Hiramatsu, Namhyung Kim, Naohiro Aota, Peter Zijlstra,
	Stephane Eranian, Suzuki K . Poulose, Thomas Gleixner,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	This one has the thread reference counting, that I tested using 'perf probe':
> 
>   perf probe -x ~/bin/perf 'thread__delete:4 thread refcnt=thread->refcnt tid=thread->tid'
>   perf probe -x ~/bin/perf 'thread__get:1 thread refcnt=thread->refcnt tid=thread->tid'
>   perf probe -x ~/bin/perf 'thread__put:6 thread refcnt=thread->refcnt tid=thread->tid'
>   perf record -o thread_refcnt.data -g -e probe_perf:thread__put,probe_perf:thread__get_1,probe_perf:thread__delete perf top
> 
> 	with that I checked and in the end the refcount reaches zero and
> thread__delete is called, as expected, using 'perf script', looking at the
> callchains, etc, did the same for 'perf sched lat' and 'trace' also seems to
> work.
> 
> 	David, Namhyung, please holler if you find something fishy with this
> thread refcnt stuff, as it is something that is related to previous/current
> work by you guys,
> 
> 	Ah, I also merged perf/urgent so that it is buildable in more systems.o
> 
> 	There is also the revert for that is_power_of_2 "simplification" in perf_mmap,
> that hasn't made it to perf/urgent nor upstream, its something only in perf/core, sorry
> about that one, should have caught that :-\
> 
> 	Please consider pulling,
> 
> - Arnaldo
> The following changes since commit 33be4ef116511f1079c4c3bf4b5547faf7439301:
> 
>   Merge 'tip/perf/urgent' into perf/core to pick fixes (2015-03-02 11:45:49 -0300)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to ae536acfacb65a4a9858c32b12361e09f84f4157:
> 
>   perf sched: No need to keep the session around (2015-03-03 00:17:12 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Warn if given uprobe event accesses memory on older kernel (Masami Hiramatsu)
> 
> - 'perf record' Documentation fixes (Namhyung Kim)
> 
> - Report unsupported events properly in 'perf stat' (Suzuki K. Poulose)
> 
> Infrastructure:
> 
> - Avoid FORK after COMM when synthesizing records for pre-existing threads (Arnaldo Carvalho de Melo)
> 
> - Reference count struct thread (Arnaldo Carvalho de Melo)
> 
> - No need to keep the session around in 'perf sched', thread refcounting removes that need (Arnaldo Carvalho de Melo)
> 
> - Initialize cpu set in pthread_attr_setaffinity_np feature test (Adrian Hunter)
> 
> - Only include tsc file for x86 (David Ahern)
> 
> - Compare JOBS to 0 after grep (David Ahern)
> 
> - Improve feature detection messages (Ingo Molnar)
> 
> - Revert "perf: Remove the extra validity check on nr_pages" (Kan Liang)
> 
> - Remove bias offset to find probe point by address (Masami Hiramatsu)
> 
> - Fix build error on ARCH=i386/x86_64/sparc64 )Namhyung Kim)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (1):
>       perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test
> 
> Arnaldo Carvalho de Melo (3):
>       perf tools: Fix FORK after COMM when synthesizing records for pre-existing threads
>       perf tools: Reference count struct thread
>       perf sched: No need to keep the session around
> 
> David Ahern (2):
>       perf tools: Only include tsc file for x86
>       perf tools: Compare JOBS to 0 after grep
> 
> Ingo Molnar (7):
>       perf tools: Add PERF-FEATURES to the .gitignore file
>       perf tools: Remove annoying extra message from the features build
>       perf tools: Improve Python feature detection messages
>       perf tools: Improve libperl detection message
>       perf tools: Improve libbfd detection message
>       perf tools: Improve feature test debuggability
>       perf tools: Improve 'libbabel' feature check failure message
> 
> Kan Liang (1):
>       Revert "perf: Remove the extra validity check on nr_pages"
> 
> Masami Hiramatsu (2):
>       perf probe: Warn if given uprobe event accesses memory on older kernel
>       perf probe: Remove bias offset to find probe point by address
> 
> Namhyung Kim (3):
>       perf tools: Fix build error on ARCH=i386/x86_64/sparc64
>       perf record: Get rid of -l option from Documentation
>       perf record: Document --group option
> 
> Suzuki K. Poulose (1):
>       perf stat: Report unsupported events properly
> 
>  kernel/events/core.c                               |  2 +-
>  tools/perf/.gitignore                              |  1 +
>  tools/perf/Documentation/perf-record.txt           | 12 ++++--
>  tools/perf/Makefile                                |  2 +-
>  tools/perf/builtin-sched.c                         | 26 +++++--------
>  tools/perf/builtin-stat.c                          |  5 ++-
>  tools/perf/builtin-trace.c                         |  7 +++-
>  tools/perf/config/Makefile                         | 17 ++++-----
>  tools/perf/config/Makefile.arch                    | 27 +++----------
>  tools/perf/config/feature-checks/Makefile          | 16 ++++----
>  .../test-pthread-attr-setaffinity-np.c             |  4 +-
>  tools/perf/config/utilities.mak                    |  3 +-
>  tools/perf/ui/browsers/hists.c                     |  6 +--
>  tools/perf/util/Build                              |  2 +-
>  tools/perf/util/build-id.c                         |  5 ++-
>  tools/perf/util/event.c                            | 34 ++++++++++++-----
>  tools/perf/util/hist.c                             |  2 +
>  tools/perf/util/hist.h                             |  2 +-
>  tools/perf/util/machine.c                          | 44 +++++++++++-----------
>  tools/perf/util/machine.h                          |  1 -
>  tools/perf/util/probe-event.c                      | 23 +++++++++++
>  tools/perf/util/probe-finder.c                     |  5 +--
>  tools/perf/util/session.c                          |  6 ---
>  tools/perf/util/thread.c                           | 14 +++++++
>  tools/perf/util/thread.h                           | 13 +++++++
>  25 files changed, 164 insertions(+), 115 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2015-03-03  3:25 Arnaldo Carvalho de Melo
  2015-03-03  6:20 ` Ingo Molnar
  2015-03-10 10:03 ` Ingo Molnar
  0 siblings, 2 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-03  3:25 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andi Kleen, Borislav Petkov, David Ahern, Don Zickus,
	Frederic Weisbecker, He Kuang, H . Peter Anvin, Jiri Olsa,
	Kaixu Xia, Kan Liang, Masami Hiramatsu, Namhyung Kim,
	Naohiro Aota, Peter Zijlstra, Stephane Eranian,
	Suzuki K . Poulose, Thomas Gleixner, Arnaldo Carvalho de Melo

Hi Ingo,

	This one has the thread reference counting, that I tested using 'perf probe':

  perf probe -x ~/bin/perf 'thread__delete:4 thread refcnt=thread->refcnt tid=thread->tid'
  perf probe -x ~/bin/perf 'thread__get:1 thread refcnt=thread->refcnt tid=thread->tid'
  perf probe -x ~/bin/perf 'thread__put:6 thread refcnt=thread->refcnt tid=thread->tid'
  perf record -o thread_refcnt.data -g -e probe_perf:thread__put,probe_perf:thread__get_1,probe_perf:thread__delete perf top

	with that I checked and in the end the refcount reaches zero and
thread__delete is called, as expected, using 'perf script', looking at the
callchains, etc, did the same for 'perf sched lat' and 'trace' also seems to
work.

	David, Namhyung, please holler if you find something fishy with this
thread refcnt stuff, as it is something that is related to previous/current
work by you guys,

	Ah, I also merged perf/urgent so that it is buildable in more systems.o

	There is also the revert for that is_power_of_2 "simplification" in perf_mmap,
that hasn't made it to perf/urgent nor upstream, its something only in perf/core, sorry
about that one, should have caught that :-\

	Please consider pulling,

- Arnaldo
The following changes since commit 33be4ef116511f1079c4c3bf4b5547faf7439301:

  Merge 'tip/perf/urgent' into perf/core to pick fixes (2015-03-02 11:45:49 -0300)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to ae536acfacb65a4a9858c32b12361e09f84f4157:

  perf sched: No need to keep the session around (2015-03-03 00:17:12 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

- Warn if given uprobe event accesses memory on older kernel (Masami Hiramatsu)

- 'perf record' Documentation fixes (Namhyung Kim)

- Report unsupported events properly in 'perf stat' (Suzuki K. Poulose)

Infrastructure:

- Avoid FORK after COMM when synthesizing records for pre-existing threads (Arnaldo Carvalho de Melo)

- Reference count struct thread (Arnaldo Carvalho de Melo)

- No need to keep the session around in 'perf sched', thread refcounting removes that need (Arnaldo Carvalho de Melo)

- Initialize cpu set in pthread_attr_setaffinity_np feature test (Adrian Hunter)

- Only include tsc file for x86 (David Ahern)

- Compare JOBS to 0 after grep (David Ahern)

- Improve feature detection messages (Ingo Molnar)

- Revert "perf: Remove the extra validity check on nr_pages" (Kan Liang)

- Remove bias offset to find probe point by address (Masami Hiramatsu)

- Fix build error on ARCH=i386/x86_64/sparc64 )Namhyung Kim)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (1):
      perf tools: Initialize cpu set in pthread_attr_setaffinity_np feature test

Arnaldo Carvalho de Melo (3):
      perf tools: Fix FORK after COMM when synthesizing records for pre-existing threads
      perf tools: Reference count struct thread
      perf sched: No need to keep the session around

David Ahern (2):
      perf tools: Only include tsc file for x86
      perf tools: Compare JOBS to 0 after grep

Ingo Molnar (7):
      perf tools: Add PERF-FEATURES to the .gitignore file
      perf tools: Remove annoying extra message from the features build
      perf tools: Improve Python feature detection messages
      perf tools: Improve libperl detection message
      perf tools: Improve libbfd detection message
      perf tools: Improve feature test debuggability
      perf tools: Improve 'libbabel' feature check failure message

Kan Liang (1):
      Revert "perf: Remove the extra validity check on nr_pages"

Masami Hiramatsu (2):
      perf probe: Warn if given uprobe event accesses memory on older kernel
      perf probe: Remove bias offset to find probe point by address

Namhyung Kim (3):
      perf tools: Fix build error on ARCH=i386/x86_64/sparc64
      perf record: Get rid of -l option from Documentation
      perf record: Document --group option

Suzuki K. Poulose (1):
      perf stat: Report unsupported events properly

 kernel/events/core.c                               |  2 +-
 tools/perf/.gitignore                              |  1 +
 tools/perf/Documentation/perf-record.txt           | 12 ++++--
 tools/perf/Makefile                                |  2 +-
 tools/perf/builtin-sched.c                         | 26 +++++--------
 tools/perf/builtin-stat.c                          |  5 ++-
 tools/perf/builtin-trace.c                         |  7 +++-
 tools/perf/config/Makefile                         | 17 ++++-----
 tools/perf/config/Makefile.arch                    | 27 +++----------
 tools/perf/config/feature-checks/Makefile          | 16 ++++----
 .../test-pthread-attr-setaffinity-np.c             |  4 +-
 tools/perf/config/utilities.mak                    |  3 +-
 tools/perf/ui/browsers/hists.c                     |  6 +--
 tools/perf/util/Build                              |  2 +-
 tools/perf/util/build-id.c                         |  5 ++-
 tools/perf/util/event.c                            | 34 ++++++++++++-----
 tools/perf/util/hist.c                             |  2 +
 tools/perf/util/hist.h                             |  2 +-
 tools/perf/util/machine.c                          | 44 +++++++++++-----------
 tools/perf/util/machine.h                          |  1 -
 tools/perf/util/probe-event.c                      | 23 +++++++++++
 tools/perf/util/probe-finder.c                     |  5 +--
 tools/perf/util/session.c                          |  6 ---
 tools/perf/util/thread.c                           | 14 +++++++
 tools/perf/util/thread.h                           | 13 +++++++
 25 files changed, 164 insertions(+), 115 deletions(-)

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2014-09-17 21:24 ` Arnaldo Carvalho de Melo
@ 2014-09-19  5:15   ` Ingo Molnar
  -1 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2014-09-19  5:15 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Yarygin, Anton Blanchard,
	Avi Kivity, Chanho Park, Christian Borntraeger, Corey Ashford,
	David Ahern, david lerner, Don Zickus, Frederic Weisbecker,
	Jean Pihet, Jiri Olsa, John Spencer, Kyle McMartin,
	linux-perf-users, Masami Hiramatsu, Michael Ellerman,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian, Sukadev Bhattiprolu, yrl.pp-manager.tt,
	Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit c88f2096136416b261bd3647cc260935f6e95805:
> 
>   perf: Do not check PERF_EVENT_STATE_EXIT on syscall read path (2014-09-16 10:30:36 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to e5685730e2c620f97bc12380e9370e857e5bd7a7:
> 
>   perf record: Use ring buffer consume method to look like other tools (2014-09-17 18:01:43 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> o Add +field argument support for --sort option (Jiri Olsa)
> 
> o Do not access kallsyms when analyzing user binaries with 'probe' (Masami Hiramatsu)
> 
> o Ignore stripped vmlinux and fallback to kallsyms (Anton Blanchard)
> 
> o Add path to Ubuntu kernel debuginfo file (Anton Blanchard)
> 
> o Disable kernel symbol demangling by default (Avi Kivity)
> 
> Infrastructure:
> 
> o More intel PT prep work, from Adrian Hunter, including:
> 
>   - Let a user specify a PMU event without any config terms
>   - Add perf-with-kcore script
>   - Let default config be defined for a PMU
>   - Add perf_pmu__scan_file()
> 
> o "perf kvm stat report" improvements by Alexander Yarygin:
>   o  Save pid string in opts.target.pid
>   o  Enable the target.system_wide flag
>   o  Unify the title bar output
> 
> o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)
> 
> o Allow to specify lib compile variable for spec usage (Jiri Olsa)
> 
> o Fix build on ARM (Stephane Eranian)
> 
> o Fix build on powerpc when DWARF support is disabled (Anton Blanchard)
> 
> o Don't include sys/poll.h directly (Arnaldo Carvalho de Melo)
> 
> o Use ring buffer consume method to look like other tools (Arnaldo Carvalho de Melo)
> 
> Chanho Park (1):
>   perf tools: define _DEFAULT_SOURCE for glibc_2.20
> 
> o Allow to specify lib compile variable for spec usage (Jiri Olsa)
> 
> o Fix GNU-only grep usage in Makefile (John Spencer)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (4):
>       perf tools: Let a user specify a PMU event without any config terms
>       perf tools: Add perf-with-kcore script
>       perf tools: Let default config be defined for a PMU
>       perf tools: Add perf_pmu__scan_file()
> 
> Alexander Yarygin (3):
>       perf kvm stat report: Save pid string in opts.target.pid
>       perf kvm stat report: Enable the target.system_wide flag
>       perf kvm stat report: Unify the title bar output
> 
> Anton Blanchard (3):
>       perf tools powerpc: Fix build issue when DWARF support is disabled
>       perf symbols: Ignore stripped vmlinux and fallback to kallsyms
>       perf symbols: Add path to Ubuntu kernel debuginfo file
> 
> Arnaldo Carvalho de Melo (2):
>       perf tools: Don't include sys/poll.h directly
>       perf record: Use ring buffer consume method to look like other tools
> 
> Avi Kivity (1):
>       perf tools: Disable kernel symbol demangling by default
> 
> Chanho Park (1):
>       perf tools: define _DEFAULT_SOURCE for glibc_2.20
> 
> Jiri Olsa (2):
>       perf tools: Add +field argument support for --sort option
>       perf tools: Allow to specify lib compile variable for spec usage
> 
> John Spencer (1):
>       perf tools: Fix GNU-only grep usage in Makefile
> 
> Masami Hiramatsu (2):
>       perf probe: Do not access kallsyms when analyzing user binaries
>       perf probe: Do not use dwfl_module_addrsym if dwarf_diename finds symbol name
> 
> Stephane Eranian (1):
>       perf tool: fix compilation for ARM
> 
>  tools/perf/.gitignore                       |   1 +
>  tools/perf/Documentation/perf-probe.txt     |   3 +
>  tools/perf/Documentation/perf-report.txt    |   3 +
>  tools/perf/Documentation/perf-top.txt       |   3 +
>  tools/perf/Makefile.perf                    |   5 +-
>  tools/perf/arch/arm/tests/dwarf-unwind.c    |   1 +
>  tools/perf/arch/arm/util/unwind-libunwind.c |   1 +
>  tools/perf/arch/powerpc/Makefile            |   2 +-
>  tools/perf/bench/sched-messaging.c          |   2 +-
>  tools/perf/builtin-kvm.c                    |  23 +--
>  tools/perf/builtin-probe.c                  |   5 +-
>  tools/perf/builtin-record.c                 |   8 +-
>  tools/perf/builtin-report.c                 |   2 +
>  tools/perf/builtin-top.c                    |   4 +-
>  tools/perf/config/Makefile                  |  12 +-
>  tools/perf/config/utilities.mak             |   2 +-
>  tools/perf/perf-with-kcore.sh               | 259 ++++++++++++++++++++++++++++
>  tools/perf/tests/pmu.c                      |   2 +-
>  tools/perf/util/kvm-stat.h                  |   1 -
>  tools/perf/util/parse-events.c              |  13 +-
>  tools/perf/util/parse-events.y              |  10 ++
>  tools/perf/util/pmu.c                       |  79 +++++++--
>  tools/perf/util/pmu.h                       |  12 +-
>  tools/perf/util/probe-event.c               |   9 +-
>  tools/perf/util/probe-event.h               |   3 +-
>  tools/perf/util/probe-finder.c              |  16 +-
>  tools/perf/util/sort.c                      |  37 +++-
>  tools/perf/util/symbol-elf.c                |  15 +-
>  tools/perf/util/symbol.c                    |   9 +-
>  tools/perf/util/symbol.h                    |   1 +
>  tools/perf/util/util.h                      |   4 +-
>  31 files changed, 487 insertions(+), 60 deletions(-)
>  create mode 100644 tools/perf/perf-with-kcore.sh

Pulled into tip:perf/core, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
@ 2014-09-19  5:15   ` Ingo Molnar
  0 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2014-09-19  5:15 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Yarygin, Anton Blanchard,
	Avi Kivity, Chanho Park, Christian Borntraeger, Corey Ashford,
	David Ahern, david lerner, Don Zickus, Frederic Weisbecker,
	Jean Pihet, Jiri Olsa, John Spencer, Kyle McMartin,
	linux-perf-users, Masami Hiramatsu, Michael Ellerman,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra


* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit c88f2096136416b261bd3647cc260935f6e95805:
> 
>   perf: Do not check PERF_EVENT_STATE_EXIT on syscall read path (2014-09-16 10:30:36 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to e5685730e2c620f97bc12380e9370e857e5bd7a7:
> 
>   perf record: Use ring buffer consume method to look like other tools (2014-09-17 18:01:43 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> o Add +field argument support for --sort option (Jiri Olsa)
> 
> o Do not access kallsyms when analyzing user binaries with 'probe' (Masami Hiramatsu)
> 
> o Ignore stripped vmlinux and fallback to kallsyms (Anton Blanchard)
> 
> o Add path to Ubuntu kernel debuginfo file (Anton Blanchard)
> 
> o Disable kernel symbol demangling by default (Avi Kivity)
> 
> Infrastructure:
> 
> o More intel PT prep work, from Adrian Hunter, including:
> 
>   - Let a user specify a PMU event without any config terms
>   - Add perf-with-kcore script
>   - Let default config be defined for a PMU
>   - Add perf_pmu__scan_file()
> 
> o "perf kvm stat report" improvements by Alexander Yarygin:
>   o  Save pid string in opts.target.pid
>   o  Enable the target.system_wide flag
>   o  Unify the title bar output
> 
> o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)
> 
> o Allow to specify lib compile variable for spec usage (Jiri Olsa)
> 
> o Fix build on ARM (Stephane Eranian)
> 
> o Fix build on powerpc when DWARF support is disabled (Anton Blanchard)
> 
> o Don't include sys/poll.h directly (Arnaldo Carvalho de Melo)
> 
> o Use ring buffer consume method to look like other tools (Arnaldo Carvalho de Melo)
> 
> Chanho Park (1):
>   perf tools: define _DEFAULT_SOURCE for glibc_2.20
> 
> o Allow to specify lib compile variable for spec usage (Jiri Olsa)
> 
> o Fix GNU-only grep usage in Makefile (John Spencer)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (4):
>       perf tools: Let a user specify a PMU event without any config terms
>       perf tools: Add perf-with-kcore script
>       perf tools: Let default config be defined for a PMU
>       perf tools: Add perf_pmu__scan_file()
> 
> Alexander Yarygin (3):
>       perf kvm stat report: Save pid string in opts.target.pid
>       perf kvm stat report: Enable the target.system_wide flag
>       perf kvm stat report: Unify the title bar output
> 
> Anton Blanchard (3):
>       perf tools powerpc: Fix build issue when DWARF support is disabled
>       perf symbols: Ignore stripped vmlinux and fallback to kallsyms
>       perf symbols: Add path to Ubuntu kernel debuginfo file
> 
> Arnaldo Carvalho de Melo (2):
>       perf tools: Don't include sys/poll.h directly
>       perf record: Use ring buffer consume method to look like other tools
> 
> Avi Kivity (1):
>       perf tools: Disable kernel symbol demangling by default
> 
> Chanho Park (1):
>       perf tools: define _DEFAULT_SOURCE for glibc_2.20
> 
> Jiri Olsa (2):
>       perf tools: Add +field argument support for --sort option
>       perf tools: Allow to specify lib compile variable for spec usage
> 
> John Spencer (1):
>       perf tools: Fix GNU-only grep usage in Makefile
> 
> Masami Hiramatsu (2):
>       perf probe: Do not access kallsyms when analyzing user binaries
>       perf probe: Do not use dwfl_module_addrsym if dwarf_diename finds symbol name
> 
> Stephane Eranian (1):
>       perf tool: fix compilation for ARM
> 
>  tools/perf/.gitignore                       |   1 +
>  tools/perf/Documentation/perf-probe.txt     |   3 +
>  tools/perf/Documentation/perf-report.txt    |   3 +
>  tools/perf/Documentation/perf-top.txt       |   3 +
>  tools/perf/Makefile.perf                    |   5 +-
>  tools/perf/arch/arm/tests/dwarf-unwind.c    |   1 +
>  tools/perf/arch/arm/util/unwind-libunwind.c |   1 +
>  tools/perf/arch/powerpc/Makefile            |   2 +-
>  tools/perf/bench/sched-messaging.c          |   2 +-
>  tools/perf/builtin-kvm.c                    |  23 +--
>  tools/perf/builtin-probe.c                  |   5 +-
>  tools/perf/builtin-record.c                 |   8 +-
>  tools/perf/builtin-report.c                 |   2 +
>  tools/perf/builtin-top.c                    |   4 +-
>  tools/perf/config/Makefile                  |  12 +-
>  tools/perf/config/utilities.mak             |   2 +-
>  tools/perf/perf-with-kcore.sh               | 259 ++++++++++++++++++++++++++++
>  tools/perf/tests/pmu.c                      |   2 +-
>  tools/perf/util/kvm-stat.h                  |   1 -
>  tools/perf/util/parse-events.c              |  13 +-
>  tools/perf/util/parse-events.y              |  10 ++
>  tools/perf/util/pmu.c                       |  79 +++++++--
>  tools/perf/util/pmu.h                       |  12 +-
>  tools/perf/util/probe-event.c               |   9 +-
>  tools/perf/util/probe-event.h               |   3 +-
>  tools/perf/util/probe-finder.c              |  16 +-
>  tools/perf/util/sort.c                      |  37 +++-
>  tools/perf/util/symbol-elf.c                |  15 +-
>  tools/perf/util/symbol.c                    |   9 +-
>  tools/perf/util/symbol.h                    |   1 +
>  tools/perf/util/util.h                      |   4 +-
>  31 files changed, 487 insertions(+), 60 deletions(-)
>  create mode 100644 tools/perf/perf-with-kcore.sh

Pulled into tip:perf/core, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2014-09-17 21:24 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-09-17 21:24 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Yarygin, Anton Blanchard, Avi Kivity, Chanho Park,
	Christian Borntraeger, Corey Ashford, David Ahern, david lerner,
	Don Zickus, Frederic Weisbecker, Jean Pihet, Jiri Olsa,
	John Spencer, Kyle McMartin, linux-perf-users, Masami Hiramatsu,
	Michael Ellerman, Mike Galbraith, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Stephane Eranian, Sukadev Bhattiprolu,
	yrl.pp-manager.tt, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit c88f2096136416b261bd3647cc260935f6e95805:

  perf: Do not check PERF_EVENT_STATE_EXIT on syscall read path (2014-09-16 10:30:36 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to e5685730e2c620f97bc12380e9370e857e5bd7a7:

  perf record: Use ring buffer consume method to look like other tools (2014-09-17 18:01:43 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

o Do not access kallsyms when analyzing user binaries with 'probe' (Masami Hiramatsu)

o Ignore stripped vmlinux and fallback to kallsyms (Anton Blanchard)

o Add path to Ubuntu kernel debuginfo file (Anton Blanchard)

o Disable kernel symbol demangling by default (Avi Kivity)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

  - Let a user specify a PMU event without any config terms
  - Add perf-with-kcore script
  - Let default config be defined for a PMU
  - Add perf_pmu__scan_file()

o "perf kvm stat report" improvements by Alexander Yarygin:
  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

o Fix build on ARM (Stephane Eranian)

o Fix build on powerpc when DWARF support is disabled (Anton Blanchard)

o Don't include sys/poll.h directly (Arnaldo Carvalho de Melo)

o Use ring buffer consume method to look like other tools (Arnaldo Carvalho de Melo)

Chanho Park (1):
  perf tools: define _DEFAULT_SOURCE for glibc_2.20

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

o Fix GNU-only grep usage in Makefile (John Spencer)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (4):
      perf tools: Let a user specify a PMU event without any config terms
      perf tools: Add perf-with-kcore script
      perf tools: Let default config be defined for a PMU
      perf tools: Add perf_pmu__scan_file()

Alexander Yarygin (3):
      perf kvm stat report: Save pid string in opts.target.pid
      perf kvm stat report: Enable the target.system_wide flag
      perf kvm stat report: Unify the title bar output

Anton Blanchard (3):
      perf tools powerpc: Fix build issue when DWARF support is disabled
      perf symbols: Ignore stripped vmlinux and fallback to kallsyms
      perf symbols: Add path to Ubuntu kernel debuginfo file

Arnaldo Carvalho de Melo (2):
      perf tools: Don't include sys/poll.h directly
      perf record: Use ring buffer consume method to look like other tools

Avi Kivity (1):
      perf tools: Disable kernel symbol demangling by default

Chanho Park (1):
      perf tools: define _DEFAULT_SOURCE for glibc_2.20

Jiri Olsa (2):
      perf tools: Add +field argument support for --sort option
      perf tools: Allow to specify lib compile variable for spec usage

John Spencer (1):
      perf tools: Fix GNU-only grep usage in Makefile

Masami Hiramatsu (2):
      perf probe: Do not access kallsyms when analyzing user binaries
      perf probe: Do not use dwfl_module_addrsym if dwarf_diename finds symbol name

Stephane Eranian (1):
      perf tool: fix compilation for ARM

 tools/perf/.gitignore                       |   1 +
 tools/perf/Documentation/perf-probe.txt     |   3 +
 tools/perf/Documentation/perf-report.txt    |   3 +
 tools/perf/Documentation/perf-top.txt       |   3 +
 tools/perf/Makefile.perf                    |   5 +-
 tools/perf/arch/arm/tests/dwarf-unwind.c    |   1 +
 tools/perf/arch/arm/util/unwind-libunwind.c |   1 +
 tools/perf/arch/powerpc/Makefile            |   2 +-
 tools/perf/bench/sched-messaging.c          |   2 +-
 tools/perf/builtin-kvm.c                    |  23 +--
 tools/perf/builtin-probe.c                  |   5 +-
 tools/perf/builtin-record.c                 |   8 +-
 tools/perf/builtin-report.c                 |   2 +
 tools/perf/builtin-top.c                    |   4 +-
 tools/perf/config/Makefile                  |  12 +-
 tools/perf/config/utilities.mak             |   2 +-
 tools/perf/perf-with-kcore.sh               | 259 ++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c                      |   2 +-
 tools/perf/util/kvm-stat.h                  |   1 -
 tools/perf/util/parse-events.c              |  13 +-
 tools/perf/util/parse-events.y              |  10 ++
 tools/perf/util/pmu.c                       |  79 +++++++--
 tools/perf/util/pmu.h                       |  12 +-
 tools/perf/util/probe-event.c               |   9 +-
 tools/perf/util/probe-event.h               |   3 +-
 tools/perf/util/probe-finder.c              |  16 +-
 tools/perf/util/sort.c                      |  37 +++-
 tools/perf/util/symbol-elf.c                |  15 +-
 tools/perf/util/symbol.c                    |   9 +-
 tools/perf/util/symbol.h                    |   1 +
 tools/perf/util/util.h                      |   4 +-
 31 files changed, 487 insertions(+), 60 deletions(-)
 create mode 100644 tools/perf/perf-with-kcore.sh

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2014-09-17 21:24 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-09-17 21:24 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Yarygin, Anton Blanchard, Avi Kivity, Chanho Park,
	Christian Borntraeger, Corey Ashford, David Ahern, david lerner,
	Don Zickus, Frederic Weisbecker, Jean Pihet, Jiri Olsa,
	John Spencer, Kyle McMartin, linux-perf-users, Masami Hiramatsu,
	Michael Ellerman, Mike Galbraith, Namhyung Kim, Paul Mackerras

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit c88f2096136416b261bd3647cc260935f6e95805:

  perf: Do not check PERF_EVENT_STATE_EXIT on syscall read path (2014-09-16 10:30:36 +0200)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo

for you to fetch changes up to e5685730e2c620f97bc12380e9370e857e5bd7a7:

  perf record: Use ring buffer consume method to look like other tools (2014-09-17 18:01:43 -0300)

----------------------------------------------------------------
perf/core improvements and fixes:

User visible:

o Add +field argument support for --sort option (Jiri Olsa)

o Do not access kallsyms when analyzing user binaries with 'probe' (Masami Hiramatsu)

o Ignore stripped vmlinux and fallback to kallsyms (Anton Blanchard)

o Add path to Ubuntu kernel debuginfo file (Anton Blanchard)

o Disable kernel symbol demangling by default (Avi Kivity)

Infrastructure:

o More intel PT prep work, from Adrian Hunter, including:

  - Let a user specify a PMU event without any config terms
  - Add perf-with-kcore script
  - Let default config be defined for a PMU
  - Add perf_pmu__scan_file()

o "perf kvm stat report" improvements by Alexander Yarygin:
  o  Save pid string in opts.target.pid
  o  Enable the target.system_wide flag
  o  Unify the title bar output

o Fix build issue on powerpc when DWARF support is disabled (Anton Blanchard)

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

o Fix build on ARM (Stephane Eranian)

o Fix build on powerpc when DWARF support is disabled (Anton Blanchard)

o Don't include sys/poll.h directly (Arnaldo Carvalho de Melo)

o Use ring buffer consume method to look like other tools (Arnaldo Carvalho de Melo)

Chanho Park (1):
  perf tools: define _DEFAULT_SOURCE for glibc_2.20

o Allow to specify lib compile variable for spec usage (Jiri Olsa)

o Fix GNU-only grep usage in Makefile (John Spencer)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Adrian Hunter (4):
      perf tools: Let a user specify a PMU event without any config terms
      perf tools: Add perf-with-kcore script
      perf tools: Let default config be defined for a PMU
      perf tools: Add perf_pmu__scan_file()

Alexander Yarygin (3):
      perf kvm stat report: Save pid string in opts.target.pid
      perf kvm stat report: Enable the target.system_wide flag
      perf kvm stat report: Unify the title bar output

Anton Blanchard (3):
      perf tools powerpc: Fix build issue when DWARF support is disabled
      perf symbols: Ignore stripped vmlinux and fallback to kallsyms
      perf symbols: Add path to Ubuntu kernel debuginfo file

Arnaldo Carvalho de Melo (2):
      perf tools: Don't include sys/poll.h directly
      perf record: Use ring buffer consume method to look like other tools

Avi Kivity (1):
      perf tools: Disable kernel symbol demangling by default

Chanho Park (1):
      perf tools: define _DEFAULT_SOURCE for glibc_2.20

Jiri Olsa (2):
      perf tools: Add +field argument support for --sort option
      perf tools: Allow to specify lib compile variable for spec usage

John Spencer (1):
      perf tools: Fix GNU-only grep usage in Makefile

Masami Hiramatsu (2):
      perf probe: Do not access kallsyms when analyzing user binaries
      perf probe: Do not use dwfl_module_addrsym if dwarf_diename finds symbol name

Stephane Eranian (1):
      perf tool: fix compilation for ARM

 tools/perf/.gitignore                       |   1 +
 tools/perf/Documentation/perf-probe.txt     |   3 +
 tools/perf/Documentation/perf-report.txt    |   3 +
 tools/perf/Documentation/perf-top.txt       |   3 +
 tools/perf/Makefile.perf                    |   5 +-
 tools/perf/arch/arm/tests/dwarf-unwind.c    |   1 +
 tools/perf/arch/arm/util/unwind-libunwind.c |   1 +
 tools/perf/arch/powerpc/Makefile            |   2 +-
 tools/perf/bench/sched-messaging.c          |   2 +-
 tools/perf/builtin-kvm.c                    |  23 +--
 tools/perf/builtin-probe.c                  |   5 +-
 tools/perf/builtin-record.c                 |   8 +-
 tools/perf/builtin-report.c                 |   2 +
 tools/perf/builtin-top.c                    |   4 +-
 tools/perf/config/Makefile                  |  12 +-
 tools/perf/config/utilities.mak             |   2 +-
 tools/perf/perf-with-kcore.sh               | 259 ++++++++++++++++++++++++++++
 tools/perf/tests/pmu.c                      |   2 +-
 tools/perf/util/kvm-stat.h                  |   1 -
 tools/perf/util/parse-events.c              |  13 +-
 tools/perf/util/parse-events.y              |  10 ++
 tools/perf/util/pmu.c                       |  79 +++++++--
 tools/perf/util/pmu.h                       |  12 +-
 tools/perf/util/probe-event.c               |   9 +-
 tools/perf/util/probe-event.h               |   3 +-
 tools/perf/util/probe-finder.c              |  16 +-
 tools/perf/util/sort.c                      |  37 +++-
 tools/perf/util/symbol-elf.c                |  15 +-
 tools/perf/util/symbol.c                    |   9 +-
 tools/perf/util/symbol.h                    |   1 +
 tools/perf/util/util.h                      |   4 +-
 31 files changed, 487 insertions(+), 60 deletions(-)
 create mode 100644 tools/perf/perf-with-kcore.sh

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2012-09-11 23:52 Arnaldo Carvalho de Melo
@ 2012-09-13 15:15 ` Ingo Molnar
  0 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2012-09-13 15:15 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, David Ahern, Frederic Weisbecker, Irina Tirdea,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Namhyung Kim,
	Paul Mackerras, Pekka Enberg, Peter Zijlstra, Stephane Eranian,
	Steven Rostedt, arnaldo.melo, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> Best Regards,
> 
> - Arnaldo
> 
> The following changes since commit d5cb2aef4fda355fbafe8db4f425b73ea94d2019:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2012-09-09 10:39:14 +0200)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
> 
> for you to fetch changes up to 9ec3f4e437ede2f3b5087d412abe16a0219b3b99:
> 
>   perf sched: Don't read all tracepoint variables in advance (2012-09-11 20:39:19 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes
> 
> . Remove die()/exit() calls from several tools.
> 
> . Add missing perf_regs.h file to MANIFEST
> 
> . Clean up and improve 'perf sched' performance by elliminating lots of
>   needless calls to libtraceevent.
> 
> . More patches to make perf build on Android, from Irina Tirdea
> 
> . Resolve vdso callchains, from Jiri Olsa
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (9):
>       perf test: Remove die() calls
>       perf sched: Remove die() calls
>       perf kmem: Remove die() calls
>       perf tools: Add missing perf_regs.h file to MANIFEST
>       perf sched: Remove unused thread parameter
>       perf sched: Use perf_tool as ancestor
>       perf evsel: Introduce perf_evsel__{str,int}val methods
>       perf sched: Use perf_evsel__{int,str}val
>       perf sched: Don't read all tracepoint variables in advance
> 
> Irina Tirdea (5):
>       perf tools: include wrapper for magic.h
>       perf tools: Update types definitions for Android
>       perf tools: include __WORDSIZE definition
>       perf tools: fix ALIGN redefinition in system headers
>       perf tools: Use __maybe_used for unused variables
> 
> Jiri Olsa (4):
>       perf tools: Do backtrace post unwind only if we regs and stack were captured
>       perf tools: Add memdup function
>       perf symbols: Make dsos__find function globally available
>       perf tools: Back [vdso] DSO with real data
> 
>  tools/lib/traceevent/event-parse.c                 |    8 +-
>  tools/lib/traceevent/event-parse.h                 |    4 +-
>  tools/perf/MANIFEST                                |    1 +
>  tools/perf/Makefile                                |    3 +
>  tools/perf/bench/bench.h                           |    3 +-
>  tools/perf/bench/mem-memcpy.c                      |    2 +-
>  tools/perf/bench/mem-memset.c                      |    2 +-
>  tools/perf/bench/sched-messaging.c                 |    2 +-
>  tools/perf/bench/sched-pipe.c                      |    6 +-
>  tools/perf/builtin-annotate.c                      |    2 +-
>  tools/perf/builtin-bench.c                         |    2 +-
>  tools/perf/builtin-buildid-cache.c                 |   10 +-
>  tools/perf/builtin-buildid-list.c                  |    3 +-
>  tools/perf/builtin-diff.c                          |    4 +-
>  tools/perf/builtin-evlist.c                        |    2 +-
>  tools/perf/builtin-help.c                          |    2 +-
>  tools/perf/builtin-inject.c                        |   24 +-
>  tools/perf/builtin-kmem.c                          |  130 +-
>  tools/perf/builtin-kvm.c                           |    2 +-
>  tools/perf/builtin-list.c                          |    2 +-
>  tools/perf/builtin-lock.c                          |    4 +-
>  tools/perf/builtin-probe.c                         |   24 +-
>  tools/perf/builtin-record.c                        |   10 +-
>  tools/perf/builtin-report.c                        |   11 +-
>  tools/perf/builtin-sched.c                         | 1446 +++++++++-----------
>  tools/perf/builtin-script.c                        |   29 +-
>  tools/perf/builtin-stat.c                          |   40 +-
>  tools/perf/builtin-test.c                          |   23 +-
>  tools/perf/builtin-timechart.c                     |   30 +-
>  tools/perf/builtin-top.c                           |    7 +-
>  tools/perf/ui/browser.c                            |    7 +-
>  tools/perf/ui/browsers/annotate.c                  |    6 +-
>  tools/perf/ui/gtk/browser.c                        |    5 +-
>  tools/perf/ui/gtk/setup.c                          |    2 +-
>  tools/perf/ui/gtk/util.c                           |    4 +-
>  tools/perf/ui/helpline.c                           |    2 +-
>  tools/perf/ui/helpline.h                           |    8 +-
>  tools/perf/ui/hist.c                               |   21 +-
>  tools/perf/ui/tui/setup.c                          |    4 +-
>  tools/perf/util/alias.c                            |    3 +-
>  tools/perf/util/annotate.c                         |    6 +-
>  tools/perf/util/annotate.h                         |   13 +-
>  tools/perf/util/build-id.c                         |   11 +-
>  tools/perf/util/cache.h                            |    6 +-
>  tools/perf/util/callchain.c                        |    6 +-
>  tools/perf/util/cgroup.c                           |    4 +-
>  tools/perf/util/config.c                           |    6 +-
>  tools/perf/util/debug.h                            |    9 +-
>  tools/perf/util/event.c                            |   29 +-
>  tools/perf/util/event.h                            |    2 +-
>  tools/perf/util/evsel.c                            |   35 +
>  tools/perf/util/evsel.h                            |    7 +
>  tools/perf/util/header.c                           |  177 ++-
>  tools/perf/util/header.h                           |    2 +-
>  tools/perf/util/help.c                             |    3 +-
>  tools/perf/util/hist.c                             |    2 +-
>  tools/perf/util/hist.h                             |   32 +-
>  tools/perf/util/include/linux/bitops.h             |    4 +
>  tools/perf/util/include/linux/compiler.h           |    8 +-
>  tools/perf/util/include/linux/kernel.h             |   13 +-
>  tools/perf/util/include/linux/magic.h              |   12 +
>  tools/perf/util/include/linux/string.h             |    2 +
>  tools/perf/util/include/linux/types.h              |    8 +
>  tools/perf/util/intlist.c                          |    4 +-
>  tools/perf/util/map.c                              |   12 +-
>  tools/perf/util/map.h                              |    2 +-
>  tools/perf/util/parse-events-test.c                |    6 +-
>  tools/perf/util/parse-events.c                     |    7 +-
>  tools/perf/util/parse-events.l                     |    2 +-
>  tools/perf/util/parse-events.y                     |    4 +-
>  tools/perf/util/parse-options.c                    |    3 +-
>  tools/perf/util/perf_regs.h                        |    2 +-
>  tools/perf/util/pmu.y                              |    6 +-
>  tools/perf/util/probe-event.c                      |   21 +-
>  tools/perf/util/probe-finder.c                     |    4 +-
>  tools/perf/util/python.c                           |    8 +-
>  .../perf/util/scripting-engines/trace-event-perl.c |    8 +-
>  .../util/scripting-engines/trace-event-python.c    |   10 +-
>  tools/perf/util/session.c                          |   61 +-
>  tools/perf/util/sort.c                             |   14 +-
>  tools/perf/util/string.c                           |   18 +-
>  tools/perf/util/symbol-minimal.c                   |   28 +-
>  tools/perf/util/symbol.c                           |    6 +-
>  tools/perf/util/symbol.h                           |    8 +-
>  tools/perf/util/trace-event-parse.c                |    4 +-
>  tools/perf/util/trace-event-scripting.c            |   33 +-
>  tools/perf/util/unwind.c                           |   36 +-
>  tools/perf/util/unwind.h                           |   11 +-
>  tools/perf/util/util.h                             |    2 +-
>  tools/perf/util/vdso.c                             |  111 ++
>  tools/perf/util/vdso.h                             |   18 +
>  tools/perf/util/wrapper.c                          |    3 +-
>  92 files changed, 1518 insertions(+), 1231 deletions(-)
>  create mode 100644 tools/perf/util/include/linux/magic.h
>  create mode 100644 tools/perf/util/vdso.c
>  create mode 100644 tools/perf/util/vdso.h

Pulled, thanks a lot Arnaldo!

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2012-09-11 23:52 Arnaldo Carvalho de Melo
  2012-09-13 15:15 ` Ingo Molnar
  0 siblings, 1 reply; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-09-11 23:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, David Ahern,
	Frederic Weisbecker, Irina Tirdea, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Namhyung Kim, Paul Mackerras, Pekka Enberg,
	Peter Zijlstra, Stephane Eranian, Steven Rostedt, arnaldo.melo,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

Best Regards,

- Arnaldo

The following changes since commit d5cb2aef4fda355fbafe8db4f425b73ea94d2019:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2012-09-09 10:39:14 +0200)

are available in the git repository at:


  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo

for you to fetch changes up to 9ec3f4e437ede2f3b5087d412abe16a0219b3b99:

  perf sched: Don't read all tracepoint variables in advance (2012-09-11 20:39:19 -0300)

----------------------------------------------------------------
perf/core improvements and fixes

. Remove die()/exit() calls from several tools.

. Add missing perf_regs.h file to MANIFEST

. Clean up and improve 'perf sched' performance by elliminating lots of
  needless calls to libtraceevent.

. More patches to make perf build on Android, from Irina Tirdea

. Resolve vdso callchains, from Jiri Olsa

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (9):
      perf test: Remove die() calls
      perf sched: Remove die() calls
      perf kmem: Remove die() calls
      perf tools: Add missing perf_regs.h file to MANIFEST
      perf sched: Remove unused thread parameter
      perf sched: Use perf_tool as ancestor
      perf evsel: Introduce perf_evsel__{str,int}val methods
      perf sched: Use perf_evsel__{int,str}val
      perf sched: Don't read all tracepoint variables in advance

Irina Tirdea (5):
      perf tools: include wrapper for magic.h
      perf tools: Update types definitions for Android
      perf tools: include __WORDSIZE definition
      perf tools: fix ALIGN redefinition in system headers
      perf tools: Use __maybe_used for unused variables

Jiri Olsa (4):
      perf tools: Do backtrace post unwind only if we regs and stack were captured
      perf tools: Add memdup function
      perf symbols: Make dsos__find function globally available
      perf tools: Back [vdso] DSO with real data

 tools/lib/traceevent/event-parse.c                 |    8 +-
 tools/lib/traceevent/event-parse.h                 |    4 +-
 tools/perf/MANIFEST                                |    1 +
 tools/perf/Makefile                                |    3 +
 tools/perf/bench/bench.h                           |    3 +-
 tools/perf/bench/mem-memcpy.c                      |    2 +-
 tools/perf/bench/mem-memset.c                      |    2 +-
 tools/perf/bench/sched-messaging.c                 |    2 +-
 tools/perf/bench/sched-pipe.c                      |    6 +-
 tools/perf/builtin-annotate.c                      |    2 +-
 tools/perf/builtin-bench.c                         |    2 +-
 tools/perf/builtin-buildid-cache.c                 |   10 +-
 tools/perf/builtin-buildid-list.c                  |    3 +-
 tools/perf/builtin-diff.c                          |    4 +-
 tools/perf/builtin-evlist.c                        |    2 +-
 tools/perf/builtin-help.c                          |    2 +-
 tools/perf/builtin-inject.c                        |   24 +-
 tools/perf/builtin-kmem.c                          |  130 +-
 tools/perf/builtin-kvm.c                           |    2 +-
 tools/perf/builtin-list.c                          |    2 +-
 tools/perf/builtin-lock.c                          |    4 +-
 tools/perf/builtin-probe.c                         |   24 +-
 tools/perf/builtin-record.c                        |   10 +-
 tools/perf/builtin-report.c                        |   11 +-
 tools/perf/builtin-sched.c                         | 1446 +++++++++-----------
 tools/perf/builtin-script.c                        |   29 +-
 tools/perf/builtin-stat.c                          |   40 +-
 tools/perf/builtin-test.c                          |   23 +-
 tools/perf/builtin-timechart.c                     |   30 +-
 tools/perf/builtin-top.c                           |    7 +-
 tools/perf/ui/browser.c                            |    7 +-
 tools/perf/ui/browsers/annotate.c                  |    6 +-
 tools/perf/ui/gtk/browser.c                        |    5 +-
 tools/perf/ui/gtk/setup.c                          |    2 +-
 tools/perf/ui/gtk/util.c                           |    4 +-
 tools/perf/ui/helpline.c                           |    2 +-
 tools/perf/ui/helpline.h                           |    8 +-
 tools/perf/ui/hist.c                               |   21 +-
 tools/perf/ui/tui/setup.c                          |    4 +-
 tools/perf/util/alias.c                            |    3 +-
 tools/perf/util/annotate.c                         |    6 +-
 tools/perf/util/annotate.h                         |   13 +-
 tools/perf/util/build-id.c                         |   11 +-
 tools/perf/util/cache.h                            |    6 +-
 tools/perf/util/callchain.c                        |    6 +-
 tools/perf/util/cgroup.c                           |    4 +-
 tools/perf/util/config.c                           |    6 +-
 tools/perf/util/debug.h                            |    9 +-
 tools/perf/util/event.c                            |   29 +-
 tools/perf/util/event.h                            |    2 +-
 tools/perf/util/evsel.c                            |   35 +
 tools/perf/util/evsel.h                            |    7 +
 tools/perf/util/header.c                           |  177 ++-
 tools/perf/util/header.h                           |    2 +-
 tools/perf/util/help.c                             |    3 +-
 tools/perf/util/hist.c                             |    2 +-
 tools/perf/util/hist.h                             |   32 +-
 tools/perf/util/include/linux/bitops.h             |    4 +
 tools/perf/util/include/linux/compiler.h           |    8 +-
 tools/perf/util/include/linux/kernel.h             |   13 +-
 tools/perf/util/include/linux/magic.h              |   12 +
 tools/perf/util/include/linux/string.h             |    2 +
 tools/perf/util/include/linux/types.h              |    8 +
 tools/perf/util/intlist.c                          |    4 +-
 tools/perf/util/map.c                              |   12 +-
 tools/perf/util/map.h                              |    2 +-
 tools/perf/util/parse-events-test.c                |    6 +-
 tools/perf/util/parse-events.c                     |    7 +-
 tools/perf/util/parse-events.l                     |    2 +-
 tools/perf/util/parse-events.y                     |    4 +-
 tools/perf/util/parse-options.c                    |    3 +-
 tools/perf/util/perf_regs.h                        |    2 +-
 tools/perf/util/pmu.y                              |    6 +-
 tools/perf/util/probe-event.c                      |   21 +-
 tools/perf/util/probe-finder.c                     |    4 +-
 tools/perf/util/python.c                           |    8 +-
 .../perf/util/scripting-engines/trace-event-perl.c |    8 +-
 .../util/scripting-engines/trace-event-python.c    |   10 +-
 tools/perf/util/session.c                          |   61 +-
 tools/perf/util/sort.c                             |   14 +-
 tools/perf/util/string.c                           |   18 +-
 tools/perf/util/symbol-minimal.c                   |   28 +-
 tools/perf/util/symbol.c                           |    6 +-
 tools/perf/util/symbol.h                           |    8 +-
 tools/perf/util/trace-event-parse.c                |    4 +-
 tools/perf/util/trace-event-scripting.c            |   33 +-
 tools/perf/util/unwind.c                           |   36 +-
 tools/perf/util/unwind.h                           |   11 +-
 tools/perf/util/util.h                             |    2 +-
 tools/perf/util/vdso.c                             |  111 ++
 tools/perf/util/vdso.h                             |   18 +
 tools/perf/util/wrapper.c                          |    3 +-
 92 files changed, 1518 insertions(+), 1231 deletions(-)
 create mode 100644 tools/perf/util/include/linux/magic.h
 create mode 100644 tools/perf/util/vdso.c
 create mode 100644 tools/perf/util/vdso.h

^ permalink raw reply	[flat|nested] 43+ messages in thread

* Re: [GIT PULL 00/20] perf/core improvements and fixes
  2012-07-05 15:44 Arnaldo Carvalho de Melo
@ 2012-07-06  8:22 ` Ingo Molnar
  0 siblings, 0 replies; 43+ messages in thread
From: Ingo Molnar @ 2012-07-06  8:22 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Borislav Petkov, Corey Ashford, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Johannes Berg, Namhyung Kim,
	Namhyung Kim, Namhyung Kim, Paul Mackerras, Peter Huewe,
	Peter Zijlstra, Stephane Eranian, Steven Rostedt, Ulrich Drepper,
	Wolfgang Mauerer, arnaldo.melo, Arnaldo Carvalho de Melo


* Arnaldo Carvalho de Melo <acme@infradead.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling, this one contains my first 
> merge, a pull request by Namhyung, please check if everything 
> is OK,
> 
> Thanks,
> 
> - Arnaldo
> 
> The following changes since commit 17d7a1123f0f6d532830152564cc812cc73db2f3:
> 
>   perf bench: Fix confused variable namings and descriptions in mem subsystem (2012-07-02 14:35:45 -0300)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo
> 
> for you to fetch changes up to 81e9b994bb20716d1f6c47e048e4ae4a43de2f83:
> 
>   Merge tag 'libtraceevent-core-for-acme' of git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf into perf/core (2012-07-05 12:16:32 -0300)
> 
> ----------------------------------------------------------------
> 
> perf/core improvements and fixes:
> 
> . Preparatory patches to use hw events in PMU syntax, from Jiri Olsa
> 
> . Remaining backport of trace-cmd's libparseevent, from Namhyung Kim
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (1):
>       Merge tag 'libtraceevent-core-for-acme' of git://git.kernel.org/.../namhyung/linux-perf into perf/core
> 
> Jiri Olsa (4):
>       perf test: Use ARRAY_SIZE in parse events tests
>       perf tools: Add empty rule for new line in event syntax parsing
>       perf tools: Split out PE_VALUE_SYM parsing token to SW and HW tokens
>       perf tools: Split event symbols arrays to hw and sw parts
> 
> Namhyung Kim (10):
>       tools lib traceevent: Fix printk_cmp()
>       tools lib traceevent: Introduce extend_token()
>       tools lib traceevent: Handle strdup failure cases
>       tools lib traceevent: Handle realloc() failure path
>       tools lib traceevent: Pass string type argument to args
>       tools lib traceevent: Do not call add_event() again if allocation failed
>       tools lib traceevent: Fix some comments
>       tools lib traceevent: Check result of malloc() during reading token
>       tools lib traceevent: Check return value of arg_to_str()
>       tools lib traceevent: Cleanup realloc use
> 
> Peter Huewe (1):
>       tools lib traceevent: Add missing break in make_bprint_args
> 
> Steven Rostedt (4):
>       tools lib traceevent: Let filtering numbers by string use function names
>       tools lib traceevent: Add support for "%.*s" in bprintk events
>       tools lib traceevent: Add support to show migrate disable counter
>       tools lib traceevent: Fix %pM print format arg handling
> 
> Wolfgang Mauerer (1):
>       tools lib traceevent: Fix trace_printk for long integers
> 
>  tools/lib/traceevent/event-parse.c  |  287 +++++++++++++++++++++++------------
>  tools/lib/traceevent/parse-filter.c |   86 +++++++----
>  tools/perf/util/parse-events-test.c |   29 ++--
>  tools/perf/util/parse-events.c      |  174 ++++++++++++++-------
>  tools/perf/util/parse-events.l      |    3 +-
>  tools/perf/util/parse-events.y      |   15 +-
>  6 files changed, 391 insertions(+), 203 deletions(-)

Pulled, thanks a lot Arnaldo! The commits from Namhyung Kim are 
looking good as well.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 43+ messages in thread

* [GIT PULL 00/20] perf/core improvements and fixes
@ 2012-07-05 15:44 Arnaldo Carvalho de Melo
  2012-07-06  8:22 ` Ingo Molnar
  0 siblings, 1 reply; 43+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-07-05 15:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Borislav Petkov,
	Corey Ashford, David Ahern, Frederic Weisbecker, Jiri Olsa,
	Johannes Berg, Namhyung Kim, Namhyung Kim, Namhyung Kim,
	Paul Mackerras, Peter Huewe, Peter Zijlstra, Stephane Eranian,
	Steven Rostedt, Ulrich Drepper, Wolfgang Mauerer, arnaldo.melo,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, this one contains my first merge, a pull
request by Namhyung, please check if everything is OK,

Thanks,

- Arnaldo

The following changes since commit 17d7a1123f0f6d532830152564cc812cc73db2f3:

  perf bench: Fix confused variable namings and descriptions in mem subsystem (2012-07-02 14:35:45 -0300)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux tags/perf-core-for-mingo

for you to fetch changes up to 81e9b994bb20716d1f6c47e048e4ae4a43de2f83:

  Merge tag 'libtraceevent-core-for-acme' of git://git.kernel.org/pub/scm/linux/kernel/git/namhyung/linux-perf into perf/core (2012-07-05 12:16:32 -0300)

----------------------------------------------------------------

perf/core improvements and fixes:

. Preparatory patches to use hw events in PMU syntax, from Jiri Olsa

. Remaining backport of trace-cmd's libparseevent, from Namhyung Kim

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
      Merge tag 'libtraceevent-core-for-acme' of git://git.kernel.org/.../namhyung/linux-perf into perf/core

Jiri Olsa (4):
      perf test: Use ARRAY_SIZE in parse events tests
      perf tools: Add empty rule for new line in event syntax parsing
      perf tools: Split out PE_VALUE_SYM parsing token to SW and HW tokens
      perf tools: Split event symbols arrays to hw and sw parts

Namhyung Kim (10):
      tools lib traceevent: Fix printk_cmp()
      tools lib traceevent: Introduce extend_token()
      tools lib traceevent: Handle strdup failure cases
      tools lib traceevent: Handle realloc() failure path
      tools lib traceevent: Pass string type argument to args
      tools lib traceevent: Do not call add_event() again if allocation failed
      tools lib traceevent: Fix some comments
      tools lib traceevent: Check result of malloc() during reading token
      tools lib traceevent: Check return value of arg_to_str()
      tools lib traceevent: Cleanup realloc use

Peter Huewe (1):
      tools lib traceevent: Add missing break in make_bprint_args

Steven Rostedt (4):
      tools lib traceevent: Let filtering numbers by string use function names
      tools lib traceevent: Add support for "%.*s" in bprintk events
      tools lib traceevent: Add support to show migrate disable counter
      tools lib traceevent: Fix %pM print format arg handling

Wolfgang Mauerer (1):
      tools lib traceevent: Fix trace_printk for long integers

 tools/lib/traceevent/event-parse.c  |  287 +++++++++++++++++++++++------------
 tools/lib/traceevent/parse-filter.c |   86 +++++++----
 tools/perf/util/parse-events-test.c |   29 ++--
 tools/perf/util/parse-events.c      |  174 ++++++++++++++-------
 tools/perf/util/parse-events.l      |    3 +-
 tools/perf/util/parse-events.y      |   15 +-
 6 files changed, 391 insertions(+), 203 deletions(-)

^ permalink raw reply	[flat|nested] 43+ messages in thread

end of thread, other threads:[~2017-03-28  5:46 UTC | newest]

Thread overview: 43+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-13 15:11 [GIT PULL 00/20] perf/core improvements and fixes Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 01/20] tools lib symbol: Start carving out symbol parsing routines from perf Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 02/20] perf tools: Add perf_event_paranoid() Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 03/20] perf header: Allow header->data_offset to be predetermined Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 04/20] perf evlist: Add can_select_event() method Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 05/20] perf tools: Move mem_bswap32/64 to util.c Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 06/20] perf tools: Fix inverted error verification bug in thread__fork Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 07/20] perf evlist: Add perf_evlist__to_front() Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 08/20] perf completion: Complete 'perf kvm' Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 09/20] tools lib traceevent: Get rid of malloc_or_die() in show_error() Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 10/20] tools lib traceevent: Get rid of die in add_filter_type() Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 11/20] tools lib traceevent: Get rid of malloc_or_die() allocate_arg() Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 12/20] tools lib traceevent: Get rid of malloc_or_die() in read_token() Arnaldo Carvalho de Melo
2013-12-13 15:11 ` [PATCH 13/20] tools lib traceevent: Get rid of malloc_or_die() in find_event() Arnaldo Carvalho de Melo
2013-12-13 15:12 ` [PATCH 14/20] tools lib traceevent: Get rid of die() in add_right() Arnaldo Carvalho de Melo
2013-12-13 15:12 ` [PATCH 15/20] tools lib traceevent: Make add_left() return pevent_errno Arnaldo Carvalho de Melo
2013-12-13 15:12 ` [PATCH 16/20] tools lib traceevent: Get rid of die() in reparent_op_arg() Arnaldo Carvalho de Melo
2013-12-13 15:12 ` [PATCH 17/20] tools lib traceevent: Refactor create_arg_item() Arnaldo Carvalho de Melo
2013-12-13 15:12 ` [PATCH 18/20] tools lib traceevent: Refactor process_filter() Arnaldo Carvalho de Melo
2013-12-13 15:12 ` [PATCH 19/20] tools lib traceevent: Make pevent_filter_add_filter_str() return pevent_errno Arnaldo Carvalho de Melo
2013-12-13 15:12 ` [PATCH 20/20] tools lib traceevent: Refactor pevent_filter_match() to get rid of die() Arnaldo Carvalho de Melo
2013-12-16 13:54 ` [GIT PULL 00/20] perf/core improvements and fixes Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2017-03-28  1:38 Arnaldo Carvalho de Melo
2017-03-28  5:45 ` Ingo Molnar
2017-03-24 14:57 Arnaldo Carvalho de Melo
2017-03-24 14:57 ` Arnaldo Carvalho de Melo
2017-03-24 18:39 ` Ingo Molnar
2017-03-24 18:39   ` Ingo Molnar
2016-12-05 21:37 Arnaldo Carvalho de Melo
2016-12-06  8:17 ` Ingo Molnar
2015-03-03  3:25 Arnaldo Carvalho de Melo
2015-03-03  6:20 ` Ingo Molnar
2015-03-10 10:03 ` Ingo Molnar
2015-03-10 14:03   ` Arnaldo Carvalho de Melo
2015-03-10 14:37     ` Ingo Molnar
2014-09-17 21:24 Arnaldo Carvalho de Melo
2014-09-17 21:24 ` Arnaldo Carvalho de Melo
2014-09-19  5:15 ` Ingo Molnar
2014-09-19  5:15   ` Ingo Molnar
2012-09-11 23:52 Arnaldo Carvalho de Melo
2012-09-13 15:15 ` Ingo Molnar
2012-07-05 15:44 Arnaldo Carvalho de Melo
2012-07-06  8:22 ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.