Skip to content

Commit

Permalink
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/acme/linux into perf/urgent

Pull perf/core fixes from Arnaldo Carvalho de Melo:

Build fixes:

  - Create config.detected into OUTPUT directory, fixing parallel
    builds sharing the same source directory (Aaro Kiskinen)

  - Allow to specify custom linker command, fixing some MIPS64
    builds. (Aaro Kiskinen)

Infrastructure fixes:

  - Add missing break for PERF_RECORD_ITRACE_START, which caused those events
    samples to be parsed as well as PERF_RECORD_LOST_SAMPLES. ITRACE_START only
    appears when Intel PT or BTS are present, so  (Jiri Olsa)

  - Call the perf_session destructor when bailing out in the inject, kmem, report,
    kvm and mem tools (Taeung Song)

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Ingo Molnar committed Jul 2, 2015
2 parents 93472af + 5ef7bbb commit b9df84f
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 29 deletions.
2 changes: 1 addition & 1 deletion tools/build/Makefile.build
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build-dir := $(srctree)/tools/build
include $(build-dir)/Build.include

# do not force detected configuration
-include .config-detected
-include $(OUTPUT).config-detected

# Init all relevant variables used in build files so
# 1) they have correct type
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/Makefile.perf
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ $(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
$(Q)touch $(OUTPUT)PERF-VERSION-FILE

CC = $(CROSS_COMPILE)gcc
LD = $(CROSS_COMPILE)ld
LD ?= $(CROSS_COMPILE)ld
AR = $(CROSS_COMPILE)ar
PKG_CONFIG = $(CROSS_COMPILE)pkg-config

Expand Down Expand Up @@ -545,7 +545,7 @@ config-clean:
clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean config-clean
$(call QUIET_CLEAN, core-objs) $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
$(Q)$(RM) .config-detected
$(Q)$(RM) $(OUTPUT).config-detected
$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32
$(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
Expand Down
7 changes: 4 additions & 3 deletions tools/perf/builtin-inject.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,13 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused)
if (inject.session == NULL)
return -1;

if (symbol__init(&inject.session->header.env) < 0)
return -1;
ret = symbol__init(&inject.session->header.env);
if (ret < 0)
goto out_delete;

ret = __cmd_inject(&inject);

out_delete:
perf_session__delete(inject.session);

return ret;
}
4 changes: 2 additions & 2 deletions tools/perf/builtin-kmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1916,7 +1916,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
if (!perf_evlist__find_tracepoint_by_name(session->evlist,
"kmem:kmalloc")) {
pr_err(errmsg, "slab", "slab");
return -1;
goto out_delete;
}
}

Expand All @@ -1927,7 +1927,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
"kmem:mm_page_alloc");
if (evsel == NULL) {
pr_err(errmsg, "page", "page");
return -1;
goto out_delete;
}

kmem_page_size = pevent_get_page_size(evsel->tp_format->pevent);
Expand Down
14 changes: 10 additions & 4 deletions tools/perf/builtin-kvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,18 +1061,24 @@ static int read_events(struct perf_kvm_stat *kvm)

symbol__init(&kvm->session->header.env);

if (!perf_session__has_traces(kvm->session, "kvm record"))
return -EINVAL;
if (!perf_session__has_traces(kvm->session, "kvm record")) {
ret = -EINVAL;
goto out_delete;
}

/*
* Do not use 'isa' recorded in kvm_exit tracepoint since it is not
* traced in the old kernel.
*/
ret = cpu_isa_config(kvm);
if (ret < 0)
return ret;
goto out_delete;

return perf_session__process_events(kvm->session);
ret = perf_session__process_events(kvm->session);

out_delete:
perf_session__delete(kvm->session);
return ret;
}

static int parse_target_str(struct perf_kvm_stat *kvm)
Expand Down
16 changes: 6 additions & 10 deletions tools/perf/builtin-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ static int report_raw_events(struct perf_mem *mem)
.mode = PERF_DATA_MODE_READ,
.force = mem->force,
};
int err = -EINVAL;
int ret;
struct perf_session *session = perf_session__new(&file, false,
&mem->tool);
Expand All @@ -135,24 +134,21 @@ static int report_raw_events(struct perf_mem *mem)
if (mem->cpu_list) {
ret = perf_session__cpu_bitmap(session, mem->cpu_list,
mem->cpu_bitmap);
if (ret)
if (ret < 0)
goto out_delete;
}

if (symbol__init(&session->header.env) < 0)
return -1;
ret = symbol__init(&session->header.env);
if (ret < 0)
goto out_delete;

printf("# PID, TID, IP, ADDR, LOCAL WEIGHT, DSRC, SYMBOL\n");

err = perf_session__process_events(session);
if (err)
return err;

return 0;
ret = perf_session__process_events(session);

out_delete:
perf_session__delete(session);
return err;
return ret;
}

static int report_events(int argc, const char **argv, struct perf_mem *mem)
Expand Down
6 changes: 4 additions & 2 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,10 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
if (report.header || report.header_only) {
perf_session__fprintf_info(session, stdout,
report.show_full_info);
if (report.header_only)
return 0;
if (report.header_only) {
ret = 0;
goto error;
}
} else if (use_browser == 0) {
fputs("# To display the perf.data header info, please use --header/--header-only options.\n#\n",
stdout);
Expand Down
6 changes: 3 additions & 3 deletions tools/perf/config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ ifneq ($(obj-perf),)
obj-perf := $(abspath $(obj-perf))/
endif

$(shell echo -n > .config-detected)
detected = $(shell echo "$(1)=y" >> .config-detected)
detected_var = $(shell echo "$(1)=$($(1))" >> .config-detected)
$(shell echo -n > $(OUTPUT).config-detected)
detected = $(shell echo "$(1)=y" >> $(OUTPUT).config-detected)
detected_var = $(shell echo "$(1)=$($(1))" >> $(OUTPUT).config-detected)

CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)

Expand Down
3 changes: 1 addition & 2 deletions tools/perf/util/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1448,10 +1448,9 @@ int machine__process_event(struct machine *machine, union perf_event *event,
case PERF_RECORD_AUX:
ret = machine__process_aux_event(machine, event); break;
case PERF_RECORD_ITRACE_START:
ret = machine__process_itrace_start_event(machine, event);
ret = machine__process_itrace_start_event(machine, event); break;
case PERF_RECORD_LOST_SAMPLES:
ret = machine__process_lost_samples_event(machine, event, sample); break;
break;
default:
ret = -1;
break;
Expand Down

0 comments on commit b9df84f

Please sign in to comment.