Commit f5540ecb authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'perf-core-for-mingo' of...

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

Pull perf tools improvements and fixes from Arnaldo Carvalho de Melo:

User visible bug fixes:

  - Fix reading of build-id from vDSO (Ben Hutchings)

  - Fix processing samples for guests, noticed with 'perf kvm',
    but noticeable as well via other tools, such as 'perf top'
    (Ravi Bangoria)

Build infrastructure:

  - Add feature-dump target and FEATURES_DUMP make variable, to
    allow reusing the feature detection results among multiple
    tools/ living codebases, such as perf and lib/bpf (Jiri Olsa)

  - 'make -C tools/perf build-test' improvements, making it more
    paralelizable and allowing building it outside of the source
    tree, using O= (Wang Nan)
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 10a0c0f0 96b9e70b
...@@ -77,6 +77,9 @@ include config/utilities.mak ...@@ -77,6 +77,9 @@ include config/utilities.mak
# Define NO_AUXTRACE if you do not want AUX area tracing support # Define NO_AUXTRACE if you do not want AUX area tracing support
# #
# Define NO_LIBBPF if you do not want BPF support # Define NO_LIBBPF if you do not want BPF support
#
# Define FEATURES_DUMP to provide features detection dump file
# and bypass the feature detection
# As per kernel Makefile, avoid funny character set dependencies # As per kernel Makefile, avoid funny character set dependencies
unexport LC_ALL unexport LC_ALL
...@@ -166,6 +169,15 @@ ifeq ($(config),1) ...@@ -166,6 +169,15 @@ ifeq ($(config),1)
include config/Makefile include config/Makefile
endif endif
# The FEATURE_DUMP_EXPORT holds location of the actual
# FEATURE_DUMP file to be used to bypass feature detection
# (for bpf or any other subproject)
ifeq ($(FEATURES_DUMP),)
FEATURE_DUMP_EXPORT := $(realpath $(OUTPUT)FEATURE-DUMP)
else
FEATURE_DUMP_EXPORT := $(FEATURES_DUMP)
endif
export prefix bindir sharedir sysconfdir DESTDIR export prefix bindir sharedir sysconfdir DESTDIR
# sparse is architecture-neutral, which means that we need to tell it # sparse is architecture-neutral, which means that we need to tell it
...@@ -436,7 +448,7 @@ $(LIBAPI)-clean: ...@@ -436,7 +448,7 @@ $(LIBAPI)-clean:
$(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null $(Q)$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
$(LIBBPF): fixdep FORCE $(LIBBPF): fixdep FORCE
$(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(realpath $(OUTPUT)FEATURE-DUMP) $(Q)$(MAKE) -C $(BPF_DIR) O=$(OUTPUT) $(OUTPUT)libbpf.a FEATURES_DUMP=$(FEATURE_DUMP_EXPORT)
$(LIBBPF)-clean: $(LIBBPF)-clean:
$(call QUIET_CLEAN, libbpf) $(call QUIET_CLEAN, libbpf)
...@@ -610,6 +622,17 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean ...@@ -610,6 +622,17 @@ clean: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean
$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
$(python-clean) $(python-clean)
#
# To provide FEATURE-DUMP into $(FEATURE_DUMP_COPY)
# file if defined, with no further action.
feature-dump:
ifdef FEATURE_DUMP_COPY
@cp $(OUTPUT)FEATURE-DUMP $(FEATURE_DUMP_COPY)
@echo "FEATURE-DUMP file copied into $(FEATURE_DUMP_COPY)"
else
@echo "FEATURE-DUMP file available in $(OUTPUT)FEATURE-DUMP"
endif
# #
# Trick: if ../../.git does not exist - we are building out of tree for example, # Trick: if ../../.git does not exist - we are building out of tree for example,
# then force version regeneration: # then force version regeneration:
......
...@@ -181,7 +181,11 @@ LDFLAGS += -Wl,-z,noexecstack ...@@ -181,7 +181,11 @@ LDFLAGS += -Wl,-z,noexecstack
EXTLIBS = -lpthread -lrt -lm -ldl EXTLIBS = -lpthread -lrt -lm -ldl
ifeq ($(FEATURES_DUMP),)
include $(srctree)/tools/build/Makefile.feature include $(srctree)/tools/build/Makefile.feature
else
include $(FEATURES_DUMP)
endif
ifeq ($(feature-stackprotector-all), 1) ifeq ($(feature-stackprotector-all), 1)
CFLAGS += -fstack-protector-all CFLAGS += -fstack-protector-all
......
...@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),) ...@@ -5,7 +5,7 @@ ifeq ($(MAKECMDGOALS),)
# no target specified, trigger the whole suite # no target specified, trigger the whole suite
all: all:
@echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile @echo "Testing Makefile"; $(MAKE) -sf tests/make MK=Makefile
@echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf @echo "Testing Makefile.perf"; $(MAKE) -sf tests/make MK=Makefile.perf SET_PARALLEL=1 SET_O=1
else else
# run only specific test over 'Makefile' # run only specific test over 'Makefile'
%: %:
...@@ -13,6 +13,26 @@ else ...@@ -13,6 +13,26 @@ else
endif endif
else else
PERF := . PERF := .
PERF_O := $(PERF)
O_OPT :=
ifneq ($(O),)
FULL_O := $(shell readlink -f $(O) || echo $(O))
PERF_O := $(FULL_O)
ifeq ($(SET_O),1)
O_OPT := 'O=$(FULL_O)'
endif
K_O_OPT := 'O=$(FULL_O)'
endif
PARALLEL_OPT=
ifeq ($(SET_PARALLEL),1)
cores := $(shell (getconf _NPROCESSORS_ONLN || egrep -c '^processor|^CPU[0-9]' /proc/cpuinfo) 2>/dev/null)
ifeq ($(cores),0)
cores := 1
endif
PARALLEL_OPT="-j$(cores)"
endif
# As per kernel Makefile, avoid funny character set dependencies # As per kernel Makefile, avoid funny character set dependencies
unexport LC_ALL unexport LC_ALL
...@@ -156,11 +176,11 @@ test_make_doc := $(test_ok) ...@@ -156,11 +176,11 @@ test_make_doc := $(test_ok)
test_make_help_O := $(test_ok) test_make_help_O := $(test_ok)
test_make_doc_O := $(test_ok) test_make_doc_O := $(test_ok)
test_make_python_perf_so := test -f $(PERF)/python/perf.so test_make_python_perf_so := test -f $(PERF_O)/python/perf.so
test_make_perf_o := test -f $(PERF)/perf.o test_make_perf_o := test -f $(PERF_O)/perf.o
test_make_util_map_o := test -f $(PERF)/util/map.o test_make_util_map_o := test -f $(PERF_O)/util/map.o
test_make_util_pmu_bison_o := test -f $(PERF)/util/pmu-bison.o test_make_util_pmu_bison_o := test -f $(PERF_O)/util/pmu-bison.o
define test_dest_files define test_dest_files
for file in $(1); do \ for file in $(1); do \
...@@ -227,7 +247,7 @@ test_make_perf_o_O := test -f $$TMP_O/perf.o ...@@ -227,7 +247,7 @@ test_make_perf_o_O := test -f $$TMP_O/perf.o
test_make_util_map_o_O := test -f $$TMP_O/util/map.o test_make_util_map_o_O := test -f $$TMP_O/util/map.o
test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
test_default = test -x $(PERF)/perf test_default = test -x $(PERF_O)/perf
test = $(if $(test_$1),$(test_$1),$(test_default)) test = $(if $(test_$1),$(test_$1),$(test_default))
test_default_O = test -x $$TMP_O/perf test_default_O = test -x $$TMP_O/perf
...@@ -247,12 +267,12 @@ endif ...@@ -247,12 +267,12 @@ endif
MAKEFLAGS := --no-print-directory MAKEFLAGS := --no-print-directory
clean := @(cd $(PERF); make -s -f $(MK) clean >/dev/null) clean := @(cd $(PERF); make -s -f $(MK) $(O_OPT) clean >/dev/null)
$(run): $(run):
$(call clean) $(call clean)
@TMP_DEST=$$(mktemp -d); \ @TMP_DEST=$$(mktemp -d); \
cmd="cd $(PERF) && make -f $(MK) DESTDIR=$$TMP_DEST $($@)"; \ cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) $(O_OPT) DESTDIR=$$TMP_DEST $($@)"; \
echo "- $@: $$cmd" && echo $$cmd > $@ && \ echo "- $@: $$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1; \ ( eval $$cmd ) >> $@ 2>&1; \
echo " test: $(call test,$@)" >> $@ 2>&1; \ echo " test: $(call test,$@)" >> $@ 2>&1; \
...@@ -263,7 +283,7 @@ $(run_O): ...@@ -263,7 +283,7 @@ $(run_O):
$(call clean) $(call clean)
@TMP_O=$$(mktemp -d); \ @TMP_O=$$(mktemp -d); \
TMP_DEST=$$(mktemp -d); \ TMP_DEST=$$(mktemp -d); \
cmd="cd $(PERF) && make -f $(MK) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \ cmd="cd $(PERF) && make -f $(MK) $(PARALLEL_OPT) O=$$TMP_O DESTDIR=$$TMP_DEST $($(patsubst %_O,%,$@))"; \
echo "- $@: $$cmd" && echo $$cmd > $@ && \ echo "- $@: $$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1 && \ ( eval $$cmd ) >> $@ 2>&1 && \
echo " test: $(call test_O,$@)" >> $@ 2>&1; \ echo " test: $(call test_O,$@)" >> $@ 2>&1; \
...@@ -276,17 +296,22 @@ tarpkg: ...@@ -276,17 +296,22 @@ tarpkg:
( eval $$cmd ) >> $@ 2>&1 && \ ( eval $$cmd ) >> $@ 2>&1 && \
rm -f $@ rm -f $@
KERNEL_O := ../..
ifneq ($(O),)
KERNEL_O := $(O)
endif
make_kernelsrc: make_kernelsrc:
@echo "- make -C <kernelsrc> tools/perf" @echo "- make -C <kernelsrc> $(PARALLEL_OPT) $(K_O_OPT) tools/perf"
$(call clean); \ $(call clean); \
(make -C ../.. tools/perf) > $@ 2>&1 && \ (make -C ../.. $(PARALLEL_OPT) $(K_O_OPT) tools/perf) > $@ 2>&1 && \
test -x perf && rm -f $@ || (cat $@ ; false) test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
make_kernelsrc_tools: make_kernelsrc_tools:
@echo "- make -C <kernelsrc>/tools perf" @echo "- make -C <kernelsrc>/tools $(PARALLEL_OPT) $(K_O_OPT) perf"
$(call clean); \ $(call clean); \
(make -C ../../tools perf) > $@ 2>&1 && \ (make -C ../../tools $(PARALLEL_OPT) $(K_O_OPT) perf) > $@ 2>&1 && \
test -x perf && rm -f $@ || (cat $@ ; false) test -x $(KERNEL_O)/tools/perf/perf && rm -f $@ || (cat $@ ; false)
all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools all: $(run) $(run_O) tarpkg make_kernelsrc make_kernelsrc_tools
@echo OK @echo OK
......
...@@ -1149,7 +1149,7 @@ static struct machine *machines__find_for_cpumode(struct machines *machines, ...@@ -1149,7 +1149,7 @@ static struct machine *machines__find_for_cpumode(struct machines *machines,
machine = machines__find(machines, pid); machine = machines__find(machines, pid);
if (!machine) if (!machine)
machine = machines__find(machines, DEFAULT_GUEST_KERNEL_ID); machine = machines__findnew(machines, DEFAULT_GUEST_KERNEL_ID);
return machine; return machine;
} }
......
...@@ -1466,7 +1466,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter) ...@@ -1466,7 +1466,7 @@ int dso__load(struct dso *dso, struct map *map, symbol_filter_t filter)
* Read the build id if possible. This is required for * Read the build id if possible. This is required for
* DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work * DSO_BINARY_TYPE__BUILDID_DEBUGINFO to work
*/ */
if (filename__read_build_id(dso->name, build_id, BUILD_ID_SIZE) > 0) if (filename__read_build_id(dso->long_name, build_id, BUILD_ID_SIZE) > 0)
dso__set_build_id(dso, build_id); dso__set_build_id(dso, build_id);
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment