linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/24] perf/core improvements and fixes
@ 2016-07-15 20:50 Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 01/24] tools lib traceevent: Add correct header for ipv6 definitions Arnaldo Carvalho de Melo
                   ` (24 more replies)
  0 siblings, 25 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andy Lutomirski, Chris Phlipot, David Ahern, He Kuang,
	H . Peter Anvin, Jiri Olsa, Josh Poimboeuf, Masami Hiramatsu,
	Namhyung Kim, Nilay Vaish, Peter Zijlstra, pi3orama,
	Songshan Gong, Stephen Rothwell, Steven Rostedt, Thomas Gleixner,
	Wang Nan, Zefan Li, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

Test results, with a new target: cross-compiling to Android ARM API 24 (NDK r12b),
for all except android-ndk:r12b now objtool is tested too, in adition to tools/perf.

  [root@jouet ~]# dm
  alpine:3.4: Ok
  android-ndk:r12b: Ok
  centos:5: Ok
  centos:6: Ok
  centos:7: Ok
  debian:7: Ok
  debian:8: Ok
  debian:experimental: Ok
  fedora:21: Ok
  fedora:22: Ok
  fedora:23: Ok
  fedora:24: Ok
  fedora:rawhide: Ok
  opensuse:13.2: Ok
  opensuse:42.1: Ok
  ubuntu:14.04.4: Ok
  ubuntu:15.10: Ok
  ubuntu:16.04: Ok
  [root@jouet ~]#

oops, the mageia image din't got rebuilt, will fix that, pretty good coverage
even so :-)

- Arnaldo

The following changes since commit b29c6574699dc475da5dbff8db19297b203aacce:

  Merge tag 'perf-core-for-mingo-20160713' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-07-14 08:54:13 +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-20160715

for you to fetch changes up to b49364f36cfdb6d540ac961102d7ffaf84279bb6:

  objtool: Initialize variable to silence old compiler (2016-07-15 17:32:52 -0300)

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

User visible:

- Allow reading from a backward ring buffer (one setup via sys_perf_event_open
  with perf_event_attr.write_backward = 1) (Wang Nan)

Infrastructure:

- Fix the build on Android NDK r12b (initially just for arm), that is now port
  of my perf-build container collection and will get tested prior to sending
  patches upstream (Arnaldo Carvalho de Melo)

- Add correct header for ipv6 defini

- Fix bitsperlong.h fallout (Arnaldo Carvalho de Melo, Peter Zijlstra)

- Use base 0 (auto) in filename__read_ull, so that we can handle hex values too (Jiri Olsa)

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (8):
      tools lib traceevent: Add correct header for ipv6 definitions
      perf tools: Do not provide dup sched_getcpu() prototype on Android
      tools: Make "__always_inline" just "inline" on Android
      perf tools: Just pr_debug() about not being able to read cacheline_size
      perf tools: Bail out at "--sort dcacheline" and cacheline_size not known
      perf evlist: Drop redundant evsel->overwrite indicator
      objtool: Add -I$(srctree)/tools/arch/$(ARCH)/include/uapi
      objtool: Initialize variable to silence old compiler

Jiri Olsa (1):
      tools lib api fs: Use base 0 in filename__read_ull

Peter Zijlstra (1):
      tools: Simplify BITS_PER_LONG define

Wang Nan (14):
      tools lib fd array: Allow associating a pointer cookie with each entry
      perf evlist: Update mmap related APIs and helpers
      perf record: Decouple record__mmap_read() and evlist.
      perf evlist: Record mmap cookie into fdarray private field
      perf evlist: Extract common code in mmap failure processing
      perf evlist: Introduce backward_mmap array for evlist
      perf evlist: Map backward events to backward_mmap
      perf evlist: Drop evlist->backward
      perf evlist: Setup backward mmap state machine
      perf record: Read from overwritable ring buffer
      perf evlist: Make {pause,resume} internal helpers
      perf tools: Enable overwrite settings
      perf session: Don't warn about out of order event if write_backward is used
      perf record: Add --tail-synthesize option

 tools/include/asm-generic/bitsperlong.h  |  23 +--
 tools/include/linux/compiler.h           |  11 ++
 tools/lib/api/fd/array.h                 |   1 +
 tools/lib/api/fs/fs.c                    |   7 +-
 tools/lib/traceevent/event-parse.c       |   3 +-
 tools/objtool/Makefile                   |   2 +-
 tools/objtool/builtin-check.c            |   2 +-
 tools/perf/Documentation/perf-record.txt |  22 +++
 tools/perf/builtin-record.c              | 113 ++++++++++---
 tools/perf/perf.c                        |   2 +-
 tools/perf/perf.h                        |   2 +
 tools/perf/tests/backward-ring-buffer.c  |  14 +-
 tools/perf/util/evlist.c                 | 269 ++++++++++++++++++++++---------
 tools/perf/util/evlist.h                 |  47 +++++-
 tools/perf/util/evsel.c                  |  16 +-
 tools/perf/util/evsel.h                  |   3 +-
 tools/perf/util/parse-events.c           |  20 ++-
 tools/perf/util/parse-events.h           |   2 +
 tools/perf/util/parse-events.l           |   2 +
 tools/perf/util/session.c                |  22 ++-
 tools/perf/util/sort.c                   |   8 +-
 tools/perf/util/util.h                   |   2 +-
 22 files changed, 441 insertions(+), 152 deletions(-)

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

* [PATCH 01/24] tools lib traceevent: Add correct header for ipv6 definitions
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 02/24] perf tools: Do not provide dup sched_getcpu() prototype on Android Arnaldo Carvalho de Melo
                   ` (23 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Chris Phlipot, David Ahern, Jiri Olsa, Namhyung Kim,
	Steven Rostedt, Wang Nan

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

We need to include netinet/in.h to get the in6_addr struct definition, needed to
build it on the Android NDK:

  In file included from event-parse.c:36:0:
  /home/acme/android/android-ndk-r12/platforms/android-24/arch-arm/usr/include/netinet/ip6.h:82:18: error: field 'ip6_src' has incomplete type
    struct in6_addr ip6_src; /* source address */

And it is the canonical way of getting IPv6 definitions, as described,
for instance, in Linux's 'man ipv6'

Doing that uncovers another problem: this source file uses PRIu64 but
doesn't include it, depending on it being included by chance via the now
replaced header (netinet/ip6.h), fix it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-tilr31n3yaba1whsd47qlwa3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/traceevent/event-parse.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 3a7bd175f73c..664c90c8e22b 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -23,6 +23,7 @@
  *  Frederic Weisbecker gave his permission to relicense the code to
  *  the Lesser General Public License.
  */
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -33,7 +34,7 @@
 #include <limits.h>
 #include <linux/string.h>
 
-#include <netinet/ip6.h>
+#include <netinet/in.h>
 #include "event-parse.h"
 #include "event-utils.h"
 
-- 
2.7.4

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

* [PATCH 02/24] perf tools: Do not provide dup sched_getcpu() prototype on Android
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 01/24] tools lib traceevent: Add correct header for ipv6 definitions Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 03/24] tools: Make "__always_inline" just "inline" " Arnaldo Carvalho de Melo
                   ` (22 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Chris Phlipot, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan

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

The Bionic libc has this definition, so don't duplicate it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-rmd19832zkt07e4crdzyen9z@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/util.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 6178cab82374..843cbba8f9d3 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -360,7 +360,7 @@ void print_binary(unsigned char *data, size_t len,
 		  size_t bytes_per_line, print_binary_t printer,
 		  void *extra);
 
-#ifndef __GLIBC__
+#if !defined(__GLIBC__) && !defined(__ANDROID__)
 extern int sched_getcpu(void);
 #endif
 
-- 
2.7.4

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

* [PATCH 03/24] tools: Make "__always_inline" just "inline" on Android
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 01/24] tools lib traceevent: Add correct header for ipv6 definitions Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 02/24] perf tools: Do not provide dup sched_getcpu() prototype on Android Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 04/24] perf tools: Just pr_debug() about not being able to read cacheline_size Arnaldo Carvalho de Melo
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Chris Phlipot, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan

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

As the gcc there is producing tons of:

  "warning: always_inline function might not be inlinable"

At least on android-ndk-r12/platforms/android-24/arch-arm, so, for the
time being, use this big hammer.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-97l3eg3fnk5shmo4rsyyvj2t@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/linux/compiler.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/tools/include/linux/compiler.h b/tools/include/linux/compiler.h
index fa7208a32d76..e33fc1df3935 100644
--- a/tools/include/linux/compiler.h
+++ b/tools/include/linux/compiler.h
@@ -9,6 +9,17 @@
 # define __always_inline	inline __attribute__((always_inline))
 #endif
 
+#ifdef __ANDROID__
+/*
+ * FIXME: Big hammer to get rid of tons of:
+ *   "warning: always_inline function might not be inlinable"
+ *
+ * At least on android-ndk-r12/platforms/android-24/arch-arm
+ */
+#undef __always_inline
+#define __always_inline	inline
+#endif
+
 #define __user
 
 #ifndef __attribute_const__
-- 
2.7.4

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

* [PATCH 04/24] perf tools: Just pr_debug() about not being able to read cacheline_size
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 03/24] tools: Make "__always_inline" just "inline" " Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 05/24] perf tools: Bail out at "--sort dcacheline" and cacheline_size not known Arnaldo Carvalho de Melo
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Chris Phlipot, David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan

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

So far the cacheline_size is only useful for the "dcacheline" --sort
order, i.e. if that is not used, which is the norm, then the user
shouldn't care that he is running this, say, on an Android system where
sysconf(_SC_LEVEL1_DCACHE_LINESIZE) and the
/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size sysfs file
isn't available.

An upcoming patch will emit an warning only for "--sort ...,dcacheline,...".

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Chris Phlipot <cphlipot0@gmail.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-580cnkvftunyvt9n7unsholi@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 4b2ff021434c..64c06961bfe4 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -503,7 +503,7 @@ void pthread__unblock_sigwinch(void)
 static void cache_line_size(int *cacheline_sizep)
 {
 	if (sysfs__read_int("devices/system/cpu/cpu0/cache/index0/coherency_line_size", cacheline_sizep))
-		perror("cannot determine cache line size");
+		pr_debug("cannot determine cache line size");
 }
 #endif
 
-- 
2.7.4

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

* [PATCH 05/24] perf tools: Bail out at "--sort dcacheline" and cacheline_size not known
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 04/24] perf tools: Just pr_debug() about not being able to read cacheline_size Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 06/24] tools lib api fs: Use base 0 in filename__read_ull Arnaldo Carvalho de Melo
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Namhyung Kim, Wang Nan

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

There are cases where further work would be needed to overcome the fact
that neither sysconf(_SC_LEVEL1_DCACHE_LINESIZE) nor
/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size are
available in some systems (Android, for instance), so bail out when such
a situation takes place.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-ho8d8g8mh0o2dri7ckcccafi@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/sort.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 5854b4660a49..947d21f38398 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -2381,6 +2381,9 @@ static int sort_dimension__add(struct perf_hpp_list *list, const char *tok,
 		if (sort__mode != SORT_MODE__MEMORY)
 			return -EINVAL;
 
+		if (sd->entry == &sort_mem_dcacheline && cacheline_size == 0)
+			return -EINVAL;
+
 		if (sd->entry == &sort_mem_daddr_sym)
 			list->sym = 1;
 
@@ -2424,7 +2427,10 @@ static int setup_sort_list(struct perf_hpp_list *list, char *str,
 		if (*tok) {
 			ret = sort_dimension__add(list, tok, evlist, level);
 			if (ret == -EINVAL) {
-				error("Invalid --sort key: `%s'", tok);
+				if (!cacheline_size && !strncasecmp(tok, "dcacheline", strlen(tok)))
+					error("The \"dcacheline\" --sort key needs to know the cacheline size and it couldn't be determined on this system");
+				else
+					error("Invalid --sort key: `%s'", tok);
 				break;
 			} else if (ret == -ESRCH) {
 				error("Unknown --sort key: `%s'", tok);
-- 
2.7.4

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

* [PATCH 06/24] tools lib api fs: Use base 0 in filename__read_ull
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 05/24] perf tools: Bail out at "--sort dcacheline" and cacheline_size not known Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 07/24] perf evlist: Drop redundant evsel->overwrite indicator Arnaldo Carvalho de Melo
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Namhyung Kim,
	Peter Zijlstra, Songshan Gong, Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

By using 0 for base, the strtoull() detects the base automatically (see
'man strtoull').

ATM we have just one user of this function, the cpu__get_max_freq
function reading the "cpuinfo_max_freq" sysfs file. It should not get
affected by this change.

Committer note:

This change seems motivated by this discussion:

"[PATCH] [RFC V1]s390/perf: fix 'start' address of module's map"
http://lkml.kernel.org/r/20160711120155.GA29929@krava

I.e. this patches paves the way for filename__read_ull() to be used in a
S/390 related fix.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Songshan Gong <gongss@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1468567797-27564-4-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/fs/fs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 08556cf2c70d..ba7094b945ff 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -283,6 +283,11 @@ int filename__read_int(const char *filename, int *value)
 	return err;
 }
 
+/*
+ * Parses @value out of @filename with strtoull.
+ * By using 0 for base, the strtoull detects the
+ * base automatically (see man strtoull).
+ */
 int filename__read_ull(const char *filename, unsigned long long *value)
 {
 	char line[64];
@@ -292,7 +297,7 @@ int filename__read_ull(const char *filename, unsigned long long *value)
 		return -1;
 
 	if (read(fd, line, sizeof(line)) > 0) {
-		*value = strtoull(line, NULL, 10);
+		*value = strtoull(line, NULL, 0);
 		if (*value != ULLONG_MAX)
 			err = 0;
 	}
-- 
2.7.4

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

* [PATCH 07/24] perf evlist: Drop redundant evsel->overwrite indicator
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 06/24] tools lib api fs: Use base 0 in filename__read_ull Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 08/24] tools: Simplify BITS_PER_LONG define Arnaldo Carvalho de Melo
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, He Kuang, Jiri Olsa,
	Masami Hiramatsu, Namhyung Kim, Nilay Vaish, Wang Nan, Zefan Li,
	pi3orama

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

evsel->overwrite indicator means an event should be put into
overwritable ring buffer. In current implementation, it equals to
evsel->attr.write_backward. To reduce compliexity, remove
evsel->overwrite, use evsel->attr.write_backward instead.

In addition, in __perf_evsel__open(), if kernel doesn't support
write_backward and user explicitly set it in evsel, don't fallback
like other missing feature, since it is meaningless to fall back to
a forward ring buffer in this case: we are unable to stably read
from an forward overwritable ring buffer.

Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Wang Nan <wangnan0@huawei.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/backward-ring-buffer.c |  1 +
 tools/perf/util/evlist.c                |  4 ++--
 tools/perf/util/evsel.c                 | 12 +++++-------
 tools/perf/util/evsel.h                 |  1 -
 4 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index f20ea4c0d0cb..5cee3873f2b5 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -101,6 +101,7 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
 		return TEST_FAIL;
 	}
 
+	evlist->backward = true;
 	err = perf_evlist__create_maps(evlist, &opts.target);
 	if (err < 0) {
 		pr_debug("Not enough memory to create thread/cpu maps\n");
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 862e69c2690d..6803f5ccd15e 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -1003,7 +1003,7 @@ static bool
 perf_evlist__should_poll(struct perf_evlist *evlist __maybe_unused,
 			 struct perf_evsel *evsel)
 {
-	if (evsel->overwrite)
+	if (evsel->attr.write_backward)
 		return false;
 	return true;
 }
@@ -1018,7 +1018,7 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
 	evlist__for_each_entry(evlist, evsel) {
 		int fd;
 
-		if (evsel->overwrite != (evlist->overwrite && evlist->backward))
+		if (!!evsel->attr.write_backward != (evlist->overwrite && evlist->backward))
 			continue;
 
 		if (evsel->system_wide && thread)
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index ba0f59fa3d5d..9ac2f92ce88d 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1377,6 +1377,9 @@ static int __perf_evsel__open(struct perf_evsel *evsel, struct cpu_map *cpus,
 	int pid = -1, err;
 	enum { NO_CHANGE, SET_TO_MAX, INCREASED_MAX } set_rlimit = NO_CHANGE;
 
+	if (perf_missing_features.write_backward && evsel->attr.write_backward)
+		return -EINVAL;
+
 	if (evsel->system_wide)
 		nthreads = 1;
 	else
@@ -1407,11 +1410,6 @@ fallback_missing_features:
 	if (perf_missing_features.lbr_flags)
 		evsel->attr.branch_sample_type &= ~(PERF_SAMPLE_BRANCH_NO_FLAGS |
 				     PERF_SAMPLE_BRANCH_NO_CYCLES);
-	if (perf_missing_features.write_backward) {
-		if (evsel->overwrite)
-			return -EINVAL;
-		evsel->attr.write_backward = false;
-	}
 retry_sample_id:
 	if (perf_missing_features.sample_id_all)
 		evsel->attr.sample_id_all = 0;
@@ -1513,7 +1511,7 @@ try_fallback:
 	 */
 	if (!perf_missing_features.write_backward && evsel->attr.write_backward) {
 		perf_missing_features.write_backward = true;
-		goto fallback_missing_features;
+		goto out_close;
 	} else if (!perf_missing_features.clockid_wrong && evsel->attr.use_clockid) {
 		perf_missing_features.clockid_wrong = true;
 		goto fallback_missing_features;
@@ -2422,7 +2420,7 @@ int perf_evsel__open_strerror(struct perf_evsel *evsel, struct target *target,
 	"We found oprofile daemon running, please stop it and try again.");
 		break;
 	case EINVAL:
-		if (evsel->overwrite && perf_missing_features.write_backward)
+		if (evsel->attr.write_backward && perf_missing_features.write_backward)
 			return scnprintf(msg, size, "Reading from overwrite event is not supported by this kernel.");
 		if (perf_missing_features.clockid)
 			return scnprintf(msg, size, "clockid feature not supported.");
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index d73391e8740e..e60cbfc2cd35 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -114,7 +114,6 @@ struct perf_evsel {
 	bool			tracking;
 	bool			per_pkg;
 	bool			precise_max;
-	bool			overwrite;
 	/* parse modifier helper */
 	int			exclude_GH;
 	int			nr_members;
-- 
2.7.4

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

* [PATCH 08/24] tools: Simplify BITS_PER_LONG define
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 07/24] perf evlist: Drop redundant evsel->overwrite indicator Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 09/24] tools lib fd array: Allow associating a pointer cookie with each entry Arnaldo Carvalho de Melo
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Peter Zijlstra, Andy Lutomirski, H . Peter Anvin,
	Thomas Gleixner, Arnaldo Carvalho de Melo

From: Peter Zijlstra <peterz@infradead.org>

Do it using (__CHAR_BIT__ * __SIZEOF_LONG__), simpler, works everywhere,
reduces the complexity by ditching CONFIG_64BIT, that was being
synthesized from yet another set of defines, which proved fragile,
breaking the build on linux-next for no obvious reasons.

Committer Note:

Except on:

gcc version 4.1.2 20080704 (Red Hat 4.1.2-55)

Fallback to __WORDSIZE in that case...

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160715072243.GP30154@twins.programming.kicks-ass.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/include/asm-generic/bitsperlong.h | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

diff --git a/tools/include/asm-generic/bitsperlong.h b/tools/include/asm-generic/bitsperlong.h
index cfd661c6fc17..45eca517efb3 100644
--- a/tools/include/asm-generic/bitsperlong.h
+++ b/tools/include/asm-generic/bitsperlong.h
@@ -3,31 +3,12 @@
 
 #include <uapi/asm-generic/bitsperlong.h>
 
-/*
- * In the kernel, where this file comes from, we can rely on CONFIG_64BIT,
- * here we have to make amends with what the various compilers provides us
- * to figure out if we're on a 64-bit machine...
- */
 #ifdef __SIZEOF_LONG__
-# if __SIZEOF_LONG__ == 8
-#  define CONFIG_64BIT
-# endif
+#define BITS_PER_LONG (__CHAR_BIT__ * __SIZEOF_LONG__)
 #else
-# ifdef __WORDSIZE
-#  if __WORDSIZE == 64
-#   define CONFIG_64BIT
-#  endif
-# else
-#  error Failed to determine BITS_PER_LONG value
-# endif
+#define BITS_PER_LONG __WORDSIZE
 #endif
 
-#ifdef CONFIG_64BIT
-#define BITS_PER_LONG 64
-#else
-#define BITS_PER_LONG 32
-#endif /* CONFIG_64BIT */
-
 #if BITS_PER_LONG != __BITS_PER_LONG
 #error Inconsistent word size. Check asm/bitsperlong.h
 #endif
-- 
2.7.4

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

* [PATCH 09/24] tools lib fd array: Allow associating a pointer cookie with each entry
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 08/24] tools: Simplify BITS_PER_LONG define Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 10/24] perf evlist: Update mmap related APIs and helpers Arnaldo Carvalho de Melo
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, Adrian Hunter, David Ahern, He Kuang,
	Masami Hiramatsu, Namhyung Kim, Nilay Vaish, Peter Zijlstra,
	Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Add a 'ptr' field to fdarray->priv array.

This feature will be used by following commits, which introduce
muiltiple 'struct perf_mmap' arrays for different types of mapping.

Because of this, during fdarray__filter(), a simple 'idx' is not enough.

Add a pointer cookie that allows to directly associate a 'struct
perf_mmap' pointer to an fdarray entry.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-3-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/fd/array.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/api/fd/array.h b/tools/lib/api/fd/array.h
index e87fd800fa8d..71287dddc05f 100644
--- a/tools/lib/api/fd/array.h
+++ b/tools/lib/api/fd/array.h
@@ -22,6 +22,7 @@ struct fdarray {
 	struct pollfd *entries;
 	union {
 		int    idx;
+		void   *ptr;
 	} *priv;
 };
 
-- 
2.7.4

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

* [PATCH 10/24] perf evlist: Update mmap related APIs and helpers
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 09/24] tools lib fd array: Allow associating a pointer cookie with each entry Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 11/24] perf record: Decouple record__mmap_read() and evlist Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Currently, the evlist mmap related helpers and APIs accept evlist and
idx, and dereference 'struct perf_mmap' by evlist->mmap[idx]. This is
unnecessary, and force each evlist contains only one mmap array.

Following commits are going to introduce multiple mmap arrays to a
evlist.  This patch refators these APIs and helpers, introduces
functions accept perf_mmap pointer directly. New helpers and APIs are
decoupled with perf_evlist, and become perf_mmap functions (so they have
perf_mmap prefix).

Old functions are reimplemented with new functions. Some of them will be
removed in following commits.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-4-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 139 ++++++++++++++++++++++++++++++++---------------
 tools/perf/util/evlist.h |  12 ++++
 2 files changed, 108 insertions(+), 43 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 6803f5ccd15e..a4137e02eab8 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -29,6 +29,7 @@
 
 static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx);
 static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx);
+static void perf_mmap__munmap(struct perf_mmap *map);
 
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
 #define SID(e, x, y) xyarray__entry(e->sample_id, x, y)
@@ -781,9 +782,8 @@ broken_event:
 	return event;
 }
 
-union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int idx)
+union perf_event *perf_mmap__read_forward(struct perf_mmap *md, bool check_messup)
 {
-	struct perf_mmap *md = &evlist->mmap[idx];
 	u64 head;
 	u64 old = md->prev;
 
@@ -795,13 +795,12 @@ union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int
 
 	head = perf_mmap__read_head(md);
 
-	return perf_mmap__read(md, evlist->overwrite, old, head, &md->prev);
+	return perf_mmap__read(md, check_messup, old, head, &md->prev);
 }
 
 union perf_event *
-perf_evlist__mmap_read_backward(struct perf_evlist *evlist, int idx)
+perf_mmap__read_backward(struct perf_mmap *md)
 {
-	struct perf_mmap *md = &evlist->mmap[idx];
 	u64 head, end;
 	u64 start = md->prev;
 
@@ -836,6 +835,31 @@ perf_evlist__mmap_read_backward(struct perf_evlist *evlist, int idx)
 	return perf_mmap__read(md, false, start, end, &md->prev);
 }
 
+union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist, int idx)
+{
+	struct perf_mmap *md = &evlist->mmap[idx];
+
+	/*
+	 * Check messup is required for forward overwritable ring buffer:
+	 * memory pointed by md->prev can be overwritten in this case.
+	 * No need for read-write ring buffer: kernel stop outputting when
+	 * it hit md->prev (perf_mmap__consume()).
+	 */
+	return perf_mmap__read_forward(md, evlist->overwrite);
+}
+
+union perf_event *perf_evlist__mmap_read_backward(struct perf_evlist *evlist, int idx)
+{
+	struct perf_mmap *md = &evlist->mmap[idx];
+
+	/*
+	 * No need to check messup for backward ring buffer:
+	 * We can always read arbitrary long data from a backward
+	 * ring buffer unless we forget to pause it before reading.
+	 */
+	return perf_mmap__read_backward(md);
+}
+
 union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
 {
 	if (!evlist->backward)
@@ -843,9 +867,8 @@ union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
 	return perf_evlist__mmap_read_backward(evlist, idx);
 }
 
-void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx)
+void perf_mmap__read_catchup(struct perf_mmap *md)
 {
-	struct perf_mmap *md = &evlist->mmap[idx];
 	u64 head;
 
 	if (!atomic_read(&md->refcnt))
@@ -855,38 +878,54 @@ void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx)
 	md->prev = head;
 }
 
+void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx)
+{
+	perf_mmap__read_catchup(&evlist->mmap[idx]);
+}
+
 static bool perf_mmap__empty(struct perf_mmap *md)
 {
 	return perf_mmap__read_head(md) == md->prev && !md->auxtrace_mmap.base;
 }
 
-static void perf_evlist__mmap_get(struct perf_evlist *evlist, int idx)
+static void perf_mmap__get(struct perf_mmap *map)
 {
-	atomic_inc(&evlist->mmap[idx].refcnt);
+	atomic_inc(&map->refcnt);
 }
 
