All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL v3 00/17] perf/core fixes
@ 2014-04-14 14:17 Jiri Olsa
  2014-04-14 14:17 ` [PATCH 01/17] perf top: Fix documentation of invalid -s option Jiri Olsa
                   ` (17 more replies)
  0 siblings, 18 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Andi Kleen,
	Arnaldo Carvalho de Melo, Cody P Schafer, David Ahern,
	Don Zickus, Frederic Weisbecker, Jean Pihet, Masami Hiramatsu,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Ramkumar Ramachandra, Richard Yao, Stephane Eranian,
	Steven Rostedt, William Cohen, Jiri Olsa

hi Ingo,
please consider pulling.

As requested, sending only fixies for 3.15. I'll send the rest for 3.16.

thanks,
jirka


The following changes since commit 538592ff0b008237ae88f5ce5fb1247127dc3ce5:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2014-03-19 08:05:47 +0100)

are available in the git repository at:


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

for you to fetch changes up to c12702d9bf3485d1b34c7913430b4e9271126561:

  perf tools: Instead of redirecting flex output, use -o (2014-04-14 13:00:46 +0200)

----------------------------------------------------------------
perf/core fixes:

Documentation:

. Fix documentation of invalid 'perf top -s' option (Namhyung Kim)

. Change e-mail to kernel.org one in MAINTAINERS file (Arnaldo Carvalho de Melo)

. Update bench manpage to mention numa and futex (Ramkumar Ramachandra)

Developer stuff:

. Disable unwind libraries when libelf isn't found (Arnaldo Carvalho de Melo)

. Print event name when showing libtraceevent warnings if possible (Namhyung Kim)

. Pick up libdw without explicit LIBDW_DIR (Ramkumar Ramachandra)

. Fix perf bench all segfault (Ramkumar Ramachandra)

. Set more defaults in the 'numa' suite (Ramkumar Ramachandra)

. Fix double free in perf test 21 (Adrian Hunter)

. Initialize statistics correctly (Andi Kleen)

. Instead of redirecting flex output, use -o (Cody P Schafer)

User visible:

. Assorted perf probe fixies (Namhyung Kim)

. Fix perf probe segfault (Masami Hiramatsu)

. Fix metrics calculation with event qualifiers (Andi Kleen)

. Search for modules in %s/lib/modules/%s (Richard Yao)

Signed-off-by: Jiri Olsa <jolsa@redhat.com>

----------------------------------------------------------------
Adrian Hunter (1):
      perf tools: Fix double free in perf test 21 (code-reading.c)

Andi Kleen (2):
      perf stat: Initialize statistics correctly
      perf tools: Fix metrics calculation with event qualifiers

Arnaldo Carvalho de Melo (2):
      perf callchains: Disable unwind libraries when libelf isn't found
      MAINTAINERS: Change e-mail to kernel.org one

Cody P Schafer (1):
      perf tools: Instead of redirecting flex output, use -o

Masami Hiramatsu (1):
      perf probe: Fix to handle errors in line_range searching

Namhyung Kim (5):
      perf top: Fix documentation of invalid -s option
      tools lib traceevent: Print event name when show warning if possible
      tools lib traceevent: Do not call warning() directly
      perf probe: Fix --line option behavior
      perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi()

Ramkumar Ramachandra (4):
      perf tools: Pick up libdw without explicit LIBDW_DIR
      perf bench: Update manpage to mention numa and futex
      perf bench: Fix segfault at the end of an 'all' execution
      perf bench: Set more defaults in the 'numa' suite

Richard Yao (1):
      perf machine: Search for modules in %s/lib/modules/%s

 MAINTAINERS                             |   2 +-
 tools/lib/traceevent/event-parse.c      | 109 +++++++++++++++----------
 tools/perf/Documentation/perf-bench.txt |  22 +++++
 tools/perf/Documentation/perf-top.txt   |   1 -
 tools/perf/Makefile.perf                |   4 +-
 tools/perf/bench/numa.c                 |   4 +
 tools/perf/builtin-bench.c              |   2 +-
 tools/perf/builtin-stat.c               | 140 ++++++++++++++++++++------------
 tools/perf/config/Makefile              |   7 +-
 tools/perf/tests/code-reading.c         |   1 +
 tools/perf/util/machine.c               |   2 +-
 tools/perf/util/probe-finder.c          |  15 ++--
 12 files changed, 197 insertions(+), 112 deletions(-)

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

* [PATCH 01/17] perf top: Fix documentation of invalid -s option
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 02/17] tools lib traceevent: Print event name when show warning if possible Jiri Olsa
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, David Ahern, Jiri Olsa, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra

From: Namhyung Kim <namhyung@kernel.org>

On perf top, the -s option is used for --sort, but the man page
contains invalid documentation of -s option for --sym-annotate.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1395193578-27098-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/Documentation/perf-top.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt
index cdd8d49..976b00c 100644
--- a/tools/perf/Documentation/perf-top.txt
+++ b/tools/perf/Documentation/perf-top.txt
@@ -87,7 +87,6 @@ Default is to monitor all CPUS.
 --realtime=<priority>::
 	Collect data with this RT SCHED_FIFO priority.
 
--s <symbol>::
 --sym-annotate=<symbol>::
         Annotate this symbol.
 
-- 
1.8.3.1


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

* [PATCH 02/17] tools lib traceevent: Print event name when show warning if possible
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
  2014-04-14 14:17 ` [PATCH 01/17] perf top: Fix documentation of invalid -s option Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 03/17] tools lib traceevent: Do not call warning() directly Jiri Olsa
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Ramkumar Ramachandra,
	Steven Rostedt

From: Namhyung Kim <namhyung@kernel.org>

It's sometimes useful to know where the parse failure was occurred.  Add
do_warning_event() macro to see the failing event.

It now shows the messages like below:

  $ perf test 5
   5: parse events tests                                     :  Warning: [kvmmmu:kvm_mmu_get_page] bad op token {
    Warning: [kvmmmu:kvm_mmu_sync_page] bad op token {
    Warning: [kvmmmu:kvm_mmu_unsync_page] bad op token {
    Warning: [kvmmmu:kvm_mmu_prepare_zap_page] bad op token {
    Warning: [kvmmmu:fast_page_fault] function is_writable_pte not defined
    Warning: [xen:xen_mmu_ptep_modify_prot_commit] function sizeof not defined
    Warning: [xen:xen_mmu_ptep_modify_prot_start] function sizeof not defined
    Warning: [xen:xen_mmu_set_pgd] function sizeof not defined
    Warning: [xen:xen_mmu_set_pud] function sizeof not defined
    Warning: [xen:xen_mmu_set_pmd] function sizeof not defined
    ...

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-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: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1395192174-26273-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 103 ++++++++++++++++++++++---------------
 1 file changed, 62 insertions(+), 41 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 1587ea39..33803c0b9 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -50,6 +50,18 @@ static int show_warning = 1;
 			warning(fmt, ##__VA_ARGS__);	\
 	} while (0)
 
+#define do_warning_event(event, fmt, ...)			\
+	do {							\
+		if (!show_warning)				\
+			continue;				\
+								\
+		if (event)					\
+			warning("[%s:%s] " fmt, event->system,	\
+				event->name, ##__VA_ARGS__);	\
+		else						\
+			warning(fmt, ##__VA_ARGS__);		\
+	} while (0)
+
 static void init_input_buf(const char *buf, unsigned long long size)
 {
 	input_buf = buf;
@@ -1355,7 +1367,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f
 		}
 
 		if (!field->type) {
-			do_warning("%s: no type found", __func__);
+			do_warning_event(event, "%s: no type found", __func__);
 			goto fail;
 		}
 		field->name = last_token;
@@ -1402,7 +1414,7 @@ static int event_read_fields(struct event_format *event, struct format_field **f
 				free_token(token);
 				type = read_token(&token);
 				if (type == EVENT_NONE) {
-					do_warning("failed to find token");
+					do_warning_event(event, "failed to find token");
 					goto fail;
 				}
 			}
@@ -1636,7 +1648,7 @@ process_cond(struct event_format *event, struct print_arg *top, char **tok)
 	right = alloc_arg();
 
 	if (!arg || !left || !right) {
-		do_warning("%s: not enough memory!", __func__);
+		do_warning_event(event, "%s: not enough memory!", __func__);
 		/* arg will be freed at out_free */
 		free_arg(left);
 		free_arg(right);
@@ -1686,7 +1698,7 @@ process_array(struct event_format *event, struct print_arg *top, char **tok)
 
 	arg = alloc_arg();
 	if (!arg) {
-		do_warning("%s: not enough memory!", __func__);
+		do_warning_event(event, "%s: not enough memory!", __func__);
 		/* '*tok' is set to top->op.op.  No need to free. */
 		*tok = NULL;
 		return EVENT_ERROR;
@@ -1792,7 +1804,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
 	if (arg->type == PRINT_OP && !arg->op.left) {
 		/* handle single op */
 		if (token[1]) {
-			do_warning("bad op token %s", token);
+			do_warning_event(event, "bad op token %s", token);
 			goto out_free;
 		}
 		switch (token[0]) {
@@ -1802,7 +1814,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
 		case '-':
 			break;
 		default:
-			do_warning("bad op token %s", token);
+			do_warning_event(event, "bad op token %s", token);
 			goto out_free;
 
 		}
@@ -1888,7 +1900,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
 			char *new_atom;
 
 			if (left->type != PRINT_ATOM) {
-				do_warning("bad pointer type");
+				do_warning_event(event, "bad pointer type");
 				goto out_free;
 			}
 			new_atom = realloc(left->atom.atom,
@@ -1930,7 +1942,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
 		type = process_array(event, arg, tok);
 
 	} else {
-		do_warning("unknown op '%s'", token);
+		do_warning_event(event, "unknown op '%s'", token);
 		event->flags |= EVENT_FL_FAILED;
 		/* the arg is now the left side */
 		goto out_free;
@@ -1951,7 +1963,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
 	return type;
 
 out_warn_free:
-	do_warning("%s: not enough memory!", __func__);
+	do_warning_event(event, "%s: not enough memory!", __func__);
 out_free:
 	free_token(token);
 	*tok = NULL;
@@ -2385,7 +2397,7 @@ process_flags(struct event_format *event, struct print_arg *arg, char **tok)
 
 	field = alloc_arg();
 	if (!field) {
-		do_warning("%s: not enough memory!", __func__);
+		do_warning_event(event, "%s: not enough memory!", __func__);
 		goto out_free;
 	}
 
@@ -2438,7 +2450,7 @@ process_symbols(struct event_format *event, struct print_arg *arg, char **tok)
 
 	field = alloc_arg();
 	if (!field) {
-		do_warning("%s: not enough memory!", __func__);
+		do_warning_event(event, "%s: not enough memory!", __func__);
 		goto out_free;
 	}
 
@@ -2477,7 +2489,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
 
 	field = alloc_arg();
 	if (!field) {
-		do_warning("%s: not enough memory!", __func__);
+		do_warning_event(event, "%s: not enough memory!", __func__);
 		goto out_free;
 	}
 
@@ -2492,7 +2504,7 @@ process_hex(struct event_format *event, struct print_arg *arg, char **tok)
 
 	field = alloc_arg();
 	if (!field) {
-		do_warning("%s: not enough memory!", __func__);
+		do_warning_event(event, "%s: not enough memory!", __func__);
 		*tok = NULL;
 		return EVENT_ERROR;
 	}
@@ -2555,7 +2567,7 @@ process_dynamic_array(struct event_format *event, struct print_arg *arg, char **
 	free_token(token);
 	arg = alloc_arg();
 	if (!arg) {
-		do_warning("%s: not enough memory!", __func__);
+		do_warning_event(event, "%s: not enough memory!", __func__);
 		*tok = NULL;
 		return EVENT_ERROR;
 	}
@@ -2614,13 +2626,14 @@ process_paren(struct event_format *event, struct print_arg *arg, char **tok)
 
 		/* prevous must be an atom */
 		if (arg->type != PRINT_ATOM) {
-			do_warning("previous needed to be PRINT_ATOM");
+			do_warning_event(event, "previous needed to be PRINT_ATOM");
 			goto out_free;
 		}
 
 		item_arg = alloc_arg();
 		if (!item_arg) {
-			do_warning("%s: not enough memory!", __func__);
+			do_warning_event(event, "%s: not enough memory!",
+					 __func__);
 			goto out_free;
 		}
 
@@ -2721,7 +2734,8 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
 	for (i = 0; i < func->nr_args; i++) {
 		farg = alloc_arg();
 		if (!farg) {
-			do_warning("%s: not enough memory!", __func__);
+			do_warning_event(event, "%s: not enough memory!",
+					 __func__);
 			return EVENT_ERROR;
 		}
 
@@ -2792,7 +2806,7 @@ process_function(struct event_format *event, struct print_arg *arg,
 		return process_func_handler(event, func, arg, tok);
 	}
 
-	do_warning("function %s not defined", token);
+	do_warning_event(event, "function %s not defined", token);
 	free_token(token);
 	return EVENT_ERROR;
 }
@@ -2878,7 +2892,7 @@ process_arg_token(struct event_format *event, struct print_arg *arg,
 
 	case EVENT_ERROR ... EVENT_NEWLINE:
 	default:
-		do_warning("unexpected type %d", type);
+		do_warning_event(event, "unexpected type %d", type);
 		return EVENT_ERROR;
 	}
 	*tok = token;
@@ -2901,7 +2915,8 @@ static int event_read_print_args(struct event_format *event, struct print_arg **
 
 		arg = alloc_arg();
 		if (!arg) {
-			do_warning("%s: not enough memory!", __func__);
+			do_warning_event(event, "%s: not enough memory!",
+					 __func__);
 			return -1;
 		}
 
@@ -3481,11 +3496,12 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
 	return val;
 
 out_warning_op:
-	do_warning("%s: unknown op '%s'", __func__, arg->op.op);
+	do_warning_event(event, "%s: unknown op '%s'", __func__, arg->op.op);
 	return 0;
 
 out_warning_field:
-	do_warning("%s: field %s not found", __func__, arg->field.name);
+	do_warning_event(event, "%s: field %s not found",
+			 __func__, arg->field.name);
 	return 0;
 }
 
@@ -3591,7 +3607,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
 		}
 		str = malloc(len + 1);
 		if (!str) {
-			do_warning("%s: not enough memory!", __func__);
+			do_warning_event(event, "%s: not enough memory!",
+					 __func__);
 			return;
 		}
 		memcpy(str, data + field->offset, len);
@@ -3697,7 +3714,8 @@ static void print_str_arg(struct trace_seq *s, void *data, int size,
 	return;
 
 out_warning_field:
-	do_warning("%s: field %s not found", __func__, arg->field.name);
+	do_warning_event(event, "%s: field %s not found",
+			 __func__, arg->field.name);
 }
 
 static unsigned long long
@@ -3742,14 +3760,16 @@ process_defined_func(struct trace_seq *s, void *data, int size,
 			trace_seq_terminate(&str);
 			string = malloc(sizeof(*string));
 			if (!string) {
-				do_warning("%s(%d): malloc str", __func__, __LINE__);
+				do_warning_event(event, "%s(%d): malloc str",
+						 __func__, __LINE__);
 				goto out_free;
 			}
 			string->next = strings;
 			string->str = strdup(str.buffer);
 			if (!string->str) {
 				free(string);
-				do_warning("%s(%d): malloc str", __func__, __LINE__);
+				do_warning_event(event, "%s(%d): malloc str",
+						 __func__, __LINE__);
 				goto out_free;
 			}
 			args[i] = (uintptr_t)string->str;
@@ -3761,7 +3781,7 @@ process_defined_func(struct trace_seq *s, void *data, int size,
 			 * Something went totally wrong, this is not
 			 * an input error, something in this code broke.
 			 */
-			do_warning("Unexpected end of arguments\n");
+			do_warning_event(event, "Unexpected end of arguments\n");
 			goto out_free;
 		}
 		farg = farg->next;
@@ -3811,12 +3831,12 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
 	if (!field) {
 		field = pevent_find_field(event, "buf");
 		if (!field) {
-			do_warning("can't find buffer field for binary printk");
+			do_warning_event(event, "can't find buffer field for binary printk");
 			return NULL;
 		}
 		ip_field = pevent_find_field(event, "ip");
 		if (!ip_field) {
-			do_warning("can't find ip field for binary printk");
+			do_warning_event(event, "can't find ip field for binary printk");
 			return NULL;
 		}
 		pevent->bprint_buf_field = field;
@@ -3830,7 +3850,8 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
 	 */
 	args = alloc_arg();
 	if (!args) {
-		do_warning("%s(%d): not enough memory!", __func__, __LINE__);
+		do_warning_event(event, "%s(%d): not enough memory!",
+				 __func__, __LINE__);
 		return NULL;
 	}
 	arg = args;
@@ -3896,7 +3917,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
 				bptr += vsize;
 				arg = alloc_arg();
 				if (!arg) {
-					do_warning("%s(%d): not enough memory!",
+					do_warning_event(event, "%s(%d): not enough memory!",
 						   __func__, __LINE__);
 					goto out_free;
 				}
@@ -3919,7 +3940,7 @@ static struct print_arg *make_bprint_args(char *fmt, void *data, int size, struc
 			case 's':
 				arg = alloc_arg();
 				if (!arg) {
-					do_warning("%s(%d): not enough memory!",
+					do_warning_event(event, "%s(%d): not enough memory!",
 						   __func__, __LINE__);
 					goto out_free;
 				}
@@ -3959,7 +3980,7 @@ get_bprint_format(void *data, int size __maybe_unused,
 	if (!field) {
 		field = pevent_find_field(event, "fmt");
 		if (!field) {
-			do_warning("can't find format field for binary printk");
+			do_warning_event(event, "can't find format field for binary printk");
 			return NULL;
 		}
 		pevent->bprint_fmt_field = field;
@@ -4003,8 +4024,8 @@ static void print_mac_arg(struct trace_seq *s, int mac, void *data, int size,
 		arg->field.field =
 			pevent_find_any_field(event, arg->field.name);
 		if (!arg->field.field) {
-			do_warning("%s: field %s not found",
-				   __func__, arg->field.name);
+			do_warning_event(event, "%s: field %s not found",
+					 __func__, arg->field.name);
 			return;
 		}
 	}
@@ -4176,7 +4197,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 			case '*':
 				/* The argument is the length. */
 				if (!arg) {
-					do_warning("no argument match");
+					do_warning_event(event, "no argument match");
 					event->flags |= EVENT_FL_FAILED;
 					goto out_failed;
 				}
@@ -4213,7 +4234,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 			case 'X':
 			case 'u':
 				if (!arg) {
-					do_warning("no argument match");
+					do_warning_event(event, "no argument match");
 					event->flags |= EVENT_FL_FAILED;
 					goto out_failed;
 				}
@@ -4223,7 +4244,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 
 				/* should never happen */
 				if (len > 31) {
-					do_warning("bad format!");
+					do_warning_event(event, "bad format!");
 					event->flags |= EVENT_FL_FAILED;
 					len = 31;
 				}
@@ -4290,13 +4311,13 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 						trace_seq_printf(s, format, (long long)val);
 					break;
 				default:
-					do_warning("bad count (%d)", ls);
+					do_warning_event(event, "bad count (%d)", ls);
 					event->flags |= EVENT_FL_FAILED;
 				}
 				break;
 			case 's':
 				if (!arg) {
-					do_warning("no matching argument");
+					do_warning_event(event, "no matching argument");
 					event->flags |= EVENT_FL_FAILED;
 					goto out_failed;
 				}
@@ -4306,7 +4327,7 @@ static void pretty_print(struct trace_seq *s, void *data, int size, struct event
 
 				/* should never happen */
 				if (len > 31) {
-					do_warning("bad format!");
+					do_warning_event(event, "bad format!");
 					event->flags |= EVENT_FL_FAILED;
 					len = 31;
 				}
-- 
1.8.3.1


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

* [PATCH 03/17] tools lib traceevent: Do not call warning() directly
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
  2014-04-14 14:17 ` [PATCH 01/17] perf top: Fix documentation of invalid -s option Jiri Olsa
  2014-04-14 14:17 ` [PATCH 02/17] tools lib traceevent: Print event name when show warning if possible Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 04/17] perf callchains: Disable unwind libraries when libelf isn't found Jiri Olsa
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Namhyung Kim, Frederic Weisbecker, Jiri Olsa,
	Namhyung Kim, Peter Zijlstra, Steven Rostedt

From: Namhyung Kim <namhyung@kernel.org>

The patch 3a3ffa2e82205 ("tools lib traceevent: Report better error
message on bad function args") added the error message but it seems
there's no reason to call warning() directly.

So change it to do_warning_event() to provide event information too.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-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/1395192174-26273-2-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 33803c0b9..baec7d8 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2742,14 +2742,16 @@ process_func_handler(struct event_format *event, struct pevent_function_handler
 		type = process_arg(event, farg, &token);
 		if (i < (func->nr_args - 1)) {
 			if (type != EVENT_DELIM || strcmp(token, ",") != 0) {
-				warning("Error: function '%s()' expects %d arguments but event %s only uses %d",
+				do_warning_event(event,
+					"Error: function '%s()' expects %d arguments but event %s only uses %d",
 					func->name, func->nr_args,
 					event->name, i + 1);
 				goto err;
 			}
 		} else {
 			if (type != EVENT_DELIM || strcmp(token, ")") != 0) {
-				warning("Error: function '%s()' only expects %d arguments but event %s has more",
+				do_warning_event(event,
+					"Error: function '%s()' only expects %d arguments but event %s has more",
 					func->name, func->nr_args, event->name);
 				goto err;
 			}
-- 
1.8.3.1


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

* [PATCH 04/17] perf callchains: Disable unwind libraries when libelf isn't found
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (2 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 03/17] tools lib traceevent: Do not call warning() directly Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 05/17] MAINTAINERS: Change e-mail to kernel.org one Jiri Olsa
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Don Zickus, Frederic Weisbecker, Jiri Olsa,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

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

I.e. do the same as when NO_LIBELF is explicitely passed in the 'make'
command line, fixing this:

  Auto-detecting system features:
  ...                         dwarf: [ OFF ]
  ...                         glibc: [ on  ]
  ...                          gtk2: [ OFF ]
  ...                      libaudit: [ OFF ]
  ...                        libbfd: [ OFF ]
  ...                        libelf: [ OFF ]
  ...                     libunwind: [ OFF ]
  ...            libdw-dwarf-unwind: [ OFF ]
  ...     DWARF post unwind library: libdw
<SNIP>
    CC       /tmp/build/perf/util/symbol-minimal.o
    CC       /tmp/build/perf/util/unwind-libdw.o
  arch/x86/util/unwind-libdw.c:1:30: fatal error: elfutils/libdwfl.h: No such file or directory
  compilation terminated.
    CC       /tmp/build/perf/tests/keep-tracking.o
  util/unwind-libdw.c:2:28: fatal error: elfutils/libdw.h: No such file or directory
  compilation terminated.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.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-e39j1yxanltjx4t0msse63ax@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/config/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index c234182..5a3c452 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -278,6 +278,8 @@ else
       NO_LIBELF := 1
       NO_DWARF := 1
       NO_DEMANGLE := 1
+      NO_LIBUNWIND := 1
+      NO_LIBDW_DWARF_UNWIND := 1
     else
       msg := $(error No gnu/libc-version.h found, please install glibc-dev[el]/glibc-static);
     endif
-- 
1.8.3.1


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

* [PATCH 05/17] MAINTAINERS: Change e-mail to kernel.org one
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (3 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 04/17] perf callchains: Disable unwind libraries when libelf isn't found Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 06/17] perf tools: Pick up libdw without explicit LIBDW_DIR Jiri Olsa
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Don Zickus, Frederic Weisbecker, Jiri Olsa,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Stephane Eranian

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

Leaving ghostprotocols.net for old networking stuff.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.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-jott6d40nkjjc3vvh3vw53lp@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 1ecfde1..b06a9a8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6678,7 +6678,7 @@ PERFORMANCE EVENTS SUBSYSTEM
 M:	Peter Zijlstra <a.p.zijlstra@chello.nl>
 M:	Paul Mackerras <paulus@samba.org>
 M:	Ingo Molnar <mingo@redhat.com>
-M:	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
+M:	Arnaldo Carvalho de Melo <acme@kernel.org>
 L:	linux-kernel@vger.kernel.org
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
 S:	Supported
-- 
1.8.3.1


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

* [PATCH 06/17] perf tools: Pick up libdw without explicit LIBDW_DIR
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (4 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 05/17] MAINTAINERS: Change e-mail to kernel.org one Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 07/17] perf probe: Fix --line option behavior Jiri Olsa
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Ramkumar Ramachandra, Arnaldo Carvalho de Melo, Jiri Olsa

From: Ramkumar Ramachandra <artagnon@gmail.com>

The Makefile logic sets FEATURE_CHECKS_CFLAGS-libdw-dwarf-unwind and
FEATURE_CHECKS_LDFLAGS-libdw-dwarf-unwind only if LIBDW_DIR is
defined. This means that under a normal setup,

  $ make NO_LIBUNWIND=1

won't automatically pick up libdw. Fix this.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Acked-by: Jean Pihet <jean.pihet@linaro.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1395873845-466-1-git-send-email-artagnon@gmail.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/config/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5a3c452..ee21fa9 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -65,10 +65,9 @@ ifndef NO_LIBELF
   ifdef LIBDW_DIR
     LIBDW_CFLAGS  := -I$(LIBDW_DIR)/include
     LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
-
-    FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
-    FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
   endif
+  FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
+  FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
 endif
 
 # include ARCH specific config
-- 
1.8.3.1


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

* [PATCH 07/17] perf probe: Fix --line option behavior
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (5 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 06/17] perf tools: Pick up libdw without explicit LIBDW_DIR Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 08/17] perf probe: Fix to handle errors in line_range searching Jiri Olsa
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Namhyung Kim, Masami Hiramatsu, Jiri Olsa

From: Namhyung Kim <namhyung@kernel.org>

The commit 5a62257a3ddd1 ("perf probe: Replace line_list with
intlist") replaced line_list to intlist but it has a problem that if a
same line was added again, it'd return -EEXIST rather than 1.

Since line_range_walk_cb() only checks the result being negative, it
resulted in failure or segfault sometimes.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Link: http://lkml.kernel.org/r/1396327677-3657-1-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/util/probe-finder.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index df02386..3bf0c8c 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1441,13 +1441,15 @@ static int line_range_walk_cb(const char *fname, int lineno,
 			      void *data)
 {
 	struct line_finder *lf = data;
+	int err;
 
 	if ((strtailcmp(fname, lf->fname) != 0) ||
 	    (lf->lno_s > lineno || lf->lno_e < lineno))
 		return 0;
 
-	if (line_range_add_line(fname, lineno, lf->lr) < 0)
-		return -EINVAL;
+	err = line_range_add_line(fname, lineno, lf->lr);
+	if (err < 0 && err != -EEXIST)
+		return err;
 
 	return 0;
 }
-- 
1.8.3.1


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

* [PATCH 08/17] perf probe: Fix to handle errors in line_range searching
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (6 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 07/17] perf probe: Fix --line option behavior Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 09/17] perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi() Jiri Olsa
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Masami Hiramatsu, Arnaldo Carvalho de Melo,
	Jiri Olsa, Namhyung Kim, Paul Mackerras, Peter Zijlstra

From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

As Namhyung reported(https://lkml.org/lkml/2014/4/1/89),
current perf-probe -L option doesn't handle errors in line-range
searching correctly. It causes a SEGV if an error occured in the
line-range searching.

  ----
  $ perf probe -x ./perf -v -L map__load
  Open Debuginfo file: /home/namhyung/project/linux/tools/perf/perf
  fname: util/map.c, lineno:153
  New line range: 153 to 2147483647
  path: (null)
  Segmentation fault (core dumped)
  ----

This is because line_range_inline_cb() ignores errors
from find_line_range_by_line() which means that lr->path is
already freed on the error path in find_line_range_by_line().
As a result, get_real_path() accesses the lr->path and it
causes a NULL pointer exception.

This fixes line_range_inline_cb() to handle the error correctly,
and report it to the caller.

Anyway, this just fixes a possible SEGV bug, Namhyung's patch
is also required.

Reported-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20140402054831.19080.27006.stgit@ltc230.yrl.intra.hitachi.co.jp
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/util/probe-finder.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index 3bf0c8c..fae274e 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -1475,14 +1475,15 @@ static int find_line_range_by_line(Dwarf_Die *sp_die, struct line_finder *lf)
 
 static int line_range_inline_cb(Dwarf_Die *in_die, void *data)
 {
-	find_line_range_by_line(in_die, data);
+	int ret = find_line_range_by_line(in_die, data);
 
 	/*
 	 * We have to check all instances of inlined function, because
 	 * some execution paths can be optimized out depends on the
-	 * function argument of instances
+	 * function argument of instances. However, if an error occurs,
+	 * it should be handled by the caller.
 	 */
-	return 0;
+	return ret < 0 ? ret : 0;
 }
 
 /* Search function definition from function name */
-- 
1.8.3.1


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

* [PATCH 09/17] perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi()
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (7 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 08/17] perf probe: Fix to handle errors in line_range searching Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 10/17] perf bench: Update manpage to mention numa and futex Jiri Olsa
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Namhyung Kim, Masami Hiramatsu, Jiri Olsa

From: Namhyung Kim <namhyung@kernel.org>

The dwarf_getcfi() only checks .debug_frame section for CFI, but as
most binaries only have .eh_frame it'd return NULL and it makes
some variables inaccessible.

Using dwarf_getcfi_elf (along with dwarf_getelf()) allows to show and
add probe to more variables.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Link: http://lkml.kernel.org/r/1396854348-9296-1-git-send-email-namhyung@kernel.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/util/probe-finder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c
index fae274e..5627621 100644
--- a/tools/perf/util/probe-finder.c
+++ b/tools/perf/util/probe-finder.c
@@ -985,7 +985,7 @@ static int debuginfo__find_probes(struct debuginfo *dbg,
 
 #if _ELFUTILS_PREREQ(0, 142)
 	/* Get the call frame information from this dwarf */
-	pf->cfi = dwarf_getcfi(dbg->dbg);
+	pf->cfi = dwarf_getcfi_elf(dwarf_getelf(dbg->dbg));
 #endif
 
 	off = 0;
-- 
1.8.3.1


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

* [PATCH 10/17] perf bench: Update manpage to mention numa and futex
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (8 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 09/17] perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi() Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 11/17] perf bench: Fix segfault at the end of an 'all' execution Jiri Olsa
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Ramkumar Ramachandra, Arnaldo Carvalho de Melo,
	David Ahern, Jiri Olsa

From: Ramkumar Ramachandra <artagnon@gmail.com>

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1395964219-22173-3-git-send-email-artagnon@gmail.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/Documentation/perf-bench.txt | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tools/perf/Documentation/perf-bench.txt b/tools/perf/Documentation/perf-bench.txt
index 7065cd6..4464ad7 100644
--- a/tools/perf/Documentation/perf-bench.txt
+++ b/tools/perf/Documentation/perf-bench.txt
@@ -48,6 +48,12 @@ SUBSYSTEM
 'mem'::
 	Memory access performance.
 
+'numa'::
+	NUMA scheduling and MM benchmarks.
+
+'futex'::
+	Futex stressing benchmarks.
+
 'all'::
 	All benchmark subsystems.
 
@@ -187,6 +193,22 @@ Show only the result with page faults before memset.
 --no-prefault::
 Show only the result without page faults before memset.
 
+SUITES FOR 'numa'
+~~~~~~~~~~~~~~~~~
+*mem*::
+Suite for evaluating NUMA workloads.
+
+SUITES FOR 'futex'
+~~~~~~~~~~~~~~~~~~
+*hash*::
+Suite for evaluating hash tables.
+
+*wake*::
+Suite for evaluating wake calls.
+
+*requeue*::
+Suite for evaluating requeue calls.
+
 SEE ALSO
 --------
 linkperf:perf[1]
-- 
1.8.3.1


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

* [PATCH 11/17] perf bench: Fix segfault at the end of an 'all' execution
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (9 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 10/17] perf bench: Update manpage to mention numa and futex Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 12/17] perf bench: Set more defaults in the 'numa' suite Jiri Olsa
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Ramkumar Ramachandra, Arnaldo Carvalho de Melo,
	David Ahern, Jiri Olsa

From: Ramkumar Ramachandra <artagnon@gmail.com>

At the end of

  $ perf bench all

the program segfaults because it attempts to dereference a NULL
pointer. Fix this fault.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1395964219-22173-4-git-send-email-artagnon@gmail.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/builtin-bench.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index f600b74..1e6e777 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -86,7 +86,7 @@ static struct collection collections[] = {
 
 /* Iterate over all benchmarks within a collection: */
 #define for_each_bench(coll, bench) \
-	for (bench = coll->benchmarks; bench->name; bench++)
+	for (bench = coll->benchmarks; bench && bench->name; bench++)
 
 static void dump_benchmarks(struct collection *coll)
 {
-- 
1.8.3.1


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

* [PATCH 12/17] perf bench: Set more defaults in the 'numa' suite
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (10 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 11/17] perf bench: Fix segfault at the end of an 'all' execution Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 13/17] perf stat: Initialize statistics correctly Jiri Olsa
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Ramkumar Ramachandra, Arnaldo Carvalho de Melo,
	David Ahern, Ingo Molnar, Jiri Olsa

From: Ramkumar Ramachandra <artagnon@gmail.com>

Currently,

  $ perf bench numa mem

errors out with usage information. To make this more user-friendly, let
us provide a minimum set of default values required for a test
run. As an added bonus,

  $ perf bench all

now goes all the way to completion.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/r/1395964219-22173-2-git-send-email-artagnon@gmail.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/bench/numa.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index d4c83c6..20697fb 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -1593,6 +1593,10 @@ static void init_params(struct params *p, const char *name, int argc, const char
 	p->data_rand_walk		= true;
 	p->nr_loops			= -1;
 	p->init_random			= true;
+	p->mb_global_str		= "1";
+	p->nr_proc			= 1;
+	p->nr_threads			= 1;
+	p->nr_secs			= 5;
 }
 
 static int run_bench_numa(const char *name, const char **argv)
-- 
1.8.3.1


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

* [PATCH 13/17] perf stat: Initialize statistics correctly
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (11 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 12/17] perf bench: Set more defaults in the 'numa' suite Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 14/17] perf tools: Fix metrics calculation with event qualifiers Jiri Olsa
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Andi Kleen, Jiri Olsa

From: Andi Kleen <ak@linux.intel.com>

perf stat did initialize the stats structure used to compute
stddev etc. incorrectly. It merely zeroes it. But one member
(min) needs to be set to a non zero value. This causes min
to be not computed at all. Call init_stats() correctly.

It doesn't matter for stat currently because it doesn't use
min, but it's still better to do it correctly.

The other users of statistics are already correct.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1395768699-16060-1-git-send-email-andi@firstfloor.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/builtin-stat.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 8b0e1c9..65a151e 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -174,13 +174,20 @@ static inline int perf_evsel__nr_cpus(struct perf_evsel *evsel)
 
 static void perf_evsel__reset_stat_priv(struct perf_evsel *evsel)
 {
-	memset(evsel->priv, 0, sizeof(struct perf_stat));
+	int i;
+	struct perf_stat *ps = evsel->priv;
+
+	for (i = 0; i < 3; i++)
+		init_stats(&ps->res_stats[i]);
 }
 
 static int perf_evsel__alloc_stat_priv(struct perf_evsel *evsel)
 {
 	evsel->priv = zalloc(sizeof(struct perf_stat));
-	return evsel->priv == NULL ? -ENOMEM : 0;
+	if (evsel == NULL)
+		return -ENOMEM;
+	perf_evsel__reset_stat_priv(evsel);
+	return 0;
 }
 
 static void perf_evsel__free_stat_priv(struct perf_evsel *evsel)
-- 
1.8.3.1


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

* [PATCH 14/17] perf tools: Fix metrics calculation with event qualifiers
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (12 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 13/17] perf stat: Initialize statistics correctly Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:38   ` Ingo Molnar
  2014-04-14 14:17 ` [PATCH 15/17] perf tools: Fix double free in perf test 21 (code-reading.c) Jiri Olsa
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Andi Kleen, Jiri Olsa

From: Andi Kleen <ak@linux.intel.com>

Currently in perf IPC and other metrics cannot be directly shown
separately for both user and kernel in a single run. The problem was
that the metrics matching code did not check event qualifiers.

With this patch the following case works correctly.

% perf stat -e cycles:k,cycles:u,instructions:k,instructions:u true

 Performance counter stats for 'true':

           531,718      cycles:k
           203,895      cycles:u
           338,151      instructions:k            #    0.64  insns per cycle
           105,961      instructions:u            #    0.52  insns per cycle

       0.002989739 seconds time elapsed

Previously it would misreport the ratios because they were matching
the wrong value.

The patch is fairly big, but quite mechanic as it just
adds context indexes everywhere.

I didn't support Hypervisor. It's not clear it's worth it.

Reported-by: William Cohen <wcohen@redhat.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1395778047-23111-1-git-send-email-andi@firstfloor.org
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/builtin-stat.c | 129 +++++++++++++++++++++++++++-------------------
 1 file changed, 77 insertions(+), 52 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 65a151e..6687dab 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -246,21 +246,35 @@ out_free:
 	return -1;
 }
 
+#define NUM_CTX 3
+
+enum { CTX_USER, CTX_KERNEL, CTX_ALL };
+
 static struct stats runtime_nsecs_stats[MAX_NR_CPUS];
-static struct stats runtime_cycles_stats[MAX_NR_CPUS];
-static struct stats runtime_stalled_cycles_front_stats[MAX_NR_CPUS];
-static struct stats runtime_stalled_cycles_back_stats[MAX_NR_CPUS];
-static struct stats runtime_branches_stats[MAX_NR_CPUS];
-static struct stats runtime_cacherefs_stats[MAX_NR_CPUS];
-static struct stats runtime_l1_dcache_stats[MAX_NR_CPUS];
-static struct stats runtime_l1_icache_stats[MAX_NR_CPUS];
-static struct stats runtime_ll_cache_stats[MAX_NR_CPUS];
-static struct stats runtime_itlb_cache_stats[MAX_NR_CPUS];
-static struct stats runtime_dtlb_cache_stats[MAX_NR_CPUS];
-static struct stats runtime_cycles_in_tx_stats[MAX_NR_CPUS];
+static struct stats runtime_cycles_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_stalled_cycles_front_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_stalled_cycles_back_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_branches_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_cacherefs_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_l1_dcache_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_l1_icache_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_ll_cache_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_itlb_cache_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_dtlb_cache_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_cycles_in_tx_stats[NUM_CTX][MAX_NR_CPUS];
 static struct stats walltime_nsecs_stats;
-static struct stats runtime_transaction_stats[MAX_NR_CPUS];
-static struct stats runtime_elision_stats[MAX_NR_CPUS];
+static struct stats runtime_transaction_stats[NUM_CTX][MAX_NR_CPUS];
+static struct stats runtime_elision_stats[NUM_CTX][MAX_NR_CPUS];
+
+static int evsel_context(struct perf_evsel *evsel)
+{
+	if (evsel->attr.exclude_kernel)
+		return CTX_USER;
+	if (evsel->attr.exclude_user)
+		return CTX_KERNEL;
+	/* Handle hypervisor too? */
+	return CTX_ALL;
+}
 
 static void perf_stat__reset_stats(struct perf_evlist *evlist)
 {
@@ -354,37 +368,39 @@ static struct perf_evsel *nth_evsel(int n)
  */
 static void update_shadow_stats(struct perf_evsel *counter, u64 *count)
 {
+	int ctx = evsel_context(counter);
+
 	if (perf_evsel__match(counter, SOFTWARE, SW_TASK_CLOCK))
 		update_stats(&runtime_nsecs_stats[0], count[0]);
 	else if (perf_evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
-		update_stats(&runtime_cycles_stats[0], count[0]);
+		update_stats(&runtime_cycles_stats[ctx][0], count[0]);
 	else if (transaction_run &&
 		 perf_evsel__cmp(counter, nth_evsel(T_CYCLES_IN_TX)))
-		update_stats(&runtime_cycles_in_tx_stats[0], count[0]);
+		update_stats(&runtime_cycles_in_tx_stats[ctx][0], count[0]);
 	else if (transaction_run &&
 		 perf_evsel__cmp(counter, nth_evsel(T_TRANSACTION_START)))
-		update_stats(&runtime_transaction_stats[0], count[0]);
+		update_stats(&runtime_transaction_stats[ctx][0], count[0]);
 	else if (transaction_run &&
 		 perf_evsel__cmp(counter, nth_evsel(T_ELISION_START)))
-		update_stats(&runtime_elision_stats[0], count[0]);
+		update_stats(&runtime_elision_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_FRONTEND))
-		update_stats(&runtime_stalled_cycles_front_stats[0], count[0]);
+		update_stats(&runtime_stalled_cycles_front_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_BACKEND))
-		update_stats(&runtime_stalled_cycles_back_stats[0], count[0]);
+		update_stats(&runtime_stalled_cycles_back_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS))
-		update_stats(&runtime_branches_stats[0], count[0]);
+		update_stats(&runtime_branches_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HARDWARE, HW_CACHE_REFERENCES))
-		update_stats(&runtime_cacherefs_stats[0], count[0]);
+		update_stats(&runtime_cacherefs_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_L1D))
-		update_stats(&runtime_l1_dcache_stats[0], count[0]);
+		update_stats(&runtime_l1_dcache_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_L1I))
-		update_stats(&runtime_l1_icache_stats[0], count[0]);
+		update_stats(&runtime_l1_icache_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_LL))
-		update_stats(&runtime_ll_cache_stats[0], count[0]);
+		update_stats(&runtime_ll_cache_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_DTLB))
-		update_stats(&runtime_dtlb_cache_stats[0], count[0]);
+		update_stats(&runtime_dtlb_cache_stats[ctx][0], count[0]);
 	else if (perf_evsel__match(counter, HW_CACHE, HW_CACHE_ITLB))
-		update_stats(&runtime_itlb_cache_stats[0], count[0]);
+		update_stats(&runtime_itlb_cache_stats[ctx][0], count[0]);
 }
 
 /*
@@ -801,8 +817,9 @@ static void print_stalled_cycles_frontend(int cpu,
 {
 	double total, ratio = 0.0;
 	const char *color;
+	int ctx = evsel_context(evsel);
 
-	total = avg_stats(&runtime_cycles_stats[cpu]);
+	total = avg_stats(&runtime_cycles_stats[ctx][cpu]);
 
 	if (total)
 		ratio = avg / total * 100.0;
@@ -820,8 +837,9 @@ static void print_stalled_cycles_backend(int cpu,
 {
 	double total, ratio = 0.0;
 	const char *color;
+	int ctx = evsel_context(evsel);
 
-	total = avg_stats(&runtime_cycles_stats[cpu]);
+	total = avg_stats(&runtime_cycles_stats[ctx][cpu]);
 
 	if (total)
 		ratio = avg / total * 100.0;
@@ -839,8 +857,9 @@ static void print_branch_misses(int cpu,
 {
 	double total, ratio = 0.0;
 	const char *color;
+	int ctx = evsel_context(evsel);
 
-	total = avg_stats(&runtime_branches_stats[cpu]);
+	total = avg_stats(&runtime_branches_stats[ctx][cpu]);
 
 	if (total)
 		ratio = avg / total * 100.0;
@@ -858,8 +877,9 @@ static void print_l1_dcache_misses(int cpu,
 {
 	double total, ratio = 0.0;
 	const char *color;
+	int ctx = evsel_context(evsel);
 
-	total = avg_stats(&runtime_l1_dcache_stats[cpu]);
+	total = avg_stats(&runtime_l1_dcache_stats[ctx][cpu]);
 
 	if (total)
 		ratio = avg / total * 100.0;
@@ -877,8 +897,9 @@ static void print_l1_icache_misses(int cpu,
 {
 	double total, ratio = 0.0;
 	const char *color;
+	int ctx = evsel_context(evsel);
 
-	total = avg_stats(&runtime_l1_icache_stats[cpu]);
+	total = avg_stats(&runtime_l1_icache_stats[ctx][cpu]);
 
 	if (total)
 		ratio = avg / total * 100.0;
@@ -896,8 +917,9 @@ static void print_dtlb_cache_misses(int cpu,
 {
 	double total, ratio = 0.0;
 	const char *color;
+	int ctx = evsel_context(evsel);
 
-	total = avg_stats(&runtime_dtlb_cache_stats[cpu]);
+	total = avg_stats(&runtime_dtlb_cache_stats[ctx][cpu]);
 
 	if (total)
 		ratio = avg / total * 100.0;
@@ -915,8 +937,9 @@ static void print_itlb_cache_misses(int cpu,
 {
 	double total, ratio = 0.0;
 	const char *color;
+	int ctx = evsel_context(evsel);
 
-	total = avg_stats(&runtime_itlb_cache_stats[cpu]);
+	total = avg_stats(&runtime_itlb_cache_stats[ctx][cpu]);
 
 	if (total)
 		ratio = avg / total * 100.0;
@@ -934,8 +957,9 @@ static void print_ll_cache_misses(int cpu,
 {
 	double total, ratio = 0.0;
 	const char *color;
+	int ctx = evsel_context(evsel);
 
-	total = avg_stats(&runtime_ll_cache_stats[cpu]);
+	total = avg_stats(&runtime_ll_cache_stats[ctx][cpu]);
 
 	if (total)
 		ratio = avg / total * 100.0;
@@ -952,6 +976,7 @@ static void abs_printout(int cpu, int nr, struct perf_evsel *evsel, double avg)
 	double total, ratio = 0.0, total2;
 	double sc =  evsel->scale;
 	const char *fmt;
+	int ctx = evsel_context(evsel);
 
 	if (csv_output) {
 		fmt = sc != 1.0 ?  "%.2f%s" : "%.0f%s";
@@ -983,13 +1008,13 @@ static void abs_printout(int cpu, int nr, struct perf_evsel *evsel, double avg)
 		return;
 
 	if (perf_evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS)) {
-		total = avg_stats(&runtime_cycles_stats[cpu]);
+		total = avg_stats(&runtime_cycles_stats[ctx][cpu]);
 		if (total) {
 			ratio = avg / total;
 			fprintf(output, " #   %5.2f  insns per cycle        ", ratio);
 		}
-		total = avg_stats(&runtime_stalled_cycles_front_stats[cpu]);
-		total = max(total, avg_stats(&runtime_stalled_cycles_back_stats[cpu]));
+		total = avg_stats(&runtime_stalled_cycles_front_stats[ctx][cpu]);
+		total = max(total, avg_stats(&runtime_stalled_cycles_back_stats[ctx][cpu]));
 
 		if (total && avg) {
 			ratio = total / avg;
@@ -1000,46 +1025,46 @@ static void abs_printout(int cpu, int nr, struct perf_evsel *evsel, double avg)
 		}
 
 	} else if (perf_evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES) &&
-			runtime_branches_stats[cpu].n != 0) {
+			runtime_branches_stats[ctx][cpu].n != 0) {
 		print_branch_misses(cpu, evsel, avg);
 	} else if (
 		evsel->attr.type == PERF_TYPE_HW_CACHE &&
 		evsel->attr.config ==  ( PERF_COUNT_HW_CACHE_L1D |
 					((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
 					((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16)) &&
-			runtime_l1_dcache_stats[cpu].n != 0) {
+			runtime_l1_dcache_stats[ctx][cpu].n != 0) {
 		print_l1_dcache_misses(cpu, evsel, avg);
 	} else if (
 		evsel->attr.type == PERF_TYPE_HW_CACHE &&
 		evsel->attr.config ==  ( PERF_COUNT_HW_CACHE_L1I |
 					((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
 					((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16)) &&
-			runtime_l1_icache_stats[cpu].n != 0) {
+			runtime_l1_icache_stats[ctx][cpu].n != 0) {
 		print_l1_icache_misses(cpu, evsel, avg);
 	} else if (
 		evsel->attr.type == PERF_TYPE_HW_CACHE &&
 		evsel->attr.config ==  ( PERF_COUNT_HW_CACHE_DTLB |
 					((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
 					((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16)) &&
-			runtime_dtlb_cache_stats[cpu].n != 0) {
+			runtime_dtlb_cache_stats[ctx][cpu].n != 0) {
 		print_dtlb_cache_misses(cpu, evsel, avg);
 	} else if (
 		evsel->attr.type == PERF_TYPE_HW_CACHE &&
 		evsel->attr.config ==  ( PERF_COUNT_HW_CACHE_ITLB |
 					((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
 					((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16)) &&
-			runtime_itlb_cache_stats[cpu].n != 0) {
+			runtime_itlb_cache_stats[ctx][cpu].n != 0) {
 		print_itlb_cache_misses(cpu, evsel, avg);
 	} else if (
 		evsel->attr.type == PERF_TYPE_HW_CACHE &&
 		evsel->attr.config ==  ( PERF_COUNT_HW_CACHE_LL |
 					((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
 					((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16)) &&
-			runtime_ll_cache_stats[cpu].n != 0) {
+			runtime_ll_cache_stats[ctx][cpu].n != 0) {
 		print_ll_cache_misses(cpu, evsel, avg);
 	} else if (perf_evsel__match(evsel, HARDWARE, HW_CACHE_MISSES) &&
-			runtime_cacherefs_stats[cpu].n != 0) {
-		total = avg_stats(&runtime_cacherefs_stats[cpu]);
+			runtime_cacherefs_stats[ctx][cpu].n != 0) {
+		total = avg_stats(&runtime_cacherefs_stats[ctx][cpu]);
 
 		if (total)
 			ratio = avg * 100 / total;
@@ -1059,15 +1084,15 @@ static void abs_printout(int cpu, int nr, struct perf_evsel *evsel, double avg)
 		}
 	} else if (transaction_run &&
 		   perf_evsel__cmp(evsel, nth_evsel(T_CYCLES_IN_TX))) {
-		total = avg_stats(&runtime_cycles_stats[cpu]);
+		total = avg_stats(&runtime_cycles_stats[ctx][cpu]);
 		if (total)
 			fprintf(output,
 				" #   %5.2f%% transactional cycles   ",
 				100.0 * (avg / total));
 	} else if (transaction_run &&
 		   perf_evsel__cmp(evsel, nth_evsel(T_CYCLES_IN_TX_CP))) {
-		total = avg_stats(&runtime_cycles_stats[cpu]);
-		total2 = avg_stats(&runtime_cycles_in_tx_stats[cpu]);
+		total = avg_stats(&runtime_cycles_stats[ctx][cpu]);
+		total2 = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
 		if (total2 < avg)
 			total2 = avg;
 		if (total)
@@ -1077,8 +1102,8 @@ static void abs_printout(int cpu, int nr, struct perf_evsel *evsel, double avg)
 	} else if (transaction_run &&
 		   perf_evsel__cmp(evsel, nth_evsel(T_TRANSACTION_START)) &&
 		   avg > 0 &&
-		   runtime_cycles_in_tx_stats[cpu].n != 0) {
-		total = avg_stats(&runtime_cycles_in_tx_stats[cpu]);
+		   runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
+		total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
 
 		if (total)
 			ratio = total / avg;
@@ -1087,8 +1112,8 @@ static void abs_printout(int cpu, int nr, struct perf_evsel *evsel, double avg)
 	} else if (transaction_run &&
 		   perf_evsel__cmp(evsel, nth_evsel(T_ELISION_START)) &&
 		   avg > 0 &&
-		   runtime_cycles_in_tx_stats[cpu].n != 0) {
-		total = avg_stats(&runtime_cycles_in_tx_stats[cpu]);
+		   runtime_cycles_in_tx_stats[ctx][cpu].n != 0) {
+		total = avg_stats(&runtime_cycles_in_tx_stats[ctx][cpu]);
 
 		if (total)
 			ratio = total / avg;
-- 
1.8.3.1


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

* [PATCH 15/17] perf tools: Fix double free in perf test 21 (code-reading.c)
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (13 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 14/17] perf tools: Fix metrics calculation with event qualifiers Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 16/17] perf machine: Search for modules in %s/lib/modules/%s Jiri Olsa
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Adrian Hunter, Jiri Olsa

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

perf_evlist__delete() deletes attached cpu and thread maps
but the test is still using them, so remove them from the
evlist before deleting it.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Link: http://lkml.kernel.org/r/53465E3E.8070201@intel.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/tests/code-reading.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 653a8fe..bfb1869 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -504,6 +504,7 @@ static int do_test_code_reading(bool try_kcore)
 		if (ret < 0) {
 			if (!excl_kernel) {
 				excl_kernel = true;
+				perf_evlist__set_maps(evlist, NULL, NULL);
 				perf_evlist__delete(evlist);
 				evlist = NULL;
 				continue;
-- 
1.8.3.1


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

* [PATCH 16/17] perf machine: Search for modules in %s/lib/modules/%s
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (14 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 15/17] perf tools: Fix double free in perf test 21 (code-reading.c) Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:17 ` [PATCH 17/17] perf tools: Instead of redirecting flex output, use -o Jiri Olsa
  2014-04-14 14:42 ` [GIT PULL v3 00/17] perf/core fixes Ingo Molnar
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Richard Yao, Jiri Olsa

From: Richard Yao <ryao@gentoo.org>

Modules installed outside of the kernel's build system should go into
"%s/lib/modules/%s/extra", but at present, perf will only look at them
when they are in "%s/lib/modules/%s/kernel". Lets encourage good
citizenship by relaxing this requirement to "%s/lib/modules/%s". This
way open source modules that are out-of-tree have no incentive to start
populating a directory reserved for in-kernle modules and I can stop hex
editing my system's perf binary when profiling OSS out-of-tree modules.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Acked-by: David Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/r/53482425.3090608@gmail.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/util/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index a53cd0b..116842e 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -786,7 +786,7 @@ static int machine__set_modules_path(struct machine *machine)
 	if (!version)
 		return -1;
 
-	snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s/kernel",
+	snprintf(modules_path, sizeof(modules_path), "%s/lib/modules/%s",
 		 machine->root_dir, version);
 	free(version);
 
-- 
1.8.3.1


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

* [PATCH 17/17] perf tools: Instead of redirecting flex output, use -o
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (15 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 16/17] perf machine: Search for modules in %s/lib/modules/%s Jiri Olsa
@ 2014-04-14 14:17 ` Jiri Olsa
  2014-04-14 14:42 ` [GIT PULL v3 00/17] perf/core fixes Ingo Molnar
  17 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:17 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Cody P Schafer, Jiri Olsa

From: Cody P Schafer <cody@linux.vnet.ibm.com>

This gives us a real filename instead of having '<stdout>' show up all
over the place when debugging.

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1396652539-2416-1-git-send-email-cody@linux.vnet.ibm.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
---
 tools/perf/Makefile.perf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 50d875d..e969233 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -192,13 +192,13 @@ endif
 export PERL_PATH
 
 $(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
-	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
+	$(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
 
 $(OUTPUT)util/parse-events-bison.c: util/parse-events.y
 	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
 
 $(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
-	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
+	$(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
 
 $(OUTPUT)util/pmu-bison.c: util/pmu.y
 	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
-- 
1.8.3.1


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

* Re: [PATCH 14/17] perf tools: Fix metrics calculation with event qualifiers
  2014-04-14 14:17 ` [PATCH 14/17] perf tools: Fix metrics calculation with event qualifiers Jiri Olsa
