Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1231100 > unrolled thread

[GIT PULL 0/9] perf/core improvements and fixes

Started byArnaldo Carvalho de Melo <acme@kernel.org>
First post2015-09-23 04:20 +0200
Last post2015-09-23 09:50 +0200
Articles 10 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [GIT PULL 0/9] perf/core improvements and fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    [PATCH 6/9] tools lib bpf: Use FEATURE_USER to allow building in the same dir as perf Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    [PATCH 4/9] tools lib bpf: Fix up FEATURE_{TESTS,DISPLAY} usage Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    [PATCH 1/9] perf probe: Fix a segfault when removing uprobe events Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    [PATCH 8/9] tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    [PATCH 7/9] perf tools: Add include/err.h into MANIFEST Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    [PATCH 3/9] tools build: Fixup feature detection display function name Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    [PATCH 2/9] perf tools: Don't assume that the parser returns non empty evsel list Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    [PATCH 9/9] perf record: Synthesize COMM event for a command line workload Arnaldo Carvalho de Melo <acme@kernel.org> - 2015-09-23 04:20 +0200
    Re: [GIT PULL 0/9] perf/core improvements and fixes Ingo Molnar <mingo@kernel.org> - 2015-09-23 09:50 +0200

#1231100 — [GIT PULL 0/9] perf/core improvements and fixes

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[GIT PULL 0/9] perf/core improvements and fixes
Message-ID<qbHP3-7ct-3@gated-at.bofh.it>
Hi Ingo,

	Please consider pulling,

- Arnaldo

The following changes since commit 96f3eda67fcf2598e9d2794398e0e7ab35138ea6:

  perf/x86/intel: Fix static checker warning in lbr enable (2015-09-18 09:24:57 +0200)

are available in the git repository at:

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

for you to fetch changes up to e803cf97a4f90d31bcc2c9a1ea20fe9cdc12b2f9:

  perf record: Synthesize COMM event for a command line workload (2015-09-22 22:43:12 -0300)

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

User visible:

- Fix a segfault in 'perf probe' when removing uprobe events (Masami Hiramatsu)

- Synthesize COMM event for workloads started from the command line in 'perf
  record' so that we can have the pid->comm mapping before we get the real
  PERF_RECORD_COMM switching from perf to the workload (Namhyung Kim)

- Fix build tools/vm/ due to removal of tools/lib/api/fs/debugfs.h
  (Arnaldo Carvalho de Melo)

Developer stuff:

- Fix the make tarball targets by including the recently added err.h header in
  the perf MANIFEST file (Jiri Olsa)

- Don't assume that the event parser returns a non empty evlist (Wang Nan)

- Add way to disambiguate feature detection state files, needed to use
  tools/build feature detection for multiple components in a single O= output
  dir, which will be the case with tools/perf/ and tools/lib/bpf/
  (Arnaldo Carvalho de Melo)

- Fixup FEATURE_{TESTS,DISPLAY} inversion in tools/lib/bpf/ (Arnaldo Carvalho de Melo)

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

----------------------------------------------------------------
Arnaldo Carvalho de Melo (5):
      tools build: Fixup feature detection display function name
      tools lib bpf: Fix up FEATURE_{TESTS,DISPLAY} usage
      tools build: Allow setting the feature detection user
      tools lib bpf: Use FEATURE_USER to allow building in the same dir as perf
      tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h

Jiri Olsa (1):
      perf tools: Add include/err.h into MANIFEST

Masami Hiramatsu (1):
      perf probe: Fix a segfault when removing uprobe events

Namhyung Kim (1):
      perf record: Synthesize COMM event for a command line workload