-static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx)
+static void perf_mmap__put(struct perf_mmap *md)
 {
-	struct perf_mmap *md = &evlist->mmap[idx];
-
 	BUG_ON(md->base && atomic_read(&md->refcnt) == 0);
 
 	if (atomic_dec_and_test(&md->refcnt))
-		__perf_evlist__munmap(evlist, idx);
+		perf_mmap__munmap(md);
 }
 
-void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx)
+static void perf_evlist__mmap_get(struct perf_evlist *evlist, int idx)
 {
-	struct perf_mmap *md = &evlist->mmap[idx];
+	perf_mmap__get(&evlist->mmap[idx]);
+}
+
+static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx)
+{
+	perf_mmap__put(&evlist->mmap[idx]);
+}
 
-	if (!evlist->overwrite) {
+void perf_mmap__consume(struct perf_mmap *md, bool overwrite)
+{
+	if (!overwrite) {
 		u64 old = md->prev;
 
 		perf_mmap__write_tail(md, old);
 	}
 
 	if (atomic_read(&md->refcnt) == 1 && perf_mmap__empty(md))
-		perf_evlist__mmap_put(evlist, idx);
+		perf_mmap__put(md);
+}
+
+void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx)
+{
+	perf_mmap__consume(&evlist->mmap[idx], evlist->overwrite);
 }
 
 int __weak auxtrace_mmap__mmap(struct auxtrace_mmap *mm __maybe_unused,
@@ -917,15 +956,20 @@ void __weak auxtrace_mmap_params__set_idx(
 {
 }
 
-static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx)
+static void perf_mmap__munmap(struct perf_mmap *map)
 {
-	if (evlist->mmap[idx].base != NULL) {
-		munmap(evlist->mmap[idx].base, evlist->mmap_len);
-		evlist->mmap[idx].base = NULL;
-		evlist->mmap[idx].fd = -1;
-		atomic_set(&evlist->mmap[idx].refcnt, 0);
+	if (map->base != NULL) {
+		munmap(map->base, perf_mmap__mmap_len(map));
+		map->base = NULL;
+		map->fd = -1;
+		atomic_set(&map->refcnt, 0);
 	}
-	auxtrace_mmap__munmap(&evlist->mmap[idx].auxtrace_mmap);
+	auxtrace_mmap__munmap(&map->auxtrace_mmap);
+}
+
+static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx)
+{
+	perf_mmap__munmap(&evlist->mmap[idx]);
 }
 
 void perf_evlist__munmap(struct perf_evlist *evlist)
@@ -941,20 +985,21 @@ void perf_evlist__munmap(struct perf_evlist *evlist)
 	zfree(&evlist->mmap);
 }
 
-static int perf_evlist__alloc_mmap(struct perf_evlist *evlist)
+static struct perf_mmap *perf_evlist__alloc_mmap(struct perf_evlist *evlist)
 {
 	int i;
+	struct perf_mmap *map;
 
 	evlist->nr_mmaps = cpu_map__nr(evlist->cpus);
 	if (cpu_map__empty(evlist->cpus))
 		evlist->nr_mmaps = thread_map__nr(evlist->threads);
-	evlist->mmap = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap));
-	if (!evlist->mmap)
-		return -ENOMEM;
+	map = zalloc(evlist->nr_mmaps * sizeof(struct perf_mmap));
+	if (!map)
+		return NULL;
 
 	for (i = 0; i < evlist->nr_mmaps; i++)
-		evlist->mmap[i].fd = -1;
-	return 0;
+		map[i].fd = -1;
+	return map;
 }
 
 struct mmap_params {
@@ -963,8 +1008,8 @@ struct mmap_params {
 	struct auxtrace_mmap_params auxtrace_mp;
 };
 
-static int __perf_evlist__mmap(struct perf_evlist *evlist, int idx,
-			       struct mmap_params *mp, int fd)
+static int perf_mmap__mmap(struct perf_mmap *map,
+			   struct mmap_params *mp, int fd)
 {
 	/*
 	 * The last one will be done at perf_evlist__mmap_consume(), so that we
@@ -979,26 +1024,32 @@ static int __perf_evlist__mmap(struct perf_evlist *evlist, int idx,
 	 * evlist layer can't just drop it when filtering events in
 	 * perf_evlist__filter_pollfd().
 	 */
-	atomic_set(&evlist->mmap[idx].refcnt, 2);
-	evlist->mmap[idx].prev = 0;
-	evlist->mmap[idx].mask = mp->mask;
-	evlist->mmap[idx].base = mmap(NULL, evlist->mmap_len, mp->prot,
-				      MAP_SHARED, fd, 0);
-	if (evlist->mmap[idx].base == MAP_FAILED) {
+	atomic_set(&map->refcnt, 2);
+	map->prev = 0;
+	map->mask = mp->mask;
+	map->base = mmap(NULL, perf_mmap__mmap_len(map), mp->prot,
+			 MAP_SHARED, fd, 0);
+	if (map->base == MAP_FAILED) {
 		pr_debug2("failed to mmap perf event ring buffer, error %d\n",
 			  errno);
-		evlist->mmap[idx].base = NULL;
+		map->base = NULL;
 		return -1;
 	}
-	evlist->mmap[idx].fd = fd;
+	map->fd = fd;
 
-	if (auxtrace_mmap__mmap(&evlist->mmap[idx].auxtrace_mmap,
-				&mp->auxtrace_mp, evlist->mmap[idx].base, fd))
+	if (auxtrace_mmap__mmap(&map->auxtrace_mmap,
+				&mp->auxtrace_mp, map->base, fd))
 		return -1;
 
 	return 0;
 }
 
+static int __perf_evlist__mmap(struct perf_evlist *evlist, int idx,
+			       struct mmap_params *mp, int fd)
+{
+	return perf_mmap__mmap(&evlist->mmap[idx], mp, fd);
+}
+
 static bool
 perf_evlist__should_poll(struct perf_evlist *evlist __maybe_unused,
 			 struct perf_evsel *evsel)
@@ -1248,7 +1299,9 @@ int perf_evlist__mmap_ex(struct perf_evlist *evlist, unsigned int pages,
 		.prot = PROT_READ | (overwrite ? 0 : PROT_WRITE),
 	};
 
-	if (evlist->mmap == NULL && perf_evlist__alloc_mmap(evlist) < 0)
+	if (!evlist->mmap)
+		evlist->mmap = perf_evlist__alloc_mmap(evlist);
+	if (!evlist->mmap)
 		return -ENOMEM;
 
 	if (evlist->pollfd.entries == NULL && perf_evlist__alloc_pollfd(evlist) < 0)
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index afd087761a47..9e680c62c980 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -35,6 +35,12 @@ struct perf_mmap {
 	char		 event_copy[PERF_SAMPLE_MAX_SIZE] __attribute__((aligned(8)));
 };
 
+static inline size_t
+perf_mmap__mmap_len(struct perf_mmap *map)
+{
+	return map->mask + 1 + page_size;
+}
+
 struct perf_evlist {
 	struct list_head entries;
 	struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
@@ -129,6 +135,12 @@ struct perf_evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist,
 
 struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id);
 
+union perf_event *perf_mmap__read_forward(struct perf_mmap *map, bool check_messup);
+union perf_event *perf_mmap__read_backward(struct perf_mmap *map);
+
+void perf_mmap__read_catchup(struct perf_mmap *md);
+void perf_mmap__consume(struct perf_mmap *md, bool overwrite);
+
 union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx);
 
 union perf_event *perf_evlist__mmap_read_forward(struct perf_evlist *evlist,
-- 
2.7.4

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

* [PATCH 11/24] perf record: Decouple record__mmap_read() and evlist.
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 10/24] perf evlist: Update mmap related APIs and helpers Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 12/24] perf evlist: Record mmap cookie into fdarray private field Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Perf evlist will have multiple mmap arrays. Update record__mmap_read():
it should read from 'struct perf_mmap' directly.

Also, make record__mmap_read() ready to read from backward ring buffer.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-5-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d9f5cc3a3667..d15517e849a3 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -119,11 +119,10 @@ backward_rb_find_range(void *buf, int mask, u64 head, u64 *start, u64 *end)
 }
 
 static int
-rb_find_range(struct perf_evlist *evlist,
-	      void *data, int mask, u64 head, u64 old,
-	      u64 *start, u64 *end)
+rb_find_range(void *data, int mask, u64 head, u64 old,
+	      u64 *start, u64 *end, bool backward)
 {
-	if (!evlist->backward) {
+	if (!backward) {
 		*start = old;
 		*end = head;
 		return 0;
@@ -132,9 +131,10 @@ rb_find_range(struct perf_evlist *evlist,
 	return backward_rb_find_range(data, mask, head, start, end);
 }
 
-static int record__mmap_read(struct record *rec, struct perf_evlist *evlist, int idx)
+static int
+record__mmap_read(struct record *rec, struct perf_mmap *md,
+		  bool overwrite, bool backward)
 {
-	struct perf_mmap *md = &evlist->mmap[idx];
 	u64 head = perf_mmap__read_head(md);
 	u64 old = md->prev;
 	u64 end = head, start = old;
@@ -143,8 +143,8 @@ static int record__mmap_read(struct record *rec, struct perf_evlist *evlist, int
 	void *buf;
 	int rc = 0;
 
-	if (rb_find_range(evlist, data, md->mask, head,
-			  old, &start, &end))
+	if (rb_find_range(data, md->mask, head,
+			  old, &start, &end, backward))
 		return -1;
 
 	if (start == end)
@@ -157,7 +157,7 @@ static int record__mmap_read(struct record *rec, struct perf_evlist *evlist, int
 		WARN_ONCE(1, "failed to keep up with mmap data. (warn only once)\n");
 
 		md->prev = head;
-		perf_evlist__mmap_consume(evlist, idx);
+		perf_mmap__consume(md, overwrite || backward);
 		return 0;
 	}
 
@@ -182,7 +182,7 @@ static int record__mmap_read(struct record *rec, struct perf_evlist *evlist, int
 	}
 
 	md->prev = head;
-	perf_evlist__mmap_consume(evlist, idx);
+	perf_mmap__consume(md, overwrite || backward);
 out:
 	return rc;
 }
@@ -498,20 +498,27 @@ static struct perf_event_header finished_round_event = {
 	.type = PERF_RECORD_FINISHED_ROUND,
 };
 
-static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evlist)
+static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evlist,
+				    bool backward)
 {
 	u64 bytes_written = rec->bytes_written;
 	int i;
 	int rc = 0;
+	struct perf_mmap *maps;
 
 	if (!evlist)
 		return 0;
 
+	maps = evlist->mmap;
+	if (!maps)
+		return 0;
+
 	for (i = 0; i < evlist->nr_mmaps; i++) {
-		struct auxtrace_mmap *mm = &evlist->mmap[i].auxtrace_mmap;
+		struct auxtrace_mmap *mm = &maps[i].auxtrace_mmap;
 
-		if (evlist->mmap[i].base) {
-			if (record__mmap_read(rec, evlist, i) != 0) {
+		if (maps[i].base) {
+			if (record__mmap_read(rec, &maps[i],
+					      evlist->overwrite, backward) != 0) {
 				rc = -1;
 				goto out;
 			}
@@ -539,7 +546,7 @@ static int record__mmap_read_all(struct record *rec)
 {
 	int err;
 
-	err = record__mmap_read_evlist(rec, rec->evlist);
+	err = record__mmap_read_evlist(rec, rec->evlist, false);
 	if (err)
 		return err;
 
-- 
2.7.4

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

* [PATCH 12/24] perf evlist: Record mmap cookie into fdarray private field
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 11/24] perf record: Decouple record__mmap_read() and evlist Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 13/24] perf evlist: Extract common code in mmap failure processing Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Insetad of saving a index into fdarray entries private field, save the
corresponding 'struct perf_mmap' pointer, and release them directly
using perf_mmap__put().

Following commits introduce multiple mmap arrays to evlist. Without this
patch, perf_evlist__munmap_filtered() is unable to retrive correct
'struct perf_mmap' pointer.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-6-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index a4137e02eab8..1462085a8618 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -30,6 +30,7 @@
 static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx);
 static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx);
 static void perf_mmap__munmap(struct perf_mmap *map);
+static void perf_mmap__put(struct perf_mmap *map);
 
 #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y))
 #define SID(e, x, y) xyarray__entry(e->sample_id, x, y)
@@ -466,7 +467,8 @@ int perf_evlist__alloc_pollfd(struct perf_evlist *evlist)
 	return 0;
 }
 
-static int __perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd, int idx, short revent)
+static int __perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd,
+				     struct perf_mmap *map, short revent)
 {
 	int pos = fdarray__add(&evlist->pollfd, fd, revent | POLLERR | POLLHUP);
 	/*
@@ -474,7 +476,7 @@ static int __perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd, int idx
 	 * close the associated evlist->mmap[] entry.
 	 */
 	if (pos >= 0) {
-		evlist->pollfd.priv[pos].idx = idx;
+		evlist->pollfd.priv[pos].ptr = map;
 
 		fcntl(fd, F_SETFL, O_NONBLOCK);
 	}
@@ -484,15 +486,16 @@ static int __perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd, int idx
 
 int perf_evlist__add_pollfd(struct perf_evlist *evlist, int fd)
 {
-	return __perf_evlist__add_pollfd(evlist, fd, -1, POLLIN);
+	return __perf_evlist__add_pollfd(evlist, fd, NULL, POLLIN);
 }
 
 static void perf_evlist__munmap_filtered(struct fdarray *fda, int fd,
 					 void *arg __maybe_unused)
 {
-	struct perf_evlist *evlist = container_of(fda, struct perf_evlist, pollfd);
+	struct perf_mmap *map = fda->priv[fd].ptr;
 
-	perf_evlist__mmap_put(evlist, fda->priv[fd].idx);
+	if (map)
+		perf_mmap__put(map);
 }
 
 int perf_evlist__filter_pollfd(struct perf_evlist *evlist, short revents_and_mask)
@@ -1098,7 +1101,7 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
 		 * Therefore don't add it for polling.
 		 */
 		if (!evsel->system_wide &&
-		    __perf_evlist__add_pollfd(evlist, fd, idx, revent) < 0) {
+		    __perf_evlist__add_pollfd(evlist, fd, &evlist->mmap[idx], revent) < 0) {
 			perf_evlist__mmap_put(evlist, idx);
 			return -1;
 		}
-- 
2.7.4

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

* [PATCH 13/24] perf evlist: Extract common code in mmap failure processing
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 12/24] perf evlist: Record mmap cookie into fdarray private field Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 14/24] perf evlist: Introduce backward_mmap array for evlist Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

In perf_evlist__mmap_per_cpu() and perf_evlist__mmap_per_thread(), in
case of mmap failure, successfully created maps should be cleared.

Current code uses two loops calling __perf_evlist__munmap() for each
function.

This patch extracts common code to perf_evlist__munmap_nofree() and use
previous introduced decoupled API perf_mmap__munmap(). Now
__perf_evlist__munmap() can be removed because of no user.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-7-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 1462085a8618..54ae0a0bc22c 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -28,7 +28,6 @@
 #include <linux/err.h>
 
 static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx);
-static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx);
 static void perf_mmap__munmap(struct perf_mmap *map);
 static void perf_mmap__put(struct perf_mmap *map);
 
@@ -970,12 +969,7 @@ static void perf_mmap__munmap(struct perf_mmap *map)
 	auxtrace_mmap__munmap(&map->auxtrace_mmap);
 }
 
-static void __perf_evlist__munmap(struct perf_evlist *evlist, int idx)
-{
-	perf_mmap__munmap(&evlist->mmap[idx]);
-}
-
-void perf_evlist__munmap(struct perf_evlist *evlist)
+static void perf_evlist__munmap_nofree(struct perf_evlist *evlist)
 {
 	int i;
 
@@ -983,8 +977,12 @@ void perf_evlist__munmap(struct perf_evlist *evlist)
 		return;
 
 	for (i = 0; i < evlist->nr_mmaps; i++)
-		__perf_evlist__munmap(evlist, i);
+		perf_mmap__munmap(&evlist->mmap[i]);
+}
 
+void perf_evlist__munmap(struct perf_evlist *evlist)
+{
+	perf_evlist__munmap_nofree(evlist);
 	zfree(&evlist->mmap);
 }
 
@@ -1142,8 +1140,7 @@ static int perf_evlist__mmap_per_cpu(struct perf_evlist *evlist,
 	return 0;
 
 out_unmap:
-	for (cpu = 0; cpu < nr_cpus; cpu++)
-		__perf_evlist__munmap(evlist, cpu);
+	perf_evlist__munmap_nofree(evlist);
 	return -1;
 }
 
@@ -1168,8 +1165,7 @@ static int perf_evlist__mmap_per_thread(struct perf_evlist *evlist,
 	return 0;
 
 out_unmap:
-	for (thread = 0; thread < nr_threads; thread++)
-		__perf_evlist__munmap(evlist, thread);
+	perf_evlist__munmap_nofree(evlist);
 	return -1;
 }
 
-- 
2.7.4

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

* [PATCH 14/24] perf evlist: Introduce backward_mmap array for evlist
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 13/24] perf evlist: Extract common code in mmap failure processing Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 15/24] perf evlist: Map backward events to backward_mmap Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Add backward_mmap to evlist, free it together with normal mmap.

Improve perf_evlist__pick_pc(), search backward_mmap if evlist->mmap is
not available.

This patch doesn't alloc this array. It will be allocated conditionally
in the following commits.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-8-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 10 +++++++---
 tools/perf/util/evlist.c    | 12 ++++++++----
 tools/perf/util/evlist.h    |  1 +
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d15517e849a3..dbcb22304398 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -509,7 +509,7 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
 	if (!evlist)
 		return 0;
 
-	maps = evlist->mmap;
+	maps = backward ? evlist->backward_mmap : evlist->mmap;
 	if (!maps)
 		return 0;
 
@@ -696,8 +696,12 @@ perf_event__synth_time_conv(const struct perf_event_mmap_page *pc __maybe_unused
 static const struct perf_event_mmap_page *
 perf_evlist__pick_pc(struct perf_evlist *evlist)
 {
-	if (evlist && evlist->mmap && evlist->mmap[0].base)
-		return evlist->mmap[0].base;
+	if (evlist) {
+		if (evlist->mmap && evlist->mmap[0].base)
+			return evlist->mmap[0].base;
+		if (evlist->backward_mmap && evlist->backward_mmap[0].base)
+			return evlist->backward_mmap[0].base;
+	}
 	return NULL;
 }
 
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 54ae0a0bc22c..24927e111d17 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -123,6 +123,7 @@ static void perf_evlist__purge(struct perf_evlist *evlist)
 void perf_evlist__exit(struct perf_evlist *evlist)
 {
 	zfree(&evlist->mmap);
+	zfree(&evlist->backward_mmap);
 	fdarray__exit(&evlist->pollfd);
 }
 
@@ -973,17 +974,20 @@ static void perf_evlist__munmap_nofree(struct perf_evlist *evlist)
 {
 	int i;
 
-	if (evlist->mmap == NULL)
-		return;
+	if (evlist->mmap)
+		for (i = 0; i < evlist->nr_mmaps; i++)
+			perf_mmap__munmap(&evlist->mmap[i]);
 
-	for (i = 0; i < evlist->nr_mmaps; i++)
-		perf_mmap__munmap(&evlist->mmap[i]);
+	if (evlist->backward_mmap)
+		for (i = 0; i < evlist->nr_mmaps; i++)
+			perf_mmap__munmap(&evlist->backward_mmap[i]);
 }
 
 void perf_evlist__munmap(struct perf_evlist *evlist)
 {
 	perf_evlist__munmap_nofree(evlist);
 	zfree(&evlist->mmap);
+	zfree(&evlist->backward_mmap);
 }
 
 static struct perf_mmap *perf_evlist__alloc_mmap(struct perf_evlist *evlist)
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 9e680c62c980..07a1ad040c92 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -61,6 +61,7 @@ struct perf_evlist {
 	} workload;
 	struct fdarray	 pollfd;
 	struct perf_mmap *mmap;
+	struct perf_mmap *backward_mmap;
 	struct thread_map *threads;
 	struct cpu_map	  *cpus;
 	struct perf_evsel *selected;
-- 
2.7.4

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

* [PATCH 15/24] perf evlist: Map backward events to backward_mmap
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 14/24] perf evlist: Introduce backward_mmap array for evlist Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 16/24] perf evlist: Drop evlist->backward Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

In perf_evlist__mmap_per_evsel(), select backward_mmap for backward
events.  Utilize new perf_mmap APIs. Dynamically alloc backward_mmap.