@ 2014-04-14 14:38   ` Ingo Molnar
  0 siblings, 0 replies; 21+ messages in thread
From: Ingo Molnar @ 2014-04-14 14:38 UTC (permalink / raw)
  To: Jiri Olsa; +Cc: linux-kernel, Andi Kleen, Arnaldo Carvalho de Melo


* Jiri Olsa <jolsa@redhat.com> wrote:

> From: Andi Kleen <ak@linux.intel.com>
> 
> Currently in perf IPC and other metrics cannot be directly shown
> separately for both user and kernel in a single run. The problem was
> that the metrics matching code did not check event qualifiers.
> 
> With this patch the following case works correctly.
> 
> % perf stat -e cycles:k,cycles:u,instructions:k,instructions:u true
> 
>  Performance counter stats for 'true':
> 
>            531,718      cycles:k
>            203,895      cycles:u
>            338,151      instructions:k            #    0.64  insns per cycle
>            105,961      instructions:u            #    0.52  insns per cycle
> 
>        0.002989739 seconds time elapsed
> 
> Previously it would misreport the ratios because they were matching
> the wrong value.
> 
> The patch is fairly big, but quite mechanic as it just
> adds context indexes everywhere.
> 
> I didn't support Hypervisor. It's not clear it's worth it.

> +static int evsel_context(struct perf_evsel *evsel)
> +{
> +	if (evsel->attr.exclude_kernel)
> +		return CTX_USER;
> +	if (evsel->attr.exclude_user)
> +		return CTX_KERNEL;
> +	/* Handle hypervisor too? */
> +	return CTX_ALL;

This fix is incomplete, as there are a whole lot of other cases:

                                exclude_user   :  1, /* don't count user      */
                                exclude_kernel :  1, /* ditto kernel          */
                                exclude_hv     :  1, /* ditto hypervisor      */
                                exclude_idle   :  1, /* don't count when idle */

                                exclude_host   :  1, /* don't count in host   */
                                exclude_guest  :  1, /* don't count in guest  */

Many of which can be triggered via current event selectors.

Thanks,

	Ingo

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

* Re: [GIT PULL v3 00/17] perf/core fixes
  2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
                   ` (16 preceding siblings ...)
  2014-04-14 14:17 ` [PATCH 17/17] perf tools: Instead of redirecting flex output, use -o Jiri Olsa
@ 2014-04-14 14:42 ` Ingo Molnar
  2014-04-14 14:52   ` Jiri Olsa
  17 siblings, 1 reply; 21+ messages in thread
From: Ingo Molnar @ 2014-04-14 14:42 UTC (permalink / raw)
  To: Jiri Olsa
  Cc: linux-kernel, Adrian Hunter, Andi Kleen,
	Arnaldo Carvalho de Melo, Cody P Schafer, David Ahern,
	Don Zickus, Frederic Weisbecker, Jean Pihet, Masami Hiramatsu,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Ramkumar Ramachandra, Richard Yao, Stephane Eranian,
	Steven Rostedt, William Cohen


* Jiri Olsa <jolsa@redhat.com> wrote:

> hi Ingo,
> please consider pulling.
> 
> As requested, sending only fixies for 3.15. I'll send the rest for 3.16.
> 
> thanks,
> jirka
> 
> 
> The following changes since commit 538592ff0b008237ae88f5ce5fb1247127dc3ce5:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2014-03-19 08:05:47 +0100)
> 
> are available in the git repository at:
> 
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to c12702d9bf3485d1b34c7913430b4e9271126561:
> 
>   perf tools: Instead of redirecting flex output, use -o (2014-04-14 13:00:46 +0200)
> 
> ----------------------------------------------------------------
> perf/core fixes:
> 
> Documentation:
> 
> . Fix documentation of invalid 'perf top -s' option (Namhyung Kim)
> 
> . Change e-mail to kernel.org one in MAINTAINERS file (Arnaldo Carvalho de Melo)
> 
> . Update bench manpage to mention numa and futex (Ramkumar Ramachandra)
> 
> Developer stuff:
> 
> . Disable unwind libraries when libelf isn't found (Arnaldo Carvalho de Melo)
> 
> . Print event name when showing libtraceevent warnings if possible (Namhyung Kim)
> 
> . Pick up libdw without explicit LIBDW_DIR (Ramkumar Ramachandra)
> 
> . Fix perf bench all segfault (Ramkumar Ramachandra)
> 
> . Set more defaults in the 'numa' suite (Ramkumar Ramachandra)
> 
> . Fix double free in perf test 21 (Adrian Hunter)
> 
> . Initialize statistics correctly (Andi Kleen)
> 
> . Instead of redirecting flex output, use -o (Cody P Schafer)
> 
> User visible:
> 
> . Assorted perf probe fixies (Namhyung Kim)
> 
> . Fix perf probe segfault (Masami Hiramatsu)
> 
> . Fix metrics calculation with event qualifiers (Andi Kleen)
> 
> . Search for modules in %s/lib/modules/%s (Richard Yao)
> 
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> 
> ----------------------------------------------------------------
> Adrian Hunter (1):
>       perf tools: Fix double free in perf test 21 (code-reading.c)
> 
> Andi Kleen (2):
>       perf stat: Initialize statistics correctly
>       perf tools: Fix metrics calculation with event qualifiers
> 
> Arnaldo Carvalho de Melo (2):
>       perf callchains: Disable unwind libraries when libelf isn't found
>       MAINTAINERS: Change e-mail to kernel.org one
> 
> Cody P Schafer (1):
>       perf tools: Instead of redirecting flex output, use -o
> 
> Masami Hiramatsu (1):
>       perf probe: Fix to handle errors in line_range searching
> 
> Namhyung Kim (5):
>       perf top: Fix documentation of invalid -s option
>       tools lib traceevent: Print event name when show warning if possible
>       tools lib traceevent: Do not call warning() directly
>       perf probe: Fix --line option behavior
>       perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi()
> 
> Ramkumar Ramachandra (4):
>       perf tools: Pick up libdw without explicit LIBDW_DIR
>       perf bench: Update manpage to mention numa and futex
>       perf bench: Fix segfault at the end of an 'all' execution
>       perf bench: Set more defaults in the 'numa' suite
> 
> Richard Yao (1):
>       perf machine: Search for modules in %s/lib/modules/%s
> 
>  MAINTAINERS                             |   2 +-
>  tools/lib/traceevent/event-parse.c      | 109 +++++++++++++++----------
>  tools/perf/Documentation/perf-bench.txt |  22 +++++
>  tools/perf/Documentation/perf-top.txt   |   1 -
>  tools/perf/Makefile.perf                |   4 +-
>  tools/perf/bench/numa.c                 |   4 +
>  tools/perf/builtin-bench.c              |   2 +-
>  tools/perf/builtin-stat.c               | 140 ++++++++++++++++++++------------
>  tools/perf/config/Makefile              |   7 +-
>  tools/perf/tests/code-reading.c         |   1 +
>  tools/perf/util/machine.c               |   2 +-
>  tools/perf/util/probe-finder.c          |  15 ++--
>  12 files changed, 197 insertions(+), 112 deletions(-)

I've pulled most of the patches, up to patch #13, thanks Jiri!

I left out #14 because it seems incomplete to me - see my previous 
mail.

You could rebase #15,16,17 on top of #13 to get the rest to me as 
well, until #14 is resolved.

Thanks!

	Ingo

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

* Re: [GIT PULL v3 00/17] perf/core fixes
  2014-04-14 14:42 ` [GIT PULL v3 00/17] perf/core fixes Ingo Molnar