Wang Nan (1):
      perf tools: Don't assume that the parser returns non empty evsel list

 tools/build/Makefile.feature   |  9 +++++----
 tools/lib/bpf/Makefile         |  5 +++--
 tools/perf/MANIFEST            |  1 +
 tools/perf/builtin-probe.c     |  7 +++++--
 tools/perf/builtin-record.c    | 15 ++++++++++++++-
 tools/perf/util/event.c        |  2 +-
 tools/perf/util/event.h        |  5 +++++
 tools/perf/util/parse-events.c | 16 ++++++++++++++++
 tools/vm/page-types.c          |  6 +++---
 9 files changed, 53 insertions(+), 13 deletions(-)
--
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/

[toc] | [next] | [standalone]


#1231101 — [PATCH 6/9] tools lib bpf: Use FEATURE_USER to allow building in the same dir as perf

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[PATCH 6/9] tools lib bpf: Use FEATURE_USER to allow building in the same dir as perf
Message-ID<qbHP3-7ct-9@gated-at.bofh.it>
In reply to#1231100
From: Arnaldo Carvalho de Melo <acme@redhat.com>

When building tools/lib/bpf as part of the tools/perf/ build process,
which will happend when we introduce a patch wiring that up, we end up
stomping on the feature detection caching mechanism, that uses a file in
the output directory (O=) that is shared by libbpf and perf to check if
something changed from one build to another that requires redoing the
feature detection process.

By using the recently introduced FEATURE_USER tools/build/ knob, we can
avoid that:

Before, every make invokation would run the feature detection:

  $ make O=/tmp/build/perf -C tools/perf
  make: Entering directory '/home/git/linux/tools/perf'
  Auto-detecting system features:
  ...                         dwarf: [ on  ]
  ...                         glibc: [ on  ]
  <SNIP>
  ...                     get_cpuid: [ on  ]
  ...                           bpf: [ on  ]

    GEN      perf-archive
    GEN      perf-with-kcore

  Auto-detecting system features:
  ...                        libelf: [ on  ]
  ...                           bpf: [ on  ]
  <SNIP>

After:

  $ make O=/tmp/build/perf -C tools/perf
  make: Entering directory '/home/git/linux/tools/perf'
    BUILD:   Doing 'make -j4' parallel build
  make: Leaving directory '/home/git/linux/tools/perf'
  $

Because we now have two different feature detection state files:

  $ ls -la /tmp/build/perf/FEATURE-DUMP*
  -rw-rw-r--. 1 acme acme 338 Sep 21 17:25 /tmp/build/perf/FEATURE-DUMP
  -rw-rw-r--. 1 acme acme  33 Sep 21 17:25 /tmp/build/perf/FEATURE-DUMP.libbpf
  $

Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: pi3orama@163.com
Fixes: 1b76c13e4b36 ("bpf tools: Introduce 'bpf' library and add bpf feature check")
Link: http://lkml.kernel.org/n/tip-s6ev9wfqy7pvvs58emys2g90@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/bpf/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index 604c12081b4b..e630f9fc4fb6 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -64,6 +64,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 endif
 
+FEATURE_USER = .libbpf
 FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf
 FEATURE_DISPLAY = libelf bpf
 
-- 
2.1.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1231102 — [PATCH 4/9] tools lib bpf: Fix up FEATURE_{TESTS,DISPLAY} usage

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[PATCH 4/9] tools lib bpf: Fix up FEATURE_{TESTS,DISPLAY} usage
Message-ID<qbHP3-7ct-7@gated-at.bofh.it>
In reply to#1231100
From: Arnaldo Carvalho de Melo <acme@redhat.com>

When libbpf was introduced it wrongly asked for the "libelf" and "bpf"
feature tests to be performed (via FEATURE_TESTS), while asking that
"libbpf", "libelf-mmap", "libelf-getphdrnum" and "bpf" to have the
result of its respective tests to be displayed (via FEATURE_DISPLAY).

Due to another recently bug fixed in the tools/build/ infrastructure
("tools build: Fixup feature detection display function name") the
results for the entries in the FEATURE_DISPLAY, for this case, were
appearing as all succeeding, when two of them (the ones only on the
DISPLAY) were not even being performed.

