linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 00/15] perf/core improvements and fixes
@ 2015-09-05  1:06 Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 01/15] perf tests: Take into account address of each objdump line Arnaldo Carvalho de Melo
                   ` (15 more replies)
  0 siblings, 16 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Arnaldo Carvalho de Melo, Adrian Hunter,
	Andi Kleen, Corey Ashford, David Ahern, Frederic Weisbecker,
	Jan Stancek, Jiri Olsa, Kan Liang, Matt Fleming, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Raphael Beamonte,
	Stephane Eranian, Steven Rostedt, Arnaldo Carvalho de Melo

Hi Ingo,

	Please consider pulling, this is on top of the previous pull request,
perf-core-for-mingo.

- Arnaldo

The following changes since commit cf2f33a4e54096f90652cca3511fd6a456ea5abe:

  perf trace: Add read/write to the file group (2015-09-04 13:22:06 -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-2

for you to fetch changes up to 0959e527b1593e662cb99639a587eac39ea1232d:

  perf stat: Move sw clock metrics printout to stat-shadow (2015-09-04 20:30:01 -0300)

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

User visible:

- Add 'socket' sort entry, to sort by the processor socket in
  'perf top' and 'perf report' (Kan Liang)

- Introduce --socket-filter to 'perf report', for filtering by
  processor socket (Kan Liang)

- Add new "Zoom into Processor Socket" operation in the perf hists browser,
  used in 'perf top' and 'perf report' (Kan Liang)

Infrastructure:

- 'perf test' fixes for the object code reading entry (Jan Stancek)

- Add processor socket and cpu topology 'perf test' entries (Kan Liang)

- Move sw clock metrics printout to stat-shadow (Andi Kleen)

- Switch to tracing_patch interface (Jiri Olsa)

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

----------------------------------------------------------------
Andi Kleen (1):
      perf stat: Move sw clock metrics printout to stat-shadow

Jan Stancek (4):
      perf tests: Take into account address of each objdump line
      perf tests: Make objdump disassemble zero blocks
      perf tests: Stop reading if objdump output crossed sections
      perf tests: Print objdump/dso buffers if they don't match

Jiri Olsa (4):
      tools lib api fs: Make tracing_path_strerror_open message generic
      tools lib api fs: Replace debugfs/tracefs objects interface with fs.c
      tools lib api fs: Remove debugfs, tracefs and findfs objects
      perf tools: Switch to tracing_path interface on appropriate places

Kan Liang (6):
      perf test: Add entry to test cpu topology
      perf tools: Add processor socket info to hist_entry and addr_location
      perf tools: Introduce new sort type "socket" for the processor socket
      perf report: Introduce --socket-filter option
      perf hists browser: Zoom in/out for processor socket
      perf test: Add entry for hists socket filter

 tools/lib/api/fs/Build                     |   3 -
 tools/lib/api/fs/debugfs.c                 |  77 -------------------
 tools/lib/api/fs/debugfs.h                 |  23 ------
 tools/lib/api/fs/findfs.c                  |  63 ----------------
 tools/lib/api/fs/findfs.h                  |  23 ------
 tools/lib/api/fs/fs.c                      |   1 -
 tools/lib/api/fs/tracefs.c                 |  78 -------------------
 tools/lib/api/fs/tracefs.h                 |  21 ------
 tools/lib/api/fs/tracing_path.c            |  35 +++++----
 tools/perf/Documentation/perf-report.txt   |   6 +-
 tools/perf/builtin-kvm.c                   |   1 -
 tools/perf/builtin-probe.c                 |   1 -
 tools/perf/builtin-report.c                |  15 ++++
 tools/perf/builtin-stat.c                  |   9 ---
 tools/perf/tests/Build                     |   1 +
 tools/perf/tests/builtin-test.c            |   4 +
 tools/perf/tests/code-reading.c            |  74 +++++++++++++++----
 tools/perf/tests/hists_filter.c            |  55 +++++++++++---
 tools/perf/tests/openat-syscall-all-cpus.c |  10 +--
 tools/perf/tests/openat-syscall.c          |  10 +--
 tools/perf/tests/parse-events.c            |  19 +----
 tools/perf/tests/tests.h                   |   1 +
 tools/perf/tests/topology.c                | 115 +++++++++++++++++++++++++++++
 tools/perf/ui/browsers/hists.c             |  59 ++++++++++++++-
 tools/perf/util/event.c                    |   1 +
 tools/perf/util/evsel.c                    |   2 +-
 tools/perf/util/hist.c                     |  37 ++++++++++
 tools/perf/util/hist.h                     |   6 +-
 tools/perf/util/probe-event.c              |   5 +-
 tools/perf/util/probe-file.c               |  15 +---
 tools/perf/util/sort.c                     |  22 ++++++
 tools/perf/util/sort.h                     |   2 +
 tools/perf/util/stat-shadow.c              |   3 +
 tools/perf/util/symbol.h                   |   1 +
 tools/perf/util/util.h                     |   3 +-
 35 files changed, 409 insertions(+), 392 deletions(-)
 delete mode 100644 tools/lib/api/fs/debugfs.c
 delete mode 100644 tools/lib/api/fs/debugfs.h
 delete mode 100644 tools/lib/api/fs/findfs.c
 delete mode 100644 tools/lib/api/fs/findfs.h
 delete mode 100644 tools/lib/api/fs/tracefs.c
 delete mode 100644 tools/lib/api/fs/tracefs.h
 create mode 100644 tools/perf/tests/topology.c

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

* [PATCH 01/15] perf tests: Take into account address of each objdump line
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 02/15] perf tests: Make objdump disassemble zero blocks Arnaldo Carvalho de Melo
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jan Stancek, Adrian Hunter, Corey Ashford,
	David Ahern, Frederic Weisbecker, Jiri Olsa, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jan Stancek <jstancek@redhat.com>

objdump output can contain repeated bytes. At the moment test reads all
output sequentially, assuming each address is represented in output only
once:

  ffffffff8164efb3 <retint_swapgs+0x9>:
  ffffffff8164efb3:  c1 5d 00 eb        rcrl   $0xeb,0x0(%rbp)
  ffffffff8164efb7:  00 4c 8b 5c        add    %cl,0x5c(%rbx,%rcx,4)

  ffffffff8164efb8 <restore_c_regs_and_iret>:
  ffffffff8164efb8:  4c 8b 5c 24 30     mov    0x30(%rsp),%r11
  ffffffff8164efbd:  4c 8b 54 24 38     mov    0x38(%rsp),%r10

Store objdump output to buffer according to offset calculated from
address on each line.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/ad13289a55d6350f7717757c7e32c2d4286402bd.1441181335.git.jstancek@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/code-reading.c | 51 ++++++++++++++++++++++++++++++-----------
 1 file changed, 38 insertions(+), 13 deletions(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 39c784a100a9..38ee90bc2228 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -33,20 +33,20 @@ static unsigned int hex(char c)
 	return c - 'A' + 10;
 }
 
-static void read_objdump_line(const char *line, size_t line_len, void **buf,
-			      size_t *len)
+static size_t read_objdump_line(const char *line, size_t line_len, void *buf,
+			      size_t len)
 {
 	const char *p;
-	size_t i;
+	size_t i, j = 0;
 
 	/* Skip to a colon */
 	p = strchr(line, ':');
 	if (!p)
-		return;
+		return 0;
 	i = p + 1 - line;
 
 	/* Read bytes */
-	while (*len) {
+	while (j < len) {
 		char c1, c2;
 
 		/* Skip spaces */
@@ -65,20 +65,26 @@ static void read_objdump_line(const char *line, size_t line_len, void **buf,
 		if (i < line_len && line[i] && !isspace(line[i]))
 			break;
 		/* Store byte */
-		*(unsigned char *)*buf = (hex(c1) << 4) | hex(c2);
-		*buf += 1;
-		*len -= 1;
+		*(unsigned char *)buf = (hex(c1) << 4) | hex(c2);
+		buf += 1;
+		j++;
 	}
+	/* return number of successfully read bytes */
+	return j;
 }
 
-static int read_objdump_output(FILE *f, void **buf, size_t *len)
+static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
 {
 	char *line = NULL;
-	size_t line_len;
+	size_t line_len, off_last = 0;
 	ssize_t ret;
 	int err = 0;
+	u64 addr;
+
+	while (off_last < *len) {
+		size_t off, read_bytes, written_bytes;
+		unsigned char tmp[BUFSZ];
 
-	while (1) {
 		ret = getline(&line, &line_len, f);
 		if (feof(f))
 			break;
@@ -87,9 +93,28 @@ static int read_objdump_output(FILE *f, void **buf, size_t *len)
 			err = -1;
 			break;
 		}
-		read_objdump_line(line, ret, buf, len);
+
+		/* read objdump data into temporary buffer */
+		read_bytes = read_objdump_line(line, ret, tmp, sizeof(tmp));
+		if (!read_bytes)
+			continue;
+
+		if (sscanf(line, "%"PRIx64, &addr) != 1)
+			continue;
+
+		/* copy it from temporary buffer to 'buf' according
+		 * to address on current objdump line */
+		off = addr - start_addr;
+		if (off >= *len)
+			break;
+		written_bytes = MIN(read_bytes, *len - off);
+		memcpy(buf + off, tmp, written_bytes);
+		off_last = off + written_bytes;
 	}
 
+	/* len returns number of bytes that could not be read */
+	*len -= off_last;
+
 	free(line);
 
 	return err;
@@ -120,7 +145,7 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
 		return -1;
 	}
 
-	ret = read_objdump_output(f, &buf, &len);
+	ret = read_objdump_output(f, buf, &len, addr);
 	if (len) {
 		pr_debug("objdump read too few bytes\n");
 		if (!ret)
-- 
2.1.0


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

* [PATCH 02/15] perf tests: Make objdump disassemble zero blocks
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 01/15] perf tests: Take into account address of each objdump line Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 03/15] perf tests: Stop reading if objdump output crossed sections Arnaldo Carvalho de Melo
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jan Stancek, Corey Ashford, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jan Stancek <jstancek@redhat.com>

Add -z parameter to avoid skipping zero blocks:

 ffffffff816704fe <sysret_check+0x4b>:
 ffffffff816704fe:  7b 34         jnp ffffffff81670534 <sysret_signal+0x1c>
       ...
 ffffffff81670501 <sysret_careful>:
 ffffffff81670501:  0f ba e2 03   bt  $0x3,%edx
 ffffffff81670505:  73 11         jae ffffffff81670518 <sysret_signal>

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/130c6267fbdb9af506633a9efa06f3269ff5bd2c.1441275982.git.jstancek@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/code-reading.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 38ee90bc2228..c409409d7765 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -128,7 +128,7 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
 	FILE *f;
 	int ret;
 
-	fmt = "%s -d --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
+	fmt = "%s -z -d --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
 	ret = snprintf(cmd, sizeof(cmd), fmt, "objdump", addr, addr + len,
 		       filename);
 	if (ret <= 0 || (size_t)ret >= sizeof(cmd))
-- 
2.1.0


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

* [PATCH 03/15] perf tests: Stop reading if objdump output crossed sections
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 01/15] perf tests: Take into account address of each objdump line Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 02/15] perf tests: Make objdump disassemble zero blocks Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 04/15] perf tests: Print objdump/dso buffers if they don't match Arnaldo Carvalho de Melo
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jan Stancek, Corey Ashford, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jan Stancek <jstancek@redhat.com>

objdump output can span across multiple sections:

  Disassembly of section .text:
    0000000000000008 <crc32c+0x8>:
       8:       48 89 e5                mov    %rsp,%rbp
       b:       53                      push   %rbx
       c:       8b 01                   mov    (%rcx),%eax
    <snip>
      6b:       90                      nop

  Disassembly of section .init.text:
    0000000000000008 <init_module+0x8>:
       8:       00 00                   add    %al,(%rax)
       a:       00 00                   add    %al,(%rax)
       c:       48 89 e5

Stop further reading if an address starts going backwards, assuming we
crossed sections.

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/9d1ea95e5f9884fdff1be6f761a2feabef37412c.1441181335.git.jstancek@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/code-reading.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index c409409d7765..8145c67fb43a 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -79,7 +79,7 @@ static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
 	size_t line_len, off_last = 0;
 	ssize_t ret;
 	int err = 0;
-	u64 addr;
+	u64 addr, last_addr = start_addr;
 
 	while (off_last < *len) {
 		size_t off, read_bytes, written_bytes;
@@ -101,6 +101,11 @@ static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
 
 		if (sscanf(line, "%"PRIx64, &addr) != 1)
 			continue;
+		if (addr < last_addr) {
+			pr_debug("addr going backwards, read beyond section?\n");
+			break;
+		}
+		last_addr = addr;
 
 		/* copy it from temporary buffer to 'buf' according
 		 * to address on current objdump line */
-- 
2.1.0


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

* [PATCH 04/15] perf tests: Print objdump/dso buffers if they don't match
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (2 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 03/15] perf tests: Stop reading if objdump output crossed sections Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 05/15] tools lib api fs: Make tracing_path_strerror_open message generic Arnaldo Carvalho de Melo
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jan Stancek, Corey Ashford, David Ahern,
	Frederic Weisbecker, Jiri Olsa, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Arnaldo Carvalho de Melo

From: Jan Stancek <jstancek@redhat.com>

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/d0f42f786bc0e965918e0f422df25617a12a4021.1441181335.git.jstancek@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/code-reading.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 8145c67fb43a..2d21183bd661 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -162,6 +162,18 @@ static int read_via_objdump(const char *filename, u64 addr, void *buf,
 	return ret;
 }
 
+static void dump_buf(unsigned char *buf, size_t len)
+{
+	size_t i;
+
+	for (i = 0; i < len; i++) {
+		pr_debug("0x%02x ", buf[i]);
+		if (i % 16 == 15)
+			pr_debug("\n");
+	}
+	pr_debug("\n");
+}
+
 static int read_object_code(u64 addr, size_t len, u8 cpumode,
 			    struct thread *thread, struct state *state)
 {
@@ -264,6 +276,10 @@ static int read_object_code(u64 addr, size_t len, u8 cpumode,
 	/* The results should be identical */
 	if (memcmp(buf1, buf2, len)) {
 		pr_debug("Bytes read differ from those read by objdump\n");
+		pr_debug("buf1 (dso):\n");
+		dump_buf(buf1, len);
+		pr_debug("buf2 (objdump):\n");
+		dump_buf(buf2, len);
 		return -1;
 	}
 	pr_debug("Bytes read match those read by objdump\n");
-- 
2.1.0


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

* [PATCH 05/15] tools lib api fs: Make tracing_path_strerror_open message generic
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (3 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 04/15] perf tests: Print objdump/dso buffers if they don't match Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 06/15] tools lib api fs: Replace debugfs/tracefs objects interface with fs.c Arnaldo Carvalho de Melo
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Matt Fleming, Namhyung Kim,
	Peter Zijlstra, Raphael Beamonte, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Making tracing_path__strerror_open_tp message generic by mentioning both
debugfs/tracefs words in error message plus the tracing_path instead of
debugfs_mountpoint.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1441180605-24737-7-git-send-email-jolsa@kernel.org
[ Add comment for the ENOENT case out of this patch discussion thread ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/fs/tracing_path.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 3b3e4f5fc50b..1e0bb0da5e4f 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -90,33 +90,39 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
 
 	switch (err) {
 	case ENOENT:
-		if (debugfs_configured()) {
+		/*
+		 * We will get here if we can't find the tracepoint, but one of
+		 * debugfs or tracefs is configured, which means you probably
+		 * want some tracepoint which wasn't compiled in your kernel.
+		 * - jirka
+		 */
+		if (debugfs_configured() || tracefs_configured()) {
 			snprintf(buf, size,
 				 "Error:\tFile %s/%s not found.\n"
 				 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
-				 debugfs_mountpoint, filename);
+				 tracing_events_path, filename);
 			break;
 		}
 		snprintf(buf, size, "%s",
-			 "Error:\tUnable to find debugfs\n"
-			 "Hint:\tWas your kernel compiled with debugfs support?\n"
-			 "Hint:\tIs the debugfs filesystem mounted?\n"
+			 "Error:\tUnable to find debugfs/tracefs\n"
+			 "Hint:\tWas your kernel compiled with debugfs/tracefs support?\n"
+			 "Hint:\tIs the debugfs/tracefs filesystem mounted?\n"
 			 "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
 		break;
 	case EACCES: {
-		const char *mountpoint = debugfs_mountpoint;
+		const char *mountpoint = debugfs_find_mountpoint();
 
-		if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
+		if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
 			const char *tracefs_mntpoint = tracefs_find_mountpoint();
 
 			if (tracefs_mntpoint)
-				mountpoint = tracefs_mntpoint;
+				mountpoint = tracefs_find_mountpoint();
 		}
 
 		snprintf(buf, size,
 			 "Error:\tNo permissions to read %s/%s\n"
 			 "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
-			 debugfs_mountpoint, filename, mountpoint);
+			 tracing_events_path, filename, mountpoint);
 	}
 		break;
 	default:
@@ -131,7 +137,7 @@ int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *
 {
 	char path[PATH_MAX];
 
-	snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
+	snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*");
 
 	return strerror_open(err, buf, size, path);
 }
-- 
2.1.0


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

* [PATCH 06/15] tools lib api fs: Replace debugfs/tracefs objects interface with fs.c
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (4 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 05/15] tools lib api fs: Make tracing_path_strerror_open message generic Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 07/15] tools lib api fs: Remove debugfs, tracefs and findfs objects Arnaldo Carvalho de Melo
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Matt Fleming, Namhyung Kim,
	Peter Zijlstra, Raphael Beamonte, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Switching to the fs.c related filesystem framework.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1441180605-24737-14-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/fs/fs.c                      |  1 -
 tools/lib/api/fs/tracing_path.c            | 15 +++++++--------
 tools/perf/builtin-kvm.c                   |  1 -
 tools/perf/builtin-probe.c                 |  1 -
 tools/perf/tests/openat-syscall-all-cpus.c |  5 +++--
 tools/perf/tests/openat-syscall.c          |  5 +++--
 tools/perf/tests/parse-events.c            |  7 +++----
 tools/perf/util/evsel.c                    |  2 +-
 tools/perf/util/probe-event.c              |  5 ++---
 tools/perf/util/probe-file.c               |  7 +++----
 tools/perf/util/util.h                     |  3 +--
 11 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 8afe08a99bc6..791509346178 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -11,7 +11,6 @@
 #include <unistd.h>
 #include <sys/mount.h>
 
-#include "debugfs.h"
 #include "fs.h"
 
 #define _STR(x) #x
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 1e0bb0da5e4f..38aca2dd1946 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -7,8 +7,7 @@
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
-#include "debugfs.h"
-#include "tracefs.h"
+#include "fs.h"
 
 #include "tracing_path.h"
 
@@ -29,7 +28,7 @@ static const char *tracing_path_tracefs_mount(void)
 {
 	const char *mnt;
 
-	mnt = tracefs_mount(NULL);
+	mnt = tracefs__mount();
 	if (!mnt)
 		return NULL;
 
@@ -42,7 +41,7 @@ static const char *tracing_path_debugfs_mount(void)
 {
 	const char *mnt;
 
-	mnt = debugfs_mount(NULL);
+	mnt = debugfs__mount();
 	if (!mnt)
 		return NULL;
 
@@ -96,7 +95,7 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
 		 * want some tracepoint which wasn't compiled in your kernel.
 		 * - jirka
 		 */
-		if (debugfs_configured() || tracefs_configured()) {
+		if (debugfs__configured() || tracefs__configured()) {
 			snprintf(buf, size,
 				 "Error:\tFile %s/%s not found.\n"
 				 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
@@ -110,13 +109,13 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
 			 "Hint:\tTry 'sudo mount -t debugfs nodev /sys/kernel/debug'");
 		break;
 	case EACCES: {
-		const char *mountpoint = debugfs_find_mountpoint();
+		const char *mountpoint = debugfs__mountpoint();
 
 		if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 8) == 0) {
-			const char *tracefs_mntpoint = tracefs_find_mountpoint();
+			const char *tracefs_mntpoint = tracefs__mountpoint();
 
 			if (tracefs_mntpoint)
-				mountpoint = tracefs_find_mountpoint();
+				mountpoint = tracefs__mountpoint();
 		}
 
 		snprintf(buf, size,
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index fc1cffb1b7a2..dd94b4ca2213 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -13,7 +13,6 @@
 #include "util/parse-options.h"
 #include "util/trace-event.h"
 #include "util/debug.h"
-#include <api/fs/debugfs.h>
 #include "util/tool.h"
 #include "util/stat.h"
 #include "util/top.h"
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index ee2c46d8353e..2bec9c1ef2a3 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -37,7 +37,6 @@
 #include "util/strfilter.h"
 #include "util/symbol.h"
 #include "util/debug.h"
-#include <api/fs/debugfs.h>
 #include "util/parse-options.h"
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index a572f87e9c8d..a38adf94c731 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -1,3 +1,4 @@
+#include <api/fs/fs.h>
 #include "evsel.h"
 #include "tests.h"
 #include "thread_map.h"
@@ -30,9 +31,9 @@ int test__openat_syscall_event_on_all_cpus(void)
 
 	evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
 	if (evsel == NULL) {
-		if (tracefs_configured())
+		if (tracefs__configured())
 			pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
-		else if (debugfs_configured())
+		else if (debugfs__configured())
 			pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
 		else
 			pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index c9a37bc6b33a..8048c7d7cd67 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,3 +1,4 @@
+#include <api/fs/fs.h>
 #include "thread_map.h"
 #include "evsel.h"
 #include "debug.h"
@@ -18,9 +19,9 @@ int test__openat_syscall_event(void)
 
 	evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
 	if (evsel == NULL) {
-		if (tracefs_configured())
+		if (tracefs__configured())
 			pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
-		else if (debugfs_configured())
+		else if (debugfs__configured())
 			pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
 		else
 			pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 9b6b2b6324a1..91fbfd593c4a 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -3,11 +3,10 @@
 #include "evsel.h"
 #include "evlist.h"
 #include <api/fs/fs.h>
-#include <api/fs/tracefs.h>
-#include <api/fs/debugfs.h>
 #include "tests.h"
 #include "debug.h"
 #include <linux/hw_breakpoint.h>
+#include <api/fs/fs.h>
 
 #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
 			     PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
@@ -1268,12 +1267,12 @@ static int count_tracepoints(void)
 	DIR *events_dir;
 	int cnt = 0;
 
-	mountpoint = tracefs_find_mountpoint();
+	mountpoint = tracefs__mountpoint();
 	if (mountpoint) {
 		scnprintf(events_path, PATH_MAX, "%s/events",
 			  mountpoint);
 	} else {
-		mountpoint = debugfs_find_mountpoint();
+		mountpoint = debugfs__mountpoint();
 		scnprintf(events_path, PATH_MAX, "%s/tracing/events",
 			  mountpoint);
 	}
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index c53f79123b37..771ade4d5966 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -9,7 +9,7 @@
 
 #include <byteswap.h>
 #include <linux/bitops.h>
-#include <api/fs/debugfs.h>
+#include <api/fs/tracing_path.h>
 #include <traceevent/event-parse.h>
 #include <linux/hw_breakpoint.h>
 #include <linux/perf_event.h>
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index 3da9e1c792fa..5964eccbe94d 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -40,8 +40,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include <api/fs/debugfs.h>
-#include <api/fs/tracefs.h>
+#include <api/fs/fs.h>
 #include "trace-event.h"	/* For __maybe_unused */
 #include "probe-event.h"
 #include "probe-finder.h"
@@ -2054,7 +2053,7 @@ static void kprobe_blacklist__delete(struct list_head *blacklist)
 static int kprobe_blacklist__load(struct list_head *blacklist)
 {
 	struct kprobe_blacklist_node *node;
-	const char *__debugfs = debugfs_find_mountpoint();
+	const char *__debugfs = debugfs__mountpoint();
 	char buf[PATH_MAX], *p;
 	FILE *fp;
 	int ret;
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 38c0a62039cc..499c83ccd44b 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -22,8 +22,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include <api/fs/debugfs.h>
-#include <api/fs/tracefs.h>
+#include <api/fs/fs.h>
 #include "probe-event.h"
 #include "probe-file.h"
 #include "session.h"
@@ -77,11 +76,11 @@ static int open_probe_events(const char *trace_file, bool readwrite)
 	const char *tracing_dir = "";
 	int ret;
 
-	__debugfs = tracefs_find_mountpoint();
+	__debugfs = tracefs__mountpoint();
 	if (__debugfs == NULL) {
 		tracing_dir = "tracing/";
 
-		__debugfs = debugfs_find_mountpoint();
+		__debugfs = debugfs__mountpoint();
 		if (__debugfs == NULL)
 			return -ENOTSUP;
 	}
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 495b99ccb588..3d5b01e8978f 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -74,8 +74,7 @@
 #include <linux/magic.h>
 #include <linux/types.h>
 #include <sys/ttydefaults.h>
-#include <api/fs/debugfs.h>
-#include <api/fs/tracefs.h>
+#include <api/fs/tracing_path.h>
 #include <termios.h>
 #include <linux/bitops.h>
 #include <termios.h>
-- 
2.1.0


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

* [PATCH 07/15] tools lib api fs: Remove debugfs, tracefs and findfs objects
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (5 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 06/15] tools lib api fs: Replace debugfs/tracefs objects interface with fs.c Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 08/15] perf tools: Switch to tracing_path interface on appropriate places Arnaldo Carvalho de Melo
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Matt Fleming, Namhyung Kim,
	Peter Zijlstra, Raphael Beamonte, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

We have all the functionality in fs.c, let's remove unneeded
objects.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1441180605-24737-15-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/api/fs/Build     |  3 --
 tools/lib/api/fs/debugfs.c | 77 ---------------------------------------------
 tools/lib/api/fs/debugfs.h | 23 --------------
 tools/lib/api/fs/findfs.c  | 63 -------------------------------------
 tools/lib/api/fs/findfs.h  | 23 --------------
 tools/lib/api/fs/tracefs.c | 78 ----------------------------------------------
 tools/lib/api/fs/tracefs.h | 21 -------------
 7 files changed, 288 deletions(-)
 delete mode 100644 tools/lib/api/fs/debugfs.c
 delete mode 100644 tools/lib/api/fs/debugfs.h
 delete mode 100644 tools/lib/api/fs/findfs.c
 delete mode 100644 tools/lib/api/fs/findfs.h
 delete mode 100644 tools/lib/api/fs/tracefs.c
 delete mode 100644 tools/lib/api/fs/tracefs.h

diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
index fa726f679b29..f4ed9629ae85 100644
--- a/tools/lib/api/fs/Build
+++ b/tools/lib/api/fs/Build
@@ -1,5 +1,2 @@
 libapi-y += fs.o
 libapi-y += tracing_path.o
-libapi-y += debugfs.o
-libapi-y += findfs.o
-libapi-y += tracefs.o
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
deleted file mode 100644
index c707cfb32782..000000000000
--- a/tools/lib/api/fs/debugfs.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#define _GNU_SOURCE
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-#include <linux/kernel.h>
-
-#include "debugfs.h"
-#include "tracefs.h"
-
-#ifndef DEBUGFS_DEFAULT_PATH
-#define DEBUGFS_DEFAULT_PATH		"/sys/kernel/debug"
-#endif
-
-char debugfs_mountpoint[PATH_MAX + 1] = DEBUGFS_DEFAULT_PATH;
-
-static const char * const debugfs_known_mountpoints[] = {
-	DEBUGFS_DEFAULT_PATH,
-	"/debug",
-	0,
-};
-
-static bool debugfs_found;
-
-bool debugfs_configured(void)
-{
-	return debugfs_find_mountpoint() != NULL;
-}
-
-/* find the path to the mounted debugfs */
-const char *debugfs_find_mountpoint(void)
-{
-	const char *ret;
-
-	if (debugfs_found)
-		return (const char *)debugfs_mountpoint;
-
-	ret = find_mountpoint("debugfs", (long) DEBUGFS_MAGIC,
-			      debugfs_mountpoint, PATH_MAX + 1,
-			      debugfs_known_mountpoints);
-	if (ret)
-		debugfs_found = true;
-
-	return ret;
-}
-
-/* mount the debugfs somewhere if it's not mounted */
-char *debugfs_mount(const char *mountpoint)
-{
-	/* see if it's already mounted */
-	if (debugfs_find_mountpoint())
-		goto out;
-
-	/* if not mounted and no argument */
-	if (mountpoint == NULL) {
-		/* see if environment variable set */
-		mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT);
-		/* if no environment variable, use default */
-		if (mountpoint == NULL)
-			mountpoint = DEBUGFS_DEFAULT_PATH;
-	}
-
-	if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
-		return NULL;
-
-	/* save the mountpoint */
-	debugfs_found = true;
-	strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
-out:
-	return debugfs_mountpoint;
-}
diff --git a/tools/lib/api/fs/debugfs.h b/tools/lib/api/fs/debugfs.h
deleted file mode 100644
index 455023698d2b..000000000000
--- a/tools/lib/api/fs/debugfs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __API_DEBUGFS_H__
-#define __API_DEBUGFS_H__
-
-#include "findfs.h"
-
-#ifndef DEBUGFS_MAGIC
-#define DEBUGFS_MAGIC          0x64626720
-#endif
-
-#ifndef PERF_DEBUGFS_ENVIRONMENT
-#define PERF_DEBUGFS_ENVIRONMENT "PERF_DEBUGFS_DIR"
-#endif
-
-bool debugfs_configured(void);
-const char *debugfs_find_mountpoint(void);
-char *debugfs_mount(const char *mountpoint);
-
-extern char debugfs_mountpoint[];
-
-int debugfs__strerror_open(int err, char *buf, size_t size, const char *filename);
-int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name);
-
-#endif /* __API_DEBUGFS_H__ */
diff --git a/tools/lib/api/fs/findfs.c b/tools/lib/api/fs/findfs.c
deleted file mode 100644
index 49946cb6d7af..000000000000
--- a/tools/lib/api/fs/findfs.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-
-#include "findfs.h"
-
-/* verify that a mountpoint is actually the type we want */
-
-int valid_mountpoint(const char *mount, long magic)
-{
-	struct statfs st_fs;
-
-	if (statfs(mount, &st_fs) < 0)
-		return -ENOENT;
-	else if ((long)st_fs.f_type != magic)
-		return -ENOENT;
-
-	return 0;
-}
-
-/* find the path to a mounted file system */
-const char *find_mountpoint(const char *fstype, long magic,
-			    char *mountpoint, int len,
-			    const char * const *known_mountpoints)
-{
-	const char * const *ptr;
-	char format[128];
-	char type[100];
-	FILE *fp;
-
-	if (known_mountpoints) {
-		ptr = known_mountpoints;
-		while (*ptr) {
-			if (valid_mountpoint(*ptr, magic) == 0) {
-				strncpy(mountpoint, *ptr, len - 1);
-				mountpoint[len-1] = 0;
-				return mountpoint;
-			}
-			ptr++;
-		}
-	}
-
-	/* give up and parse /proc/mounts */
-	fp = fopen("/proc/mounts", "r");
-	if (fp == NULL)
-		return NULL;
-
-	snprintf(format, 128, "%%*s %%%ds %%99s %%*s %%*d %%*d\n", len);
-
-	while (fscanf(fp, format, mountpoint, type) == 2) {
-		if (strcmp(type, fstype) == 0)
-			break;
-	}
-	fclose(fp);
-
-	if (strcmp(type, fstype) != 0)
-		return NULL;
-
-	return mountpoint;
-}
diff --git a/tools/lib/api/fs/findfs.h b/tools/lib/api/fs/findfs.h
deleted file mode 100644
index b6f5d05acc42..000000000000
--- a/tools/lib/api/fs/findfs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __API_FINDFS_H__
-#define __API_FINDFS_H__
-
-#include <stdbool.h>
-
-#define _STR(x) #x
-#define STR(x) _STR(x)
-
-/*
- * On most systems <limits.h> would have given us this, but  not on some systems
- * (e.g. GNU/Hurd).
- */
-#ifndef PATH_MAX
-#define PATH_MAX 4096
-#endif
-
-const char *find_mountpoint(const char *fstype, long magic,
-			    char *mountpoint, int len,
-			    const char * const *known_mountpoints);
-
-int valid_mountpoint(const char *mount, long magic);
-
-#endif /* __API_FINDFS_H__ */
diff --git a/tools/lib/api/fs/tracefs.c b/tools/lib/api/fs/tracefs.c
deleted file mode 100644
index e4aa9688b71e..000000000000
--- a/tools/lib/api/fs/tracefs.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdbool.h>
-#include <sys/vfs.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/mount.h>
-#include <linux/kernel.h>
-
-#include "tracefs.h"
-
-#ifndef TRACEFS_DEFAULT_PATH
-#define TRACEFS_DEFAULT_PATH		"/sys/kernel/tracing"
-#endif
-
-char tracefs_mountpoint[PATH_MAX + 1] = TRACEFS_DEFAULT_PATH;
-
-static const char * const tracefs_known_mountpoints[] = {
-	TRACEFS_DEFAULT_PATH,
-	"/sys/kernel/debug/tracing",
-	"/tracing",
-	"/trace",
-	0,
-};
-
-static bool tracefs_found;
-
-bool tracefs_configured(void)
-{
-	return tracefs_find_mountpoint() != NULL;
-}
-
-/* find the path to the mounted tracefs */
-const char *tracefs_find_mountpoint(void)
-{
-	const char *ret;
-
-	if (tracefs_found)
-		return (const char *)tracefs_mountpoint;
-
-	ret = find_mountpoint("tracefs", (long) TRACEFS_MAGIC,
-			      tracefs_mountpoint, PATH_MAX + 1,
-			      tracefs_known_mountpoints);
-
-	if (ret)
-		tracefs_found = true;
-
-	return ret;
-}
-
-/* mount the tracefs somewhere if it's not mounted */
-char *tracefs_mount(const char *mountpoint)
-{
-	/* see if it's already mounted */
-	if (tracefs_find_mountpoint())
-		goto out;
-
-	/* if not mounted and no argument */
-	if (mountpoint == NULL) {
-		/* see if environment variable set */
-		mountpoint = getenv(PERF_TRACEFS_ENVIRONMENT);
-		/* if no environment variable, use default */
-		if (mountpoint == NULL)
-			mountpoint = TRACEFS_DEFAULT_PATH;
-	}
-
-	if (mount(NULL, mountpoint, "tracefs", 0, NULL) < 0)
-		return NULL;
-
-	/* save the mountpoint */
-	tracefs_found = true;
-	strncpy(tracefs_mountpoint, mountpoint, sizeof(tracefs_mountpoint));
-out:
-	return tracefs_mountpoint;
-}
diff --git a/tools/lib/api/fs/tracefs.h b/tools/lib/api/fs/tracefs.h
deleted file mode 100644
index da780ac49acb..000000000000
--- a/tools/lib/api/fs/tracefs.h
+++ /dev/null
@@ -1,21 +0,0 @@
-#ifndef __API_TRACEFS_H__
-#define __API_TRACEFS_H__
-
-#include "findfs.h"
-
-#ifndef TRACEFS_MAGIC
-#define TRACEFS_MAGIC          0x74726163
-#endif
-
-#ifndef PERF_TRACEFS_ENVIRONMENT
-#define PERF_TRACEFS_ENVIRONMENT "PERF_TRACEFS_DIR"
-#endif
-
-bool tracefs_configured(void);
-const char *tracefs_find_mountpoint(void);
-int tracefs_valid_mountpoint(const char *debugfs);
-char *tracefs_mount(const char *mountpoint);
-
-extern char tracefs_mountpoint[];
-
-#endif /* __API_DEBUGFS_H__ */
-- 
2.1.0


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

* [PATCH 08/15] perf tools: Switch to tracing_path interface on appropriate places
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (6 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 07/15] tools lib api fs: Remove debugfs, tracefs and findfs objects Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 09/15] perf test: Add entry to test cpu topology Arnaldo Carvalho de Melo
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Jiri Olsa, David Ahern, Matt Fleming, Namhyung Kim,
	Peter Zijlstra, Raphael Beamonte, Steven Rostedt,
	Arnaldo Carvalho de Melo

From: Jiri Olsa <jolsa@kernel.org>

Using tracing_path interface on several places, that more or less
copy the functionality of tracing_path interface.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1441180605-24737-16-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/openat-syscall-all-cpus.c |  9 +++------
 tools/perf/tests/openat-syscall.c          | 11 ++++-------
 tools/perf/tests/parse-events.c            | 16 ++--------------
 tools/perf/util/probe-file.c               | 14 ++------------
 4 files changed, 11 insertions(+), 39 deletions(-)

diff --git a/tools/perf/tests/openat-syscall-all-cpus.c b/tools/perf/tests/openat-syscall-all-cpus.c
index a38adf94c731..495d8126b722 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -15,6 +15,7 @@ int test__openat_syscall_event_on_all_cpus(void)
 	cpu_set_t cpu_set;
 	struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
 	char sbuf[STRERR_BUFSIZE];
+	char errbuf[BUFSIZ];
 
 	if (threads == NULL) {
 		pr_debug("thread_map__new\n");
@@ -31,12 +32,8 @@ int test__openat_syscall_event_on_all_cpus(void)
 
 	evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
 	if (evsel == NULL) {
-		if (tracefs__configured())
-			pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
-		else if (debugfs__configured())
-			pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
-		else
-			pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");
+		tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
+		pr_err("%s\n", errbuf);
 		goto out_thread_map_delete;
 	}
 
diff --git a/tools/perf/tests/openat-syscall.c b/tools/perf/tests/openat-syscall.c
index 8048c7d7cd67..08ac9d94a050 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,4 +1,4 @@
-#include <api/fs/fs.h>
+#include <api/fs/tracing_path.h>
 #include "thread_map.h"
 #include "evsel.h"
 #include "debug.h"
@@ -11,6 +11,7 @@ int test__openat_syscall_event(void)
 	unsigned int nr_openat_calls = 111, i;
 	struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
 	char sbuf[STRERR_BUFSIZE];
+	char errbuf[BUFSIZ];
 
 	if (threads == NULL) {
 		pr_debug("thread_map__new\n");
@@ -19,12 +20,8 @@ int test__openat_syscall_event(void)
 
 	evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
 	if (evsel == NULL) {
-		if (tracefs__configured())
-			pr_debug("is tracefs mounted on /sys/kernel/tracing?\n");
-		else if (debugfs__configured())
-			pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
-		else
-			pr_debug("Neither tracefs or debugfs is enabled in this kernel\n");
+		tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), "syscalls", "sys_enter_openat");
+		pr_err("%s\n", errbuf);
 		goto out_thread_map_delete;
 	}
 
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 91fbfd593c4a..3a2ebe666192 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1261,23 +1261,11 @@ test__checkevent_breakpoint_len_rw_modifier(struct perf_evlist *evlist)
 
 static int count_tracepoints(void)
 {
-	char events_path[PATH_MAX];
 	struct dirent *events_ent;
-	const char *mountpoint;
 	DIR *events_dir;
 	int cnt = 0;
 
-	mountpoint = tracefs__mountpoint();
-	if (mountpoint) {
-		scnprintf(events_path, PATH_MAX, "%s/events",
-			  mountpoint);
-	} else {
-		mountpoint = debugfs__mountpoint();
-		scnprintf(events_path, PATH_MAX, "%s/tracing/events",
-			  mountpoint);
-	}
-
-	events_dir = opendir(events_path);
+	events_dir = opendir(tracing_events_path);
 
 	TEST_ASSERT_VAL("Can't open events dir", events_dir);
 
@@ -1294,7 +1282,7 @@ static int count_tracepoints(void)
 			continue;
 
 		scnprintf(sys_path, PATH_MAX, "%s/%s",
-			  events_path, events_ent->d_name);
+			  tracing_events_path, events_ent->d_name);
 
 		sys_dir = opendir(sys_path);
 		TEST_ASSERT_VAL("Can't open sys dir", sys_dir);
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index 499c83ccd44b..89dbeb92c68e 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -22,7 +22,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include <api/fs/fs.h>
+#include <api/fs/tracing_path.h>
 #include "probe-event.h"
 #include "probe-file.h"
 #include "session.h"
@@ -72,21 +72,11 @@ static void print_both_open_warning(int kerr, int uerr)
 static int open_probe_events(const char *trace_file, bool readwrite)
 {
 	char buf[PATH_MAX];
-	const char *__debugfs;
 	const char *tracing_dir = "";
 	int ret;
 
-	__debugfs = tracefs__mountpoint();
-	if (__debugfs == NULL) {
-		tracing_dir = "tracing/";
-
-		__debugfs = debugfs__mountpoint();
-		if (__debugfs == NULL)
-			return -ENOTSUP;
-	}
-
 	ret = e_snprintf(buf, PATH_MAX, "%s/%s%s",
-			 __debugfs, tracing_dir, trace_file);
+			 tracing_path, tracing_dir, trace_file);
 	if (ret >= 0) {
 		pr_debug("Opening %s write=%d\n", buf, readwrite);
 		if (readwrite && !probe_event_dry_run)
-- 
2.1.0


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

* [PATCH 09/15] perf test: Add entry to test cpu topology
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (7 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 08/15] perf tools: Switch to tracing_path interface on appropriate places Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 10/15] perf tools: Add processor socket info to hist_entry and addr_location Arnaldo Carvalho de Melo
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Kan Liang, Andi Kleen, Jiri Olsa, Arnaldo Carvalho de Melo

From: Kan Liang <kan.liang@intel.com>

This patch test cpu core_id and socket_id which are stored in perf_env.

Commiter note:

  # perf test topo
  40: Test topology in session: Ok

  # perf test -v topo
  40: Test topology in session:
  --- start ---
  test child forked, pid 31767
  templ file: /tmp/perf-test-VTZ1PL
  CPU 0, core 0, socket 0
  CPU 1, core 1, socket 0
  CPU 2, core 0, socket 0
  CPU 3, core 1, socket 0
  test child finished with 0
  ---- end ----
  Test topology in session: Ok
  #

Based-on-a-patch-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Kan Liang <kan.liang@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1441357111-64522-1-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/Build          |   1 +
 tools/perf/tests/builtin-test.c |   4 ++
 tools/perf/tests/tests.h        |   1 +
 tools/perf/tests/topology.c     | 115 ++++++++++++++++++++++++++++++++++++++++
 4 files changed, 121 insertions(+)
 create mode 100644 tools/perf/tests/topology.c

diff --git a/tools/perf/tests/Build b/tools/perf/tests/Build
index 51fb737f82fc..c6f198ae65fb 100644
--- a/tools/perf/tests/Build
+++ b/tools/perf/tests/Build
@@ -33,6 +33,7 @@ perf-y += parse-no-sample-id-all.o
 perf-y += kmod-path.o
 perf-y += thread-map.o
 perf-y += llvm.o
+perf-y += topology.o
 
 perf-$(CONFIG_X86) += perf-time-to-tsc.o
 ifdef CONFIG_AUXTRACE
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 69a77f71d594..98b0b2486100 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -187,6 +187,10 @@ static struct test {
 #endif
 #endif
 	{
+		.desc = "Test topology in session",
+		.func = test_session_topology,
+	},
+	{
 		.func = NULL,
 	},
 };
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 4e2c5458269a..0b3549672c16 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -64,6 +64,7 @@ int test__kmod_path__parse(void);
 int test__thread_map(void);
 int test__llvm(void);
 int test__insn_x86(void);
+int test_session_topology(void);
 
 #if defined(__x86_64__) || defined(__i386__) || defined(__arm__) || defined(__aarch64__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
diff --git a/tools/perf/tests/topology.c b/tools/perf/tests/topology.c
new file mode 100644
index 000000000000..c3aff53a976a
--- /dev/null
+++ b/tools/perf/tests/topology.c
@@ -0,0 +1,115 @@
+#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "tests.h"
+#include "util.h"
+#include "session.h"
+#include "evlist.h"
+#include "debug.h"
+
+#define TEMPL "/tmp/perf-test-XXXXXX"
+#define DATA_SIZE	10
+
+static int get_temp(char *path)
+{
+	int fd;
+
+	strcpy(path, TEMPL);
+
+	fd = mkstemp(path);
+	if (fd < 0) {
+		perror("mkstemp failed");
+		return -1;
+	}
+
+	close(fd);
+	return 0;
+}
+
+static int session_write_header(char *path)
+{
+	struct perf_session *session;
+	struct perf_data_file file = {
+		.path = path,
+		.mode = PERF_DATA_MODE_WRITE,
+	};
+
+	session = perf_session__new(&file, false, NULL);
+	TEST_ASSERT_VAL("can't get session", session);
+
+	session->evlist = perf_evlist__new_default();
+	TEST_ASSERT_VAL("can't get evlist", session->evlist);
+
+	perf_header__set_feat(&session->header, HEADER_CPU_TOPOLOGY);
+	perf_header__set_feat(&session->header, HEADER_NRCPUS);
+
+	session->header.data_size += DATA_SIZE;
+
+	TEST_ASSERT_VAL("failed to write header",
+			!perf_session__write_header(session, session->evlist, file.fd, true));
+
+	perf_session__delete(session);
+
+	return 0;
+}
+
+static int check_cpu_topology(char *path, struct cpu_map *map)
+{
+	struct perf_session *session;
+	struct perf_data_file file = {
+		.path = path,
+		.mode = PERF_DATA_MODE_READ,
+	};
+	int i;
+
+	session = perf_session__new(&file, false, NULL);
+	TEST_ASSERT_VAL("can't get session", session);
+
+	for (i = 0; i < session->header.env.nr_cpus_online; i++) {
+		pr_debug("CPU %d, core %d, socket %d\n", i,
+			 session->header.env.cpu[i].core_id,
+			 session->header.env.cpu[i].socket_id);
+	}
+
+	for (i = 0; i < map->nr; i++) {
+		TEST_ASSERT_VAL("Core ID doesn't match",
+			(session->header.env.cpu[map->map[i]].core_id == (cpu_map__get_core(map, i) & 0xffff)));
+
+		TEST_ASSERT_VAL("Socket ID doesn't match",
+			(session->header.env.cpu[map->map[i]].socket_id == cpu_map__get_socket(map, i)));
+	}
+
+	perf_session__delete(session);
+
+	return 0;
+}
+
+int test_session_topology(void)
+{
+	char path[PATH_MAX];
+	struct cpu_map *map;
+	int ret = -1;
+
+	TEST_ASSERT_VAL("can't get templ file", !get_temp(path));
+
+	pr_debug("templ file: %s\n", path);
+
+	if (session_write_header(path))
+		goto free_path;
+
+	map = cpu_map__new(NULL);
+	if (map == NULL) {
+		pr_debug("failed to get system cpumap\n");
+		goto free_path;
+	}
+
+	if (check_cpu_topology(path, map))
+		goto free_map;
+	ret = 0;
+
+free_map:
+	cpu_map__put(map);
+free_path:
+	unlink(path);
+	return ret;
+}
-- 
2.1.0


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

* [PATCH 10/15] perf tools: Add processor socket info to hist_entry and addr_location
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (8 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 09/15] perf test: Add entry to test cpu topology Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 11/15] perf tools: Introduce new sort type "socket" for the processor socket Arnaldo Carvalho de Melo
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Kan Liang, Adrian Hunter, Andi Kleen, Jiri Olsa,
	Namhyung Kim, Stephane Eranian, Arnaldo Carvalho de Melo

From: Kan Liang <kan.liang@intel.com>

Add processor socket id info in hist_entry and addr_location.

Finor 'perf report', the socket id info is from perf.data.

For others, the socket id info is from current system.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1441377946-44429-1-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-report.c | 4 ++++
 tools/perf/util/event.c     | 1 +
 tools/perf/util/hist.c      | 1 +
 tools/perf/util/sort.h      | 1 +
 tools/perf/util/symbol.h    | 1 +
 5 files changed, 8 insertions(+)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 62b285e32aa5..affd70d064bc 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -149,6 +149,7 @@ static int process_sample_event(struct perf_tool *tool,
 		.add_entry_cb 		= hist_iter__report_callback,
 	};
 	int ret = 0;
+	struct perf_env *env = evsel->evlist->env;
 
 	if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) {
 		pr_debug("problem processing %d event, skipping it.\n",
@@ -156,6 +157,9 @@ static int process_sample_event(struct perf_tool *tool,
 		return -1;
 	}
 
+	/* read socket id from perf.data for perf report */
+	al.socket = env->cpu[al.cpu].socket_id;
+
 	if (rep->hide_unresolved && al.sym == NULL)
 		goto out_put;
 
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 7ff61274ed57..0bf8c9889fc0 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -1021,6 +1021,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
 
 	al->sym = NULL;
 	al->cpu = sample->cpu;
+	al->socket = cpu_map__get_socket_id(al->cpu);
 
 	if (al->map) {
 		struct dso *dso = al->map->dso;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 08b6cd945f1e..80c4683b3192 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -452,6 +452,7 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
 			.map	= al->map,
 			.sym	= al->sym,
 		},
+		.socket	 = al->socket,
 		.cpu	 = al->cpu,
 		.cpumode = al->cpumode,
 		.ip	 = al->addr,
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 3c2a399f8f5b..7cf1cf7d2406 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -90,6 +90,7 @@ struct hist_entry {
 	struct comm		*comm;
 	u64			ip;
 	u64			transaction;
+	s32			socket;
 	s32			cpu;
 	u8			cpumode;
 
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 440ba8ae888f..40073c60b83d 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -191,6 +191,7 @@ struct addr_location {
 	u8	      filtered;
 	u8	      cpumode;
 	s32	      cpu;
+	s32	      socket;
 };
 
 struct symsrc {
-- 
2.1.0


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

* [PATCH 11/15] perf tools: Introduce new sort type "socket" for the processor socket
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (9 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 10/15] perf tools: Add processor socket info to hist_entry and addr_location Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 12/15] perf report: Introduce --socket-filter option Arnaldo Carvalho de Melo
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Kan Liang, Adrian Hunter, Andi Kleen, Jiri Olsa,
	Namhyung Kim, Stephane Eranian, Arnaldo Carvalho de Melo

From: Kan Liang <kan.liang@intel.com>

This patch enable perf report to sort by processor socket:

  $ perf report --stdio --sort socket,comm,dso,symbol
  # To display the perf.data header info, please use --header/--header-only options.
  #
  # Total Lost Samples: 0
  #
  # Samples: 686  of event 'cycles'
  # Event count (approx.): 349215462
  #
  # Overhead SOCKET Command Shared Object    Symbol
  # ........ ...... ....... ................ ............................
  #
    97.05%    000   test    test             [.] plusB_c
     0.98%    000   test    test             [.] plusA_c
     0.93%    001   perf    [kernel.vmlinux] [k] smp_call_function_single
     0.19%    001   perf    [kernel.vmlinux] [k] page_fault
     0.19%    001   swapper [kernel.vmlinux] [k] pm_qos_request
     0.16%    000   test    [kernel.vmlinux] [k] add_mm_counter_fast

Signed-off-by: Kan Liang <kan.liang@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1441377946-44429-2-git-send-email-kan.liang@intel.com
[ Fix column calculation, un-allcapsify column header ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-report.txt |  3 ++-
 tools/perf/util/hist.c                   |  1 +
 tools/perf/util/hist.h                   |  1 +
 tools/perf/util/sort.c                   | 22 ++++++++++++++++++++++
 tools/perf/util/sort.h                   |  1 +
 5 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 9c7981bfddad..92361a7771f4 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -68,7 +68,7 @@ OPTIONS
 --sort=::
 	Sort histogram entries by given key(s) - multiple keys can be specified
 	in CSV format.  Following sort keys are available:
-	pid, comm, dso, symbol, parent, cpu, srcline, weight, local_weight.
+	pid, comm, dso, symbol, parent, cpu, socket, srcline, weight, local_weight.
 
 	Each key has following meaning:
 
@@ -79,6 +79,7 @@ OPTIONS
 	- parent: name of function matched to the parent regex filter. Unmatched
 	entries are displayed as "[other]".
 	- cpu: cpu number the task ran at the time of sample
+	- socket: processor socket number the task ran at the time of sample
 	- srcline: filename and line number executed at the time of sample.  The
 	DWARF debugging info must be provided.
 	- srcfile: file name of the source file of the same. Requires dwarf
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 80c4683b3192..b5440a5b5240 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -144,6 +144,7 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h)
 		hists__set_unres_dso_col_len(hists, HISTC_MEM_DADDR_DSO);
 	}
 
+	hists__new_col_len(hists, HISTC_SOCKET, 6);
 	hists__new_col_len(hists, HISTC_MEM_LOCKED, 6);
 	hists__new_col_len(hists, HISTC_MEM_TLB, 22);
 	hists__new_col_len(hists, HISTC_MEM_SNOOP, 12);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index de6d58e7f0d5..5d04d28eedd7 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -29,6 +29,7 @@ enum hist_column {
 	HISTC_COMM,
 	HISTC_PARENT,
 	HISTC_CPU,
+	HISTC_SOCKET,
 	HISTC_SRCLINE,
 	HISTC_SRCFILE,
 	HISTC_MISPREDICT,
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index a97bceeac0e7..5e4ed1779f6f 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -421,6 +421,27 @@ struct sort_entry sort_cpu = {
 	.se_width_idx	= HISTC_CPU,
 };
 
+/* --sort socket */
+
+static int64_t
+sort__socket_cmp(struct hist_entry *left, struct hist_entry *right)
+{
+	return right->socket - left->socket;
+}
+
+static int hist_entry__socket_snprintf(struct hist_entry *he, char *bf,
+				    size_t size, unsigned int width)
+{
+	return repsep_snprintf(bf, size, "%*.*d", width, width-3, he->socket);
+}
+
+struct sort_entry sort_socket = {
+	.se_header      = "Socket",
+	.se_cmp	        = sort__socket_cmp,
+	.se_snprintf    = hist_entry__socket_snprintf,
+	.se_width_idx	= HISTC_SOCKET,
+};
+
 /* sort keys for branch stacks */
 
 static int64_t
@@ -1248,6 +1269,7 @@ static struct sort_dimension common_sort_dimensions[] = {
 	DIM(SORT_SYM, "symbol", sort_sym),
 	DIM(SORT_PARENT, "parent", sort_parent),
 	DIM(SORT_CPU, "cpu", sort_cpu),
+	DIM(SORT_SOCKET, "socket", sort_socket),
 	DIM(SORT_SRCLINE, "srcline", sort_srcline),
 	DIM(SORT_SRCFILE, "srcfile", sort_srcfile),
 	DIM(SORT_LOCAL_WEIGHT, "local_weight", sort_local_weight),
diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h
index 7cf1cf7d2406..654ac8a2c565 100644
--- a/tools/perf/util/sort.h
+++ b/tools/perf/util/sort.h
@@ -173,6 +173,7 @@ enum sort_type {
 	SORT_SYM,
 	SORT_PARENT,
 	SORT_CPU,
+	SORT_SOCKET,
 	SORT_SRCLINE,
 	SORT_SRCFILE,
 	SORT_LOCAL_WEIGHT,
-- 
2.1.0


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

* [PATCH 12/15] perf report: Introduce --socket-filter option
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (10 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 11/15] perf tools: Introduce new sort type "socket" for the processor socket Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 13/15] perf hists browser: Zoom in/out for processor socket Arnaldo Carvalho de Melo
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Kan Liang, Adrian Hunter, Andi Kleen, Jiri Olsa,
	Namhyung Kim, Stephane Eranian, Arnaldo Carvalho de Melo

From: Kan Liang <kan.liang@intel.com>

Introduce --socket-filter option for 'perf report' to only show entries
for a processor socket that match this filter.

  $ perf report --socket-filter 1 --stdio
  # To display the perf.data header info, please use --header/--header-only options.
  #
  # Total Lost Samples: 0
  #
  # Samples: 752  of event 'cycles'
  # Event count (approx.): 350995599
  # Processor Socket: 1
  #
  # Overhead  Command    Shared Object     Symbol
  # ........  .........  ................  .................................
  #
      97.02%  test       test              [.] plusB_c
       0.97%  test       test              [.] plusA_c
       0.23%  swapper    [kernel.vmlinux]  [k] acpi_idle_do_entry
       0.09%  rcu_sched  [kernel.vmlinux]  [k] dyntick_save_progress_counter
       0.01%  swapper    [kernel.vmlinux]  [k] task_waking_fair
       0.00%  swapper    [kernel.vmlinux]  [k] run_timer_softirq

Signed-off-by: Kan Liang <kan.liang@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1441377946-44429-3-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-report.txt |  3 +++
 tools/perf/builtin-report.c              | 11 +++++++++++
 tools/perf/ui/browsers/hists.c           |  4 ++++
 tools/perf/util/hist.c                   | 16 ++++++++++++++++
 tools/perf/util/hist.h                   |  4 +++-
 5 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt
index 92361a7771f4..b941d5e07e28 100644
--- a/tools/perf/Documentation/perf-report.txt
+++ b/tools/perf/Documentation/perf-report.txt
@@ -350,6 +350,9 @@ include::itrace.txt[]
 	This option extends the perf report to show reference callgraphs,
 	which collected by reference event, in no callgraph event.
 
+--socket-filter::
+	Only report the samples on the processor socket that match with this filter
+
 include::callchain-overhead-calculation.txt[]
 
 SEE ALSO
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index affd70d064bc..4b432453922f 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -62,6 +62,7 @@ struct report {
 	float			min_percent;
 	u64			nr_entries;
 	u64			queue_size;
+	int			socket_filter;
 	DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS);
 };
 
@@ -290,6 +291,7 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
 	struct perf_evsel *evsel = hists_to_evsel(hists);
 	char buf[512];
 	size_t size = sizeof(buf);
+	int socket = hists->socket_filter;
 
 	if (symbol_conf.filter_relative) {
 		nr_samples = hists->stats.nr_non_filtered_samples;
@@ -330,6 +332,10 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
 		ret += fprintf(fp, "\n# Sort order   : %s", sort_order ? : default_mem_sort_order);
 	} else
 		ret += fprintf(fp, "\n# Event count (approx.): %" PRIu64, nr_events);
+
+	if (socket > -1)
+		ret += fprintf(fp, "\n# Processor Socket: %d", socket);
+
 	return ret + fprintf(fp, "\n#\n");
 }
 
@@ -454,6 +460,8 @@ static void report__collapse_hists(struct report *rep)
 		if (pos->idx == 0)
 			hists->symbol_filter_str = rep->symbol_filter_str;
 
+		hists->socket_filter = rep->socket_filter;
+
 		hists__collapse_resort(hists, &prog);
 
 		/* Non-group events are considered as leader */
@@ -639,6 +647,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 		},
 		.max_stack		 = PERF_MAX_STACK_DEPTH,
 		.pretty_printing_style	 = "normal",
+		.socket_filter		 = -1,
 	};
 	const struct option options[] = {
 	OPT_STRING('i', "input", &input_name, "file",
@@ -751,6 +760,8 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
 			"Show full source file name path for source lines"),
 	OPT_BOOLEAN(0, "show-ref-call-graph", &symbol_conf.show_ref_callgraph,
 		    "Show callgraph from reference event"),
+	OPT_INTEGER(0, "socket-filter", &report.socket_filter,
+		    "only show processor socket that match with this filter"),
 	OPT_END()
 	};
 	struct perf_data_file file = {
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index cf86f2d3a5e7..457f24c8fbe0 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1261,6 +1261,7 @@ static int hists__browser_title(struct hists *hists,
 	int printed;
 	const struct dso *dso = hists->dso_filter;
 	const struct thread *thread = hists->thread_filter;
+	int socket = hists->socket_filter;
 	unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
 	u64 nr_events = hists->stats.total_period;
 	struct perf_evsel *evsel = hists_to_evsel(hists);
@@ -1314,6 +1315,9 @@ static int hists__browser_title(struct hists *hists,
 	if (dso)
 		printed += scnprintf(bf + printed, size - printed,
 				    ", DSO: %s", dso->short_name);
+	if (socket > -1)
+		printed += scnprintf(bf + printed, size - printed,
+				    ", Processor Socket: %d", socket);
 	if (!is_report_browser(hbt)) {
 		struct perf_top *top = hbt->arg;
 
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b5440a5b5240..58687a10e03f 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -15,6 +15,8 @@ static bool hists__filter_entry_by_thread(struct hists *hists,
 					  struct hist_entry *he);
 static bool hists__filter_entry_by_symbol(struct hists *hists,
 					  struct hist_entry *he);
+static bool hists__filter_entry_by_socket(struct hists *hists,
+					  struct hist_entry *he);
 
 u16 hists__col_len(struct hists *hists, enum hist_column col)
 {
@@ -1026,6 +1028,7 @@ static void hists__apply_filters(struct hists *hists, struct hist_entry *he)
 	hists__filter_entry_by_dso(hists, he);
 	hists__filter_entry_by_thread(hists, he);
 	hists__filter_entry_by_symbol(hists, he);
+	hists__filter_entry_by_socket(hists, he);
 }
 
 void hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
@@ -1294,6 +1297,18 @@ void hists__filter_by_symbol(struct hists *hists)
 	}
 }
 
+static bool hists__filter_entry_by_socket(struct hists *hists,
+					  struct hist_entry *he)
+{
+	if ((hists->socket_filter > -1) &&
+	    (he->socket != hists->socket_filter)) {
+		he->filtered |= (1 << HIST_FILTER__SOCKET);
+		return true;
+	}
+
+	return false;
+}
+
 void events_stats__inc(struct events_stats *stats, u32 type)
 {
 	++stats->nr_events[0];
@@ -1519,6 +1534,7 @@ static int hists_evsel__init(struct perf_evsel *evsel)
 	hists->entries_collapsed = RB_ROOT;
 	hists->entries = RB_ROOT;
 	pthread_mutex_init(&hists->lock, NULL);
+	hists->socket_filter = -1;
 	return 0;
 }
 
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index 5d04d28eedd7..ef682f210923 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -20,6 +20,7 @@ enum hist_filter {
 	HIST_FILTER__SYMBOL,
 	HIST_FILTER__GUEST,
 	HIST_FILTER__HOST,
+	HIST_FILTER__SOCKET,
 };
 
 enum hist_column {
@@ -71,6 +72,7 @@ struct hists {
 	struct events_stats	stats;
 	u64			event_stream;
 	u16			col_len[HISTC_NR_COLS];
+	int			socket_filter;
 };
 
 struct hist_entry_iter;
@@ -149,7 +151,7 @@ void hists__filter_by_symbol(struct hists *hists);
 static inline bool hists__has_filter(struct hists *hists)
 {
 	return hists->thread_filter || hists->dso_filter ||
-		hists->symbol_filter_str;
+		hists->symbol_filter_str || (hists->socket_filter > -1);
 }
 
 u16 hists__col_len(struct hists *hists, enum hist_column col);
-- 
2.1.0


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

* [PATCH 13/15] perf hists browser: Zoom in/out for processor socket
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (11 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 12/15] perf report: Introduce --socket-filter option Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 14/15] perf test: Add entry for hists socket filter Arnaldo Carvalho de Melo
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Kan Liang, Adrian Hunter, Andi Kleen, Jiri Olsa,
	Namhyung Kim, Stephane Eranian, Arnaldo Carvalho de Melo

From: Kan Liang <kan.liang@intel.com>

Currently, users can zoom in/out for threads and dso in 'perf top' and
'perf report'.

This patch extends it for the processor sockets.

'S' is the short key to zoom into current Processor Socket.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1441377946-44429-4-git-send-email-kan.liang@intel.com
[ Made it elide the Socket column when zooming into it, just like with the other zoom ops,
  make it use browser->pstack, to unzoom level by level ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/ui/browsers/hists.c | 55 +++++++++++++++++++++++++++++++++++++++---
 tools/perf/util/hist.c         | 19 +++++++++++++++
 tools/perf/util/hist.h         |  1 +
 3 files changed, 71 insertions(+), 4 deletions(-)

diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 457f24c8fbe0..e4fd40f72b4a 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1429,6 +1429,7 @@ struct popup_action {
 	struct thread 		*thread;
 	struct dso		*dso;
 	struct map_symbol 	ms;
+	int			socket;
 
 	int (*fn)(struct hist_browser *browser, struct popup_action *act);
 };
@@ -1676,6 +1677,41 @@ add_exit_opt(struct hist_browser *browser __maybe_unused,
 	return 1;
 }
 
+static int
+do_zoom_socket(struct hist_browser *browser, struct popup_action *act)
+{
+	if (browser->hists->socket_filter > -1) {
+		pstack__remove(browser->pstack, &browser->hists->socket_filter);
+		browser->hists->socket_filter = -1;
+		perf_hpp__set_elide(HISTC_SOCKET, false);
+	} else {
+		browser->hists->socket_filter = act->socket;
+		perf_hpp__set_elide(HISTC_SOCKET, true);
+		pstack__push(browser->pstack, &browser->hists->socket_filter);
+	}
+
+	hists__filter_by_socket(browser->hists);
+	hist_browser__reset(browser);
+	return 0;
+}
+
+static int
+add_socket_opt(struct hist_browser *browser, struct popup_action *act,
+	       char **optstr, int socket)
+{
+	if (socket < 0)
+		return 0;
+
+	if (asprintf(optstr, "Zoom %s Processor Socket %d",
+		     (browser->hists->socket_filter > -1) ? "out of" : "into",
+		     socket) < 0)
+		return 0;
+
+	act->socket = socket;
+	act->fn = do_zoom_socket;
+	return 1;
+}
+
 static void hist_browser__update_nr_entries(struct hist_browser *hb)
 {
 	u64 nr_entries = 0;
@@ -1729,6 +1765,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 	"E             Expand all callchains\n"				\
 	"F             Toggle percentage of filtered entries\n"		\
 	"H             Display column headers\n"			\
+	"S             Zoom into current Processor Socket\n"		\
 
 	/* help messages are sorted by lexical order of the hotkey */
 	const char report_help[] = HIST_BROWSER_HELP_COMMON
@@ -1759,7 +1796,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 		hist_browser__update_nr_entries(browser);
 	}
 
-	browser->pstack = pstack__new(2);
+	browser->pstack = pstack__new(3);
 	if (browser->pstack == NULL)
 		goto out;
 
@@ -1778,6 +1815,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 		struct thread *thread = NULL;
 		struct dso *dso = NULL;
 		int choice = 0;
+		int socket = -1;
 
 		nr_options = 0;
 
@@ -1786,6 +1824,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 		if (browser->he_selection != NULL) {
 			thread = hist_browser__selected_thread(browser);
 			dso = browser->selection->map ? browser->selection->map->dso : NULL;
+			socket = browser->he_selection->socket;
 		}
 		switch (key) {
 		case K_TAB:
@@ -1828,6 +1867,10 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 			actions->thread = thread;
 			do_zoom_thread(browser, actions);
 			continue;
+		case 'S':
+			actions->socket = socket;
+			do_zoom_socket(browser, actions);
+			continue;
 		case '/':
 			if (ui_browser__input_window("Symbol to show",
 					"Please enter the name of symbol you want to see",
@@ -1903,9 +1946,11 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
 				 * Ditto for thread below.
 				 */
 				do_zoom_dso(browser, actions);
-			}
-			if (top == &browser->hists->thread_filter)
+			} else if (top == &browser->hists->thread_filter) {
 				do_zoom_thread(browser, actions);
+			} else if (top == &browser->hists->socket_filter) {
+				do_zoom_socket(browser, actions);
+			}
 			continue;
 		}
 		case 'q':
@@ -1973,7 +2018,9 @@ skip_annotation:
 		nr_options += add_map_opt(browser, &actions[nr_options],
 					  &options[nr_options],
 					  browser->selection->map);
-
+		nr_options += add_socket_opt(browser, &actions[nr_options],
+					     &options[nr_options],
+					     socket);
 		/* perf script support */
 		if (browser->he_selection) {
 			nr_options += add_script_opt(browser,
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index 58687a10e03f..67b48616ab31 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1309,6 +1309,25 @@ static bool hists__filter_entry_by_socket(struct hists *hists,
 	return false;
 }
 
+void hists__filter_by_socket(struct hists *hists)
+{
+	struct rb_node *nd;
+
+	hists->stats.nr_non_filtered_samples = 0;
+
+	hists__reset_filter_stats(hists);
+	hists__reset_col_len(hists);
+
+	for (nd = rb_first(&hists->entries); nd; nd = rb_next(nd)) {
+		struct hist_entry *h = rb_entry(nd, struct hist_entry, rb_node);
+
+		if (hists__filter_entry_by_socket(hists, h))
+			continue;
+
+		hists__remove_entry_filter(hists, h, HIST_FILTER__SOCKET);
+	}
+}
+
 void events_stats__inc(struct events_stats *stats, u32 type)
 {
 	++stats->nr_events[0];
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index ef682f210923..4d6aa1dbdaee 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -147,6 +147,7 @@ size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp);
 void hists__filter_by_dso(struct hists *hists);
 void hists__filter_by_thread(struct hists *hists);
 void hists__filter_by_symbol(struct hists *hists);
+void hists__filter_by_socket(struct hists *hists);
 
 static inline bool hists__has_filter(struct hists *hists)
 {
-- 
2.1.0


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

* [PATCH 14/15] perf test: Add entry for hists socket filter
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (12 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 13/15] perf hists browser: Zoom in/out for processor socket Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-05  1:06 ` [PATCH 15/15] perf stat: Move sw clock metrics printout to stat-shadow Arnaldo Carvalho de Melo
  2015-09-08 14:09 ` [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: linux-kernel, Kan Liang, Adrian Hunter, Andi Kleen, Jiri Olsa,
	Namhyung Kim, Stephane Eranian, Arnaldo Carvalho de Melo

From: Kan Liang <kan.liang@intel.com>

Add test case for hists socket filter.

Signed-off-by: Kan Liang <kan.liang@intel.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1441377946-44429-5-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/tests/hists_filter.c | 55 +++++++++++++++++++++++++++++++++--------
 1 file changed, 45 insertions(+), 10 deletions(-)

diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index ce48775e6ada..818acf875dd0 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -16,30 +16,31 @@ struct sample {
 	struct thread *thread;
 	struct map *map;
 	struct symbol *sym;
+	int socket;
 };
 
 /* For the numbers, see hists_common.c */
 static struct sample fake_samples[] = {
 	/* perf [kernel] schedule() */
-	{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_SCHEDULE, },
+	{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_KERNEL_SCHEDULE, .socket = 0 },
 	/* perf [perf]   main() */
-	{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_PERF_MAIN, },
+	{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_PERF_MAIN, .socket = 0 },
 	/* perf [libc]   malloc() */
-	{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_LIBC_MALLOC, },
+	{ .pid = FAKE_PID_PERF1, .ip = FAKE_IP_LIBC_MALLOC, .socket = 0 },
 	/* perf [perf]   main() */
-	{ .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_MAIN, }, /* will be merged */
+	{ .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_MAIN, .socket = 0 }, /* will be merged */
 	/* perf [perf]   cmd_record() */
-	{ .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_CMD_RECORD, },
+	{ .pid = FAKE_PID_PERF2, .ip = FAKE_IP_PERF_CMD_RECORD, .socket = 1 },
 	/* perf [kernel] page_fault() */
-	{ .pid = FAKE_PID_PERF2, .ip = FAKE_IP_KERNEL_PAGE_FAULT, },
+	{ .pid = FAKE_PID_PERF2, .ip = FAKE_IP_KERNEL_PAGE_FAULT, .socket = 1 },
 	/* bash [bash]   main() */
-	{ .pid = FAKE_PID_BASH,  .ip = FAKE_IP_BASH_MAIN, },
+	{ .pid = FAKE_PID_BASH,  .ip = FAKE_IP_BASH_MAIN, .socket = 2 },
 	/* bash [bash]   xmalloc() */
-	{ .pid = FAKE_PID_BASH,  .ip = FAKE_IP_BASH_XMALLOC, },
+	{ .pid = FAKE_PID_BASH,  .ip = FAKE_IP_BASH_XMALLOC, .socket = 2 },
 	/* bash [libc]   malloc() */
-	{ .pid = FAKE_PID_BASH,  .ip = FAKE_IP_LIBC_MALLOC, },
+	{ .pid = FAKE_PID_BASH,  .ip = FAKE_IP_LIBC_MALLOC, .socket = 3 },
 	/* bash [kernel] page_fault() */
-	{ .pid = FAKE_PID_BASH,  .ip = FAKE_IP_KERNEL_PAGE_FAULT, },
+	{ .pid = FAKE_PID_BASH,  .ip = FAKE_IP_KERNEL_PAGE_FAULT, .socket = 3 },
 };
 
 static int add_hist_entries(struct perf_evlist *evlist,
@@ -83,6 +84,7 @@ static int add_hist_entries(struct perf_evlist *evlist,
 							  &sample) < 0)
 				goto out;
 
+			al.socket = fake_samples[i].socket;
 			if (hist_entry_iter__add(&iter, &al,
 						 PERF_MAX_STACK_DEPTH, NULL) < 0) {
 				addr_location__put(&al);
@@ -253,6 +255,39 @@ int test__hists_filter(void)
 		TEST_ASSERT_VAL("Unmatched total period for symbol filter",
 				hists->stats.total_non_filtered_period == 300);
 
+		/* remove symbol filter first */
+		hists->symbol_filter_str = NULL;
+		hists__filter_by_symbol(hists);
+
+		/* now applying socket filters */
+		hists->socket_filter = 2;
+		hists__filter_by_socket(hists);
+
+		if (verbose > 2) {
+			pr_info("Histogram for socket filters\n");
+			print_hists_out(hists);
+		}
+
+		/* normal stats should be invariant */
+		TEST_ASSERT_VAL("Invalid nr samples",
+				hists->stats.nr_events[PERF_RECORD_SAMPLE] == 10);
+		TEST_ASSERT_VAL("Invalid nr hist entries",
+				hists->nr_entries == 9);
+		TEST_ASSERT_VAL("Invalid total period",
+				hists->stats.total_period == 1000);
+
+		/* but filter stats are changed */
+		TEST_ASSERT_VAL("Unmatched nr samples for socket filter",
+				hists->stats.nr_non_filtered_samples == 2);
+		TEST_ASSERT_VAL("Unmatched nr hist entries for socket filter",
+				hists->nr_non_filtered_entries == 2);
+		TEST_ASSERT_VAL("Unmatched total period for socket filter",
+				hists->stats.total_non_filtered_period == 200);
+
+		/* remove socket filter first */
+		hists->socket_filter = -1;
+		hists__filter_by_socket(hists);
+
 		/* now applying all filters at once. */
 		hists->thread_filter = fake_samples[1].thread;
 		hists->dso_filter = fake_samples[1].map->dso;
-- 
2.1.0


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

* [PATCH 15/15] perf stat: Move sw clock metrics printout to stat-shadow
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (13 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 14/15] perf test: Add entry for hists socket filter Arnaldo Carvalho de Melo
@ 2015-09-05  1:06 ` Arnaldo Carvalho de Melo
  2015-09-08 14:09 ` [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
  15 siblings, 0 replies; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-05  1:06 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Andi Kleen, Arnaldo Carvalho de Melo

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

The sw clock metrics printing was missed in the earlier move to
stat-shadow of all the other metric printouts. Move it too.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Link: http://lkml.kernel.org/r/1441406717-1717-2-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-stat.c     | 9 ---------
 tools/perf/util/stat-shadow.c | 3 +++
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index a96fb5c3bedb..77e578110194 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -510,15 +510,6 @@ static void nsec_printout(int id, int nr, struct perf_evsel *evsel, double avg)
 
 	if (evsel->cgrp)
 		fprintf(output, "%s%s", csv_sep, evsel->cgrp->name);
-
-	if (csv_output || stat_config.interval)
-		return;
-
-	if (perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK))
-		fprintf(output, " # %8.3f CPUs utilized          ",
-			avg / avg_stats(&walltime_nsecs_stats));
-	else
-		fprintf(output, "                                   ");
 }
 
 static void abs_printout(int id, int nr, struct perf_evsel *evsel, double avg)
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index 2a5d8d7698ae..625ab3b10e41 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -413,6 +413,9 @@ void perf_stat__print_shadow_stats(FILE *out, struct perf_evsel *evsel,
 			ratio = total / avg;
 
 		fprintf(out, " # %8.0f cycles / elision       ", ratio);
+	} else if (perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK) &&
+		   (ratio = avg_stats(&walltime_nsecs_stats)) != 0) {
+		fprintf(out, " # %8.3f CPUs utilized          ", avg / ratio);
 	} else if (runtime_nsecs_stats[cpu].n != 0) {
 		char unit = 'M';
 
-- 
2.1.0


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

* Re: [GIT PULL 00/15] perf/core improvements and fixes
  2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
                   ` (14 preceding siblings ...)
  2015-09-05  1:06 ` [PATCH 15/15] perf stat: Move sw clock metrics printout to stat-shadow Arnaldo Carvalho de Melo
@ 2015-09-08 14:09 ` Arnaldo Carvalho de Melo
  2015-09-08 14:21   ` Ingo Molnar
  15 siblings, 1 reply; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-08 14:09 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Ingo Molnar, linux-kernel, Adrian Hunter, Andi Kleen,
	Corey Ashford, David Ahern, Frederic Weisbecker, Jan Stancek,
	Jiri Olsa, Kan Liang, Matt Fleming, Namhyung Kim, Paul Mackerras,
	Peter Zijlstra, Raphael Beamonte, Stephane Eranian,
	Steven Rostedt

Em Fri, Sep 04, 2015 at 10:06:28PM -0300, Arnaldo Carvalho de Melo escreveu:
> Hi Ingo,
> 
> 	Please consider pulling, this is on top of the previous pull request,
> perf-core-for-mingo.

	Ingo, please do not pull this 'perf-core-for-mingo-2' tag, there were
some misunderstandings about the acks for "Move sw clock metrics
printout to stat-shadow" and Jiri and Andi are working that out.

	I'll remove those patches and get a new perf-core-for-mingo-2
tag in place, before continuing today's batch, which possibly will be
available as 'perf-core-for-mingo-3'

	What is in 'perf-core-for-mingo" should be Ok.

- Arnaldo
 
> - Arnaldo
> 
> The following changes since commit cf2f33a4e54096f90652cca3511fd6a456ea5abe:
> 
>   perf trace: Add read/write to the file group (2015-09-04 13:22:06 -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-2
> 
> for you to fetch changes up to 0959e527b1593e662cb99639a587eac39ea1232d:
> 
>   perf stat: Move sw clock metrics printout to stat-shadow (2015-09-04 20:30:01 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Add 'socket' sort entry, to sort by the processor socket in
>   'perf top' and 'perf report' (Kan Liang)
> 
> - Introduce --socket-filter to 'perf report', for filtering by
>   processor socket (Kan Liang)
> 
> - Add new "Zoom into Processor Socket" operation in the perf hists browser,
>   used in 'perf top' and 'perf report' (Kan Liang)
> 
> Infrastructure:
> 
> - 'perf test' fixes for the object code reading entry (Jan Stancek)
> 
> - Add processor socket and cpu topology 'perf test' entries (Kan Liang)
> 
> - Move sw clock metrics printout to stat-shadow (Andi Kleen)
> 
> - Switch to tracing_patch interface (Jiri Olsa)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Andi Kleen (1):
>       perf stat: Move sw clock metrics printout to stat-shadow
> 
> Jan Stancek (4):
>       perf tests: Take into account address of each objdump line
>       perf tests: Make objdump disassemble zero blocks
>       perf tests: Stop reading if objdump output crossed sections
>       perf tests: Print objdump/dso buffers if they don't match
> 
> Jiri Olsa (4):
>       tools lib api fs: Make tracing_path_strerror_open message generic
>       tools lib api fs: Replace debugfs/tracefs objects interface with fs.c
>       tools lib api fs: Remove debugfs, tracefs and findfs objects
>       perf tools: Switch to tracing_path interface on appropriate places
> 
> Kan Liang (6):
>       perf test: Add entry to test cpu topology
>       perf tools: Add processor socket info to hist_entry and addr_location
>       perf tools: Introduce new sort type "socket" for the processor socket
>       perf report: Introduce --socket-filter option
>       perf hists browser: Zoom in/out for processor socket
>       perf test: Add entry for hists socket filter
> 
>  tools/lib/api/fs/Build                     |   3 -
>  tools/lib/api/fs/debugfs.c                 |  77 -------------------
>  tools/lib/api/fs/debugfs.h                 |  23 ------
>  tools/lib/api/fs/findfs.c                  |  63 ----------------
>  tools/lib/api/fs/findfs.h                  |  23 ------
>  tools/lib/api/fs/fs.c                      |   1 -
>  tools/lib/api/fs/tracefs.c                 |  78 -------------------
>  tools/lib/api/fs/tracefs.h                 |  21 ------
>  tools/lib/api/fs/tracing_path.c            |  35 +++++----
>  tools/perf/Documentation/perf-report.txt   |   6 +-
>  tools/perf/builtin-kvm.c                   |   1 -
>  tools/perf/builtin-probe.c                 |   1 -
>  tools/perf/builtin-report.c                |  15 ++++
>  tools/perf/builtin-stat.c                  |   9 ---
>  tools/perf/tests/Build                     |   1 +
>  tools/perf/tests/builtin-test.c            |   4 +
>  tools/perf/tests/code-reading.c            |  74 +++++++++++++++----
>  tools/perf/tests/hists_filter.c            |  55 +++++++++++---
>  tools/perf/tests/openat-syscall-all-cpus.c |  10 +--
>  tools/perf/tests/openat-syscall.c          |  10 +--
>  tools/perf/tests/parse-events.c            |  19 +----
>  tools/perf/tests/tests.h                   |   1 +
>  tools/perf/tests/topology.c                | 115 +++++++++++++++++++++++++++++
>  tools/perf/ui/browsers/hists.c             |  59 ++++++++++++++-
>  tools/perf/util/event.c                    |   1 +
>  tools/perf/util/evsel.c                    |   2 +-
>  tools/perf/util/hist.c                     |  37 ++++++++++
>  tools/perf/util/hist.h                     |   6 +-
>  tools/perf/util/probe-event.c              |   5 +-
>  tools/perf/util/probe-file.c               |  15 +---
>  tools/perf/util/sort.c                     |  22 ++++++
>  tools/perf/util/sort.h                     |   2 +
>  tools/perf/util/stat-shadow.c              |   3 +
>  tools/perf/util/symbol.h                   |   1 +
>  tools/perf/util/util.h                     |   3 +-
>  35 files changed, 409 insertions(+), 392 deletions(-)
>  delete mode 100644 tools/lib/api/fs/debugfs.c
>  delete mode 100644 tools/lib/api/fs/debugfs.h
>  delete mode 100644 tools/lib/api/fs/findfs.c
>  delete mode 100644 tools/lib/api/fs/findfs.h
>  delete mode 100644 tools/lib/api/fs/tracefs.c
>  delete mode 100644 tools/lib/api/fs/tracefs.h
>  create mode 100644 tools/perf/tests/topology.c

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

* Re: [GIT PULL 00/15] perf/core improvements and fixes
  2015-09-08 14:09 ` [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
@ 2015-09-08 14:21   ` Ingo Molnar
  2015-09-08 14:30     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 21+ messages in thread
From: Ingo Molnar @ 2015-09-08 14:21 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Adrian Hunter,
	Andi Kleen, Corey Ashford, David Ahern, Frederic Weisbecker,
	Jan Stancek, Jiri Olsa, Kan Liang, Matt Fleming, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Raphael Beamonte,
	Stephane Eranian, Steven Rostedt


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

> Em Fri, Sep 04, 2015 at 10:06:28PM -0300, Arnaldo Carvalho de Melo escreveu:
> > Hi Ingo,
> > 
> > 	Please consider pulling, this is on top of the previous pull request,
> > perf-core-for-mingo.
> 
> 	Ingo, please do not pull this 'perf-core-for-mingo-2' tag, there were
> some misunderstandings about the acks for "Move sw clock metrics
> printout to stat-shadow" and Jiri and Andi are working that out.
> 
> 	I'll remove those patches and get a new perf-core-for-mingo-2
> tag in place, before continuing today's batch, which possibly will be
> available as 'perf-core-for-mingo-3'
> 
> 	What is in 'perf-core-for-mingo" should be Ok.

Ok!

Thanks,

	Ingo

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

* Re: [GIT PULL 00/15] perf/core improvements and fixes
  2015-09-08 14:21   ` Ingo Molnar
@ 2015-09-08 14:30     ` Arnaldo Carvalho de Melo
  2015-09-14  8:41       ` Ingo Molnar
  0 siblings, 1 reply; 21+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-09-08 14:30 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Adrian Hunter,
	Andi Kleen, Corey Ashford, David Ahern, Frederic Weisbecker,
	Jan Stancek, Jiri Olsa, Kan Liang, Matt Fleming, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Raphael Beamonte,
	Stephane Eranian, Steven Rostedt

Em Tue, Sep 08, 2015 at 04:21:47PM +0200, Ingo Molnar escreveu:
> 
> * Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> 
> > Em Fri, Sep 04, 2015 at 10:06:28PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Hi Ingo,
> > > 
> > > 	Please consider pulling, this is on top of the previous pull request,
> > > perf-core-for-mingo.
> > 
> > 	Ingo, please do not pull this 'perf-core-for-mingo-2' tag, there were
> > some misunderstandings about the acks for "Move sw clock metrics
> > printout to stat-shadow" and Jiri and Andi are working that out.
> > 
> > 	I'll remove those patches and get a new perf-core-for-mingo-2
> > tag in place, before continuing today's batch, which possibly will be
> > available as 'perf-core-for-mingo-3'
> > 
> > 	What is in 'perf-core-for-mingo" should be Ok.
> 
> Ok!

Thanks! I have already removed that problematic changeset and resigned
the 'perf-core-for-mingo-2' tag, same contents modulo that cset.

- Arnaldo

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

* Re: [GIT PULL 00/15] perf/core improvements and fixes
  2015-09-08 14:30     ` Arnaldo Carvalho de Melo
@ 2015-09-14  8:41       ` Ingo Molnar
  2015-09-14  9:07         ` Wangnan (F)
  0 siblings, 1 reply; 21+ messages in thread
From: Ingo Molnar @ 2015-09-14  8:41 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Adrian Hunter,
	Andi Kleen, Corey Ashford, David Ahern, Frederic Weisbecker,
	Jan Stancek, Jiri Olsa, Kan Liang, Matt Fleming, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Raphael Beamonte,
	Stephane Eranian, Steven Rostedt


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

> Em Tue, Sep 08, 2015 at 04:21:47PM +0200, Ingo Molnar escreveu:
> > 
> > * Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> > 
> > > Em Fri, Sep 04, 2015 at 10:06:28PM -0300, Arnaldo Carvalho de Melo escreveu:
> > > > Hi Ingo,
> > > > 
> > > > 	Please consider pulling, this is on top of the previous pull request,
> > > > perf-core-for-mingo.
> > > 
> > > 	Ingo, please do not pull this 'perf-core-for-mingo-2' tag, there were
> > > some misunderstandings about the acks for "Move sw clock metrics
> > > printout to stat-shadow" and Jiri and Andi are working that out.
> > > 
> > > 	I'll remove those patches and get a new perf-core-for-mingo-2
> > > tag in place, before continuing today's batch, which possibly will be
> > > available as 'perf-core-for-mingo-3'
> > > 
> > > 	What is in 'perf-core-for-mingo" should be Ok.
> > 
> > Ok!
> 
> Thanks! I have already removed that problematic changeset and resigned
> the 'perf-core-for-mingo-2' tag, same contents modulo that cset.

Hm, so I pulled it (commit 1765d9b26f84), but with an old perf.data I'm getting 
this crash:

triton:~/tip/tools/perf> perf report
perf: Segmentation fault
-------- backtrace --------
perf[0x52bc0b]
/lib/x86_64-linux-gnu/libc.so.6(+0x352f0)[0x7f51a583c2f0]
perf[0x42ce95]
perf[0x4bc6c3]
perf[0x4bcfa1]
perf[0x4bf939]
perf(perf_session__process_events+0x390)[0x4be430]
perf(cmd_report+0x1070)[0x42e2e0]
perf[0x478e03]
perf(main+0x60a)[0x41f1ba]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f51a5827a40]
perf(_start+0x29)[0x41f2d9]
[0x0]

I also re-tested 1765d9b26f84 and it still crashes.

Bisected it to:

  e1e499aba570 perf tools: Add processor socket info to hist_entry and addr_location

Running on Ubuntu, 1 socket box, 12 CPUs.

I went back to perf/core 8f3e5684d3fb and it doesn't crash anymore - so I unpulled 
your tree for now. (Will send you the perf.data privately.)

Thanks,

	Ingo

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

* Re: [GIT PULL 00/15] perf/core improvements and fixes
  2015-09-14  8:41       ` Ingo Molnar
@ 2015-09-14  9:07         ` Wangnan (F)
  0 siblings, 0 replies; 21+ messages in thread
From: Wangnan (F) @ 2015-09-14  9:07 UTC (permalink / raw)
  To: Ingo Molnar, Arnaldo Carvalho de Melo
  Cc: Arnaldo Carvalho de Melo, linux-kernel, Adrian Hunter,
	Andi Kleen, Corey Ashford, David Ahern, Frederic Weisbecker,
	Jan Stancek, Jiri Olsa, Kan Liang, Matt Fleming, Namhyung Kim,
	Paul Mackerras, Peter Zijlstra, Raphael Beamonte,
	Stephane Eranian, Steven Rostedt



On 2015/9/14 16:41, Ingo Molnar wrote:
> * Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
>
>> Em Tue, Sep 08, 2015 at 04:21:47PM +0200, Ingo Molnar escreveu:
>>> * Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
>>>
>>>> Em Fri, Sep 04, 2015 at 10:06:28PM -0300, Arnaldo Carvalho de Melo escreveu:
>>>>> Hi Ingo,
>>>>>
>>>>> 	Please consider pulling, this is on top of the previous pull request,
>>>>> perf-core-for-mingo.
>>>> 	Ingo, please do not pull this 'perf-core-for-mingo-2' tag, there were
>>>> some misunderstandings about the acks for "Move sw clock metrics
>>>> printout to stat-shadow" and Jiri and Andi are working that out.
>>>>
>>>> 	I'll remove those patches and get a new perf-core-for-mingo-2
>>>> tag in place, before continuing today's batch, which possibly will be
>>>> available as 'perf-core-for-mingo-3'
>>>>
>>>> 	What is in 'perf-core-for-mingo" should be Ok.
>>> Ok!
>> Thanks! I have already removed that problematic changeset and resigned
>> the 'perf-core-for-mingo-2' tag, same contents modulo that cset.
> Hm, so I pulled it (commit 1765d9b26f84), but with an old perf.data I'm getting
> this crash:
>
> triton:~/tip/tools/perf> perf report
> perf: Segmentation fault
> -------- backtrace --------
> perf[0x52bc0b]
> /lib/x86_64-linux-gnu/libc.so.6(+0x352f0)[0x7f51a583c2f0]
> perf[0x42ce95]
> perf[0x4bc6c3]
> perf[0x4bcfa1]
> perf[0x4bf939]
> perf(perf_session__process_events+0x390)[0x4be430]
> perf(cmd_report+0x1070)[0x42e2e0]
> perf[0x478e03]
> perf(main+0x60a)[0x41f1ba]
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7f51a5827a40]
> perf(_start+0x29)[0x41f2d9]
> [0x0]
>
> I also re-tested qand it still crashes.
>
> Bisected it to:
>
>    e1e499aba570 perf tools: Add processor socket info to hist_entry and addr_location
>
> Running on Ubuntu, 1 socket box, 12 CPUs.

Hi Ingo,

It seems you met a bug we are discussing these days. Please have a look at
the following discussions:

http://lkml.kernel.org/r/1441630315-189525-1-git-send-email-wangnan0@huawei.com

http://lkml.kernel.org/r/1441828225-667-1-git-send-email-acme@kernel.org

Thank you.

> I went back to perf/core 8f3e5684d3fb and it doesn't crash anymore - so I unpulled
> your tree for now. (Will send you the perf.data privately.)
>
> Thanks,
>
> 	Ingo
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



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

end of thread, other threads:[~2015-09-14  9:08 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-05  1:06 [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 01/15] perf tests: Take into account address of each objdump line Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 02/15] perf tests: Make objdump disassemble zero blocks Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 03/15] perf tests: Stop reading if objdump output crossed sections Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 04/15] perf tests: Print objdump/dso buffers if they don't match Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 05/15] tools lib api fs: Make tracing_path_strerror_open message generic Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 06/15] tools lib api fs: Replace debugfs/tracefs objects interface with fs.c Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 07/15] tools lib api fs: Remove debugfs, tracefs and findfs objects Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 08/15] perf tools: Switch to tracing_path interface on appropriate places Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 09/15] perf test: Add entry to test cpu topology Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 10/15] perf tools: Add processor socket info to hist_entry and addr_location Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 11/15] perf tools: Introduce new sort type "socket" for the processor socket Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 12/15] perf report: Introduce --socket-filter option Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 13/15] perf hists browser: Zoom in/out for processor socket Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 14/15] perf test: Add entry for hists socket filter Arnaldo Carvalho de Melo
2015-09-05  1:06 ` [PATCH 15/15] perf stat: Move sw clock metrics printout to stat-shadow Arnaldo Carvalho de Melo
2015-09-08 14:09 ` [GIT PULL 00/15] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-09-08 14:21   ` Ingo Molnar
2015-09-08 14:30     ` Arnaldo Carvalho de Melo
2015-09-14  8:41       ` Ingo Molnar
2015-09-14  9:07         ` Wangnan (F)

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).