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>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWAgaZAAoJENZQFvNTUqpAsZ0P/AuZ92BE6yHPd8VwEYnREAIn
 PGO3rmW7+dy/rE7pDvKYkHkSAu86VVGCB8Kjbn+7mGssBBNnnC21BwdJQRi3c/If
 Upyl4w7jUB6UooXoAAt4tQqSIZV2fq0esN6ss7D2zpblB6ZBZ/TAC9sNWdDq9Yav
 fU+Wks5AMSQDNmj4l9/q3K5v2U5gUBginHyHKvnrOF6fMAN4ZZRAOlB5viisyt+P
 dRDol95SCnhTaOHoM3Eko7uNlHyWUW7HhXN9N5ZaoXeBn/QI2gwAzBz4snFpJPDm
 1Ua9t6Kx4sCNOcuHMVL4Jy2c/kyRSKWyWnb9PBv//m0HKAJyGp39/XIRkRD1ngQ2
 NXESfP4ljhLvUeU6zL5/q6qyNHvpXLxsi1y/tftGGpPXmLbjHiuPq57gdMyvRyOQ
 UbCGQl8aj/08jEPloCeoXk5cGin5iJA0wZg9JkT2kbSlklTGWYVaphy0Nlgn2Ojn
 S/vOVqpSBNlq2afT4lBicZ91QFl3AIfCWUGutbnaDdvZ/inTRfjBJoLJyvXikSSC
 p+FQDOXxbiUH0POc6A0VfYZWJzvXax9XA8H62EA47CQS4GD+CygmUUOD5Gwro0iX
 v9uXWFootRzvgD5ElG6gg7hgZgO1hqOp1xd+STlyGsYuyKIzu7Nk9GqoXf4vYLIV
 JWoEW0N+kypOx4quwne8
 =6DJ/
 -----END PGP SIGNATURE-----

Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core

Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:

User visible changes:

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

Infrastructure changes:

  - 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>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
Ingo Molnar 2015-09-23 09:42:58 +02:00
commit 968d712a25
9 changed files with 53 additions and 13 deletions

View File

@ -121,8 +121,9 @@ define feature_print_text_code
MSG = $(shell printf '...%30s: %s' $(1) $(2))
endef
FEATURE_DUMP_FILENAME = $(OUTPUT)FEATURE-DUMP$(FEATURE_USER)
FEATURE_DUMP := $(foreach feat,$(FEATURE_DISPLAY),feature-$(feat)($(feature-$(feat))))
FEATURE_DUMP_FILE := $(shell touch $(OUTPUT)FEATURE-DUMP; cat $(OUTPUT)FEATURE-DUMP)
FEATURE_DUMP_FILE := $(shell touch $(FEATURE_DUMP_FILENAME); cat $(FEATURE_DUMP_FILENAME))
ifeq ($(dwarf-post-unwind),1)
FEATURE_DUMP += dwarf-post-unwind($(dwarf-post-unwind-text))
@ -131,16 +132,16 @@ endif
# The $(feature_display) controls the default detection message
# output. It's set if:
# - detected features differes from stored features from
# last build (in FEATURE-DUMP file)
# last build (in $(FEATURE_DUMP_FILENAME) file)
# - one of the $(FEATURE_DISPLAY) is not detected
# - VF is enabled
ifneq ("$(FEATURE_DUMP)","$(FEATURE_DUMP_FILE)")
$(shell echo "$(FEATURE_DUMP)" > $(OUTPUT)FEATURE-DUMP)
$(shell echo "$(FEATURE_DUMP)" > $(FEATURE_DUMP_FILENAME))
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

View File

@ -64,8 +64,9 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
#$(info Determined 'srctree' to be $(srctree))
endif
FEATURE_DISPLAY = libelf libelf-getphdrnum libelf-mmap bpf
FEATURE_TESTS = libelf bpf
FEATURE_USER = .libbpf
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)

View File

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

View File

@ -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) {

View File

@ -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);

View File

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

View File

@ -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,

View File

@ -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);

View File

@ -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);