@ 2014-04-14 14:52   ` Jiri Olsa
  0 siblings, 0 replies; 21+ messages in thread
From: Jiri Olsa @ 2014-04-14 14:52 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Adrian Hunter, Andi Kleen,
	Arnaldo Carvalho de Melo, Cody P Schafer, David Ahern,
	Don Zickus, Frederic Weisbecker, Jean Pihet, Masami Hiramatsu,
	Mike Galbraith, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Ramkumar Ramachandra, Richard Yao, Stephane Eranian,
	Steven Rostedt, William Cohen

On Mon, Apr 14, 2014 at 04:42:36PM +0200, Ingo Molnar wrote:

SNIP

> >       perf machine: Search for modules in %s/lib/modules/%s
> > 
> >  MAINTAINERS                             |   2 +-
> >  tools/lib/traceevent/event-parse.c      | 109 +++++++++++++++----------
> >  tools/perf/Documentation/perf-bench.txt |  22 +++++
> >  tools/perf/Documentation/perf-top.txt   |   1 -
> >  tools/perf/Makefile.perf                |   4 +-
> >  tools/perf/bench/numa.c                 |   4 +
> >  tools/perf/builtin-bench.c              |   2 +-
> >  tools/perf/builtin-stat.c               | 140 ++++++++++++++++++++------------
> >  tools/perf/config/Makefile              |   7 +-
> >  tools/perf/tests/code-reading.c         |   1 +
> >  tools/perf/util/machine.c               |   2 +-
> >  tools/perf/util/probe-finder.c          |  15 ++--
> >  12 files changed, 197 insertions(+), 112 deletions(-)
> 
> I've pulled most of the patches, up to patch #13, thanks Jiri!
> 
> I left out #14 because it seems incomplete to me - see my previous 
> mail.
> 
> You could rebase #15,16,17 on top of #13 to get the rest to me as 
> well, until #14 is resolved.

ok, will do

thanks,
jirka

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

end of thread, other threads:[~2014-04-14 14:52 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-14 14:17 [GIT PULL v3 00/17] perf/core fixes Jiri Olsa
2014-04-14 14:17 ` [PATCH 01/17] perf top: Fix documentation of invalid -s option Jiri Olsa
2014-04-14 14:17 ` [PATCH 02/17] tools lib traceevent: Print event name when show warning if possible Jiri Olsa
2014-04-14 14:17 ` [PATCH 03/17] tools lib traceevent: Do not call warning() directly Jiri Olsa
2014-04-14 14:17 ` [PATCH 04/17] perf callchains: Disable unwind libraries when libelf isn't found Jiri Olsa
2014-04-14 14:17 ` [PATCH 05/17] MAINTAINERS: Change e-mail to kernel.org one Jiri Olsa
2014-04-14 14:17 ` [PATCH 06/17] perf tools: Pick up libdw without explicit LIBDW_DIR Jiri Olsa
2014-04-14 14:17 ` [PATCH 07/17] perf probe: Fix --line option behavior Jiri Olsa
2014-04-14 14:17 ` [PATCH 08/17] perf probe: Fix to handle errors in line_range searching Jiri Olsa
2014-04-14 14:17 ` [PATCH 09/17] perf probe: Use dwarf_getcfi_elf() instead of dwarf_getcfi() Jiri Olsa
2014-04-14 14:17 ` [PATCH 10/17] perf bench: Update manpage to mention numa and futex Jiri Olsa
2014-04-14 14:17 ` [PATCH 11/17] perf bench: Fix segfault at the end of an 'all' execution Jiri Olsa
2014-04-14 14:17 ` [PATCH 12/17] perf bench: Set more defaults in the 'numa' suite Jiri Olsa
2014-04-14 14:17 ` [PATCH 13/17] perf stat: Initialize statistics correctly Jiri Olsa
2014-04-14 14:17 ` [PATCH 14/17] perf tools: Fix metrics calculation with event qualifiers Jiri Olsa
2014-04-14 14:38   ` Ingo Molnar
2014-04-14 14:17 ` [PATCH 15/17] perf tools: Fix double free in perf test 21 (code-reading.c) Jiri Olsa
2014-04-14 14:17 ` [PATCH 16/17] perf machine: Search for modules in %s/lib/modules/%s Jiri Olsa
2014-04-14 14:17 ` [PATCH 17/17] perf tools: Instead of redirecting flex output, use -o Jiri Olsa
2014-04-14 14:42 ` [GIT PULL v3 00/17] perf/core fixes Ingo Molnar
2014-04-14 14:52   ` Jiri Olsa

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.