Before:

  $ make -C tools/lib/bpf/
  make: Entering directory '/home/git/linux/tools/lib/bpf'
  Auto-detecting system features:
  ...                        libelf: [ on  ]
  ...             libelf-getphdrnum: [ OFF ]
  ...                   libelf-mmap: [ OFF ]
  ...                           bpf: [ on  ]
  <SNIP>

After, with FEATURE_TESTS == FEATURE_DISPLAY:

  Auto-detecting system features:
  ...                        libelf: [ on  ]
  ...             libelf-getphdrnum: [ on  ]
  ...                   libelf-mmap: [ on  ]
  ...                           bpf: [ on  ]
  <SNIP>

I just inverted, so that it tests the four features but displays just
the libelf and mmap ones, to make it more compact. So it becomes:

  $ make -C tools/lib/bpf/
  make: Entering directory '/home/git/linux/tools/lib/bpf'

  Auto-detecting system features:
  ...                        libelf: [ on  ]
  ...                           bpf: [ on  ]

Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: pi3orama@163.com
Fixes: 1b76c13e4b36 ("bpf tools: Introduce 'bpf' library and add bpf feature check")
Link: http://lkml.kernel.org/n/tip-y4bd59e6j9rzzojiyeqrg2jq@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/lib/bpf/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
index f68d23a0b487..604c12081b4b 100644
--- a/tools/lib/bpf/Makefile
+++ b/tools/lib/bpf/Makefile
@@ -64,8 +64,8 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
 #$(info Determined 'srctree' to be $(srctree))
 endif
 
-FEATURE_DISPLAY = libelf libelf-getphdrnum libelf-mmap bpf
-FEATURE_TESTS = libelf bpf
+FEATURE_TESTS = libelf libelf-getphdrnum libelf-mmap bpf
+FEATURE_DISPLAY = libelf bpf
 
 INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/arch/$(ARCH)/include/uapi -I$(srctree)/include/uapi
 FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
-- 
2.1.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1231103 — [PATCH 1/9] perf probe: Fix a segfault when removing uprobe events

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[PATCH 1/9] perf probe: Fix a segfault when removing uprobe events
Message-ID<qbHP3-7ct-17@gated-at.bofh.it>
In reply to#1231100
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>

Fix a segfault bug and a small mistake in perf probe -d.

Since the "ulist" in perf_del_probe_events is never initialized,
strlist__add(ulist, *) always causes a segfault when removing
uprobe events by perf probe -d.

Also, the "str" local variable is never released if fail to
allocate the "klist". This fixes it too.