Remove useless functions.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-9-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/backward-ring-buffer.c |  4 +--
 tools/perf/util/evlist.c                | 54 ++++++++++++++++-----------------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index 5cee3873f2b5..b2c634815f6b 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -31,8 +31,8 @@ static int count_samples(struct perf_evlist *evlist, int *sample_count,
 	for (i = 0; i < evlist->nr_mmaps; i++) {
 		union perf_event *event;
 
-		perf_evlist__mmap_read_catchup(evlist, i);
-		while ((event = perf_evlist__mmap_read_backward(evlist, i)) != NULL) {
+		perf_mmap__read_catchup(&evlist->backward_mmap[i]);
+		while ((event = perf_mmap__read_backward(&evlist->backward_mmap[i])) != NULL) {
 			const u32 type = event->header.type;
 
 			switch (type) {
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 24927e111d17..7570f903200e 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -27,7 +27,6 @@
 #include <linux/log2.h>
 #include <linux/err.h>
 
-static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx);
 static void perf_mmap__munmap(struct perf_mmap *map);
 static void perf_mmap__put(struct perf_mmap *map);
 
@@ -692,8 +691,11 @@ static int perf_evlist__set_paused(struct perf_evlist *evlist, bool value)
 {
 	int i;
 
+	if (!evlist->backward_mmap)
+		return 0;
+
 	for (i = 0; i < evlist->nr_mmaps; i++) {
-		int fd = evlist->mmap[i].fd;
+		int fd = evlist->backward_mmap[i].fd;
 		int err;
 
 		if (fd < 0)
@@ -904,16 +906,6 @@ static void perf_mmap__put(struct perf_mmap *md)
 		perf_mmap__munmap(md);
 }
 
-static void perf_evlist__mmap_get(struct perf_evlist *evlist, int idx)
-{
-	perf_mmap__get(&evlist->mmap[idx]);
-}
-
-static void perf_evlist__mmap_put(struct perf_evlist *evlist, int idx)
-{
-	perf_mmap__put(&evlist->mmap[idx]);
-}
-
 void perf_mmap__consume(struct perf_mmap *md, bool overwrite)
 {
 	if (!overwrite) {
@@ -1049,12 +1041,6 @@ static int perf_mmap__mmap(struct perf_mmap *map,
 	return 0;
 }
 
-static int __perf_evlist__mmap(struct perf_evlist *evlist, int idx,
-			       struct mmap_params *mp, int fd)
-{
-	return perf_mmap__mmap(&evlist->mmap[idx], mp, fd);
-}
-
 static bool
 perf_evlist__should_poll(struct perf_evlist *evlist __maybe_unused,
 			 struct perf_evsel *evsel)
@@ -1066,16 +1052,27 @@ perf_evlist__should_poll(struct perf_evlist *evlist __maybe_unused,
 
 static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
 				       struct mmap_params *mp, int cpu,
-				       int thread, int *output)
+				       int thread, int *_output, int *_output_backward)
 {
 	struct perf_evsel *evsel;
 	int revent;
 
 	evlist__for_each_entry(evlist, evsel) {
+		struct perf_mmap *maps = evlist->mmap;
+		int *output = _output;
 		int fd;
 
-		if (!!evsel->attr.write_backward != (evlist->overwrite && evlist->backward))
-			continue;
+		if (evsel->attr.write_backward) {
+			output = _output_backward;
+			maps = evlist->backward_mmap;
+
+			if (!maps) {
+				maps = perf_evlist__alloc_mmap(evlist);
+				if (!maps)
+					return -1;
+				evlist->backward_mmap = maps;
+			}
+		}
 
 		if (evsel->system_wide && thread)
 			continue;
@@ -1084,13 +1081,14 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
 
 		if (*output == -1) {
 			*output = fd;
-			if (__perf_evlist__mmap(evlist, idx, mp, *output) < 0)
+
+			if (perf_mmap__mmap(&maps[idx], mp, *output)  < 0)
 				return -1;
 		} else {
 			if (ioctl(fd, PERF_EVENT_IOC_SET_OUTPUT, *output) != 0)
 				return -1;
 
-			perf_evlist__mmap_get(evlist, idx);
+			perf_mmap__get(&maps[idx]);
 		}
 
 		revent = perf_evlist__should_poll(evlist, evsel) ? POLLIN : 0;
@@ -1103,8 +1101,8 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
 		 * Therefore don't add it for polling.
 		 */
 		if (!evsel->system_wide &&
-		    __perf_evlist__add_pollfd(evlist, fd, &evlist->mmap[idx], revent) < 0) {
-			perf_evlist__mmap_put(evlist, idx);
+		    __perf_evlist__add_pollfd(evlist, fd, &maps[idx], revent) < 0) {
+			perf_mmap__put(&maps[idx]);
 			return -1;
 		}
 
@@ -1130,13 +1128,14 @@ static int perf_evlist__mmap_per_cpu(struct perf_evlist *evlist,
 	pr_debug2("perf event ring buffer mmapped per cpu\n");
 	for (cpu = 0; cpu < nr_cpus; cpu++) {
 		int output = -1;
+		int output_backward = -1;
 
 		auxtrace_mmap_params__set_idx(&mp->auxtrace_mp, evlist, cpu,
 					      true);
 
 		for (thread = 0; thread < nr_threads; thread++) {
 			if (perf_evlist__mmap_per_evsel(evlist, cpu, mp, cpu,
-							thread, &output))
+							thread, &output, &output_backward))
 				goto out_unmap;
 		}
 	}
@@ -1157,12 +1156,13 @@ static int perf_evlist__mmap_per_thread(struct perf_evlist *evlist,
 	pr_debug2("perf event ring buffer mmapped per thread\n");
 	for (thread = 0; thread < nr_threads; thread++) {
 		int output = -1;
+		int output_backward = -1;
 
 		auxtrace_mmap_params__set_idx(&mp->auxtrace_mp, evlist, thread,
 					      false);
 
 		if (perf_evlist__mmap_per_evsel(evlist, thread, mp, 0, thread,
-						&output))
+						&output, &output_backward))
 			goto out_unmap;
 	}
 
-- 
2.7.4

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

* [PATCH 16/24] perf evlist: Drop evlist->backward
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 15/24] perf evlist: Map backward events to backward_mmap Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 17/24] perf evlist: Setup backward mmap state machine Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Now there's no real user of evlist->backward. Drop it. We are going to
use evlist->backward_mmap as a container for backward ring buffer.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-10-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/backward-ring-buffer.c | 1 -
 tools/perf/util/evlist.c                | 5 +----
 tools/perf/util/evlist.h                | 1 -
 3 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index b2c634815f6b..db9cd3048655 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -101,7 +101,6 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
 		return TEST_FAIL;
 	}
 
-	evlist->backward = true;
 	err = perf_evlist__create_maps(evlist, &opts.target);
 	if (err < 0) {
 		pr_debug("Not enough memory to create thread/cpu maps\n");
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 7570f903200e..5beb44faa71d 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -44,7 +44,6 @@ void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
 	perf_evlist__set_maps(evlist, cpus, threads);
 	fdarray__init(&evlist->pollfd, 64);
 	evlist->workload.pid = -1;
-	evlist->backward = false;
 }
 
 struct perf_evlist *perf_evlist__new(void)
@@ -867,9 +866,7 @@ union perf_event *perf_evlist__mmap_read_backward(struct perf_evlist *evlist, in
 
 union perf_event *perf_evlist__mmap_read(struct perf_evlist *evlist, int idx)
 {
-	if (!evlist->backward)
-		return perf_evlist__mmap_read_forward(evlist, idx);
-	return perf_evlist__mmap_read_backward(evlist, idx);
+	return perf_evlist__mmap_read_forward(evlist, idx);
 }
 
 void perf_mmap__read_catchup(struct perf_mmap *md)
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 07a1ad040c92..6a3d9bdda4bb 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -50,7 +50,6 @@ struct perf_evlist {
 	bool		 overwrite;
 	bool		 enabled;
 	bool		 has_user_cpus;
-	bool		 backward;
 	size_t		 mmap_len;
 	int		 id_pos;
 	int		 is_pos;
-- 
2.7.4

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

* [PATCH 17/24] perf evlist: Setup backward mmap state machine
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (15 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 16/24] perf evlist: Drop evlist->backward Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 18/24] perf record: Read from overwritable ring buffer Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Introduce a bkw_mmap_state state machine to evlist:

                     .________________(forbid)_____________.
                     |                                     V
 NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
                     ^  ^              |   ^               |
                     |  |__(forbid)____/   |___(forbid)___/|
                     |                                     |
                      \_________________(3)_______________/

 NOTREADY     : Backward ring buffers are not ready
 RUNNING      : Backward ring buffers are recording
 DATA_PENDING : We are required to collect data from backward ring buffers
 EMPTY        : We have collected data from backward ring buffers.

 (0): Setup backward ring buffer
 (1): Pause ring buffers for reading
 (2): Read from ring buffers
 (3): Resume ring buffers for recording

We can't avoid this complexity. Since we deliberately drop records from
overwritable ring buffer, there's no way for us to check remaining from
ring buffer itself (by checking head and old pointers). Therefore, we
need DATA_PENDING and EMPTY state to help us recording what we have done
to the ring buffer.

In record__mmap_read_evlist(), drive this state machine from DATA_PENDING
to EMPTY.

In perf_evlist__mmap_per_evsel(), drive this state machine from NOTREADY
to RUNNING when creating backward mmap.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-11-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c |  5 ++++
 tools/perf/util/evlist.c    | 62 +++++++++++++++++++++++++++++++++++++++++++++
 tools/perf/util/evlist.h    | 31 +++++++++++++++++++++++
 3 files changed, 98 insertions(+)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index dbcb22304398..d4f15e76c98a 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -513,6 +513,9 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
 	if (!maps)
 		return 0;
 
+	if (backward && evlist->bkw_mmap_state != BKW_MMAP_DATA_PENDING)
+		return 0;
+
 	for (i = 0; i < evlist->nr_mmaps; i++) {
 		struct auxtrace_mmap *mm = &maps[i].auxtrace_mmap;
 
@@ -538,6 +541,8 @@ static int record__mmap_read_evlist(struct record *rec, struct perf_evlist *evli
 	if (bytes_written != rec->bytes_written)
 		rc = record__write(rec, &finished_round_event, sizeof(finished_round_event));
 
+	if (backward)
+		perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_EMPTY);
 out:
 	return rc;
 }
diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 5beb44faa71d..93ab66415f51 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -15,6 +15,7 @@
 #include "evlist.h"
 #include "evsel.h"
 #include "debug.h"
+#include "asm/bug.h"
 #include <unistd.h>
 
 #include "parse-events.h"
@@ -44,6 +45,7 @@ void perf_evlist__init(struct perf_evlist *evlist, struct cpu_map *cpus,
 	perf_evlist__set_maps(evlist, cpus, threads);
 	fdarray__init(&evlist->pollfd, 64);
 	evlist->workload.pid = -1;
+	evlist->bkw_mmap_state = BKW_MMAP_NOTREADY;
 }
 
 struct perf_evlist *perf_evlist__new(void)
@@ -1068,6 +1070,8 @@ static int perf_evlist__mmap_per_evsel(struct perf_evlist *evlist, int idx,
 				if (!maps)
 					return -1;
 				evlist->backward_mmap = maps;
+				if (evlist->bkw_mmap_state == BKW_MMAP_NOTREADY)
+					perf_evlist__toggle_bkw_mmap(evlist, BKW_MMAP_RUNNING);
 			}
 		}
 
@@ -1972,3 +1976,61 @@ perf_evlist__find_evsel_by_str(struct perf_evlist *evlist,
 
 	return NULL;
 }
+
+void perf_evlist__toggle_bkw_mmap(struct perf_evlist *evlist,
+				  enum bkw_mmap_state state)
+{
+	enum bkw_mmap_state old_state = evlist->bkw_mmap_state;
+	enum action {
+		NONE,
+		PAUSE,
+		RESUME,
+	} action = NONE;
+
+	if (!evlist->backward_mmap)
+		return;
+
+	switch (old_state) {
+	case BKW_MMAP_NOTREADY: {
+		if (state != BKW_MMAP_RUNNING)
+			goto state_err;;
+		break;
+	}
+	case BKW_MMAP_RUNNING: {
+		if (state != BKW_MMAP_DATA_PENDING)
+			goto state_err;
+		action = PAUSE;
+		break;
+	}
+	case BKW_MMAP_DATA_PENDING: {
+		if (state != BKW_MMAP_EMPTY)
+			goto state_err;
+		break;
+	}
+	case BKW_MMAP_EMPTY: {
+		if (state != BKW_MMAP_RUNNING)
+			goto state_err;
+		action = RESUME;
+		break;
+	}
+	default:
+		WARN_ONCE(1, "Shouldn't get there\n");
+	}
+
+	evlist->bkw_mmap_state = state;
+
+	switch (action) {
+	case PAUSE:
+		perf_evlist__pause(evlist);
+		break;
+	case RESUME:
+		perf_evlist__resume(evlist);
+		break;
+	case NONE:
+	default:
+		break;
+	}
+
+state_err:
+	return;
+}
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 6a3d9bdda4bb..20faaab1941c 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -41,6 +41,34 @@ perf_mmap__mmap_len(struct perf_mmap *map)
 	return map->mask + 1 + page_size;
 }
 
+/*
+ * State machine of bkw_mmap_state:
+ *
+ *                     .________________(forbid)_____________.
+ *                     |                                     V
+ * NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
+ *                     ^  ^              |   ^               |
+ *                     |  |__(forbid)____/   |___(forbid)___/|
+ *                     |                                     |
+ *                      \_________________(3)_______________/
+ *
+ * NOTREADY     : Backward ring buffers are not ready
+ * RUNNING      : Backward ring buffers are recording
+ * DATA_PENDING : We are required to collect data from backward ring buffers
+ * EMPTY        : We have collected data from backward ring buffers.
+ *
+ * (0): Setup backward ring buffer
+ * (1): Pause ring buffers for reading
+ * (2): Read from ring buffers
+ * (3): Resume ring buffers for recording
+ */
+enum bkw_mmap_state {
+	BKW_MMAP_NOTREADY,
+	BKW_MMAP_RUNNING,
+	BKW_MMAP_DATA_PENDING,
+	BKW_MMAP_EMPTY,
+};
+
 struct perf_evlist {
 	struct list_head entries;
 	struct hlist_head heads[PERF_EVLIST__HLIST_SIZE];
@@ -54,6 +82,7 @@ struct perf_evlist {
 	int		 id_pos;
 	int		 is_pos;
 	u64		 combined_sample_type;
+	enum bkw_mmap_state bkw_mmap_state;
 	struct {
 		int	cork_fd;
 		pid_t	pid;
@@ -135,6 +164,8 @@ struct perf_evsel *perf_evlist__id2evsel_strict(struct perf_evlist *evlist,
 
 struct perf_sample_id *perf_evlist__id2sid(struct perf_evlist *evlist, u64 id);
 
+void perf_evlist__toggle_bkw_mmap(struct perf_evlist *evlist, enum bkw_mmap_state state);
+
 union perf_event *perf_mmap__read_forward(struct perf_mmap *map, bool check_messup);
 union perf_event *perf_mmap__read_backward(struct perf_mmap *map);
 
-- 
2.7.4

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

* [PATCH 18/24] perf record: Read from overwritable ring buffer
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (16 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 17/24] perf evlist: Setup backward mmap state machine Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 19/24] perf evlist: Make {pause,resume} internal helpers Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, He Kuang,
	Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

Drive the evlist->bkw_mmap_state state machine during draining and when
SIGUSR2 is received. Read the backward ring buffer in record__mmap_read_all.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-12-git-send-email-wangnan0@huawei.com
Signed-off-by: He Kuang <hekuang@huawei.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index d4f15e76c98a..b87070b1f492 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -555,7 +555,7 @@ static int record__mmap_read_all(struct record *rec)
 	if (err)
 		return err;
 
-	return err;
+	return record__mmap_read_evlist(rec, rec->evlist, true);
 }
 
 static void record__init_features(struct record *rec)
@@ -953,6 +953,17 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	for (;;) {
 		unsigned long long hits = rec->samples;
 
+		/*
+		 * rec->evlist->bkw_mmap_state is possible to be
+		 * BKW_MMAP_EMPTY here: when done == true and
+		 * hits != rec->samples in previous round.
+		 *
+		 * perf_evlist__toggle_bkw_mmap ensure we never
+		 * convert BKW_MMAP_EMPTY to BKW_MMAP_DATA_PENDING.
+		 */
+		if (trigger_is_hit(&switch_output_trigger) || done || draining)
+			perf_evlist__toggle_bkw_mmap(rec->evlist, BKW_MMAP_DATA_PENDING);
+
 		if (record__mmap_read_all(rec) < 0) {
 			trigger_error(&auxtrace_snapshot_trigger);
 			trigger_error(&switch_output_trigger);
@@ -972,8 +983,26 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 		}
 
 		if (trigger_is_hit(&switch_output_trigger)) {
+			/*
+			 * If switch_output_trigger is hit, the data in
+			 * overwritable ring buffer should have been collected,
+			 * so bkw_mmap_state should be set to BKW_MMAP_EMPTY.
+			 *
+			 * If SIGUSR2 raise after or during record__mmap_read_all(),
+			 * record__mmap_read_all() didn't collect data from
+			 * overwritable ring buffer. Read again.
+			 */
+			if (rec->evlist->bkw_mmap_state == BKW_MMAP_RUNNING)
+				continue;
 			trigger_ready(&switch_output_trigger);
 
+			/*
+			 * Reenable events in overwrite ring buffer after
+			 * record__mmap_read_all(): we should have collected
+			 * data from it.
+			 */
+			perf_evlist__toggle_bkw_mmap(rec->evlist, BKW_MMAP_RUNNING);
+
 			if (!quiet)
 				fprintf(stderr, "[ perf record: dump data: Woken up %ld times ]\n",
 					waking);
-- 
2.7.4

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

* [PATCH 19/24] perf evlist: Make {pause,resume} internal helpers
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (17 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 18/24] perf record: Read from overwritable ring buffer Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 20/24] perf tools: Enable overwrite settings Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

There's no user of these two function outside evlist.c. Remove them from
public namespace.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: He Kuang <hekuang@huawei.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-13-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 4 ++--
 tools/perf/util/evlist.h | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index 93ab66415f51..2a40b8e1def7 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -708,12 +708,12 @@ static int perf_evlist__set_paused(struct perf_evlist *evlist, bool value)
 	return 0;
 }
 
-int perf_evlist__pause(struct perf_evlist *evlist)
+static int perf_evlist__pause(struct perf_evlist *evlist)
 {
 	return perf_evlist__set_paused(evlist, true);
 }
 
-int perf_evlist__resume(struct perf_evlist *evlist)
+static int perf_evlist__resume(struct perf_evlist *evlist)
 {
 	return perf_evlist__set_paused(evlist, false);
 }
diff --git a/tools/perf/util/evlist.h b/tools/perf/util/evlist.h
index 20faaab1941c..4fd034f22d2f 100644
--- a/tools/perf/util/evlist.h
+++ b/tools/perf/util/evlist.h
@@ -182,8 +182,6 @@ void perf_evlist__mmap_read_catchup(struct perf_evlist *evlist, int idx);
 
 void perf_evlist__mmap_consume(struct perf_evlist *evlist, int idx);
 
-int perf_evlist__pause(struct perf_evlist *evlist);
-int perf_evlist__resume(struct perf_evlist *evlist);
 int perf_evlist__open(struct perf_evlist *evlist);
 void perf_evlist__close(struct perf_evlist *evlist);
 
-- 
2.7.4

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

* [PATCH 20/24] perf tools: Enable overwrite settings
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (18 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 19/24] perf evlist: Make {pause,resume} internal helpers Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 21/24] perf session: Don't warn about out of order event if write_backward is used Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, He Kuang,
	Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

This patch allows following config terms and option:

Globally setting events to overwrite;

  # perf record --overwrite ...

Set specific events to be overwrite or no-overwrite.

  # perf record --event cycles/overwrite/ ...
  # perf record --event cycles/no-overwrite/ ...

Add missing config terms and update the config term array size because
the longest string length has changed.

For overwritable events, it automatically selects attr.write_backward
since perf requires it to be backward for reading.

Test result:

  # perf record --overwrite -e syscalls:*enter_nanosleep* usleep 1
  [ perf record: Woken up 2 times to write data ]
  [ perf record: Captured and wrote 0.011 MB perf.data (1 samples) ]
  # perf evlist -v
  syscalls:sys_enter_nanosleep: type: 2, size: 112, config: 0x134, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW, disabled: 1, inherit: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, write_backward: 1
  # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-14-git-send-email-wangnan0@huawei.com
Signed-off-by: He Kuang <hekuang@huawei.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-record.txt | 14 ++++++++++++++
 tools/perf/builtin-record.c              |  1 +
 tools/perf/perf.h                        |  1 +
 tools/perf/tests/backward-ring-buffer.c  | 10 +++++-----
 tools/perf/util/evsel.c                  |  4 ++++
 tools/perf/util/evsel.h                  |  2 ++
 tools/perf/util/parse-events.c           | 20 ++++++++++++++++++--
 tools/perf/util/parse-events.h           |  2 ++
 tools/perf/util/parse-events.l           |  2 ++
 9 files changed, 49 insertions(+), 7 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 5b46b1d1a37c..384c630436f8 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -367,6 +367,20 @@ options.
 'perf record --dry-run -e' can act as a BPF script compiler if llvm.dump-obj
 in config file is set to true.
 
+--overwrite::
+Makes all events use an overwritable ring buffer. An overwritable ring
+buffer works like a flight recorder: when it gets full, the kernel will
+overwrite the oldest records, that thus will never make it to the
+perf.data file.
+
+When '--overwrite' and '--switch-output' are used perf records and drops
+events until it receives a signal, meaning that something unusual was
+detected that warrants taking a snapshot of the most current events,
+those fitting in the ring buffer at that moment.
+
+'overwrite' attribute can also be set or canceled for an event using
+config terms. For example: 'cycles/overwrite/' and 'instructions/no-overwrite/'.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index b87070b1f492..39c7486f0607 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -1399,6 +1399,7 @@ struct option __record_options[] = {
 	OPT_BOOLEAN_SET('i', "no-inherit", &record.opts.no_inherit,
 			&record.opts.no_inherit_set,
 			"child tasks do not inherit counters"),
+	OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"),
 	OPT_UINTEGER('F', "freq", &record.opts.user_freq, "profile at this frequency"),
 	OPT_CALLBACK('m', "mmap-pages", &record.opts, "pages[,pages]",
 		     "number of mmap data pages and AUX area tracing mmap pages",
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index cd8f1b150f9e..608b42bdb1b6 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -59,6 +59,7 @@ struct record_opts {
 	bool	     record_switch_events;
 	bool	     all_kernel;
 	bool	     all_user;
+	bool	     overwrite;
 	unsigned int freq;
 	unsigned int mmap_pages;
 	unsigned int auxtrace_mmap_pages;
diff --git a/tools/perf/tests/backward-ring-buffer.c b/tools/perf/tests/backward-ring-buffer.c
index db9cd3048655..615780cbfe1d 100644
--- a/tools/perf/tests/backward-ring-buffer.c
+++ b/tools/perf/tests/backward-ring-buffer.c
@@ -108,7 +108,11 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
 	}
 
 	bzero(&parse_error, sizeof(parse_error));
-	err = parse_events(evlist, "syscalls:sys_enter_prctl", &parse_error);
+	/*
+	 * Set backward bit, ring buffer should be writing from end. Record
+	 * it in aux evlist
+	 */
+	err = parse_events(evlist, "syscalls:sys_enter_prctl/overwrite/", &parse_error);
 	if (err) {
 		pr_debug("Failed to parse tracepoint event, try use root\n");
 		ret = TEST_SKIP;
@@ -117,10 +121,6 @@ int test__backward_ring_buffer(int subtest __maybe_unused)
 
 	perf_evlist__config(evlist, &opts, NULL);
 
-	/* Set backward bit, ring buffer should be writing from end */
-	evlist__for_each_entry(evlist, evsel)
-		evsel->attr.write_backward = 1;
-
 	err = perf_evlist__open(evlist);
 	if (err < 0) {
 		pr_debug("perf_evlist__open: %s\n",
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 9ac2f92ce88d..8c54df61fe64 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -695,6 +695,9 @@ static void apply_config_terms(struct perf_evsel *evsel,
 			 */
 			attr->inherit = term->val.inherit ? 1 : 0;
 			break;
+		case PERF_EVSEL__CONFIG_TERM_OVERWRITE:
+			attr->write_backward = term->val.overwrite ? 1 : 0;
+			break;
 		default:
 			break;
 		}
@@ -776,6 +779,7 @@ void perf_evsel__config(struct perf_evsel *evsel, struct record_opts *opts,
 
 	attr->sample_id_all = perf_missing_features.sample_id_all ? 0 : 1;
 	attr->inherit	    = !opts->no_inherit;
+	attr->write_backward = opts->overwrite ? 1 : 0;
 
 	perf_evsel__set_sample_bit(evsel, IP);
 	perf_evsel__set_sample_bit(evsel, TID);
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index e60cbfc2cd35..8a4a6c9f1480 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -45,6 +45,7 @@ enum {
 	PERF_EVSEL__CONFIG_TERM_STACK_USER,
 	PERF_EVSEL__CONFIG_TERM_INHERIT,
 	PERF_EVSEL__CONFIG_TERM_MAX_STACK,
+	PERF_EVSEL__CONFIG_TERM_OVERWRITE,
 	PERF_EVSEL__CONFIG_TERM_MAX,
 };
 
@@ -59,6 +60,7 @@ struct perf_evsel_config_term {
 		u64	stack_user;
 		int	max_stack;
 		bool	inherit;
+		bool	overwrite;
 	} val;
 };
 
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 375af0e02831..6c913c3914fb 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -902,6 +902,8 @@ static const char *config_term_names[__PARSE_EVENTS__TERM_TYPE_NR] = {
 	[PARSE_EVENTS__TERM_TYPE_NOINHERIT]		= "no-inherit",
 	[PARSE_EVENTS__TERM_TYPE_INHERIT]		= "inherit",
 	[PARSE_EVENTS__TERM_TYPE_MAX_STACK]		= "max-stack",
+	[PARSE_EVENTS__TERM_TYPE_OVERWRITE]		= "overwrite",
+	[PARSE_EVENTS__TERM_TYPE_NOOVERWRITE]		= "no-overwrite",
 };
 
 static bool config_term_shrinked;
@@ -994,6 +996,12 @@ do {									   \
 	case PARSE_EVENTS__TERM_TYPE_NOINHERIT:
 		CHECK_TYPE_VAL(NUM);
 		break;
+	case PARSE_EVENTS__TERM_TYPE_OVERWRITE:
+		CHECK_TYPE_VAL(NUM);
+		break;
+	case PARSE_EVENTS__TERM_TYPE_NOOVERWRITE:
+		CHECK_TYPE_VAL(NUM);
+		break;
 	case PARSE_EVENTS__TERM_TYPE_NAME:
 		CHECK_TYPE_VAL(STR);
 		break;
@@ -1046,6 +1054,8 @@ static int config_term_tracepoint(struct perf_event_attr *attr,
 	case PARSE_EVENTS__TERM_TYPE_INHERIT:
 	case PARSE_EVENTS__TERM_TYPE_NOINHERIT:
 	case PARSE_EVENTS__TERM_TYPE_MAX_STACK:
+	case PARSE_EVENTS__TERM_TYPE_OVERWRITE:
+	case PARSE_EVENTS__TERM_TYPE_NOOVERWRITE:
 		return config_term_common(attr, term, err);
 	default:
 		if (err) {
@@ -1118,6 +1128,12 @@ do {								\
 		case PARSE_EVENTS__TERM_TYPE_MAX_STACK:
 			ADD_CONFIG_TERM(MAX_STACK, max_stack, term->val.num);
 			break;
+		case PARSE_EVENTS__TERM_TYPE_OVERWRITE:
+			ADD_CONFIG_TERM(OVERWRITE, overwrite, term->val.num ? 1 : 0);
+			break;
+		case PARSE_EVENTS__TERM_TYPE_NOOVERWRITE:
+			ADD_CONFIG_TERM(OVERWRITE, overwrite, term->val.num ? 0 : 1);
+			break;
 		default:
 			break;
 		}
@@ -2412,9 +2428,9 @@ static void config_terms_list(char *buf, size_t buf_sz)
 char *parse_events_formats_error_string(char *additional_terms)
 {
 	char *str;
-	/* "branch_type" is the longest name */
+	/* "no-overwrite" is the longest name */
 	char static_terms[__PARSE_EVENTS__TERM_TYPE_NR *
-			  (sizeof("branch_type") - 1)];
+			  (sizeof("no-overwrite") - 1)];
 
 	config_terms_list(static_terms, sizeof(static_terms));
 	/* valid terms */
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index b4aa7eb2df73..d1edbf8cc66a 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -69,6 +69,8 @@ enum {
 	PARSE_EVENTS__TERM_TYPE_NOINHERIT,
 	PARSE_EVENTS__TERM_TYPE_INHERIT,
 	PARSE_EVENTS__TERM_TYPE_MAX_STACK,
+	PARSE_EVENTS__TERM_TYPE_NOOVERWRITE,
+	PARSE_EVENTS__TERM_TYPE_OVERWRITE,
 	__PARSE_EVENTS__TERM_TYPE_NR,
 };
 
diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l
index 3c15b33b2e84..7a2519435da0 100644
--- a/tools/perf/util/parse-events.l
+++ b/tools/perf/util/parse-events.l
@@ -202,6 +202,8 @@ stack-size		{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_STACKSIZE); }
 max-stack		{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_MAX_STACK); }
 inherit			{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_INHERIT); }
 no-inherit		{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOINHERIT); }
+overwrite		{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_OVERWRITE); }
+no-overwrite		{ return term(yyscanner, PARSE_EVENTS__TERM_TYPE_NOOVERWRITE); }
 ,			{ return ','; }
 "/"			{ BEGIN(INITIAL); return '/'; }
 {name_minus}		{ return str(yyscanner, PE_NAME); }
-- 
2.7.4

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

* [PATCH 21/24] perf session: Don't warn about out of order event if write_backward is used
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (19 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 20/24] perf tools: Enable overwrite settings Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 22/24] perf record: Add --tail-synthesize option Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, Masami Hiramatsu, Namhyung Kim,
	Nilay Vaish, Zefan Li, pi3orama, He Kuang,
	Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

If write_backward attribute is set, records are written into kernel
ring buffer from end to beginning, but read from beginning to end.
To avoid 'XX out of order events recorded' warning message (timestamps
of records is in reverse order when using write_backward), suppress the
warning message if write_backward is selected by at lease one event.

Result:

Before this patch:
  # perf record -m 1 -e raw_syscalls:sys_exit/overwrite/ \
                     -e raw_syscalls:sys_enter \
                     dd if=/dev/zero of=/dev/null count=300
  300+0 records in
  300+0 records out
  153600 bytes (154 kB) copied, 0.000601617 s, 255 MB/s
  [ perf record: Woken up 5 times to write data ]
  Warning:
  40 out of order events recorded.
  [ perf record: Captured and wrote 0.096 MB perf.data (696 samples) ]

After this patch:
  # perf record -m 1 -e raw_syscalls:sys_exit/overwrite/ \
                     -e raw_syscalls:sys_enter \
                     dd if=/dev/zero of=/dev/null count=300
  300+0 records in
  300+0 records out
  153600 bytes (154 kB) copied, 0.000644873 s, 238 MB/s
  [ perf record: Woken up 5 times to write data ]
  [ perf record: Captured and wrote 0.096 MB perf.data (696 samples) ]

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-15-git-send-email-wangnan0@huawei.com
Signed-off-by: He Kuang <hekuang@huawei.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/session.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 078d49626494..5d61242a6e64 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1499,10 +1499,27 @@ int perf_session__register_idle_thread(struct perf_session *session)
 	return err;
 }
 
+static void
+perf_session__warn_order(const struct perf_session *session)
+{
+	const struct ordered_events *oe = &session->ordered_events;
+	struct perf_evsel *evsel;
+	bool should_warn = true;
+
+	evlist__for_each_entry(session->evlist, evsel) {
+		if (evsel->attr.write_backward)
+			should_warn = false;
+	}
+
+	if (!should_warn)
+		return;
+	if (oe->nr_unordered_events != 0)
+		ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events);
+}
+
 static void perf_session__warn_about_errors(const struct perf_session *session)
 {
 	const struct events_stats *stats = &session->evlist->stats;
-	const struct ordered_events *oe = &session->ordered_events;
 
 	if (session->tool->lost == perf_event__process_lost &&
 	    stats->nr_events[PERF_RECORD_LOST] != 0) {
@@ -1559,8 +1576,7 @@ static void perf_session__warn_about_errors(const struct perf_session *session)
 			    stats->nr_unprocessable_samples);
 	}
 
-	if (oe->nr_unordered_events != 0)
-		ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events);
+	perf_session__warn_order(session);
 
 	events_stats__auxtrace_error_warn(stats);
 
-- 
2.7.4

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

* [PATCH 22/24] perf record: Add --tail-synthesize option
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (20 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 21/24] perf session: Don't warn about out of order event if write_backward is used Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 23/24] objtool: Add -I$(srctree)/tools/arch/$(ARCH)/include/uapi Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Wang Nan, He Kuang, Jiri Olsa, Masami Hiramatsu,
	Namhyung Kim, Nilay Vaish, Zefan Li, pi3orama,
	Arnaldo Carvalho de Melo

From: Wang Nan <wangnan0@huawei.com>

When working with overwritable ring buffer there's a inconvenience
problem: if perf dumps data after a long period after it starts,
non-sample events may lost, which makes following 'perf report' unable
to identify proc name and mmap layout. For example:

 # perf record -m 4 -e raw_syscalls:* -g --overwrite --switch-output \
        dd if=/dev/zero of=/dev/null

send SIGUSR2 after dd runs long enough. The resuling perf.data lost
correct comm and mmap events:

 # perf script -i perf.data.2016061522374354
 perf 24478 [004] 2581325.601789:  raw_syscalls:sys_exit: NR 0 = 512
 ^^^^
 Should be 'dd'
                   27b2e8 syscall_slow_exit_work+0xfe2000e3 (/lib/modules/4.6.0-rc3+/build/vmlinux)
                   203cc7 do_syscall_64+0xfe200117 (/lib/modules/4.6.0-rc3+/build/vmlinux)
                   b18d83 return_from_SYSCALL_64+0xfe200000 (/lib/modules/4.6.0-rc3+/build/vmlinux)
             7f47c417edf0 [unknown] ([unknown])
             ^^^^^^^^^^^^
             Fail to unwind

This patch provides a '--tail-synthesize' option, allows perf to collect
system status when finalizing output file. In resuling output file, the
non-sample events reflect system status when dumping data.

After this patch:
 # perf record -m 4 -e raw_syscalls:* -g --overwrite --switch-output --tail-synthesize \
        dd if=/dev/zero of=/dev/null

 # perf script -i perf.data.2016061600544998
 dd 27364 [004] 2583244.994464: raw_syscalls:sys_enter: NR 1 (1, ...
 ^^
 Correct comm
                   203a18 syscall_trace_enter_phase2+0xfe2001a8 ([kernel.kallsyms])
                   203aa5 syscall_trace_enter+0xfe200055 ([kernel.kallsyms])
                   203caa do_syscall_64+0xfe2000fa ([kernel.kallsyms])
                   b18d83 return_from_SYSCALL_64+0xfe200000 ([kernel.kallsyms])
                    d8e50 __GI___libc_write+0xffff01d9639f4010 (/tmp/oxygen_root-w00229757/lib64/libc-2.18.so)
                    ^^^^^
                    Correct unwind

This option doesn't aim to solve this problem completely. If a process
terminates before SIGUSR2, we still lost its COMM and MMAP events. For
example, we can't unwind correctly from the final perf.data we get from
the previous example, because when perf collects the final output file
(when we press C-c), 'dd' has been terminated so its '/proc/<pid>/mmap'
becomes empty.

However, this is a cheaper choice. To completely solve this problem we
need to continously output non-sample events. To satisify the
requirement of daemonization, we need to merge them periodically. It is
possible but requires much more code and cycles.

Automatically select --tail-synthesize when --overwrite is provided.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Nilay Vaish <nilayvaish@gmail.com>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1468485287-33422-16-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-record.txt |  8 ++++++++
 tools/perf/builtin-record.c              | 31 +++++++++++++++++++++++++------
 tools/perf/perf.h                        |  1 +
 3 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
index 384c630436f8..69966abf65d1 100644
--- a/tools/perf/Documentation/perf-record.txt
+++ b/tools/perf/Documentation/perf-record.txt
@@ -367,6 +367,12 @@ options.
 'perf record --dry-run -e' can act as a BPF script compiler if llvm.dump-obj
 in config file is set to true.
 
+--tail-synthesize::
+Instead of collecting non-sample events (for example, fork, comm, mmap) at
+the beginning of record, collect them during finalizing an output file.
+The collected non-sample events reflects the status of the system when
+record is finished.
+
 --overwrite::
 Makes all events use an overwritable ring buffer. An overwritable ring
 buffer works like a flight recorder: when it gets full, the kernel will
@@ -381,6 +387,8 @@ those fitting in the ring buffer at that moment.
 'overwrite' attribute can also be set or canceled for an event using
 config terms. For example: 'cycles/overwrite/' and 'instructions/no-overwrite/'.
 
+Implies --tail-synthesize.
+
 SEE ALSO
 --------
 linkperf:perf-stat[1], linkperf:perf-list[1]
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 39c7486f0607..8f2c16d9275f 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -604,13 +604,16 @@ record__finish_output(struct record *rec)
 	return;
 }
 
-static int record__synthesize_workload(struct record *rec)
+static int record__synthesize_workload(struct record *rec, bool tail)
 {
 	struct {
 		struct thread_map map;
 		struct thread_map_data map_data;
 	} thread_map;
 
+	if (rec->opts.tail_synthesize != tail)
+		return 0;
+
 	thread_map.map.nr = 1;
 	thread_map.map.map[0].pid = rec->evlist->workload.pid;
 	thread_map.map.map[0].comm = NULL;
@@ -621,7 +624,7 @@ static int record__synthesize_workload(struct record *rec)
 						 rec->opts.proc_map_timeout);
 }
 
-static int record__synthesize(struct record *rec);
+static int record__synthesize(struct record *rec, bool tail);
 
 static int
 record__switch_output(struct record *rec, bool at_exit)
@@ -632,6 +635,10 @@ record__switch_output(struct record *rec, bool at_exit)
 	/* Same Size:      "2015122520103046"*/
 	char timestamp[] = "InvalidTimestamp";
 
+	record__synthesize(rec, true);
+	if (target__none(&rec->opts.target))
+		record__synthesize_workload(rec, true);
+
 	rec->samples = 0;
 	record__finish_output(rec);
 	err = fetch_current_timestamp(timestamp, sizeof(timestamp));
@@ -654,7 +661,7 @@ record__switch_output(struct record *rec, bool at_exit)
 
 	/* Output tracking events */
 	if (!at_exit) {
-		record__synthesize(rec);
+		record__synthesize(rec, false);
 
 		/*
 		 * In 'perf record --switch-output' without -a,
@@ -666,7 +673,7 @@ record__switch_output(struct record *rec, bool at_exit)
 		 * perf_event__synthesize_thread_map() for those events.
 		 */
 		if (target__none(&rec->opts.target))
-			record__synthesize_workload(rec);
+			record__synthesize_workload(rec, false);
 	}
 	return fd;
 }