This has been introduced by the commit e607f1426b58 ("perf probe:
Print deleted events in cmd_probe()").

Reported-by: Milian Wolff <milian.wolff@kdab.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/20150916125241.4446.44805.stgit@localhost.localdomain
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-probe.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 94385ee89dc8..f7882ae9ebc6 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -380,8 +380,11 @@ static int perf_del_probe_events(struct strfilter *filter)
 		goto out;
 
 	klist = strlist__new(NULL, NULL);
-	if (!klist)
-		return -ENOMEM;
+	ulist = strlist__new(NULL, NULL);
+	if (!klist || !ulist) {
+		ret = -ENOMEM;
+		goto out;
+	}
 
 	ret = probe_file__get_events(kfd, filter, klist);
 	if (ret == 0) {
-- 
2.1.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1231104 — [PATCH 8/9] tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[PATCH 8/9] tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h
Message-ID<qbHP3-7ct-11@gated-at.bofh.it>
In reply to#1231100
From: Arnaldo Carvalho de Melo <acme@redhat.com>

There were some changes in how this debugfs mounting helper is
implemented/exported and we forgot to check if there were other users
besides perf, fix it.

Need to do a make -C tools/ everytime we do changes to
tools/{lib,include} and other places where we're moving things from
tools/perf/ to be used by other tools/ living code.

Fixed:

  $ make -C tools/vm
  make: Entering directory '/home/git/linux/tools/vm'
  make -C ../lib/api
  make[1]: Entering directory '/home/git/linux/tools/lib/api'
    CC       fd/array.o
    LD       fd/libapi-in.o
    CC       fs/fs.o
    CC       fs/tracing_path.o
    LD       fs/libapi-in.o
    CC       cpu.o
    LD       libapi-in.o
    AR       libapi.a
  make[1]: Leaving directory '/home/git/linux/tools/lib/api'
  gcc -Wall -Wextra -I../lib/ -o page-types page-types.c ../lib/api/libapi.a
  make: Leaving directory '/home/git/linux/tools/vm'
  $

Reported-by: Vinson Lee <vlee@twopensource.com>
Tested-by: Vinson Lee <vlee@twopensource.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Raphael Beamonte <raphael.beamonte@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: David Ahern <dsahern@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Fixes: 60a1133a5b39 ("tools lib api fs: Remove debugfs, tracefs and findfs objects")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/vm/page-types.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
index 7f73fa32a590..bcf5ec760eb9 100644
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -42,7 +42,7 @@
 #include <sys/mman.h>
 #include "../../include/uapi/linux/magic.h"
 #include "../../include/uapi/linux/kernel-page-flags.h"
-#include <api/fs/debugfs.h>
+#include <api/fs/fs.h>
 
 #ifndef MAX_PATH
 # define MAX_PATH 256
@@ -188,7 +188,7 @@ static int		kpageflags_fd;
 static int		opt_hwpoison;
 static int		opt_unpoison;
 
-static char		*hwpoison_debug_fs;
+static const char	*hwpoison_debug_fs;
 static int		hwpoison_inject_fd;
 static int		hwpoison_forget_fd;
 
@@ -487,7 +487,7 @@ static void prepare_hwpoison_fd(void)
 {
 	char buf[MAX_PATH + 1];
 
-	hwpoison_debug_fs = debugfs_mount(NULL);
+	hwpoison_debug_fs = debugfs__mount();
 	if (!hwpoison_debug_fs) {
 		perror("mount debugfs");
 		exit(EXIT_FAILURE);
-- 
2.1.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1231105 — [PATCH 7/9] perf tools: Add include/err.h into MANIFEST

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[PATCH 7/9] perf tools: Add include/err.h into MANIFEST
Message-ID<qbHP3-7ct-13@gated-at.bofh.it>
In reply to#1231100
From: Jiri Olsa <jolsa@kernel.org>

Otherwise the tarpkg is incomplete (tarpkg tests fails).

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Fixes: 01ca9fd41d6f ("tools: Add err.h with ERR_PTR PTR_ERR interface")
Link: http://lkml.kernel.org/r/1442846143-8556-1-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/MANIFEST | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 2a958a80c763..9e6bdf5b2df6 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -50,6 +50,7 @@ tools/include/linux/poison.h
 tools/include/linux/rbtree.h
 tools/include/linux/rbtree_augmented.h
 tools/include/linux/types.h
+tools/include/linux/err.h
 include/asm-generic/bitops/arch_hweight.h
 include/asm-generic/bitops/const_hweight.h
 include/asm-generic/bitops/fls64.h
-- 
2.1.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1231106 — [PATCH 3/9] tools build: Fixup feature detection display function name

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[PATCH 3/9] tools build: Fixup feature detection display function name
Message-ID<qbHP3-7ct-19@gated-at.bofh.it>
In reply to#1231100
From: Arnaldo Carvalho de Melo <acme@redhat.com>

Cut'n'paste mistake, it should eval the name of the function
defined right next to it, in the next line, fix it.

Before:

  $ make -C tools/lib/bpf/
  make: Entering directory '/home/git/linux/tools/lib/bpf'

  Auto-detecting system features:
  ...                        libelf: [ on  ]
  ...             libelf-getphdrnum: [ on  ]
  ...                   libelf-mmap: [ on  ]
  ...                           bpf: [ on  ]
  <SNIP>

After:

  $ make -C tools/lib/bpf/
  make: Entering directory '/home/git/linux/tools/lib/bpf'

  Auto-detecting system features:
  ...                        libelf: [ on  ]
  ...             libelf-getphdrnum: [ OFF ]
  ...                   libelf-mmap: [ OFF ]
  ...                           bpf: [ on  ]
  <SNIP>

Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: pi3orama@163.com
Fixes: 58d4f00ff13f ("perf build: Fix feature_check name clash")
Link: http://lkml.kernel.org/n/tip-dzu1c4sruukgfq5d5b1c4r30@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/Makefile.feature | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/build/Makefile.feature b/tools/build/Makefile.feature
index c8fe6d177119..690d5614edd4 100644
--- a/tools/build/Makefile.feature
+++ b/tools/build/Makefile.feature
@@ -140,7 +140,7 @@ ifneq ("$(FEATURE_DUMP)","$(FEATURE_DUMP_FILE)")
   feature_display := 1
 endif
 
-feature_display_check = $(eval $(feature_check_code))
+feature_display_check = $(eval $(feature_check_display_code))
 define feature_display_check_code
   ifneq ($(feature-$(1)), 1)
     feature_display := 1
-- 
2.1.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1231107 — [PATCH 2/9] perf tools: Don't assume that the parser returns non empty evsel list

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[PATCH 2/9] perf tools: Don't assume that the parser returns non empty evsel list
Message-ID<qbHP3-7ct-15@gated-at.bofh.it>
In reply to#1231100
From: Wang Nan <wangnan0@huawei.com>

Don't blindly retrieve and use a last element in the lists returned by
parse_events__scanner(), as it may have collected no entries, i.e.
return an empty list.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
Cc: Alexei Starovoitov <ast@plumgrid.com>
Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: David Ahern <dsahern@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kaixu Xia <xiakaixu@huawei.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Zefan Li <lizefan@huawei.com>
Cc: pi3orama@163.com
Link: http://lkml.kernel.org/r/1441523623-152703-2-git-send-email-wangnan0@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/parse-events.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 0fde5293a38e..61c2bc20926d 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -827,6 +827,11 @@ void parse_events__set_leader(char *name, struct list_head *list)
 {
 	struct perf_evsel *leader;
 
+	if (list_empty(list)) {
+		WARN_ONCE(true, "WARNING: failed to set leader: empty list");
+		return;
+	}
+
 	__perf_evlist__set_leader(list);
 	leader = list_entry(list->next, struct perf_evsel, node);
 	leader->group_name = name ? strdup(name) : NULL;
@@ -1176,6 +1181,11 @@ int parse_events(struct perf_evlist *evlist, const char *str,
 	if (!ret) {
 		struct perf_evsel *last;
 
+		if (list_empty(&data.list)) {
+			WARN_ONCE(true, "WARNING: event parser found nothing");
+			return -1;
+		}
+
 		perf_evlist__splice_list_tail(evlist, &data.list);
 		evlist->nr_groups += data.nr_groups;
 		last = perf_evlist__last(evlist);
@@ -1285,6 +1295,12 @@ foreach_evsel_in_last_glob(struct perf_evlist *evlist,
 	struct perf_evsel *last = NULL;
 	int err;
 
+	/*
+	 * Don't return when list_empty, give func a chance to report
+	 * error when it found last == NULL.
+	 *
+	 * So no need to WARN here, let *func do this.
+	 */
 	if (evlist->nr_entries > 0)
 		last = perf_evlist__last(evlist);
 
-- 
2.1.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1231108 — [PATCH 9/9] perf record: Synthesize COMM event for a command line workload

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2015-09-23 04:20 +0200
Subject[PATCH 9/9] perf record: Synthesize COMM event for a command line workload
Message-ID<qbHP4-7ct-21@gated-at.bofh.it>
In reply to#1231100
From: Namhyung Kim <namhyung@kernel.org>

When perf creates a new child to profile, the events are enabled on
exec().  And in this case, it doesn't synthesize any event for the
child since they'll be generated during exec().  But there's an window
between the enabling and the event generation.

It used to be overcome since samples are only in kernel (so we always
have the map) and the comm is overridden by a later COMM event.
However it won't work if events are processed and displayed before the
COMM event overrides like in 'perf script'.  This leads to those early
samples (like native_write_msr_safe) not having a comm but pid (like
':15328').

So it needs to synthesize COMM event for the child explicitly before
enabling so that it can have a correct comm.  But at this time, the
comm will be "perf" since it's not exec-ed yet.

Committer note:

Before this patch:

  # perf record usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.017 MB perf.data (7 samples) ]
  # perf script --show-task-events
    :4429  4429 27909.079372:          1 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
    :4429  4429 27909.079375:          1 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
    :4429  4429 27909.079376:         10 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
    :4429  4429 27909.079377:        223 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
    :4429  4429 27909.079378:       6571 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
   usleep  4429 27909.079380: PERF_RECORD_COMM exec: usleep:4429/4429
   usleep  4429 27909.079381:     185403 cycles:  ffffffff810a72d3 flush_signal_handlers (/lib/modules/4.
   usleep  4429 27909.079444:    2241110 cycles:      7fc575355be3 _dl_start (/usr/lib64/ld-2.20.so)
   usleep  4429 27909.079875: PERF_RECORD_EXIT(4429:4429):(4429:4429)

After:

  # perf record usleep 1
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.017 MB perf.data (7 samples) ]
  # perf script --show-task
     perf     0     0.000000: PERF_RECORD_COMM: perf:8446/8446
     perf  8446 30154.038944:          1 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
     perf  8446 30154.038948:          1 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
     perf  8446 30154.038949:          9 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
     perf  8446 30154.038950:        230 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
     perf  8446 30154.038951:       6772 cycles:  ffffffff8105f45a native_write_msr_safe (/lib/modules/4.
   usleep  8446 30154.038952: PERF_RECORD_COMM exec: usleep:8446/8446
   usleep  8446 30154.038954:     196923 cycles:  ffffffff81766440 _raw_spin_lock (/lib/modules/4.3.0-rc1
   usleep  8446 30154.039021:    2292130 cycles:      7f609a173dc4 memcpy (/usr/lib64/ld-2.20.so)
   usleep  8446 30154.039349: PERF_RECORD_EXIT(8446:8446):(8446:8446)
  #

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1442881495-2928-1-git-send-email-namhyung@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/builtin-record.c | 15 ++++++++++++++-
 tools/perf/util/event.c     |  2 +-
 tools/perf/util/event.h     |  5 +++++
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 142eeb341b29..a01c8ae1ee07 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -636,8 +636,21 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
 	/*
 	 * Let the child rip
 	 */
-	if (forks)
+	if (forks) {
+		union perf_event event;
+		/*
+		 * Some H/W events are generated before COMM event
+		 * which is emitted during exec(), so perf script
+		 * cannot see a correct process name for those events.
+		 * Synthesize COMM event to prevent it.
+		 */
+		perf_event__synthesize_comm(tool, &event,
+					    rec->evlist->workload.pid,
+					    process_synthesized_event,
+					    machine);
+
 		perf_evlist__start_workload(rec->evlist);
+	}
 
 	if (opts->initial_delay) {
 		usleep(opts->initial_delay * 1000);
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 497157affc9c..6214ad47d554 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -167,7 +167,7 @@ static int perf_event__prepare_comm(union perf_event *event, pid_t pid,
 	return 0;
 }
 
-static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
+pid_t perf_event__synthesize_comm(struct perf_tool *tool,
 					 union perf_event *event, pid_t pid,
 					 perf_event__handler_t process,
 					 struct machine *machine)
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index f729df5e25e6..be5cbc7be889 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -478,6 +478,11 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
 				  const struct perf_sample *sample,
 				  bool swapped);
 
+pid_t perf_event__synthesize_comm(struct perf_tool *tool,
+				  union perf_event *event, pid_t pid,
+				  perf_event__handler_t process,
+				  struct machine *machine);
+
 int perf_event__synthesize_mmap_events(struct perf_tool *tool,
 				       union perf_event *event,
 				       pid_t pid, pid_t tgid,
-- 
2.1.0

--
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/

[toc] | [prev] | [next] | [standalone]


#1231204

FromIngo Molnar <mingo@kernel.org>
Date2015-09-23 09:50 +0200
Message-ID<qbMYq-686-11@gated-at.bofh.it>
In reply to#1231100
* Arnaldo Carvalho de Melo <acme@kernel.org> wrote:

> Hi Ingo,
> 
> 	Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit 96f3eda67fcf2598e9d2794398e0e7ab35138ea6:
> 
>   perf/x86/intel: Fix static checker warning in lbr enable (2015-09-18 09:24:57 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-core-for-mingo
> 
> for you to fetch changes up to e803cf97a4f90d31bcc2c9a1ea20fe9cdc12b2f9:
> 
>   perf record: Synthesize COMM event for a command line workload (2015-09-22 22:43:12 -0300)
> 
> ----------------------------------------------------------------
> perf/core improvements and fixes:
> 
> User visible:
> 
> - Fix a segfault in 'perf probe' when removing uprobe events (Masami Hiramatsu)
> 
> - Synthesize COMM event for workloads started from the command line in 'perf
>   record' so that we can have the pid->comm mapping before we get the real
>   PERF_RECORD_COMM switching from perf to the workload (Namhyung Kim)
> 
> - Fix build tools/vm/ due to removal of tools/lib/api/fs/debugfs.h
>   (Arnaldo Carvalho de Melo)
> 
> Developer stuff:
> 
> - Fix the make tarball targets by including the recently added err.h header in
>   the perf MANIFEST file (Jiri Olsa)
> 
> - Don't assume that the event parser returns a non empty evlist (Wang Nan)
> 
> - Add way to disambiguate feature detection state files, needed to use
>   tools/build feature detection for multiple components in a single O= output
>   dir, which will be the case with tools/perf/ and tools/lib/bpf/
>   (Arnaldo Carvalho de Melo)
> 
> - Fixup FEATURE_{TESTS,DISPLAY} inversion in tools/lib/bpf/ (Arnaldo Carvalho de Melo)
> 
> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> 
> ----------------------------------------------------------------
> Arnaldo Carvalho de Melo (5):
>       tools build: Fixup feature detection display function name
>       tools lib bpf: Fix up FEATURE_{TESTS,DISPLAY} usage
>       tools build: Allow setting the feature detection user
>       tools lib bpf: Use FEATURE_USER to allow building in the same dir as perf
>       tools vm: Fix build due to removal of tools/lib/api/fs/debugfs.h
> 
> Jiri Olsa (1):
>       perf tools: Add include/err.h into MANIFEST
> 
> Masami Hiramatsu (1):
>       perf probe: Fix a segfault when removing uprobe events
> 
> Namhyung Kim (1):
>       perf record: Synthesize COMM event for a command line workload
> 
> Wang Nan (1):
>       perf tools: Don't assume that the parser returns non empty evsel list
> 
>  tools/build/Makefile.feature   |  9 +++++----
>  tools/lib/bpf/Makefile         |  5 +++--
>  tools/perf/MANIFEST            |  1 +
>  tools/perf/builtin-probe.c     |  7 +++++--
>  tools/perf/builtin-record.c    | 15 ++++++++++++++-
>  tools/perf/util/event.c        |  2 +-
>  tools/perf/util/event.h        |  5 +++++
>  tools/perf/util/parse-events.c | 16 ++++++++++++++++
>  tools/vm/page-types.c          |  6 +++---
>  9 files changed, 53 insertions(+), 13 deletions(-)

Pulled, thanks a lot Arnaldo!

	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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web