@@ -720,7 +727,7 @@ static const struct perf_event_mmap_page *record__pick_pc(struct record *rec)
 	return NULL;
 }
 
-static int record__synthesize(struct record *rec)
+static int record__synthesize(struct record *rec, bool tail)
 {
 	struct perf_session *session = rec->session;
 	struct machine *machine = &session->machines.host;
@@ -730,6 +737,9 @@ static int record__synthesize(struct record *rec)
 	int fd = perf_data_file__fd(file);
 	int err = 0;
 
+	if (rec->opts.tail_synthesize != tail)
+		return 0;
+
 	if (file->is_pipe) {
 		err = perf_event__synthesize_attrs(tool, session,
 						   process_synthesized_event);
@@ -893,7 +903,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 
 	machine = &session->machines.host;
 
-	err = record__synthesize(rec);
+	err = record__synthesize(rec, false);
 	if (err < 0)
 		goto out_child;
 
@@ -1057,6 +1067,9 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	if (!quiet)
 		fprintf(stderr, "[ perf record: Woken up %ld times to write data ]\n", waking);
 
+	if (target__none(&rec->opts.target))
+		record__synthesize_workload(rec, true);
+
 out_child:
 	if (forks) {
 		int exit_status;
@@ -1075,6 +1088,7 @@ out_child:
 	} else
 		status = err;
 
+	record__synthesize(rec, true);
 	/* this will be recalculated during process_buildids() */
 	rec->samples = 0;
 
@@ -1399,6 +1413,8 @@ struct option __record_options[] = {
 	OPT_BOOLEAN_SET('i', "no-inherit", &record.opts.no_inherit,
 			&record.opts.no_inherit_set,
 			"child tasks do not inherit counters"),
+	OPT_BOOLEAN(0, "tail-synthesize", &record.opts.tail_synthesize,
+		    "synthesize non-sample events at the end of output"),
 	OPT_BOOLEAN(0, "overwrite", &record.opts.overwrite, "use overwrite mode"),
 	OPT_UINTEGER('F', "freq", &record.opts.user_freq, "profile at this frequency"),
 	OPT_CALLBACK('m', "mmap-pages", &record.opts, "pages[,pages]",
@@ -1610,6 +1626,9 @@ int cmd_record(int argc, const char **argv, const char *prefix __maybe_unused)
 		}
 	}
 
+	if (record.opts.overwrite)
+		record.opts.tail_synthesize = true;
+
 	if (rec->evlist->nr_entries == 0 &&
 	    perf_evlist__add_default(rec->evlist) < 0) {
 		pr_err("Not enough memory for event selector list\n");
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 608b42bdb1b6..a7e0f1497244 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -59,6 +59,7 @@ struct record_opts {
 	bool	     record_switch_events;
 	bool	     all_kernel;
 	bool	     all_user;
+	bool	     tail_synthesize;
 	bool	     overwrite;
 	unsigned int freq;
 	unsigned int mmap_pages;
-- 
2.7.4

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

* [PATCH 23/24] objtool: Add -I$(srctree)/tools/arch/$(ARCH)/include/uapi
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (21 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 22/24] perf record: Add --tail-synthesize option Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-15 20:50 ` [PATCH 24/24] objtool: Initialize variable to silence old compiler Arnaldo Carvalho de Melo
  2016-07-16 20:39 ` [GIT PULL 00/24] perf/core improvements and fixes Ingo Molnar
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Josh Poimboeuf, Namhyung Kim,
	Peter Zijlstra, Wang Nan

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

So that it can find asm/bitsperlong.h to get the __BITS_PER_LONG
definition.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-pr3pvskh65pey4po7t122z4j@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/objtool/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 9a3110cac604..1f75b0a046cc 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -26,7 +26,7 @@ OBJTOOL_IN := $(OBJTOOL)-in.o
 
 all: $(OBJTOOL)
 
-INCLUDES := -I$(srctree)/tools/include
+INCLUDES := -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi
 CFLAGS   += -Wall -Werror $(EXTRA_WARNINGS) -fomit-frame-pointer -O2 -g $(INCLUDES)
 LDFLAGS  += -lelf $(LIBSUBCMD)
 
-- 
2.7.4

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

* [PATCH 24/24] objtool: Initialize variable to silence old compiler
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (22 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 23/24] objtool: Add -I$(srctree)/tools/arch/$(ARCH)/include/uapi Arnaldo Carvalho de Melo
@ 2016-07-15 20:50 ` Arnaldo Carvalho de Melo
  2016-07-16 20:39 ` [GIT PULL 00/24] perf/core improvements and fixes Ingo Molnar
  24 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-07-15 20:50 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	David Ahern, Jiri Olsa, Josh Poimboeuf, Namhyung Kim, Wang Nan

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

gcc version 4.1.2 20080704 (Red Hat 4.1.2-55) barfs with:

    CC       /tmp/build/objtool/builtin-check.o
  cc1: warnings being treated as errors
  builtin-check.c: In function 'cmd_check':
  builtin-check.c:667: warning: 'prev_rela' may be used uninitialized in this function
  mv: cannot stat `/tmp/build/objtool/.builtin-check.o.tmp': No such file or directory
  make[1]: *** [/tmp/build/objtool/builtin-check.o] Error 1

Init it to NULL to silence it.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-qolo31rl2ojlwj1lj9dhemyz@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/objtool/builtin-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 92d84b277032..4ed30f45c6da 100644
--- a/tools/objtool/builtin-check.c
+++ b/tools/objtool/builtin-check.c
@@ -664,7 +664,7 @@ static int add_func_switch_tables(struct objtool_file *file,
 				  struct symbol *func)
 {
 	struct instruction *insn, *prev_jump;
-	struct rela *text_rela, *rodata_rela, *prev_rela;
+	struct rela *text_rela, *rodata_rela, *prev_rela = NULL;
 	int ret;
 
 	prev_jump = NULL;
-- 
2.7.4

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (23 preceding siblings ...)
  2016-07-15 20:50 ` [PATCH 24/24] objtool: Initialize variable to silence old compiler Arnaldo Carvalho de Melo
@ 2016-07-16 20:39 ` Ingo Molnar
  24 siblings, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2016-07-16 20:39 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Andy Lutomirski, Chris Phlipot,
	David Ahern, He Kuang, H . Peter Anvin, Jiri Olsa,
	Josh Poimboeuf, Masami Hiramatsu, Namhyung Kim, Nilay Vaish,
	Peter Zijlstra, pi3orama, Songshan Gong, Stephen Rothwell,
	Steven Rostedt, Thomas Gleixner, Wang Nan, Zefan Li,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> Test results, with a new target: cross-compiling to Android ARM API 24 (NDK r12b),
> for all except android-ndk:r12b now objtool is tested too, in adition to tools/perf.
> 
>   [root@jouet ~]# dm
>   alpine:3.4: Ok
>   android-ndk:r12b: Ok
>   centos:5: Ok
>   centos:6: Ok
>   centos:7: Ok
>   debian:7: Ok
>   debian:8: Ok
>   debian:experimental: Ok
>   fedora:21: Ok
>   fedora:22: Ok
>   fedora:23: Ok
>   fedora:24: Ok
>   fedora:rawhide: Ok
>   opensuse:13.2: Ok
>   opensuse:42.1: Ok
>   ubuntu:14.04.4: Ok
>   ubuntu:15.10: Ok
>   ubuntu:16.04: Ok
>   [root@jouet ~]#
> 
> oops, the mageia image din't got rebuilt, will fix that, pretty good coverage
> even so :-)
> 
> - Arnaldo
> 
> The following changes since commit b29c6574699dc475da5dbff8db19297b203aacce:
> 
>   Merge tag 'perf-core-for-mingo-20160713' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2016-07-14 08:54:13 +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-20160715
> 
> for you to fetch changes up to b49364f36cfdb6d540ac961102d7ffaf84279bb6:
> 
>   objtool: Initialize variable to silence old compiler (2016-07-15 17:32:52 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Allow reading from a backward ring buffer (one setup via sys_perf_event_open
>   with perf_event_attr.write_backward = 1) (Wang Nan)
> 
> Infrastructure:
> 
> - Fix the build on Android NDK r12b (initially just for arm), that is now port
>   of my perf-build container collection and will get tested prior to sending
>   patches upstream (Arnaldo Carvalho de Melo)
> 
> - Add correct header for ipv6 defini
> 
> - Fix bitsperlong.h fallout (Arnaldo Carvalho de Melo, Peter Zijlstra)
> 
> - Use base 0 (auto) in filename__read_ull, so that we can handle hex values too (Jiri Olsa)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (8):
>       tools lib traceevent: Add correct header for ipv6 definitions
>       perf tools: Do not provide dup sched_getcpu() prototype on Android
>       tools: Make "__always_inline" just "inline" on Android
>       perf tools: Just pr_debug() about not being able to read cacheline_size
>       perf tools: Bail out at "--sort dcacheline" and cacheline_size not known
>       perf evlist: Drop redundant evsel->overwrite indicator
>       objtool: Add -I$(srctree)/tools/arch/$(ARCH)/include/uapi
>       objtool: Initialize variable to silence old compiler
> 
> Jiri Olsa (1):
>       tools lib api fs: Use base 0 in filename__read_ull
> 
> Peter Zijlstra (1):
>       tools: Simplify BITS_PER_LONG define
> 
> Wang Nan (14):
>       tools lib fd array: Allow associating a pointer cookie with each entry
>       perf evlist: Update mmap related APIs and helpers
>       perf record: Decouple record__mmap_read() and evlist.
>       perf evlist: Record mmap cookie into fdarray private field
>       perf evlist: Extract common code in mmap failure processing
>       perf evlist: Introduce backward_mmap array for evlist
>       perf evlist: Map backward events to backward_mmap
>       perf evlist: Drop evlist->backward
>       perf evlist: Setup backward mmap state machine
>       perf record: Read from overwritable ring buffer
>       perf evlist: Make {pause,resume} internal helpers
>       perf tools: Enable overwrite settings
>       perf session: Don't warn about out of order event if write_backward is used
>       perf record: Add --tail-synthesize option
> 
>  tools/include/asm-generic/bitsperlong.h  |  23 +--
>  tools/include/linux/compiler.h           |  11 ++
>  tools/lib/api/fd/array.h                 |   1 +
>  tools/lib/api/fs/fs.c                    |   7 +-
>  tools/lib/traceevent/event-parse.c       |   3 +-
>  tools/objtool/Makefile                   |   2 +-
>  tools/objtool/builtin-check.c            |   2 +-
>  tools/perf/Documentation/perf-record.txt |  22 +++
>  tools/perf/builtin-record.c              | 113 ++++++++++---
>  tools/perf/perf.c                        |   2 +-
>  tools/perf/perf.h                        |   2 +
>  tools/perf/tests/backward-ring-buffer.c  |  14 +-
>  tools/perf/util/evlist.c                 | 269 ++++++++++++++++++++++---------
>  tools/perf/util/evlist.h                 |  47 +++++-
>  tools/perf/util/evsel.c                  |  16 +-
>  tools/perf/util/evsel.h                  |   3 +-
>  tools/perf/util/parse-events.c           |  20 ++-
>  tools/perf/util/parse-events.h           |   2 +
>  tools/perf/util/parse-events.l           |   2 +
>  tools/perf/util/session.c                |  22 ++-
>  tools/perf/util/sort.c                   |   8 +-
>  tools/perf/util/util.h                   |   2 +-
>  22 files changed, 441 insertions(+), 152 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2019-01-21 23:56 Arnaldo Carvalho de Melo
@ 2019-01-22 10:07 ` Ingo Molnar
  0 siblings, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2019-01-22 10:07 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Clark Williams, linux-kernel, linux-perf-users, Brajeswar Ghosh,
	Jamal Hadi Salim, Rasmus Villemoes, Song Liu, Thomas Richter,
	YueHaibing, Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> Regards,
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit ad07c8ceb6631a83b62d405a61448bba92adac68:
> 
>   perf/core: Remove unused perf_flags (2019-01-21 11:01:31 +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-5.0-20190121
> 
> for you to fetch changes up to 32e9136e37840a62c659259a394ed3735e3b3c84:
> 
>   perf utils: Move perf_config using routines from color.c to separate object (2019-01-21 17:38:56 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> BPF:
> 
>   Song Liu:
> 
>   - Introduce PERF_RECORD_KSYMBOL to allow tooling to notice the addition
>     of new kernel symbols and be able to resolve samples in such symbols.
> 
>   - Introduce PERF_RECORD_BPF_EVENT to notify tooling about the loading
>     and unloading of BPF programs, making them visible and allowing for
>     the request of further information to allow for things like annotation.
> 
>   - Change the userspace perf tools to handle those new events and to
>     synthesize them for pre-existing loaded BPF programs.
> 
> Kernel:
> 
>   Arnaldo Carvalho de Melo:
> 
>   - Make perf_event_output() propagate the output() return, allowing
>     users to check for -ENOSPC in the ring buffer.
> 
> perf report:
> 
>   Thomas Richter:
> 
>   - Display arch specific diagnostic counter sets, starting with s390
>     diagnostic counter sets.
> 
> perf session:
> 
>   Jiri Olsa:
> 
>   - Introduce a reader object to prep for multithreaded processing
>     of recorded events.
> 
> Misc:
> 
>   Rasmus Villemoes:
> 
>   - Replace automatic const char[] variables by statics, to avoid
>     initializing them at runtime, instead having them in .rodata,
>     reducing code size.
> 
>   YueHaibing:
> 
>   - Remove duplicated workqueue.h include from perf_event.h
> 
>   Brajeswar Ghosh:
> 
>   - Remove some more duplicated headers.
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (4):
>       perf: Make perf_event_output() propagate the output() return
>       perf top: Synthesize BPF events for pre-existing loaded BPF programs
>       perf python: Remove -fstack-clash-protection when building with some clang versions
>       perf utils: Move perf_config using routines from color.c to separate object
> 
> Brajeswar Ghosh (1):
>       perf tools: Remove duplicate headers
> 
> Jiri Olsa (6):
>       perf session: Rearrange perf_session__process_events function
>       perf session: Get rid of file_size variable
>       perf session: Add reader object
>       perf session: Add 'data_size' member to reader object
>       perf session: Add 'data_offset' member to reader object
>       perf session: Add reader__process_events function
> 
> Rasmus Villemoes (1):
>       perf tools: Replace automatic const char[] variables by statics
> 
> Song Liu (8):
>       perf, bpf: Introduce PERF_RECORD_KSYMBOL
>       tools headers uapi: Sync tools/include/uapi/linux/perf_event.h
>       perf, bpf: Introduce PERF_RECORD_BPF_EVENT
>       tools headers uapi: Sync tools/include/uapi/linux/perf_event.h
>       perf tools: Handle PERF_RECORD_KSYMBOL
>       perf tools: Handle PERF_RECORD_BPF_EVENT
>       perf tools: Synthesize PERF_RECORD_* for loaded BPF programs
>       bpf: Add module name [bpf] to ksymbols for bpf programs
> 
> Thomas Richter (3):
>       perf report: Display arch specific diagnostic counter sets, starting with s390
>       perf report: Display names in s390 diagnostic counter sets
>       perf report: Dump s390 counter set data to file
> 
> YueHaibing (1):
>       perf: Remove duplicated workqueue.h include from perf_event.h
> 
>  include/linux/filter.h                           |   7 +
>  include/linux/perf_event.h                       |  21 +-
>  include/uapi/linux/perf_event.h                  |  53 ++++-
>  kernel/bpf/core.c                                |   2 +-
>  kernel/bpf/syscall.c                             |   2 +
>  kernel/events/core.c                             | 224 +++++++++++++++++++-
>  kernel/kallsyms.c                                |   2 +-
>  kernel/trace/bpf_trace.c                         |   3 +-
>  tools/include/uapi/linux/perf_event.h            |  53 ++++-
>  tools/perf/builtin-c2c.c                         |   4 +-
>  tools/perf/builtin-kmem.c                        |   4 +-
>  tools/perf/builtin-record.c                      |   7 +
>  tools/perf/builtin-report.c                      |   6 +-
>  tools/perf/builtin-sched.c                       |   2 +-
>  tools/perf/builtin-stat.c                        |   1 -
>  tools/perf/builtin-top.c                         |   7 +
>  tools/perf/examples/bpf/augmented_raw_syscalls.c |   4 +-
>  tools/perf/examples/bpf/augmented_syscalls.c     |  14 +-
>  tools/perf/examples/bpf/etcsnoop.c               |  10 +-
>  tools/perf/perf.h                                |   1 +
>  tools/perf/tests/bp_account.c                    |   1 -
>  tools/perf/ui/browsers/header.c                  |   2 +-
>  tools/perf/ui/browsers/hists.c                   |   4 +-
>  tools/perf/util/Build                            |   5 +
>  tools/perf/util/bpf-event.c                      | 257 +++++++++++++++++++++++
>  tools/perf/util/bpf-event.h                      |  38 ++++
>  tools/perf/util/color.c                          |  39 ----
>  tools/perf/util/color_config.c                   |  47 +++++
>  tools/perf/util/dso.h                            |   1 -
>  tools/perf/util/event.c                          |  41 ++++
>  tools/perf/util/event.h                          |  36 ++++
>  tools/perf/util/evlist.h                         |   4 +-
>  tools/perf/util/evsel.c                          |  19 +-
>  tools/perf/util/evsel.h                          |   2 +
>  tools/perf/util/machine.c                        |  58 +++++
>  tools/perf/util/machine.h                        |   3 +
>  tools/perf/util/s390-cpumcf-kernel.h             |  62 ++++++
>  tools/perf/util/s390-cpumsf.c                    |  77 ++++++-
>  tools/perf/util/s390-sample-raw.c                | 222 ++++++++++++++++++++
>  tools/perf/util/sample-raw.c                     |  18 ++
>  tools/perf/util/sample-raw.h                     |  14 ++
>  tools/perf/util/session.c                        |  98 ++++++---
>  tools/perf/util/setup.py                         |   2 +
>  tools/perf/util/tool.h                           |   5 +-
>  tools/perf/util/zlib.c                           |   1 -
>  45 files changed, 1358 insertions(+), 125 deletions(-)
>  create mode 100644 tools/perf/util/bpf-event.c
>  create mode 100644 tools/perf/util/bpf-event.h
>  create mode 100644 tools/perf/util/color_config.c
>  create mode 100644 tools/perf/util/s390-cpumcf-kernel.h
>  create mode 100644 tools/perf/util/s390-sample-raw.c
>  create mode 100644 tools/perf/util/sample-raw.c
>  create mode 100644 tools/perf/util/sample-raw.h

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/24] perf/core improvements and fixes
@ 2019-01-21 23:56 Arnaldo Carvalho de Melo
  2019-01-22 10:07 ` Ingo Molnar
  0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-01-21 23:56 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Clark Williams, linux-kernel, linux-perf-users,
	Arnaldo Carvalho de Melo, Brajeswar Ghosh, Jamal Hadi Salim,
	Rasmus Villemoes, Song Liu, Thomas Richter, YueHaibing,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

Regards,

- Arnaldo

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

The following changes since commit ad07c8ceb6631a83b62d405a61448bba92adac68:

  perf/core: Remove unused perf_flags (2019-01-21 11:01:31 +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-5.0-20190121

for you to fetch changes up to 32e9136e37840a62c659259a394ed3735e3b3c84:

  perf utils: Move perf_config using routines from color.c to separate object (2019-01-21 17:38:56 -0300)

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

BPF:

  Song Liu:

  - Introduce PERF_RECORD_KSYMBOL to allow tooling to notice the addition
    of new kernel symbols and be able to resolve samples in such symbols.

  - Introduce PERF_RECORD_BPF_EVENT to notify tooling about the loading
    and unloading of BPF programs, making them visible and allowing for
    the request of further information to allow for things like annotation.

  - Change the userspace perf tools to handle those new events and to
    synthesize them for pre-existing loaded BPF programs.

Kernel:

  Arnaldo Carvalho de Melo:

  - Make perf_event_output() propagate the output() return, allowing
    users to check for -ENOSPC in the ring buffer.

perf report:

  Thomas Richter:

  - Display arch specific diagnostic counter sets, starting with s390
    diagnostic counter sets.

perf session:

  Jiri Olsa:

  - Introduce a reader object to prep for multithreaded processing
    of recorded events.

Misc:

  Rasmus Villemoes:

  - Replace automatic const char[] variables by statics, to avoid
    initializing them at runtime, instead having them in .rodata,
    reducing code size.

  YueHaibing:

  - Remove duplicated workqueue.h include from perf_event.h

  Brajeswar Ghosh:

  - Remove some more duplicated headers.

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (4):
      perf: Make perf_event_output() propagate the output() return
      perf top: Synthesize BPF events for pre-existing loaded BPF programs
      perf python: Remove -fstack-clash-protection when building with some clang versions
      perf utils: Move perf_config using routines from color.c to separate object

Brajeswar Ghosh (1):
      perf tools: Remove duplicate headers

Jiri Olsa (6):
      perf session: Rearrange perf_session__process_events function
      perf session: Get rid of file_size variable
      perf session: Add reader object
      perf session: Add 'data_size' member to reader object
      perf session: Add 'data_offset' member to reader object
      perf session: Add reader__process_events function

Rasmus Villemoes (1):
      perf tools: Replace automatic const char[] variables by statics

Song Liu (8):
      perf, bpf: Introduce PERF_RECORD_KSYMBOL
      tools headers uapi: Sync tools/include/uapi/linux/perf_event.h
      perf, bpf: Introduce PERF_RECORD_BPF_EVENT
      tools headers uapi: Sync tools/include/uapi/linux/perf_event.h
      perf tools: Handle PERF_RECORD_KSYMBOL
      perf tools: Handle PERF_RECORD_BPF_EVENT
      perf tools: Synthesize PERF_RECORD_* for loaded BPF programs
      bpf: Add module name [bpf] to ksymbols for bpf programs

Thomas Richter (3):
      perf report: Display arch specific diagnostic counter sets, starting with s390
      perf report: Display names in s390 diagnostic counter sets
      perf report: Dump s390 counter set data to file

YueHaibing (1):
      perf: Remove duplicated workqueue.h include from perf_event.h

 include/linux/filter.h                           |   7 +
 include/linux/perf_event.h                       |  21 +-
 include/uapi/linux/perf_event.h                  |  53 ++++-
 kernel/bpf/core.c                                |   2 +-
 kernel/bpf/syscall.c                             |   2 +
 kernel/events/core.c                             | 224 +++++++++++++++++++-
 kernel/kallsyms.c                                |   2 +-
 kernel/trace/bpf_trace.c                         |   3 +-
 tools/include/uapi/linux/perf_event.h            |  53 ++++-
 tools/perf/builtin-c2c.c                         |   4 +-
 tools/perf/builtin-kmem.c                        |   4 +-
 tools/perf/builtin-record.c                      |   7 +
 tools/perf/builtin-report.c                      |   6 +-
 tools/perf/builtin-sched.c                       |   2 +-
 tools/perf/builtin-stat.c                        |   1 -
 tools/perf/builtin-top.c                         |   7 +
 tools/perf/examples/bpf/augmented_raw_syscalls.c |   4 +-
 tools/perf/examples/bpf/augmented_syscalls.c     |  14 +-
 tools/perf/examples/bpf/etcsnoop.c               |  10 +-
 tools/perf/perf.h                                |   1 +
 tools/perf/tests/bp_account.c                    |   1 -
 tools/perf/ui/browsers/header.c                  |   2 +-
 tools/perf/ui/browsers/hists.c                   |   4 +-
 tools/perf/util/Build                            |   5 +
 tools/perf/util/bpf-event.c                      | 257 +++++++++++++++++++++++
 tools/perf/util/bpf-event.h                      |  38 ++++
 tools/perf/util/color.c                          |  39 ----
 tools/perf/util/color_config.c                   |  47 +++++
 tools/perf/util/dso.h                            |   1 -
 tools/perf/util/event.c                          |  41 ++++
 tools/perf/util/event.h                          |  36 ++++
 tools/perf/util/evlist.h                         |   4 +-
 tools/perf/util/evsel.c                          |  19 +-
 tools/perf/util/evsel.h                          |   2 +
 tools/perf/util/machine.c                        |  58 +++++
 tools/perf/util/machine.h                        |   3 +
 tools/perf/util/s390-cpumcf-kernel.h             |  62 ++++++
 tools/perf/util/s390-cpumsf.c                    |  77 ++++++-
 tools/perf/util/s390-sample-raw.c                | 222 ++++++++++++++++++++
 tools/perf/util/sample-raw.c                     |  18 ++
 tools/perf/util/sample-raw.h                     |  14 ++
 tools/perf/util/session.c                        |  98 ++++++---
 tools/perf/util/setup.py                         |   2 +
 tools/perf/util/tool.h                           |   5 +-
 tools/perf/util/zlib.c                           |   1 -
 45 files changed, 1358 insertions(+), 125 deletions(-)
 create mode 100644 tools/perf/util/bpf-event.c
 create mode 100644 tools/perf/util/bpf-event.h
 create mode 100644 tools/perf/util/color_config.c
 create mode 100644 tools/perf/util/s390-cpumcf-kernel.h
 create mode 100644 tools/perf/util/s390-sample-raw.c
 create mode 100644 tools/perf/util/sample-raw.c
 create mode 100644 tools/perf/util/sample-raw.h

Test results:

The first ones are container based builds of tools/perf with and without libelf
support.  Where clang is available, it is also used to build perf with/without
libelf, and building with LIBCLANGLLVM=1 (built-in clang) with gcc and clang
when clang and its devel libraries are installed.

The objtool and samples/bpf/ builds are disabled now that I'm switching from
using the sources in a local volume to fetching them from a http server to
build it inside the container, to make it easier to build in a container cluster.
Those will come back later.

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   gcc (Alpine 5.3.0) 5.3.0
   2 alpine:3.5                    : Ok   gcc (Alpine 6.2.1) 6.2.1 20160822
   3 alpine:3.6                    : Ok   gcc (Alpine 6.3.0) 6.3.0
   4 alpine:3.7                    : Ok   gcc (Alpine 6.4.0) 6.4.0
   5 alpine:3.8                    : Ok   gcc (Alpine 6.4.0) 6.4.0
   6 alpine:edge                   : Ok   gcc (Alpine 8.2.0) 8.2.0
   7 amazonlinux:1                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-28)
   8 amazonlinux:2                 : Ok   gcc (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
   9 android-ndk:r12b-arm          : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  10 android-ndk:r15c-arm          : Ok   gcc (GCC) 8.2.1 20181215 (Red Hat 8.2.1-6)
  11 centos:5                      : Ok   gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
  12 centos:6                      : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23)
  13 centos:7                      : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36)
  14 clearlinux:latest             : Ok   gcc (Clear Linux OS for Intel Architecture) 8.2.1 20180502
  15 debian:7                      : Ok   gcc (Debian 4.7.2-5) 4.7.2
  16 debian:8                      : Ok   gcc (Debian 4.9.2-10+deb8u2) 4.9.2
  17 debian:9                      : Ok   gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
  18 debian:experimental           : Ok   gcc (Debian 8.2.0-13) 8.2.0
  19 debian:experimental-x-arm64   : Ok   gcc (Debian 8.2.0-13) 8.2.0
  20 debian:experimental-x-mips    : Ok   gcc (Debian 8.2.0-13) 8.2.0
  21 debian:experimental-x-mips64  : Ok   gcc (Debian 8.2.0-13) 8.2.0
  22 debian:experimental-x-mipsel  : Ok   gcc (Debian 8.2.0-13) 8.2.0
  23 fedora:20                     : Ok   gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)
  24 fedora:22                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  25 fedora:23                     : Ok   gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
  26 fedora:24                     : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  27 fedora:24-x-ARC-uClibc        : Ok   gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
  28 fedora:25                     : Ok   gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
  29 fedora:26                     : Ok   gcc (GCC) 7.3.1 20180130 (Red Hat 7.3.1-2)
  30 fedora:27                     : Ok   gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-6)
  31 fedora:28                     : Ok   gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)
  32 fedora:29                     : Ok   gcc (GCC) 8.2.1 20181105 (Red Hat 8.2.1-5)
  33 fedora:rawhide                : Ok   gcc (GCC) 8.2.1 20190109 (Red Hat 8.2.1-7)
  34 gentoo-stage3-amd64:latest    : Ok   gcc (Gentoo 7.3.0-r3 p1.4) 7.3.0
  35 mageia:5                      : Ok   gcc (GCC) 4.9.2
  36 mageia:6                      : Ok   gcc (Mageia 5.5.0-1.mga6) 5.5.0
  37 opensuse:13.2                 : Ok   gcc (SUSE Linux) 4.8.3 20140627 [gcc-4_8-branch revision 212064]
  38 opensuse:15.0                 : Ok   gcc (SUSE Linux) 7.3.1 20180323 [gcc-7-branch revision 258812]
  39 opensuse:42.1                 : Ok   gcc (SUSE Linux) 4.8.5
  40 opensuse:42.2                 : Ok   gcc (SUSE Linux) 4.8.5
  41 opensuse:42.3                 : Ok   gcc (SUSE Linux) 4.8.5
  42 opensuse:tumbleweed           : Ok   gcc (SUSE Linux) 8.2.1 20181108 [gcc-8-branch revision 265914]
  43 oraclelinux:6                 : Ok   gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-23.0.1)
  44 oraclelinux:7                 : Ok   gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36.0.1)
  45 ubuntu:12.04.5                : Ok   gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
  46 ubuntu:14.04.4                : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
  47 ubuntu:14.04.4-x-linaro-arm64 : Ok   gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4
  48 ubuntu:16.04                  : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  49 ubuntu:16.04-x-arm            : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  50 ubuntu:16.04-x-arm64          : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  51 ubuntu:16.04-x-powerpc        : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  52 ubuntu:16.04-x-powerpc64      : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  53 ubuntu:16.04-x-powerpc64el    : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  54 ubuntu:16.04-x-s390           : Ok   gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
  55 ubuntu:17.10                  : Ok   gcc (Ubuntu 7.2.0-8ubuntu3.2) 7.2.0
  56 ubuntu:18.04                  : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  57 ubuntu:18.04-x-arm            : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  58 ubuntu:18.04-x-arm64          : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  59 ubuntu:18.04-x-m68k           : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  60 ubuntu:18.04-x-powerpc        : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  61 ubuntu:18.04-x-powerpc64      : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  62 ubuntu:18.04-x-powerpc64el    : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  63 ubuntu:18.04-x-riscv64        : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  64 ubuntu:18.04-x-s390           : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  65 ubuntu:18.04-x-sh4            : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  66 ubuntu:18.04-x-sparc64        : Ok   gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
  67 ubuntu:18.10                  : Ok   gcc (Ubuntu 8.2.0-7ubuntu1) 8.2.0
  68 ubuntu:19.04                  : Ok   gcc (Ubuntu 8.2.0-12ubuntu1) 8.2.0
  69 ubuntu:19.04-x-alpha          : Ok   gcc (Ubuntu 8.2.0-12ubuntu1) 8.2.0
  70 ubuntu:19.04-x-hppa           : Ok   gcc (Ubuntu 8.2.0-12ubuntu1) 8.2.0
  $

  # uname -a
  Linux quaco 5.0.0-rc3+ #16 SMP Mon Jan 21 12:01:36 -03 2019 x86_64 x86_64 x86_64 GNU/Linux
  # git log --oneline -1
  32e9136e3784 perf utils: Move perf_config using routines from color.c to separate object
  # perf version --build-options
  perf version 5.0.rc2.g32e9136
                   dwarf: [ on  ]  # HAVE_DWARF_SUPPORT
      dwarf_getlocations: [ on  ]  # HAVE_DWARF_GETLOCATIONS_SUPPORT
                   glibc: [ on  ]  # HAVE_GLIBC_SUPPORT
                    gtk2: [ on  ]  # HAVE_GTK2_SUPPORT
           syscall_table: [ on  ]  # HAVE_SYSCALL_TABLE_SUPPORT
                  libbfd: [ on  ]  # HAVE_LIBBFD_SUPPORT
                  libelf: [ on  ]  # HAVE_LIBELF_SUPPORT
                 libnuma: [ on  ]  # HAVE_LIBNUMA_SUPPORT
  numa_num_possible_cpus: [ on  ]  # HAVE_LIBNUMA_SUPPORT
                 libperl: [ on  ]  # HAVE_LIBPERL_SUPPORT
               libpython: [ on  ]  # HAVE_LIBPYTHON_SUPPORT
                libslang: [ on  ]  # HAVE_SLANG_SUPPORT
               libcrypto: [ on  ]  # HAVE_LIBCRYPTO_SUPPORT
               libunwind: [ on  ]  # HAVE_LIBUNWIND_SUPPORT
      libdw-dwarf-unwind: [ on  ]  # HAVE_DWARF_SUPPORT
                    zlib: [ on  ]  # HAVE_ZLIB_SUPPORT
                    lzma: [ on  ]  # HAVE_LZMA_SUPPORT
               get_cpuid: [ on  ]  # HAVE_AUXTRACE_SUPPORT
                     bpf: [ on  ]  # HAVE_LIBBPF_SUPPORT
  # 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: Test data source output                               : Ok
   6: Parse event definition strings                        : Ok
   7: Simple expression parser                              : Ok
   8: PERF_RECORD_* events & perf_sample fields             : Ok
   9: Parse perf pmu format                                 : Ok
  10: DSO data read                                         : Ok
  11: DSO data cache                                        : Ok
  12: DSO data reopen                                       : Ok
  13: Roundtrip evsel->name                                 : Ok
  14: Parse sched tracepoints fields                        : Ok
  15: syscalls:sys_enter_openat event fields                : Ok
  16: Setup struct perf_event_attr                          : Ok
  17: Match and link multiple hists                         : Ok
  18: 'import perf' in python                               : Ok
  19: Breakpoint overflow signal handler                    : Ok
  20: Breakpoint overflow sampling                          : Ok
  21: Breakpoint accounting                                 : Ok
  22: Watchpoint                                            :
  22.1: Read Only Watchpoint                                : Skip
  22.2: Write Only Watchpoint                               : Ok
  22.3: Read / Write Watchpoint                             : Ok
  22.4: Modify Watchpoint                                   : Ok
  23: Number of exit events of a simple workload            : Ok
  24: Software clock events period values                   : Ok
  25: Object code reading                                   : Ok
  26: Sample parsing                                        : Ok
  27: Use a dummy software event to keep tracking           : Ok
  28: Parse with no sample_id_all bit set                   : Ok
  29: Filter hist entries                                   : Ok
  30: Lookup mmap thread                                    : Ok
  31: Share thread mg                                       : Ok
  32: Sort output of hist entries                           : Ok
  33: Cumulate child hist entries                           : Ok
  34: Track with sched_switch                               : Ok
  35: Filter fds with revents mask in a fdarray             : Ok
  36: Add fd to a fdarray, making it autogrow               : Ok
  37: kmod_path__parse                                      : Ok
  38: Thread map                                            : Ok
  39: LLVM search and compile                               :
  39.1: Basic BPF llvm compile                              : Ok
  39.2: kbuild searching                                    : Ok
  39.3: Compile source for BPF prologue generation          : Ok
  39.4: Compile source for BPF relocation                   : Ok
  40: Session topology                                      : Ok
  41: BPF filter                                            :
  41.1: Basic BPF filtering                                 : Ok
  41.2: BPF pinning                                         : Ok
  41.3: BPF prologue generation                             : Ok
  41.4: BPF relocation checker                              : Ok
  42: Synthesize thread map                                 : Ok
  43: Remove thread map                                     : Ok
  44: Synthesize cpu map                                    : Ok
  45: Synthesize stat config                                : Ok
  46: Synthesize stat                                       : Ok
  47: Synthesize stat round                                 : Ok
  48: Synthesize attr update                                : Ok
  49: Event times                                           : Ok
  50: Read backward ring buffer                             : Ok
  51: Print cpu map                                         : Ok
  52: Probe SDT events                                      : Ok
  53: is_printable_array                                    : Ok
  54: Print bitmap                                          : Ok
  55: perf hooks                                            : Ok
  56: builtin clang support                                 : Skip (not compiled in)
  57: unit_number__scnprintf                                : Ok
  58: mem2node                                              : Ok
  59: x86 rdpmc                                             : Ok
  60: Convert perf time to TSC                              : Ok
  61: DWARF unwind                                          : Ok
  62: x86 instruction decoder - new instructions            : Ok
  63: x86 bp modify                                         : Ok
  64: probe libc's inet_pton & backtrace it with ping       : Ok
  65: Use vfs_getname probe to get syscall args filenames   : Ok
  66: Add vfs_getname probe to get syscall args filenames   : Ok
  67: Check open filename arg using perf trace + vfs_getname: Ok

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

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2017-10-23 23:47 Arnaldo Carvalho de Melo
@ 2017-10-24  9:13 ` Ingo Molnar
  0 siblings, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2017-10-24  9:13 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, linux-perf-users, Adrian Hunter,
	Alexander Shishkin, Andi Kleen, Christophe JAILLET, David Ahern,
	Jin Yao, Jiri Olsa, Kan Liang, Li Zhijian, Milian Wolff,
	Namhyung Kim, Peter Zijlstra, Ravi Bangoria, Sukadev Bhattiprolu,
	Wang Nan, yuzhoujian, Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling, hopefully the next batch will have a
> few other interesting patchkits, from Jin Yao, Kan Liang and Milian
> Wolff.
> 
> - Arnaldo
> 
> Test results at the end of this message, as usual.
> 
> The following changes since commit 8776fe75dc0e263ed2056ea9896c2267599dc447:
> 
>   lkdtm, kprobes: Convert from jprobes to kprobes (2017-10-23 13:52:45 +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-4.15-20171023
> 
> for you to fetch changes up to 65db92e0965ab56e8031d5c804f26d5be0e47047:
> 
>   perf vendor events: Add Goldmont Plus V1 event file (2017-10-23 16:30:54 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> - Update vendor events JSON metrics for Intel's Broadwell, Broadwell
>   Server, Haswell, Haswell Server, IvyBridge, IvyTown, JakeTown, Sandy
>   Bridge, Skylake and SkyLake Server (Andi Kleen)
> 
> - Add vendor event file for Intel's Goldmont Plus V1 (Kan Liang)
> 
> - Move perf_mmap methods from 'perf record' and evlist.c to a separate
>   mmap.[ch] pair, to better separate things and pave the way for further
>   work on multithreading tools (Arnaldo Carvalho de Melo)
> 
> - Do not check ABI headers in a detached tarball build, as it the kernel
>   headers from where we copied tools/include/ are by definition not
>   available (Arnaldo Carvalho de Melo)
> 
> - Make 'perf script' use fprintf() like printing, i.e. receiving a FILE
>   pointer so that it gets consistent with other tools/ code and allows
>   for printing to per-event files (Arnaldo Carvalho de Melo)
> 
> - Error handling fixes (resource release on exit) for 'perf script'
>   and 'perf kmem' (Christophe JAILLET)
> 
> - Make some 'perf event attr' tests optional on virtual machines, where
>   tested counters are not available (Jiri Olsa)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Andi Kleen (12):
>       perf vendor events: Update JSON metrics for Broadwell
>       perf vendor events: Update JSON metrics for Broadwell Server
>       perf vendor events: Update JSON metrics for Haswell
>       perf vendor events: Update JSON metrics for Haswell Server
>       perf vendor events: Update JSON metrics for IvyBridge
>       perf vendor events: Update JSON metrics for IvyTown
>       perf vendor events: Update JSON metrics for JakeTown
>       perf vendor events: Update JSON metrics for Sandy Bridge
>       perf vendor events: Update JSON metrics for Skylake
>       perf vendor events: Update JSON metrics for Skylake Server
>       perf list: Fix group description in the man page
>       perf vendor events: Fix incorrect cmask syntax for some Intel metrics
> 
> Arnaldo Carvalho de Melo (7):
>       perf mmap: Move perf_mmap and methods to separate mmap.[ch] files
>       perf record: Make record__mmap_read generic
>       perf mmap: Adopt push method from builtin-record.c
>       perf tools: Do not check ABI headers in a detached tarball build
>       perf tools: Introduce binary__fprintf()
>       perf script: Use fprintf like printing uniformly
>       perf namespaces: Add more appropriate set of headers
> 
> Christophe JAILLET (2):
>       perf script: Fix error handling path
>       perf kmem: Perform some cleanup if '--time' is given an invalid value
> 
> Jiri Olsa (2):
>       perf tests attr: Make hw events optional
>       perf annotate: Remove arch::cpuid_parse callback
> 
> Kan Liang (1):
>       perf vendor events: Add Goldmont Plus V1 event file
> 
>  tools/perf/Documentation/perf-list.txt             |    2 +-
>  tools/perf/arch/arm/annotate/instructions.c        |    3 +-
>  tools/perf/arch/arm64/annotate/instructions.c      |    3 +-
>  tools/perf/arch/powerpc/annotate/instructions.c    |    4 +-
>  tools/perf/arch/s390/annotate/instructions.c       |    4 +-
>  tools/perf/arch/x86/annotate/instructions.c        |   14 +
>  tools/perf/builtin-kmem.c                          |    3 +-
>  tools/perf/builtin-record.c                        |  104 +-
>  tools/perf/builtin-script.c                        |  527 +++----
>  tools/perf/builtin-trace.c                         |   14 +-
>  tools/perf/check-headers.sh                        |    5 +
>  .../pmu-events/arch/x86/broadwell/bdw-metrics.json |   18 +-
>  .../arch/x86/broadwellx/bdx-metrics.json           |   18 +-
>  .../pmu-events/arch/x86/goldmontplus/cache.json    | 1453 ++++++++++++++++++++
>  .../pmu-events/arch/x86/goldmontplus/frontend.json |   62 +
>  .../pmu-events/arch/x86/goldmontplus/memory.json   |   38 +
>  .../pmu-events/arch/x86/goldmontplus/other.json    |   98 ++
>  .../pmu-events/arch/x86/goldmontplus/pipeline.json |  544 ++++++++
>  .../arch/x86/goldmontplus/virtual-memory.json      |  218 +++
>  .../pmu-events/arch/x86/haswell/hsw-metrics.json   |   16 +-
>  .../pmu-events/arch/x86/haswellx/hsx-metrics.json  |   16 +-
>  .../pmu-events/arch/x86/ivybridge/ivb-metrics.json |   18 +-
>  .../pmu-events/arch/x86/ivytown/ivt-metrics.json   |   18 +-
>  .../pmu-events/arch/x86/jaketown/jkt-metrics.json  |   12 +-
>  tools/perf/pmu-events/arch/x86/mapfile.csv         |    1 +
>  .../arch/x86/sandybridge/snb-metrics.json          |   12 +-
>  .../pmu-events/arch/x86/skylake/skl-metrics.json   |   20 +-
>  .../pmu-events/arch/x86/skylakex/skx-metrics.json  |   42 +-
>  tools/perf/tests/attr/test-stat-C0                 |    1 +
>  tools/perf/tests/attr/test-stat-basic              |    1 +
>  tools/perf/tests/attr/test-stat-default            |    4 +
>  tools/perf/tests/attr/test-stat-detailed-1         |    8 +
>  tools/perf/tests/attr/test-stat-detailed-2         |   13 +
>  tools/perf/tests/attr/test-stat-detailed-3         |   13 +
>  tools/perf/tests/attr/test-stat-no-inherit         |    1 +
>  tools/perf/util/Build                              |    1 +
>  tools/perf/util/annotate.c                         |   10 +-
>  tools/perf/util/debug.c                            |   31 +-
>  tools/perf/util/evlist.c                           |  248 ----
>  tools/perf/util/evlist.h                           |   76 +-
>  tools/perf/util/mmap.c                             |  352 +++++
>  tools/perf/util/mmap.h                             |   97 ++
>  tools/perf/util/namespaces.h                       |    5 +-
>  tools/perf/util/print_binary.c                     |   30 +-
>  tools/perf/util/print_binary.h                     |   18 +-
>  tools/perf/util/python-ext-sources                 |    1 +
>  46 files changed, 3367 insertions(+), 830 deletions(-)
>  create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/cache.json
>  create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/frontend.json
>  create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/memory.json
>  create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/other.json
>  create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/pipeline.json
>  create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/virtual-memory.json
>  create mode 100644 tools/perf/util/mmap.c
>  create mode 100644 tools/perf/util/mmap.h

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/24] perf/core improvements and fixes
@ 2017-10-23 23:47 Arnaldo Carvalho de Melo
  2017-10-24  9:13 ` Ingo Molnar
  0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-10-23 23:47 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, linux-perf-users, Arnaldo Carvalho de Melo,
	Adrian Hunter, Alexander Shishkin, Andi Kleen,
	Christophe JAILLET, David Ahern, Jin Yao, Jiri Olsa, Kan Liang,
	Li Zhijian, Milian Wolff, Namhyung Kim, Peter Zijlstra,
	Ravi Bangoria, Sukadev Bhattiprolu, Wang Nan, yuzhoujian,
	Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, hopefully the next batch will have a
few other interesting patchkits, from Jin Yao, Kan Liang and Milian
Wolff.

- Arnaldo

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

The following changes since commit 8776fe75dc0e263ed2056ea9896c2267599dc447:

  lkdtm, kprobes: Convert from jprobes to kprobes (2017-10-23 13:52:45 +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-4.15-20171023

for you to fetch changes up to 65db92e0965ab56e8031d5c804f26d5be0e47047:

  perf vendor events: Add Goldmont Plus V1 event file (2017-10-23 16:30:54 -0300)

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

- Update vendor events JSON metrics for Intel's Broadwell, Broadwell
  Server, Haswell, Haswell Server, IvyBridge, IvyTown, JakeTown, Sandy
  Bridge, Skylake and SkyLake Server (Andi Kleen)

- Add vendor event file for Intel's Goldmont Plus V1 (Kan Liang)

- Move perf_mmap methods from 'perf record' and evlist.c to a separate
  mmap.[ch] pair, to better separate things and pave the way for further
  work on multithreading tools (Arnaldo Carvalho de Melo)

- Do not check ABI headers in a detached tarball build, as it the kernel
  headers from where we copied tools/include/ are by definition not
  available (Arnaldo Carvalho de Melo)

- Make 'perf script' use fprintf() like printing, i.e. receiving a FILE
  pointer so that it gets consistent with other tools/ code and allows
  for printing to per-event files (Arnaldo Carvalho de Melo)

- Error handling fixes (resource release on exit) for 'perf script'
  and 'perf kmem' (Christophe JAILLET)

- Make some 'perf event attr' tests optional on virtual machines, where
  tested counters are not available (Jiri Olsa)

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

----------------------------------------------------------------
Andi Kleen (12):
      perf vendor events: Update JSON metrics for Broadwell
      perf vendor events: Update JSON metrics for Broadwell Server
      perf vendor events: Update JSON metrics for Haswell
      perf vendor events: Update JSON metrics for Haswell Server
      perf vendor events: Update JSON metrics for IvyBridge
      perf vendor events: Update JSON metrics for IvyTown
      perf vendor events: Update JSON metrics for JakeTown
      perf vendor events: Update JSON metrics for Sandy Bridge
      perf vendor events: Update JSON metrics for Skylake
      perf vendor events: Update JSON metrics for Skylake Server
      perf list: Fix group description in the man page
      perf vendor events: Fix incorrect cmask syntax for some Intel metrics

Arnaldo Carvalho de Melo (7):
      perf mmap: Move perf_mmap and methods to separate mmap.[ch] files
      perf record: Make record__mmap_read generic
      perf mmap: Adopt push method from builtin-record.c
      perf tools: Do not check ABI headers in a detached tarball build
      perf tools: Introduce binary__fprintf()
      perf script: Use fprintf like printing uniformly
      perf namespaces: Add more appropriate set of headers

Christophe JAILLET (2):
      perf script: Fix error handling path
      perf kmem: Perform some cleanup if '--time' is given an invalid value

Jiri Olsa (2):
      perf tests attr: Make hw events optional
      perf annotate: Remove arch::cpuid_parse callback

Kan Liang (1):
      perf vendor events: Add Goldmont Plus V1 event file

 tools/perf/Documentation/perf-list.txt             |    2 +-
 tools/perf/arch/arm/annotate/instructions.c        |    3 +-
 tools/perf/arch/arm64/annotate/instructions.c      |    3 +-
 tools/perf/arch/powerpc/annotate/instructions.c    |    4 +-
 tools/perf/arch/s390/annotate/instructions.c       |    4 +-
 tools/perf/arch/x86/annotate/instructions.c        |   14 +
 tools/perf/builtin-kmem.c                          |    3 +-
 tools/perf/builtin-record.c                        |  104 +-
 tools/perf/builtin-script.c                        |  527 +++----
 tools/perf/builtin-trace.c                         |   14 +-
 tools/perf/check-headers.sh                        |    5 +
 .../pmu-events/arch/x86/broadwell/bdw-metrics.json |   18 +-
 .../arch/x86/broadwellx/bdx-metrics.json           |   18 +-
 .../pmu-events/arch/x86/goldmontplus/cache.json    | 1453 ++++++++++++++++++++
 .../pmu-events/arch/x86/goldmontplus/frontend.json |   62 +
 .../pmu-events/arch/x86/goldmontplus/memory.json   |   38 +
 .../pmu-events/arch/x86/goldmontplus/other.json    |   98 ++
 .../pmu-events/arch/x86/goldmontplus/pipeline.json |  544 ++++++++
 .../arch/x86/goldmontplus/virtual-memory.json      |  218 +++
 .../pmu-events/arch/x86/haswell/hsw-metrics.json   |   16 +-
 .../pmu-events/arch/x86/haswellx/hsx-metrics.json  |   16 +-
 .../pmu-events/arch/x86/ivybridge/ivb-metrics.json |   18 +-
 .../pmu-events/arch/x86/ivytown/ivt-metrics.json   |   18 +-
 .../pmu-events/arch/x86/jaketown/jkt-metrics.json  |   12 +-
 tools/perf/pmu-events/arch/x86/mapfile.csv         |    1 +
 .../arch/x86/sandybridge/snb-metrics.json          |   12 +-
 .../pmu-events/arch/x86/skylake/skl-metrics.json   |   20 +-
 .../pmu-events/arch/x86/skylakex/skx-metrics.json  |   42 +-
 tools/perf/tests/attr/test-stat-C0                 |    1 +
 tools/perf/tests/attr/test-stat-basic              |    1 +
 tools/perf/tests/attr/test-stat-default            |    4 +
 tools/perf/tests/attr/test-stat-detailed-1         |    8 +
 tools/perf/tests/attr/test-stat-detailed-2         |   13 +
 tools/perf/tests/attr/test-stat-detailed-3         |   13 +
 tools/perf/tests/attr/test-stat-no-inherit         |    1 +
 tools/perf/util/Build                              |    1 +
 tools/perf/util/annotate.c                         |   10 +-
 tools/perf/util/debug.c                            |   31 +-
 tools/perf/util/evlist.c                           |  248 ----
 tools/perf/util/evlist.h                           |   76 +-
 tools/perf/util/mmap.c                             |  352 +++++
 tools/perf/util/mmap.h                             |   97 ++
 tools/perf/util/namespaces.h                       |    5 +-
 tools/perf/util/print_binary.c                     |   30 +-
 tools/perf/util/print_binary.h                     |   18 +-
 tools/perf/util/python-ext-sources                 |    1 +
 46 files changed, 3367 insertions(+), 830 deletions(-)
 create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/cache.json
 create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/frontend.json
 create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/memory.json
 create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/other.json
 create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/pipeline.json
 create mode 100644 tools/perf/pmu-events/arch/x86/goldmontplus/virtual-memory.json
 create mode 100644 tools/perf/util/mmap.c
 create mode 100644 tools/perf/util/mmap.h

Test results:

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

The objtool and samples/bpf/ builds are disabled now that I'm switching from
using the sources in a local volume to fetching them from a http server to
build it inside the container, to make it easier to build in a container cluster.
Those will come back later.

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:3.6: Ok
   4 alpine:edge: Ok
   5 android-ndk:r12b-arm: Ok
   6 android-ndk:r15c-arm: Ok
   7 archlinux:latest: Ok
   8 centos:5: Ok
   9 centos:6: Ok
  10 centos:7: Ok
  11 debian:7: Ok
  12 debian:8: Ok
  13 debian:9: Ok
  14 debian:experimental: Ok
  15 debian:experimental-x-arm64: Ok
  16 debian:experimental-x-mips: Ok
  17 debian:experimental-x-mips64: Ok
  18 debian:experimental-x-mipsel: Ok
  19 fedora:20: Ok
  20 fedora:21: Ok
  21 fedora:22: Ok
  22 fedora:23: Ok
  23 fedora:24: Ok
  24 fedora:24-x-ARC-uClibc: Ok

     Should finally be fixed with the rc2 toolchain + -matomic for
     atomic_cmpchg -> __sync_val_compare_and_swap_4

  25 fedora:25: Ok
  26 fedora:26: Ok
  27 fedora:rawhide: Ok
  28 mageia:5: Ok
  29 opensuse:42.1: Ok
  30 opensuse:42.2: Ok
  31 opensuse:42.3: Ok
  32 opensuse:tumbleweed: Ok
  33 oraclelinux:6: Ok
  34 ubuntu:12.04.5: Ok
  35 ubuntu:14.04.4: Ok
  36 ubuntu:14.04.4-x-linaro-arm64: Ok
  37 ubuntu:15.04: Ok
  38 ubuntu:16.04: Ok
  39 ubuntu:16.04-x-arm: Ok
  40 ubuntu:16.04-x-arm64: Ok
  41 ubuntu:16.04-x-powerpc: Ok
  42 ubuntu:16.04-x-powerpc64: Ok
  43 ubuntu:16.04-x-powerpc64el: Ok
  44 ubuntu:16.04-x-s390: Ok
  45 ubuntu:16.10: Ok
  46 ubuntu:17.10: Ok
  #

  # uname -a
  Linux jouet 4.14.0-rc3+ #1 SMP Fri Oct 13 12:21:12 -03 2017 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: Test data source output                               : Ok
   6: Parse event definition strings                        : Ok
   7: Simple expression parser                              : Ok
   8: PERF_RECORD_* events & perf_sample fields             : Ok
   9: Parse perf pmu format                                 : Ok
  10: DSO data read                                         : Ok
  11: DSO data cache                                        : Ok
  12: DSO data reopen                                       : Ok
  13: Roundtrip evsel->name                                 : Ok
  14: Parse sched tracepoints fields                        : Ok
  15: syscalls:sys_enter_openat event fields                : Ok
  16: Setup struct perf_event_attr                          : Ok
  17: Match and link multiple hists                         : Ok
  18: 'import perf' in python                               : Ok
  19: Breakpoint overflow signal handler                    : Ok
  20: Breakpoint overflow sampling                          : Ok
  21: Number of exit events of a simple workload            : Ok
  22: Software clock events period values                   : Ok
  23: Object code reading                                   : Ok
  24: Sample parsing                                        : Ok
  25: Use a dummy software event to keep tracking           : Ok
  26: Parse with no sample_id_all bit set                   : Ok
  27: Filter hist entries                                   : Ok
  28: Lookup mmap thread                                    : Ok
  29: Share thread mg                                       : Ok
  30: Sort output of hist entries                           : Ok
  31: Cumulate child hist entries                           : Ok
  32: Track with sched_switch                               : Ok
  33: Filter fds with revents mask in a fdarray             : Ok
  34: Add fd to a fdarray, making it autogrow               : Ok
  35: kmod_path__parse                                      : Ok
  36: Thread map                                            : Ok
  37: LLVM search and compile                               :
  37.1: Basic BPF llvm compile                              : Ok
  37.2: kbuild searching                                    : Ok
  37.3: Compile source for BPF prologue generation          : Ok
  37.4: Compile source for BPF relocation                   : Ok
  38: Session topology                                      : Ok
  39: BPF filter                                            :
  39.1: Basic BPF filtering                                 : Ok
  39.2: BPF pinning                                         : Ok
  39.3: BPF prologue generation                             : Ok
  39.4: BPF relocation checker                              : Ok
  40: Synthesize thread map                                 : Ok
  41: Remove thread map                                     : Ok
  42: Synthesize cpu map                                    : Ok
  43: Synthesize stat config                                : Ok
  44: Synthesize stat                                       : Ok
  45: Synthesize stat round                                 : Ok
  46: Synthesize attr update                                : Ok
  47: Event times                                           : Ok
  48: Read backward ring buffer                             : Ok
  49: Print cpu map                                         : Ok
  50: Probe SDT events                                      : Ok
  51: is_printable_array                                    : Ok
  52: Print bitmap                                          : Ok
  53: perf hooks                                            : Ok
  54: builtin clang support                                 : Skip (not compiled in)
  55: unit_number__scnprintf                                : Ok
  56: x86 rdpmc                                             : Ok
  57: Convert perf time to TSC                              : Ok
  58: DWARF unwind                                          : Ok
  59: x86 instruction decoder - new instructions            : Ok
  60: Use vfs_getname probe to get syscall args filenames   : Ok
  61: probe libc's inet_pton & backtrace it with ping       : Ok
  62: Check open filename arg using perf trace + vfs_getname: Ok
  63: Add vfs_getname probe to get syscall args filenames   : Ok
  #

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

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2016-06-07 23:10 ` Taeung Song
@ 2016-06-08 13:09   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-06-08 13:09 UTC (permalink / raw)
  To: Taeung Song
  Cc: Arnaldo Carvalho de Melo, Ingo Molnar, linux-kernel,
	Adrian Hunter, Alexander Shishkin, Andi Kleen, David Ahern,
	Ekaterina Tumanova, He Kuang, Jiri Olsa, Josh Poimboeuf,
	Kan Liang, Masami Hiramatsu, Milian Wolff, Namhyung Kim,
	Pekka Enberg, Peter Zijlstra, pi3orama, Stephane Eranian,
	Sukadev Bhattiprolu, Wang Nan, Zefan Li,
	Arnaldo Carvalho de Melo

Em Wed, Jun 08, 2016 at 08:10:50AM +0900, Taeung Song escreveu:
> I found something weird about perf/core branch on your repository.
> (I don't know whether it is just my illusion or not)
> 
> I can't pull new commits on top of perf-core-for-mingo-20160606
> by normal way as below

I forgot to push perf/core, having pushed just
perf-core-for-mingo-20160607, which is enough for Ingo to pull what I
sent to him, but not for you to get if you use perf/core, as usual,
instead of perf-core-for-mingo-20160607.

I pushed perf/core now, please update your local repo and all should be
ok now.

- Arnaldo

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2016-06-07 20:04 Arnaldo Carvalho de Melo
  2016-06-07 23:10 ` Taeung Song
@ 2016-06-08  7:43 ` Ingo Molnar
  1 sibling, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2016-06-08  7:43 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Alexander Shishkin, Andi Kleen,
	David Ahern, Ekaterina Tumanova, He Kuang, Jiri Olsa,
	Josh Poimboeuf, Kan Liang, Masami Hiramatsu, Milian Wolff,
	Namhyung Kim, Pekka Enberg, Peter Zijlstra, pi3orama,
	Stephane Eranian, Sukadev Bhattiprolu, Taeung Song, Wang Nan,
	Zefan Li, Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling, this is on top of perf-core-for-mingo-20160606,
> 
> Thanks,
> 
> - Arnaldo
> 
> The following changes since commit 7db91f251056f90fec4121f028680ab3153a0f3c:
> 
>   perf config: Handle the error when config set is NULL at collect_config() (2016-06-06 17:43:19 -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-20160607
> 
> for you to fetch changes up to 057fbfb25cde4a368418f3f720cdc31d48800c4d:
> 
>   perf callchain: Support aarch64 cross-platform (2016-06-07 15:13:35 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Support cross unwinding, i.e. collecting '--call-graph dwarf' perf.data files
>   in one machine and then doing analysis in another machine of a different
>   hardware architecture. This enables, for instance, to do:
> 
> 	perf record -a --call-graph dwarf
> 
>   on a x86-32 or aarch64 system and then do 'perf report' on it on a
>   x86_64 workstation. (He Kuang)
> 
> - Fix crash in build_id_cache__kallsyms_path(), recent regression (Wang Nan)
> 
> Infrastructure:
> 
> - Make tools/lib/bpf use the IS_ERR return facility consistently and also stop
>   using the _get_ term for non-reference count methods (Arnaldo Carvalho de Melo)
> 
> - 'perf config' refactorings (Taeung Song)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (7):
>       tools lib bpf: Use IS_ERR() reporting macros with bpf_map__get_private()
>       tools lib bpf: Rename bpf_map__get_name() to bpf_map__name()
>       tools lib bpf: Use IS_ERR() reporting macros with bpf_map__get_def()
>       tools lib bpf: Rename bpf_map__get_fd() to bpf_map__fd()
>       tools lib bpf: Remove _get_ from non-refcount method names
>       tools lib bpf: Make bpf_program__get_private() use IS_ERR()
>       tools lib bpf: Rename set_private() to set_priv()
> 
> He Kuang (14):
>       perf unwind: Use LIBUNWIND_DIR for remote libunwind feature check
>       perf unwind: Decouple thread->address_space on libunwind
>       perf unwind: Introduce 'struct unwind_libunwind_ops' for local unwind
>       perf unwind: Move unwind__prepare_access from thread_new into thread__insert_map
>       perf unwind: Don't mix LIBUNWIND_LIBS into LIBUNWIND_LDFLAGS
>       perf unwind: Separate local/remote libunwind config
>       perf unwind: Rename unwind-libunwind.c to unwind-libunwind-local.c
>       perf tools: Extract common API out of unwind-libunwind-local.c
>       perf tools: Export normalize_arch() function
>       perf unwind: Check the target platform before assigning unwind methods
>       perf unwind: Change fixed name of libunwind__arch_reg_id to macro
>       perf unwind: Introduce flag to separate local/remote unwind compilation
>       perf callchain: Support x86 target platform
>       perf callchain: Support aarch64 cross-platform
> 
> Taeung Song (2):
>       perf config: Constructor should free its allocated memory when failing
>       perf config: Use new perf_config_set__init() to initialize config set
> 
> Wang Nan (1):
>       perf tools: Fix crash in build_id_cache__kallsyms_path()
> 
>  tools/lib/bpf/libbpf.c                        |  60 +--
>  tools/lib/bpf/libbpf.h                        |  25 +-
>  tools/perf/arch/arm/util/Build                |   2 +-
>  tools/perf/arch/arm64/util/Build              |   2 +-
>  tools/perf/arch/arm64/util/unwind-libunwind.c |   4 +-
>  tools/perf/arch/common.c                      |   2 +-
>  tools/perf/arch/common.h                      |   1 +
>  tools/perf/arch/x86/util/Build                |   2 +-
>  tools/perf/arch/x86/util/unwind-libunwind.c   |   6 +-
>  tools/perf/config/Makefile                    |  52 +-
>  tools/perf/util/Build                         |   3 +
>  tools/perf/util/bpf-loader.c                  | 132 +++--
>  tools/perf/util/build-id.c                    |  11 +-
>  tools/perf/util/config.c                      |  51 +-
>  tools/perf/util/libunwind/arm64.c             |  35 ++
>  tools/perf/util/libunwind/x86_32.c            |  37 ++
>  tools/perf/util/machine.c                     |  14 +-
>  tools/perf/util/thread.c                      |  13 +-
>  tools/perf/util/thread.h                      |   9 +-
>  tools/perf/util/unwind-libunwind-local.c      | 697 ++++++++++++++++++++++++++
>  tools/perf/util/unwind-libunwind.c            | 688 ++-----------------------
>  tools/perf/util/unwind.h                      |  22 +-
>  22 files changed, 1056 insertions(+), 812 deletions(-)
>  create mode 100644 tools/perf/util/libunwind/arm64.c
>  create mode 100644 tools/perf/util/libunwind/x86_32.c
>  create mode 100644 tools/perf/util/unwind-libunwind-local.c

Pulled, thanks a lot Arnaldo!

	Ingo

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2016-06-07 20:04 Arnaldo Carvalho de Melo
@ 2016-06-07 23:10 ` Taeung Song
  2016-06-08 13:09   ` Arnaldo Carvalho de Melo
  2016-06-08  7:43 ` Ingo Molnar
  1 sibling, 1 reply; 44+ messages in thread
From: Taeung Song @ 2016-06-07 23:10 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, linux-kernel, Arnaldo Carvalho de Melo,
	Adrian Hunter, Alexander Shishkin, Andi Kleen, David Ahern,
	Ekaterina Tumanova, He Kuang, Jiri Olsa, Josh Poimboeuf,
	Kan Liang, Masami Hiramatsu, Milian Wolff, Namhyung Kim,
	Pekka Enberg, Peter Zijlstra, pi3orama, Stephane Eranian,
	Sukadev Bhattiprolu, Wang Nan, Zefan Li,
	Arnaldo Carvalho de Melo

Hi, Arnaldo

I found something weird about perf/core branch on your repository.
(I don't know whether it is just my illusion or not)

I can't pull new commits on top of perf-core-for-mingo-20160606
by normal way as below


# git remote show acme
* remote acme
   Fetch URL: git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git


# git log --oneline
edb13ed tools lib bpf: Rename set_private() to set_priv()
be834ff tools lib bpf: Make bpf_program__get_private() use IS_ERR()
...


# git pull acme perf/core
 From git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
  * branch            perf/core  -> FETCH_HEAD
Already up-to-date.


And then nothing changed, I didn't also find new commits
and new tag 'perf-core-for-mingo-20160607'.

However, if using tag perf-core-for-mingo-20160607,
I can get new commits from your repository as below.


# git fetch acme --tags
remote: Counting objects: 4888, done.
remote: Compressing objects: 100% (4800/4800), done.
remote: Total 4888 (delta 266), reused 1212 (delta 59)
Receiving objects: 100% (4888/4888), 21.36 MiB | 3.72 MiB/s, done.
Resolving deltas: 100% (266/266), done.
 From git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux
  * [new tag]         perf-core-for-mingo-20160307 -> 
perf-core-for-mingo-20160307
  * [new tag]         perf-core-for-mingo-20160329 -> 
perf-core-for-mingo-20160329
  * [new tag]         perf-core-for-mingo-20160407 -> 
perf-core-for-mingo-20160407
  * [new tag]         perf-core-for-mingo-20160607 -> 
perf-core-for-mingo-20160607
  * [new tag]         perf-ebpf-for-mingo -> perf-ebpf-for-mingo
  * [new tag]         perf-urgent-for-mingo-20160510 -> 
perf-urgent-for-mingo-20160510
  * [new tag]         v2.6.11    -> v2.6.11
  * [new tag]         v2.6.11-tree -> v2.6.11-tree


But there is a strange thing about git branch.
I can't find which branch is that have tag perf-core-for-mingo-20160607 
like below.


# git branch -a --contains perf-core-for-mingo-20160607


As the final outcome, I got new commits on top of 
perf-core-for-mingo-20160606 directly using a tag 
'perf-core-for-mingo-20160607' as below.


# git reset --hard perf-core-for-mingo-20160607
HEAD is now at 057fbfb perf callchain: Support aarch64 cross-platform


But isn't it a problem ?
Just use a tag?


Thanks,
Taeung

On 06/08/2016 05:04 AM, Arnaldo Carvalho de Melo wrote:
> Hi Ingo,
>
> 	Please consider pulling, this is on top of perf-core-for-mingo-20160606,
>
> Thanks,
>
> - Arnaldo
>
> The following changes since commit 7db91f251056f90fec4121f028680ab3153a0f3c:
>
>    perf config: Handle the error when config set is NULL at collect_config() (2016-06-06 17:43:19 -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-20160607
>
> for you to fetch changes up to 057fbfb25cde4a368418f3f720cdc31d48800c4d:
>
>    perf callchain: Support aarch64 cross-platform (2016-06-07 15:13:35 -0300)
>
> ----------------------------------------------------------------
> perf/core improvements and fixes:
>
> User visible:
>
> - Support cross unwinding, i.e. collecting '--call-graph dwarf' perf.data files
>    in one machine and then doing analysis in another machine of a different
>    hardware architecture. This enables, for instance, to do:
>
> 	perf record -a --call-graph dwarf
>
>    on a x86-32 or aarch64 system and then do 'perf report' on it on a
>    x86_64 workstation. (He Kuang)
>
> - Fix crash in build_id_cache__kallsyms_path(), recent regression (Wang Nan)
>
> Infrastructure:
>
> - Make tools/lib/bpf use the IS_ERR return facility consistently and also stop
>    using the _get_ term for non-reference count methods (Arnaldo Carvalho de Melo)
>
> - 'perf config' refactorings (Taeung Song)
>
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
>
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (7):
>        tools lib bpf: Use IS_ERR() reporting macros with bpf_map__get_private()
>        tools lib bpf: Rename bpf_map__get_name() to bpf_map__name()
>        tools lib bpf: Use IS_ERR() reporting macros with bpf_map__get_def()
>        tools lib bpf: Rename bpf_map__get_fd() to bpf_map__fd()
>        tools lib bpf: Remove _get_ from non-refcount method names
>        tools lib bpf: Make bpf_program__get_private() use IS_ERR()
>        tools lib bpf: Rename set_private() to set_priv()
>
> He Kuang (14):
>        perf unwind: Use LIBUNWIND_DIR for remote libunwind feature check
>        perf unwind: Decouple thread->address_space on libunwind
>        perf unwind: Introduce 'struct unwind_libunwind_ops' for local unwind
>        perf unwind: Move unwind__prepare_access from thread_new into thread__insert_map
>        perf unwind: Don't mix LIBUNWIND_LIBS into LIBUNWIND_LDFLAGS
>        perf unwind: Separate local/remote libunwind config
>        perf unwind: Rename unwind-libunwind.c to unwind-libunwind-local.c
>        perf tools: Extract common API out of unwind-libunwind-local.c
>        perf tools: Export normalize_arch() function
>        perf unwind: Check the target platform before assigning unwind methods
>        perf unwind: Change fixed name of libunwind__arch_reg_id to macro
>        perf unwind: Introduce flag to separate local/remote unwind compilation
>        perf callchain: Support x86 target platform
>        perf callchain: Support aarch64 cross-platform
>
> Taeung Song (2):
>        perf config: Constructor should free its allocated memory when failing
>        perf config: Use new perf_config_set__init() to initialize config set
>
> Wang Nan (1):
>        perf tools: Fix crash in build_id_cache__kallsyms_path()
>
>   tools/lib/bpf/libbpf.c                        |  60 +--
>   tools/lib/bpf/libbpf.h                        |  25 +-
>   tools/perf/arch/arm/util/Build                |   2 +-
>   tools/perf/arch/arm64/util/Build              |   2 +-
>   tools/perf/arch/arm64/util/unwind-libunwind.c |   4 +-
>   tools/perf/arch/common.c                      |   2 +-
>   tools/perf/arch/common.h                      |   1 +
>   tools/perf/arch/x86/util/Build                |   2 +-
>   tools/perf/arch/x86/util/unwind-libunwind.c   |   6 +-
>   tools/perf/config/Makefile                    |  52 +-
>   tools/perf/util/Build                         |   3 +
>   tools/perf/util/bpf-loader.c                  | 132 +++--
>   tools/perf/util/build-id.c                    |  11 +-
>   tools/perf/util/config.c                      |  51 +-
>   tools/perf/util/libunwind/arm64.c             |  35 ++
>   tools/perf/util/libunwind/x86_32.c            |  37 ++
>   tools/perf/util/machine.c                     |  14 +-
>   tools/perf/util/thread.c                      |  13 +-
>   tools/perf/util/thread.h                      |   9 +-
>   tools/perf/util/unwind-libunwind-local.c      | 697 ++++++++++++++++++++++++++
>   tools/perf/util/unwind-libunwind.c            | 688 ++-----------------------
>   tools/perf/util/unwind.h                      |  22 +-
>   22 files changed, 1056 insertions(+), 812 deletions(-)
>   create mode 100644 tools/perf/util/libunwind/arm64.c
>   create mode 100644 tools/perf/util/libunwind/x86_32.c
>   create mode 100644 tools/perf/util/unwind-libunwind-local.c
>

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

* [GIT PULL 00/24] perf/core improvements and fixes
@ 2016-06-07 20:04 Arnaldo Carvalho de Melo
  2016-06-07 23:10 ` Taeung Song
  2016-06-08  7:43 ` Ingo Molnar
  0 siblings, 2 replies; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-06-07 20:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Alexander Shishkin, Andi Kleen, David Ahern, Ekaterina Tumanova,
	He Kuang, Jiri Olsa, Josh Poimboeuf, Kan Liang, Masami Hiramatsu,
	Milian Wolff, Namhyung Kim, Pekka Enberg, Peter Zijlstra,
	pi3orama, Stephane Eranian, Sukadev Bhattiprolu, Taeung Song,
	Wang Nan, Zefan Li, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, this is on top of perf-core-for-mingo-20160606,

Thanks,

- Arnaldo

The following changes since commit 7db91f251056f90fec4121f028680ab3153a0f3c:

  perf config: Handle the error when config set is NULL at collect_config() (2016-06-06 17:43:19 -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-20160607

for you to fetch changes up to 057fbfb25cde4a368418f3f720cdc31d48800c4d:

  perf callchain: Support aarch64 cross-platform (2016-06-07 15:13:35 -0300)

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

User visible:

- Support cross unwinding, i.e. collecting '--call-graph dwarf' perf.data files
  in one machine and then doing analysis in another machine of a different
  hardware architecture. This enables, for instance, to do:

	perf record -a --call-graph dwarf

  on a x86-32 or aarch64 system and then do 'perf report' on it on a
  x86_64 workstation. (He Kuang)

- Fix crash in build_id_cache__kallsyms_path(), recent regression (Wang Nan)

Infrastructure:

- Make tools/lib/bpf use the IS_ERR return facility consistently and also stop
  using the _get_ term for non-reference count methods (Arnaldo Carvalho de Melo)

- 'perf config' refactorings (Taeung Song)

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (7):
      tools lib bpf: Use IS_ERR() reporting macros with bpf_map__get_private()
      tools lib bpf: Rename bpf_map__get_name() to bpf_map__name()
      tools lib bpf: Use IS_ERR() reporting macros with bpf_map__get_def()
      tools lib bpf: Rename bpf_map__get_fd() to bpf_map__fd()
      tools lib bpf: Remove _get_ from non-refcount method names
      tools lib bpf: Make bpf_program__get_private() use IS_ERR()
      tools lib bpf: Rename set_private() to set_priv()

He Kuang (14):
      perf unwind: Use LIBUNWIND_DIR for remote libunwind feature check
      perf unwind: Decouple thread->address_space on libunwind
      perf unwind: Introduce 'struct unwind_libunwind_ops' for local unwind
      perf unwind: Move unwind__prepare_access from thread_new into thread__insert_map
      perf unwind: Don't mix LIBUNWIND_LIBS into LIBUNWIND_LDFLAGS
      perf unwind: Separate local/remote libunwind config
      perf unwind: Rename unwind-libunwind.c to unwind-libunwind-local.c
      perf tools: Extract common API out of unwind-libunwind-local.c
      perf tools: Export normalize_arch() function
      perf unwind: Check the target platform before assigning unwind methods
      perf unwind: Change fixed name of libunwind__arch_reg_id to macro
      perf unwind: Introduce flag to separate local/remote unwind compilation
      perf callchain: Support x86 target platform
      perf callchain: Support aarch64 cross-platform

Taeung Song (2):
      perf config: Constructor should free its allocated memory when failing
      perf config: Use new perf_config_set__init() to initialize config set

Wang Nan (1):
      perf tools: Fix crash in build_id_cache__kallsyms_path()

 tools/lib/bpf/libbpf.c                        |  60 +--
 tools/lib/bpf/libbpf.h                        |  25 +-
 tools/perf/arch/arm/util/Build                |   2 +-
 tools/perf/arch/arm64/util/Build              |   2 +-
 tools/perf/arch/arm64/util/unwind-libunwind.c |   4 +-
 tools/perf/arch/common.c                      |   2 +-
 tools/perf/arch/common.h                      |   1 +
 tools/perf/arch/x86/util/Build                |   2 +-
 tools/perf/arch/x86/util/unwind-libunwind.c   |   6 +-
 tools/perf/config/Makefile                    |  52 +-
 tools/perf/util/Build                         |   3 +
 tools/perf/util/bpf-loader.c                  | 132 +++--
 tools/perf/util/build-id.c                    |  11 +-
 tools/perf/util/config.c                      |  51 +-
 tools/perf/util/libunwind/arm64.c             |  35 ++
 tools/perf/util/libunwind/x86_32.c            |  37 ++
 tools/perf/util/machine.c                     |  14 +-
 tools/perf/util/thread.c                      |  13 +-
 tools/perf/util/thread.h                      |   9 +-
 tools/perf/util/unwind-libunwind-local.c      | 697 ++++++++++++++++++++++++++
 tools/perf/util/unwind-libunwind.c            | 688 ++-----------------------
 tools/perf/util/unwind.h                      |  22 +-
 22 files changed, 1056 insertions(+), 812 deletions(-)
 create mode 100644 tools/perf/util/libunwind/arm64.c
 create mode 100644 tools/perf/util/libunwind/x86_32.c
 create mode 100644 tools/perf/util/unwind-libunwind-local.c

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2015-06-26 15:44 Arnaldo Carvalho de Melo
@ 2015-06-30  4:48 ` Ingo Molnar
  0 siblings, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2015-06-30  4:48 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andi Kleen, Borislav Petkov, David Ahern, Don Zickus,
	Flavio Leitner, Frederic Weisbecker, Jiri Olsa, Li Zhang,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian,
	Sukadev Bhattiprolu


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

> From: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit 6eedf416429a32e0216f61b8b690d25577b2b91e:
> 
>   Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-06-26 10:38:11 +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 36c8bb56a9f718a9a5f35d1834ca9dcec95deb4a:
> 
>   perf symbols: Check access permission when reading symbol files (2015-06-26 12:11:53 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Validate syscall list passed via -e argument to 'perf trace' (Arnaldo Carvalho de Melo)
> 
> - Introduce 'perf stat --per-thread' (Jiri Olsa)
> 
> - Check access permission for --kallsyms and --vmlinux (Li Zhang)
> 
> Infrastructure:
> 
> - Move stuff out of 'perf stat' and into the lib for further use (Jiri Olsa)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (1):
>       perf trace: Validate syscall list passed via -e argument
> 
> Jiri Olsa (22):
>       perf thread_map: Introduce thread_map__reset function
>       perf thrad_map: Add comm string into array
>       perf tests: Add thread_map object tests
>       perf stat: Introduce perf_counts function
>       perf stat: Use xyarray for cpu evsel counts
>       perf stat: Make stats work over the thread dimension
>       perf stat: Rename struct perf_counts::cpu member to values
>       perf stat: Introduce perf_evlist__reset_stats
>       perf stat: Move perf_evsel__(alloc|free|reset)_stat_priv into stat object
>       perf stat: Move perf_evsel__(alloc|free)_prev_raw_counts into stat object
>       perf stat: Move perf_evlist__(alloc|free|reset)_stats into stat object
>       perf stat: Introduce perf_evsel__alloc_stats function
>       perf stat: Introduce perf_evsel__read function
>       perf stat: Introduce read_counters function
>       perf stat: Separate counters reading and processing
>       perf stat: Move zero_per_pkg into counter process code
>       perf stat: Move perf_stat initialization counter process code
>       perf stat: Remove perf_evsel__read_cb function
>       perf stat: Rename print_interval to process_interval
>       perf stat: Using init_stats instead of memset
>       perf stat: Introduce print_counters function
>       perf stat: Introduce --per-thread option
> 
> Li Zhang (1):
>       perf symbols: Check access permission when reading symbol files
> 
>  tools/perf/Documentation/perf-stat.txt     |   4 +
>  tools/perf/builtin-report.c                |  11 +
>  tools/perf/builtin-stat.c                  | 402 +++++++++++++++--------------
>  tools/perf/builtin-trace.c                 |  32 +++
>  tools/perf/tests/Build                     |   1 +
>  tools/perf/tests/builtin-test.c            |   4 +
>  tools/perf/tests/openat-syscall-all-cpus.c |   6 +-
>  tools/perf/tests/openat-syscall.c          |   4 +-
>  tools/perf/tests/tests.h                   |   1 +
>  tools/perf/tests/thread-map.c              |  38 +++
>  tools/perf/util/evlist.h                   |   1 -
>  tools/perf/util/evsel.c                    |  24 +-
>  tools/perf/util/evsel.h                    |  28 +-
>  tools/perf/util/python-ext-sources         |   1 +
>  tools/perf/util/stat.c                     | 132 +++++++++-
>  tools/perf/util/stat.h                     |  47 +++-
>  tools/perf/util/symbol.c                   |   5 +-
>  tools/perf/util/thread_map.c               |  76 +++++-
>  tools/perf/util/thread_map.h               |   8 +
>  19 files changed, 570 insertions(+), 255 deletions(-)
>  create mode 100644 tools/perf/tests/thread-map.c

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/24] perf/core improvements and fixes
@ 2015-06-26 15:44 Arnaldo Carvalho de Melo
  2015-06-30  4:48 ` Ingo Molnar
  0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-06-26 15:44 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andi Kleen, Borislav Petkov, David Ahern, Don Zickus,
	Flavio Leitner, Frederic Weisbecker, Jiri Olsa, Li Zhang,
	Namhyung Kim, Peter Zijlstra, Stephane Eranian,
	Sukadev Bhattiprolu

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

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit 6eedf416429a32e0216f61b8b690d25577b2b91e:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent (2015-06-26 10:38:11 +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 36c8bb56a9f718a9a5f35d1834ca9dcec95deb4a:

  perf symbols: Check access permission when reading symbol files (2015-06-26 12:11:53 -0300)

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

User visible:

- Validate syscall list passed via -e argument to 'perf trace' (Arnaldo Carvalho de Melo)

- Introduce 'perf stat --per-thread' (Jiri Olsa)

- Check access permission for --kallsyms and --vmlinux (Li Zhang)

Infrastructure:

- Move stuff out of 'perf stat' and into the lib for further use (Jiri Olsa)

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
      perf trace: Validate syscall list passed via -e argument

Jiri Olsa (22):
      perf thread_map: Introduce thread_map__reset function
      perf thrad_map: Add comm string into array
      perf tests: Add thread_map object tests
      perf stat: Introduce perf_counts function
      perf stat: Use xyarray for cpu evsel counts
      perf stat: Make stats work over the thread dimension
      perf stat: Rename struct perf_counts::cpu member to values
      perf stat: Introduce perf_evlist__reset_stats
      perf stat: Move perf_evsel__(alloc|free|reset)_stat_priv into stat object
      perf stat: Move perf_evsel__(alloc|free)_prev_raw_counts into stat object
      perf stat: Move perf_evlist__(alloc|free|reset)_stats into stat object
      perf stat: Introduce perf_evsel__alloc_stats function
      perf stat: Introduce perf_evsel__read function
      perf stat: Introduce read_counters function
      perf stat: Separate counters reading and processing
      perf stat: Move zero_per_pkg into counter process code
      perf stat: Move perf_stat initialization counter process code
      perf stat: Remove perf_evsel__read_cb function
      perf stat: Rename print_interval to process_interval
      perf stat: Using init_stats instead of memset
      perf stat: Introduce print_counters function
      perf stat: Introduce --per-thread option

Li Zhang (1):
      perf symbols: Check access permission when reading symbol files

 tools/perf/Documentation/perf-stat.txt     |   4 +
 tools/perf/builtin-report.c                |  11 +
 tools/perf/builtin-stat.c                  | 402 +++++++++++++++--------------
 tools/perf/builtin-trace.c                 |  32 +++
 tools/perf/tests/Build                     |   1 +
 tools/perf/tests/builtin-test.c            |   4 +
 tools/perf/tests/openat-syscall-all-cpus.c |   6 +-
 tools/perf/tests/openat-syscall.c          |   4 +-
 tools/perf/tests/tests.h                   |   1 +
 tools/perf/tests/thread-map.c              |  38 +++
 tools/perf/util/evlist.h                   |   1 -
 tools/perf/util/evsel.c                    |  24 +-
 tools/perf/util/evsel.h                    |  28 +-
 tools/perf/util/python-ext-sources         |   1 +
 tools/perf/util/stat.c                     | 132 +++++++++-
 tools/perf/util/stat.h                     |  47 +++-
 tools/perf/util/symbol.c                   |   5 +-
 tools/perf/util/thread_map.c               |  76 +++++-
 tools/perf/util/thread_map.h               |   8 +
 19 files changed, 570 insertions(+), 255 deletions(-)
 create mode 100644 tools/perf/tests/thread-map.c

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2015-03-13 12:34 ` Ingo Molnar
@ 2015-03-13 12:45   ` Jiri Olsa
  0 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2015-03-13 12:45 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Adrian Hunter,
	Andi Kleen, Borislav Petkov, Corey Ashford, David Ahern,
	Don Zickus, Frederic Weisbecker, He Kuang, Jeremie Galarneau,
	Joonsoo Kim, Masami Hiramatsu, Minchan Kim, Namhyung Kim,
	Naohiro Aota, Paul Mackerras, Peter Zijlstra,
	Sebastian Andrzej Siewior, Stephane Eranian, Tom Zanussi,
	Wang Nan, Arnaldo Carvalho de Melo

On Fri, Mar 13, 2015 at 01:34:51PM +0100, Ingo Molnar wrote:
> 
> * Arnaldo Carvalho de Melo <acme@kernel.org> wrote:
> 
> > Infrastructure:
> 
> > . Fix libbabeltrace detection (Jiri Olsa)
> 
> So this still doesn't seem to work for me:
> 
> ...                 libbabeltrace: [ OFF ]
> 
> it should really not be included in the default build until the 
> required library features are more widely available in distros.

the patch that moves babeltrace out of default
check wasn't pulled in yet:

http://marc.info/?l=linux-kernel&m=142606453815125&w=2

also note there's another bug in test-all that prevents
the test-all speed up, fixed by this patch:

http://marc.info/?l=linux-kernel&m=142606452415123&w=2

> 
> I think we should only use library features by default that are 
> available in the latest Fedora, SuSE and Ubuntu distros. We want them 
> to build and package perf and there's little point in adding features 
> that won't work on packaged up perf.

I think we should have the possibility to work and commit new
features even if the support is not yet in the main distros

for such features we could:
  - leave those features out of the default features check
    like we'll do for babeltrace
  - maybe use some sort of EXPERIMENTAL config option dependency
    once we have the .config file support ;-)

jirka

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2015-03-12 21:27 Arnaldo Carvalho de Melo
@ 2015-03-13 12:34 ` Ingo Molnar
  2015-03-13 12:45   ` Jiri Olsa
  0 siblings, 1 reply; 44+ messages in thread
From: Ingo Molnar @ 2015-03-13 12:34 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Andi Kleen, Borislav Petkov,
	Corey Ashford, David Ahern, Don Zickus, Frederic Weisbecker,
	He Kuang, Jeremie Galarneau, Jiri Olsa, Joonsoo Kim,
	Masami Hiramatsu, Minchan Kim, Namhyung Kim, Naohiro Aota,
	Paul Mackerras, Peter Zijlstra, Sebastian Andrzej Siewior,
	Stephane Eranian, Tom Zanussi, Wang Nan,
	Arnaldo Carvalho de Melo


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

> Infrastructure:

> . Fix libbabeltrace detection (Jiri Olsa)

So this still doesn't seem to work for me:

...                 libbabeltrace: [ OFF ]

it should really not be included in the default build until the 
required library features are more widely available in distros.

I think we should only use library features by default that are 
available in the latest Fedora, SuSE and Ubuntu distros. We want them 
to build and package perf and there's little point in adding features 
that won't work on packaged up perf.

Thanks,

	Ingo

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

* [GIT PULL 00/24] perf/core improvements and fixes
@ 2015-03-12 21:27 Arnaldo Carvalho de Melo
  2015-03-13 12:34 ` Ingo Molnar
  0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-03-12 21:27 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andi Kleen, Borislav Petkov, Corey Ashford, David Ahern,
	Don Zickus, Frederic Weisbecker, He Kuang, Jeremie Galarneau,
	Jiri Olsa, Joonsoo Kim, Masami Hiramatsu, Minchan Kim,
	Namhyung Kim, Naohiro Aota, Paul Mackerras, Peter Zijlstra,
	Sebastian Andrzej Siewior, Stephane Eranian, Tom Zanussi,
	Wang Nan, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, more to come, will continue tomorrow,

- Arnaldo

The following changes since commit 94ac003b665fc04f13a7ab3b2be896b9b9503451:

  Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core (2015-03-03 07:17:53 +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

for you to fetch changes up to 7afa95d95b7b4c17f3c648f58f8c8abdcb619b85:

  perf data: Add tracepoint events fields CTF conversion support (2015-03-12 16:10:41 -0300)

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

User visible:

. Fix UI bug after zoom into thread/dso/symbol and another, after fold/unfold,
  in the TUI hists browser (He Kuang)

. Fixes for 'perf probe' handle aliased symbols, for instance in glibc (Masami Hiramatsu, Namhyung Kim)

- 'perf kmem' improvements and fixes: (Namhyung Kim)
  - Fix segfault when invalid sort key is given
  - Allow -v option
  - Fix alignment of slab result table

- 'perf stat' improvements and fixes: (Andi Kleen)
  - Output running time and run/enabled ratio in CSV mode
  - Fix IPC and other formulas with -A
  - Always correctly indent ratio column

. Add tracepoint events fields CTF conversion support to 'perf data' (Sebastian Andrzej Siewior)

Infrastructure:

. Output feature detection's gcc output to a file, to help in debugging (Arnaldo Carvalho de Melo)

. Fix 'perf probe' compiles due to declarations using perf_probe_point (David Ahern)

. Fix possible double free on error in 'perf probe' (He Kuang)

. Remove superfluous thread->comm_set setting (Jiri Olsa)

. Fix libbabeltrace detection (Jiri Olsa)

. More work on separating ordered_events code out of perf_session (Arnaldo Carvalho de Melo)

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

----------------------------------------------------------------
Andi Kleen (3):
      perf stat: Output running time and run/enabled ratio in CSV mode
      perf stat: Fix IPC and other formulas with -A
      perf stat: Always correctly indent ratio column

Arnaldo Carvalho de Melo (6):
      perf ordered_events: Untangle from perf_session
      perf ordered_events: Shorten function signatures
      perf ordered_events: Allow tools to specify a deliver method
      perf tools: tool->finished_round() doesn't need perf_session
      perf ordered_events: Adopt queue() method
      perf tools: Output feature detection's gcc output to a file

David Ahern (1):
      perf probe: Fix compiles due to declarations using perf_probe_point

He Kuang (3):
      perf probe: Fix possible double free on error
      perf hists browser: Fix UI bug after zoom into thread/dso/symbol
      perf hists browser: Fix UI bug after fold/unfold

Jiri Olsa (2):
      perf tools: Remove superfluous thread->comm_set setting
      perf build: Fix libbabeltrace detection

Masami Hiramatsu (3):
      perf probe: Fix to handle aliased symbols in glibc
      perf probe: Fix --line to handle aliased symbols in glibc
      Revert "perf probe: Fix to fall back to find probe point in symbols"

Namhyung Kim (5):
      perf symbols: Allow symbol alias when loading map for symbol name
      perf probe: Allow weak symbols to be probed
      perf kmem: Fix segfault when invalid sort key is given
      perf kmem: Allow -v option
      perf kmem: Fix alignment of slab result table

Sebastian Andrzej Siewior (1):
      perf data: Add tracepoint events fields CTF conversion support

 tools/perf/Documentation/perf-kmem.txt             |   4 +
 tools/perf/Makefile.perf                           |   1 +
 tools/perf/builtin-annotate.c                      |   2 +-
 tools/perf/builtin-buildid-list.c                  |   2 +-
 tools/perf/builtin-diff.c                          |   2 +-
 tools/perf/builtin-inject.c                        |  15 +-
 tools/perf/builtin-kmem.c                          |  17 +-
 tools/perf/builtin-kvm.c                           |  13 +-
 tools/perf/builtin-lock.c                          |   2 +-
 tools/perf/builtin-mem.c                           |   2 +-
 tools/perf/builtin-record.c                        |   4 +-
 tools/perf/builtin-report.c                        |   2 +-
 tools/perf/builtin-sched.c                         |   2 +-
 tools/perf/builtin-script.c                        |   2 +-
 tools/perf/builtin-stat.c                          |  89 ++++----
 tools/perf/builtin-timechart.c                     |   2 +-
 tools/perf/builtin-trace.c                         |   2 +-
 tools/perf/config/Makefile                         |   2 +-
 .../config/feature-checks/test-libbabeltrace.c     |   1 +
 tools/perf/ui/browsers/hists.c                     |  19 ++
 tools/perf/util/data-convert-bt.c                  | 246 ++++++++++++++++++++-
 tools/perf/util/hist.c                             |   1 +
 tools/perf/util/ordered-events.c                   |  57 +++--
 tools/perf/util/ordered-events.h                   |  27 ++-
 tools/perf/util/probe-event.c                      | 194 +++++++++++++---
 tools/perf/util/session.c                          | 140 ++++++------
 tools/perf/util/session.h                          |  16 +-
 tools/perf/util/symbol-elf.c                       |   3 +-
 tools/perf/util/symbol.h                           |   1 +
 tools/perf/util/thread.c                           |   1 -
 tools/perf/util/tool.h                             |   8 +-
 31 files changed, 672 insertions(+), 207 deletions(-)

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2014-10-14 21:04 Arnaldo Carvalho de Melo
@ 2014-10-15  9:56 ` Ingo Molnar
  0 siblings, 0 replies; 44+ messages in thread
From: Ingo Molnar @ 2014-10-15  9:56 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Borislav Petkov, Chuck Ebbert,
	Corey Ashford, David Ahern, Don Zickus, Douglas Hatch,
	Frederic Weisbecker, Jean Pihet, Jiri Olsa, Mike Galbraith,
	Milian Wolff, Namhyung Kim, Paul Mackerras, Peter Zijlstra,
	Scott J Norton, Stephane Eranian, Waiman Long,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit cc6cd47e7395bc05c5077009808b820633eb3f18:
> 
>   perf/x86: Tone down kernel messages when the PMU check fails in a virtual environment (2014-10-03 06:04:41 +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 2c241bd35e6f626ad6f867dcf9fefdc2315f125f:
> 
>   perf symbols: Make sym->end be the first address after the symbol range (2014-10-14 17:50:58 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> Infrastructure:
> 
> . Do not include a struct hists per perf_evsel, untangling the histogram code
>   from perf_evsel, to pave the way for exporting a minimalistic
>   tools/lib/api/perf/ library usable by tools/perf and initially by the rasd
>   daemon being developed by Borislav Petkov, Robert Richter and Jean Pihet.
>   (Arnaldo Carvalho de Melo)
> 
> . Make perf_evlist__open(evlist, NULL, NULL), i.e. without cpu and thread
>   maps mean syswide monitoring, reducing the boilerplate for tools that
>   only want system wide mode. (Arnaldo Carvalho de Melo)
> 
> . Fix off-by-one bugs in map->end handling (Stephane Eranian)
> 
> . Fix off-by-one bug in maps__find(), also related to map->end handling (Namhyung Kim)
> 
> . Make struct symbol->end be the first addr after the symbol range, to make it
>   match the convention used for struct map->end. (Arnaldo Carvalho de Melo)
> 
> . Fix perf_evlist__add_pollfd() error handling in 'perf kvm stat live' (Jiri Olsa)
> 
> . Fix python test build by moving callchain_param to an object linked into the
>   python binding (Jiri Olsa)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (18):
>       perf sched: Stop updating hists stats, not used
>       perf script: Stop updating hists stats, not used
>       perf evsel: Add hists helper
>       perf session: Don't count per evsel events
>       perf tools: Move events_stats struct to event.h
>       perf ui browsers: Add missing include
>       perf session: Remove last reference to hists struct
>       perf evsel: Subclassing
>       perf callchain: Move the callchain_param extern to callchain.h
>       perf tools: Remove hists from evsel
>       perf thread_map: Create dummy constructor out of open coded equivalent
>       perf evlist: Check that there is a thread_map when preparing a workload
>       perf evlist: Default to syswide target when no thread/cpu maps set
>       perf evsel: Add missing 'target' struct forward declaration
>       perf evsel: Make some exit routines static
>       perf machine: Add missing dsos->root rbtree root initialization
>       perf symbols: Fix map->end fixup
>       perf symbols: Make sym->end be the first address after the symbol range
> 
> Jiri Olsa (4):
>       perf kvm stat live: Fix perf_evlist__add_pollfd error handling
>       perf kvm stat live: Use perf_evlist__add_pollfd return fd position
>       perf kvm stat live: Use fdarray object instead of pollfd
>       perf callchain: Move callchain_param to util object in to fix python test
> 
> Namhyung Kim (1):
>       perf tools: Fixup off-by-one comparision in maps__find
> 
> Stephane Eranian (1):
>       perf tools: fix off-by-one error in maps
> 
>  tools/perf/builtin-annotate.c                      | 14 +++--
>  tools/perf/builtin-diff.c                          | 21 ++++---
>  tools/perf/builtin-kvm.c                           | 22 +++----
>  tools/perf/builtin-record.c                        |  1 +
>  tools/perf/builtin-report.c                        | 24 ++++---
>  tools/perf/builtin-sched.c                         |  3 -
>  tools/perf/builtin-script.c                        |  1 -
>  tools/perf/builtin-top.c                           | 60 ++++++++++--------
>  tools/perf/tests/builtin-test.c                    |  5 ++
>  tools/perf/tests/hists_cumulate.c                  |  8 +--
>  tools/perf/tests/hists_filter.c                    | 23 +++----
>  tools/perf/tests/hists_link.c                      | 23 ++++---
>  tools/perf/tests/hists_output.c                    | 20 +++---
>  tools/perf/ui/browsers/header.c                    |  1 +
>  tools/perf/ui/browsers/hists.c                     | 20 +++---
>  tools/perf/ui/gtk/hists.c                          |  2 +-
>  tools/perf/util/annotate.c                         |  8 +--
>  tools/perf/util/callchain.h                        |  2 +
>  tools/perf/util/event.h                            | 26 ++++++++
>  tools/perf/util/evlist.c                           | 48 +++++++++++++-
>  tools/perf/util/evsel.c                            | 66 ++++++++++++++-----
>  tools/perf/util/evsel.h                            | 14 ++---
>  tools/perf/util/hist.c                             | 73 +++++++++++++++++-----
>  tools/perf/util/hist.h                             | 49 +++++++--------
>  tools/perf/util/machine.c                          | 10 ++-
>  tools/perf/util/map.c                              |  8 +--
>  .../util/scripting-engines/trace-event-python.c    |  1 +
>  tools/perf/util/session.c                          | 23 -------
>  tools/perf/util/session.h                          |  1 -
>  tools/perf/util/sort.c                             |  4 +-
>  tools/perf/util/symbol.c                           |  8 +--
>  tools/perf/util/symbol.h                           |  2 +-
>  tools/perf/util/thread_map.c                       | 21 ++++---
>  tools/perf/util/thread_map.h                       |  1 +
>  tools/perf/util/util.c                             |  8 +++
>  35 files changed, 392 insertions(+), 229 deletions(-)

Pulled, thanks a lot Arnaldo!

	Ingo

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

* [GIT PULL 00/24] perf/core improvements and fixes
@ 2014-10-14 21:04 Arnaldo Carvalho de Melo
  2014-10-15  9:56 ` Ingo Molnar
  0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2014-10-14 21:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Borislav Petkov, Chuck Ebbert, Corey Ashford, David Ahern,
	Don Zickus, Douglas Hatch, Frederic Weisbecker, Jean Pihet,
	Jiri Olsa, Mike Galbraith, Milian Wolff, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Scott J Norton, Stephane Eranian,
	Waiman Long, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit cc6cd47e7395bc05c5077009808b820633eb3f18:

  perf/x86: Tone down kernel messages when the PMU check fails in a virtual environment (2014-10-03 06:04:41 +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 2c241bd35e6f626ad6f867dcf9fefdc2315f125f:

  perf symbols: Make sym->end be the first address after the symbol range (2014-10-14 17:50:58 -0300)

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

Infrastructure:

. Do not include a struct hists per perf_evsel, untangling the histogram code
  from perf_evsel, to pave the way for exporting a minimalistic
  tools/lib/api/perf/ library usable by tools/perf and initially by the rasd
  daemon being developed by Borislav Petkov, Robert Richter and Jean Pihet.
  (Arnaldo Carvalho de Melo)

. Make perf_evlist__open(evlist, NULL, NULL), i.e. without cpu and thread
  maps mean syswide monitoring, reducing the boilerplate for tools that
  only want system wide mode. (Arnaldo Carvalho de Melo)

. Fix off-by-one bugs in map->end handling (Stephane Eranian)

. Fix off-by-one bug in maps__find(), also related to map->end handling (Namhyung Kim)

. Make struct symbol->end be the first addr after the symbol range, to make it
  match the convention used for struct map->end. (Arnaldo Carvalho de Melo)

. Fix perf_evlist__add_pollfd() error handling in 'perf kvm stat live' (Jiri Olsa)

. Fix python test build by moving callchain_param to an object linked into the
  python binding (Jiri Olsa)

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (18):
      perf sched: Stop updating hists stats, not used
      perf script: Stop updating hists stats, not used
      perf evsel: Add hists helper
      perf session: Don't count per evsel events
      perf tools: Move events_stats struct to event.h
      perf ui browsers: Add missing include
      perf session: Remove last reference to hists struct
      perf evsel: Subclassing
      perf callchain: Move the callchain_param extern to callchain.h
      perf tools: Remove hists from evsel
      perf thread_map: Create dummy constructor out of open coded equivalent
      perf evlist: Check that there is a thread_map when preparing a workload
      perf evlist: Default to syswide target when no thread/cpu maps set
      perf evsel: Add missing 'target' struct forward declaration
      perf evsel: Make some exit routines static
      perf machine: Add missing dsos->root rbtree root initialization
      perf symbols: Fix map->end fixup
      perf symbols: Make sym->end be the first address after the symbol range

Jiri Olsa (4):
      perf kvm stat live: Fix perf_evlist__add_pollfd error handling
      perf kvm stat live: Use perf_evlist__add_pollfd return fd position
      perf kvm stat live: Use fdarray object instead of pollfd
      perf callchain: Move callchain_param to util object in to fix python test

Namhyung Kim (1):
      perf tools: Fixup off-by-one comparision in maps__find

Stephane Eranian (1):
      perf tools: fix off-by-one error in maps

 tools/perf/builtin-annotate.c                      | 14 +++--
 tools/perf/builtin-diff.c                          | 21 ++++---
 tools/perf/builtin-kvm.c                           | 22 +++----
 tools/perf/builtin-record.c                        |  1 +
 tools/perf/builtin-report.c                        | 24 ++++---
 tools/perf/builtin-sched.c                         |  3 -
 tools/perf/builtin-script.c                        |  1 -
 tools/perf/builtin-top.c                           | 60 ++++++++++--------
 tools/perf/tests/builtin-test.c                    |  5 ++
 tools/perf/tests/hists_cumulate.c                  |  8 +--
 tools/perf/tests/hists_filter.c                    | 23 +++----
 tools/perf/tests/hists_link.c                      | 23 ++++---
 tools/perf/tests/hists_output.c                    | 20 +++---
 tools/perf/ui/browsers/header.c                    |  1 +
 tools/perf/ui/browsers/hists.c                     | 20 +++---
 tools/perf/ui/gtk/hists.c                          |  2 +-
 tools/perf/util/annotate.c                         |  8 +--
 tools/perf/util/callchain.h                        |  2 +
 tools/perf/util/event.h                            | 26 ++++++++
 tools/perf/util/evlist.c                           | 48 +++++++++++++-
 tools/perf/util/evsel.c                            | 66 ++++++++++++++-----
 tools/perf/util/evsel.h                            | 14 ++---
 tools/perf/util/hist.c                             | 73 +++++++++++++++++-----
 tools/perf/util/hist.h                             | 49 +++++++--------
 tools/perf/util/machine.c                          | 10 ++-
 tools/perf/util/map.c                              |  8 +--
 .../util/scripting-engines/trace-event-python.c    |  1 +
 tools/perf/util/session.c                          | 23 -------
 tools/perf/util/session.h                          |  1 -
 tools/perf/util/sort.c                             |  4 +-
 tools/perf/util/symbol.c                           |  8 +--
 tools/perf/util/symbol.h                           |  2 +-
 tools/perf/util/thread_map.c                       | 21 ++++---
 tools/perf/util/thread_map.h                       |  1 +
 tools/perf/util/util.c                             |  8 +++
 35 files changed, 392 insertions(+), 229 deletions(-)

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2012-08-21  9:32 ` Ingo Molnar
@ 2012-08-21  9:36   ` Jiri Olsa
  0 siblings, 0 replies; 44+ messages in thread
From: Jiri Olsa @ 2012-08-21  9:36 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Andi Kleen,
	Ben Hutchings, Borislav Petkov, Corey Ashford, David Ahern,
	Feng Tang, Frederic Weisbecker, Mike Galbraith, Namhyung Kim,
	Namhyung Kim, Namhyung Kim, Paul Mackerras, Pekka Enberg,
	Peter Zijlstra, Robert Richter, Sedat Dilek, Stephane Eranian,
	Steven Rostedt, Thomas Gleixner, Ulrich Drepper, arnaldo.melo,
	Arnaldo Carvalho de Melo

On Tue, Aug 21, 2012 at 11:32:31AM +0200, Ingo Molnar wrote:
> 
> * Arnaldo Carvalho de Melo <acme@infradead.org> wrote:
> 

SNIP

> 
> One minor observation, the Makefile tells us:
> 
> Makefile:496: No libunwind found. Please install libunwind >= 0.99
> 
> I guess that should be libunwind-dev[el], right? Plain libunwind 
> is not enough.

right, will fix it

thanks,
jirka

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

* Re: [GIT PULL 00/24] perf/core improvements and fixes
  2012-08-20 16:26 Arnaldo Carvalho de Melo
@ 2012-08-21  9:32 ` Ingo Molnar
  2012-08-21  9:36   ` Jiri Olsa
  0 siblings, 1 reply; 44+ messages in thread
From: Ingo Molnar @ 2012-08-21  9:32 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Andi Kleen, Ben Hutchings, Borislav Petkov,
	Corey Ashford, David Ahern, Feng Tang, Frederic Weisbecker,
	Jiri Olsa, Mike Galbraith, Namhyung Kim, Namhyung Kim,
	Namhyung Kim, Paul Mackerras, Pekka Enberg, Peter Zijlstra,
	Robert Richter, Sedat Dilek, Stephane Eranian, Steven Rostedt,
	Thomas Gleixner, Ulrich Drepper, arnaldo.melo,
	Arnaldo Carvalho de Melo


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

> Hi Ingo,
> 
> 	Please consider pulling, this is on top of my previous pull requests,
> 
> - Arnaldo
> 
> The following changes since commit 0fe7d7e9761ec7e23350b5543ddac470bb3cde1e:
> 
>   perf symbols: Add description of JIT interface (2012-08-13 14:55:02 -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 000078bc3ee69efb1124b8478c7527389a826074:
> 
>   perf hists: Rename and move some functions (2012-08-20 09:47:31 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
>  . Fix include order for bison/flex-generated C files, from Ben Hutchings
> 
>  . Build fixes and documentation corrections from David Ahern
> 
>  . Group parsing support, from Jiri Olsa
> 
>  . UI/gtk refactorings and improvements from Namhyung Kim
> 
>  . NULL deref fix for perf script, from Namhyung Kim
> 
>  . Assorted cleanups from Robert Richter
> 
>  . Let O= makes handle relative paths, from Steven Rostedt
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (3):
>       perf tools: Add missing files to build the python binding
>       perf evlist: Rename __group method to __set_leader
>       perf evlist: Introduce evsel list accessors
> 
> Ben Hutchings (1):
>       perf tools: Fix include order for bison/flex-generated C files
> 
> David Ahern (3):
>       perf script perl/python: Fix libexec scripts path in Documentation
>       perf: silence GTK2 probing errors
>       perf symbols: Fix builds with NO_LIBELF set
> 
> Jiri Olsa (4):
>       perf tools: Add support to parse event group syntax
>       perf tools: Add support to update event modifier
>       perf tools: Enable grouping logic for parsed events
>       perf test: Add automated tests for event group parsing
> 
> Namhyung Kim (8):
>       perf script: Fix a NULL pointer dereference
>       perf ui: Introduce struct ui_helpline
>       perf ui gtk: Implement helpline_fns
>       perf ui/gtk: Use helpline API in browser
>       perf ui gtk: Add perf_gtk__show_helpline() for pr_*
>       perf ui gtk: Ensure not to call gtk_main_quit() twice
>       perf hists: Separate out hist print functions
>       perf hists: Rename and move some functions
> 
> Robert Richter (4):
>       perf tools: Fix type for evsel->ids and add size check for ids
>       perf tools: Report number of pmu type of unknown events
>       perf tools: Rename some variables for better understanding
>       perf tools: Rename global variable 'events' in util/header.c
> 
> Steven Rostedt (1):
>       perf tools: Let O= makes handle relative paths
> 
>  tools/perf/Documentation/perf-script-perl.txt   |    4 +-
>  tools/perf/Documentation/perf-script-python.txt |   10 +-
>  tools/perf/Makefile                             |   20 +-
>  tools/perf/builtin-record.c                     |   17 +-
>  tools/perf/builtin-stat.c                       |   15 +-
>  tools/perf/builtin-test.c                       |   10 +-
>  tools/perf/builtin-top.c                        |   18 +-
>  tools/perf/ui/browsers/hists.c                  |    4 +-
>  tools/perf/ui/gtk/browser.c                     |    5 +-
>  tools/perf/ui/gtk/gtk.h                         |    2 +
>  tools/perf/ui/gtk/helpline.c                    |   56 ++
>  tools/perf/ui/gtk/setup.c                       |    3 +
>  tools/perf/ui/gtk/util.c                        |    5 -
>  tools/perf/ui/helpline.c                        |   56 +-
>  tools/perf/ui/helpline.h                        |   33 +-
>  tools/perf/ui/setup.c                           |    4 +
>  tools/perf/ui/stdio/hist.c                      |  653 ++++++++++++++++++++++
>  tools/perf/ui/tui/helpline.c                    |   57 ++
>  tools/perf/ui/tui/setup.c                       |    2 -
>  tools/perf/util/debug.c                         |    4 +-
>  tools/perf/util/debug.h                         |    8 +-
>  tools/perf/util/evlist.c                        |   73 +--
>  tools/perf/util/evlist.h                        |   27 +-
>  tools/perf/util/evsel.c                         |   52 +-
>  tools/perf/util/evsel.h                         |   20 +-
>  tools/perf/util/header.c                        |   97 ++--
>  tools/perf/util/header.h                        |    2 +-
>  tools/perf/util/hist.c                          |  677 +----------------------
>  tools/perf/util/hist.h                          |    6 +-
>  tools/perf/util/parse-events-test.c             |  387 ++++++++++---
>  tools/perf/util/parse-events.c                  |   93 +++-
>  tools/perf/util/parse-events.h                  |    4 +-
>  tools/perf/util/parse-events.l                  |    2 +
>  tools/perf/util/parse-events.y                  |   93 +++-
>  tools/perf/util/python-ext-sources              |    2 +
>  tools/perf/util/python.c                        |    7 +-
>  tools/perf/util/symbol-elf.c                    |    3 +
>  tools/perf/util/symbol.c                        |    2 +-
>  tools/perf/util/top.c                           |    3 +-
>  tools/perf/util/trace-event-parse.c             |    2 +-
>  tools/scripts/Makefile.include                  |    6 +-
>  41 files changed, 1560 insertions(+), 984 deletions(-)
>  create mode 100644 tools/perf/ui/gtk/helpline.c
>  create mode 100644 tools/perf/ui/stdio/hist.c
>  create mode 100644 tools/perf/ui/tui/helpline.c

Pulled this and the previous two pull requests, thanks a lot 
Arnaldo!

One minor observation, the Makefile tells us:

Makefile:496: No libunwind found. Please install libunwind >= 0.99

I guess that should be libunwind-dev[el], right? Plain libunwind 
is not enough.

Thanks,

	Ingo

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

* [GIT PULL 00/24] perf/core improvements and fixes
@ 2012-08-20 16:26 Arnaldo Carvalho de Melo
  2012-08-21  9:32 ` Ingo Molnar
  0 siblings, 1 reply; 44+ messages in thread
From: Arnaldo Carvalho de Melo @ 2012-08-20 16:26 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Andi Kleen,
	Ben Hutchings, Borislav Petkov, Corey Ashford, David Ahern,
	Feng Tang, Frederic Weisbecker, Jiri Olsa, Mike Galbraith,
	Namhyung Kim, Namhyung Kim, Namhyung Kim, Paul Mackerras,
	Pekka Enberg, Peter Zijlstra, Robert Richter, Sedat Dilek,
	Stephane Eranian, Steven Rostedt, Thomas Gleixner,
	Ulrich Drepper, arnaldo.melo, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, this is on top of my previous pull requests,

- Arnaldo

The following changes since commit 0fe7d7e9761ec7e23350b5543ddac470bb3cde1e:

  perf symbols: Add description of JIT interface (2012-08-13 14:55:02 -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 000078bc3ee69efb1124b8478c7527389a826074:

  perf hists: Rename and move some functions (2012-08-20 09:47:31 -0300)

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

 . Fix include order for bison/flex-generated C files, from Ben Hutchings

 . Build fixes and documentation corrections from David Ahern

 . Group parsing support, from Jiri Olsa

 . UI/gtk refactorings and improvements from Namhyung Kim

 . NULL deref fix for perf script, from Namhyung Kim

 . Assorted cleanups from Robert Richter

 . Let O= makes handle relative paths, from Steven Rostedt

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (3):
      perf tools: Add missing files to build the python binding
      perf evlist: Rename __group method to __set_leader
      perf evlist: Introduce evsel list accessors

Ben Hutchings (1):
      perf tools: Fix include order for bison/flex-generated C files

David Ahern (3):
      perf script perl/python: Fix libexec scripts path in Documentation
      perf: silence GTK2 probing errors
      perf symbols: Fix builds with NO_LIBELF set

Jiri Olsa (4):
      perf tools: Add support to parse event group syntax
      perf tools: Add support to update event modifier
      perf tools: Enable grouping logic for parsed events
      perf test: Add automated tests for event group parsing

Namhyung Kim (8):
      perf script: Fix a NULL pointer dereference
      perf ui: Introduce struct ui_helpline
      perf ui gtk: Implement helpline_fns
      perf ui/gtk: Use helpline API in browser
      perf ui gtk: Add perf_gtk__show_helpline() for pr_*
      perf ui gtk: Ensure not to call gtk_main_quit() twice
      perf hists: Separate out hist print functions
      perf hists: Rename and move some functions

Robert Richter (4):
      perf tools: Fix type for evsel->ids and add size check for ids
      perf tools: Report number of pmu type of unknown events
      perf tools: Rename some variables for better understanding
      perf tools: Rename global variable 'events' in util/header.c

Steven Rostedt (1):
      perf tools: Let O= makes handle relative paths

 tools/perf/Documentation/perf-script-perl.txt   |    4 +-
 tools/perf/Documentation/perf-script-python.txt |   10 +-
 tools/perf/Makefile                             |   20 +-
 tools/perf/builtin-record.c                     |   17 +-
 tools/perf/builtin-stat.c                       |   15 +-
 tools/perf/builtin-test.c                       |   10 +-
 tools/perf/builtin-top.c                        |   18 +-
 tools/perf/ui/browsers/hists.c                  |    4 +-
 tools/perf/ui/gtk/browser.c                     |    5 +-
 tools/perf/ui/gtk/gtk.h                         |    2 +
 tools/perf/ui/gtk/helpline.c                    |   56 ++
 tools/perf/ui/gtk/setup.c                       |    3 +
 tools/perf/ui/gtk/util.c                        |    5 -
 tools/perf/ui/helpline.c                        |   56 +-
 tools/perf/ui/helpline.h                        |   33 +-
 tools/perf/ui/setup.c                           |    4 +
 tools/perf/ui/stdio/hist.c                      |  653 ++++++++++++++++++++++
 tools/perf/ui/tui/helpline.c                    |   57 ++
 tools/perf/ui/tui/setup.c                       |    2 -
 tools/perf/util/debug.c                         |    4 +-
 tools/perf/util/debug.h                         |    8 +-
 tools/perf/util/evlist.c                        |   73 +--
 tools/perf/util/evlist.h                        |   27 +-
 tools/perf/util/evsel.c                         |   52 +-
 tools/perf/util/evsel.h                         |   20 +-
 tools/perf/util/header.c                        |   97 ++--
 tools/perf/util/header.h                        |    2 +-
 tools/perf/util/hist.c                          |  677 +----------------------
 tools/perf/util/hist.h                          |    6 +-
 tools/perf/util/parse-events-test.c             |  387 ++++++++++---
 tools/perf/util/parse-events.c                  |   93 +++-
 tools/perf/util/parse-events.h                  |    4 +-
 tools/perf/util/parse-events.l                  |    2 +
 tools/perf/util/parse-events.y                  |   93 +++-
 tools/perf/util/python-ext-sources              |    2 +
 tools/perf/util/python.c                        |    7 +-
 tools/perf/util/symbol-elf.c                    |    3 +
 tools/perf/util/symbol.c                        |    2 +-
 tools/perf/util/top.c                           |    3 +-
 tools/perf/util/trace-event-parse.c             |    2 +-
 tools/scripts/Makefile.include                  |    6 +-
 41 files changed, 1560 insertions(+), 984 deletions(-)
 create mode 100644 tools/perf/ui/gtk/helpline.c
 create mode 100644 tools/perf/ui/stdio/hist.c
 create mode 100644 tools/perf/ui/tui/helpline.c

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

end of thread, other threads:[~2019-01-22 10:08 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-15 20:50 [GIT PULL 00/24] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 01/24] tools lib traceevent: Add correct header for ipv6 definitions Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 02/24] perf tools: Do not provide dup sched_getcpu() prototype on Android Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 03/24] tools: Make "__always_inline" just "inline" " Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 04/24] perf tools: Just pr_debug() about not being able to read cacheline_size Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 05/24] perf tools: Bail out at "--sort dcacheline" and cacheline_size not known Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 06/24] tools lib api fs: Use base 0 in filename__read_ull Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 07/24] perf evlist: Drop redundant evsel->overwrite indicator Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 08/24] tools: Simplify BITS_PER_LONG define Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 09/24] tools lib fd array: Allow associating a pointer cookie with each entry Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 10/24] perf evlist: Update mmap related APIs and helpers Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 11/24] perf record: Decouple record__mmap_read() and evlist Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 12/24] perf evlist: Record mmap cookie into fdarray private field Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 13/24] perf evlist: Extract common code in mmap failure processing Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 14/24] perf evlist: Introduce backward_mmap array for evlist Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 15/24] perf evlist: Map backward events to backward_mmap Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 16/24] perf evlist: Drop evlist->backward Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 17/24] perf evlist: Setup backward mmap state machine Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 18/24] perf record: Read from overwritable ring buffer Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 19/24] perf evlist: Make {pause,resume} internal helpers Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 20/24] perf tools: Enable overwrite settings Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 21/24] perf session: Don't warn about out of order event if write_backward is used Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 22/24] perf record: Add --tail-synthesize option Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 23/24] objtool: Add -I$(srctree)/tools/arch/$(ARCH)/include/uapi Arnaldo Carvalho de Melo
2016-07-15 20:50 ` [PATCH 24/24] objtool: Initialize variable to silence old compiler Arnaldo Carvalho de Melo
2016-07-16 20:39 ` [GIT PULL 00/24] perf/core improvements and fixes Ingo Molnar
  -- strict thread matches above, loose matches on Subject: below --
2019-01-21 23:56 Arnaldo Carvalho de Melo
2019-01-22 10:07 ` Ingo Molnar
2017-10-23 23:47 Arnaldo Carvalho de Melo
2017-10-24  9:13 ` Ingo Molnar
2016-06-07 20:04 Arnaldo Carvalho de Melo
2016-06-07 23:10 ` Taeung Song
2016-06-08 13:09   ` Arnaldo Carvalho de Melo
2016-06-08  7:43 ` Ingo Molnar
2015-06-26 15:44 Arnaldo Carvalho de Melo
2015-06-30  4:48 ` Ingo Molnar
2015-03-12 21:27 Arnaldo Carvalho de Melo
2015-03-13 12:34 ` Ingo Molnar
2015-03-13 12:45   ` Jiri Olsa
2014-10-14 21:04 Arnaldo Carvalho de Melo
2014-10-15  9:56 ` Ingo Molnar
2012-08-20 16:26 Arnaldo Carvalho de Melo
2012-08-21  9:32 ` Ingo Molnar
2012-08-21  9:36   ` Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).