Skip to contentSkip to conversation

tools/perf/build: Speed up the perf build system

GIT PULL New Ingo Molnar 5 participants 15 messages Oct 9, 2013 – Oct 15, 2013 perf events

lore
Share & tools
lore
#0 lore raw

Arnaldo,

Please pull the tools/perf/build git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tmp.tools/perf/build

# HEAD: 165108a92fc554d51e73b143b69b77e7c278da78 tools/perf/build: Clean up feature_print_code()

This tree contains the build system speedup series described at:

https://lkml.org/lkml/2013/10/7/199

Reviewed by David Ahern and Jiri Olsa (thanks guys!).

Thanks,

Ingo

------------------>
Ingo Molnar (52):
tools/perf: Standardize feature support define names to: HAVE_{FEATURE}_SUPPORT tools/perf/build: Add feature check core code
tools/perf/build: Add 'autodep' functionality, generate feature test dependencies automatically tools/perf/build: Split out feature check: 'libnuma'
tools/perf/build: Split out feature check: 'stackprotector-all' tools/perf/build: Split out feature check: 'stackprotector'
tools/perf/build: Split out feature check: 'volatile-register-var' tools/perf/build: Split out feature check: 'fortify-source'
tools/perf/build: Split out feature check: 'bionic'
tools/perf/build: Clean up the libelf logic in config/Makefile tools/perf/build: Split out feature check: 'libelf'
tools/perf/build: Split out feature check: 'glibc'
tools/perf/build: Split out feature check: 'dwarf'
tools/perf/build: Clean up the mmap logic in config/Makefile
tools/perf/build: Split out feature check: 'libelf-mmap'
tools/perf/build: Split out feature check: 'libelf-getphdrnum' tools/perf/build: Clean up the libunwind logic in config/Makefile tools/perf/build: Split out feature check: 'libunwind'
tools/perf/build: Split out feature check: 'libaudit'
tools/perf/build: Split out feature check: 'libslang'
tools/perf/build: Split out feature check: 'gtk2'
tools/perf/build: Split out feature check: 'gtk2-infobar'
tools/perf/build: Split out feature check: 'libperl'
tools/perf/build: Split out feature check: 'libpython'
tools/perf/build: Split out feature check: 'libpython-version' tools/perf/build: Split out feature check: 'libbfd'
tools/perf/build: Split out feature check: 'strlcpy'
tools/perf/build: Split out feature check: 'on-exit'
tools/perf/build: Split out feature check: 'backtrace'
tools/perf: Clean up util/include/linux/compiler.h
tools/perf: Turn strlcpy() into a __weak function
tools/perf/build: Speed up auto-detection of features by adding a 'test-all' target tools/perf/build: Speed up git-version test on re-make
tools/perf/build: Speed up the final link
tools/perf: Fix double/triple-build of the feature detection logic during 'make install' et al tools/perf/build: Invoke feature-checks 'clean' target from the main Makefile tools/perf/build: Speed up auto-detection
tools/perf/build: Improve printout-of auto-detected features
tools/perf/build: Automatically build in parallel, based on number of CPUs in the system tools/perf/build: Flip Makefile.parallel and Makefile.perf
tools/perf/build: Standardize the various messages output by parallel make tools/perf/build: Split out feature checks: 'liberty', 'liberty-z', 'cplus-demangle' tools/perf/build: Remove unused config/feature-tests.mak
tools/perf/build: Clean up various testcases
tools/perf/build: Collapse the test-all.c testcase
tools/perf/build: Pass through all targets to Makefile.perf
tools/perf/build: Make sure autodep feature binaries honor the O= setting tools/perf/build: Exclude MAKEFLAGS from nested invocation
tools/perf/build: Fix non-canonical directory names in O=
tools/perf/build: Fix O=/some/dir perf.o type of targets
tools/perf/build: Harmonize the style of the feature testcases tools/perf/build: Pass through LDFLAGS to feature tests

Jiri Olsa (1):
tools/perf/build: Clean up feature_print_code()

 tools/perf/Documentation/Makefile                  |  17 +-
 tools/perf/Makefile                                | 841 ++------------------
 tools/perf/Makefile.perf                           | 856 +++++++++++++++++++++
 tools/perf/arch/x86/include/perf_regs.h            |   6 +-
 tools/perf/arch/x86/util/unwind.c                  |   4 +-
 tools/perf/bench/mem-memcpy-arch.h                 |   2 +-
 tools/perf/bench/mem-memcpy.c                      |   2 +-
 tools/perf/bench/mem-memset-arch.h                 |   2 +-
 tools/perf/bench/mem-memset.c                      |   2 +-
 tools/perf/builtin-bench.c                         |   4 +-
 tools/perf/builtin-inject.c                        |   2 +-
 tools/perf/builtin-probe.c                         |  14 +-
 tools/perf/builtin-record.c                        |  12 +-
 tools/perf/config/Makefile                         | 337 +++++---
 tools/perf/config/feature-checks/Makefile          | 148 ++++
 tools/perf/config/feature-checks/test-all.c        | 106 +++
 tools/perf/config/feature-checks/test-backtrace.c  |  13 +
 tools/perf/config/feature-checks/test-bionic.c     |   6 +
 .../config/feature-checks/test-cplus-demangle.c    |  14 +
 tools/perf/config/feature-checks/test-dwarf.c      |  10 +
 .../config/feature-checks/test-fortify-source.c    |   6 +
 tools/perf/config/feature-checks/test-glibc.c      |   8 +
 .../perf/config/feature-checks/test-gtk2-infobar.c |  11 +
 tools/perf/config/feature-checks/test-gtk2.c       |  10 +
 tools/perf/config/feature-checks/test-hello.c      |   6 +
 tools/perf/config/feature-checks/test-libaudit.c   |  10 +
 tools/perf/config/feature-checks/test-libbfd.c     |  15 +
 .../config/feature-checks/test-libelf-getphdrnum.c |   8 +
 .../perf/config/feature-checks/test-libelf-mmap.c  |   8 +
 tools/perf/config/feature-checks/test-libelf.c     |   8 +
 tools/perf/config/feature-checks/test-libnuma.c    |   9 +
 tools/perf/config/feature-checks/test-libperl.c    |   9 +
 .../config/feature-checks/test-libpython-version.c |  10 +
 tools/perf/config/feature-checks/test-libpython.c  |   8 +
 tools/perf/config/feature-checks/test-libslang.c   |   6 +
 tools/perf/config/feature-checks/test-libunwind.c  |  27 +
 tools/perf/config/feature-checks/test-on-exit.c    |  15 +
 .../feature-checks/test-stackprotector-all.c       |   6 +
 .../config/feature-checks/test-stackprotector.c    |   6 +
 .../feature-checks/test-volatile-register-var.c    |   6 +
 tools/perf/config/feature-tests.mak                | 246 ------
 tools/perf/config/utilities.mak                    |  14 -
 tools/perf/perf.c                                  |   4 +-
 tools/perf/ui/gtk/browser.c                        |   2 +-
 tools/perf/ui/gtk/gtk.h                            |   4 +-
 tools/perf/ui/gtk/util.c                           |   4 +-
 tools/perf/ui/ui.h                                 |   4 +-
 tools/perf/util/annotate.h                         |   4 +-
 tools/perf/util/cache.h                            |   3 +-
 tools/perf/util/generate-cmdlist.sh                |   4 +-
 tools/perf/util/hist.h                             |   4 +-
 tools/perf/util/include/dwarf-regs.h               |   2 +-
 tools/perf/util/include/linux/compiler.h           |  19 +-
 tools/perf/util/map.c                              |   2 +-
 tools/perf/util/path.c                             |  10 +-
 tools/perf/util/perf_regs.h                        |   4 +-
 tools/perf/util/probe-event.c                      |   4 +-
 tools/perf/util/probe-finder.h                     |   4 +-
 tools/perf/util/symbol-elf.c                       |   2 +-
 tools/perf/util/symbol.h                           |   8 +-
 tools/perf/util/unwind.h                           |   4 +-
 tools/perf/util/util.c                             |   4 +-
 62 files changed, 1688 insertions(+), 1258 deletions(-)
 create mode 100644 tools/perf/Makefile.perf
 create mode 100644 tools/perf/config/feature-checks/Makefile
 create mode 100644 tools/perf/config/feature-checks/test-all.c
 create mode 100644 tools/perf/config/feature-checks/test-backtrace.c
 create mode 100644 tools/perf/config/feature-checks/test-bionic.c
 create mode 100644 tools/perf/config/feature-checks/test-cplus-demangle.c
 create mode 100644 tools/perf/config/feature-checks/test-dwarf.c
 create mode 100644 tools/perf/config/feature-checks/test-fortify-source.c
 create mode 100644 tools/perf/config/feature-checks/test-glibc.c
 create mode 100644 tools/perf/config/feature-checks/test-gtk2-infobar.c
 create mode 100644 tools/perf/config/feature-checks/test-gtk2.c
 create mode 100644 tools/perf/config/feature-checks/test-hello.c
 create mode 100644 tools/perf/config/feature-checks/test-libaudit.c
 create mode 100644 tools/perf/config/feature-checks/test-libbfd.c
 create mode 100644 tools/perf/config/feature-checks/test-libelf-getphdrnum.c
 create mode 100644 tools/perf/config/feature-checks/test-libelf-mmap.c
 create mode 100644 tools/perf/config/feature-checks/test-libelf.c
 create mode 100644 tools/perf/config/feature-checks/test-libnuma.c
 create mode 100644 tools/perf/config/feature-checks/test-libperl.c
 create mode 100644 tools/perf/config/feature-checks/test-libpython-version.c
 create mode 100644 tools/perf/config/feature-checks/test-libpython.c
 create mode 100644 tools/perf/config/feature-checks/test-libslang.c
 create mode 100644 tools/perf/config/feature-checks/test-libunwind.c
 create mode 100644 tools/perf/config/feature-checks/test-on-exit.c
 create mode 100644 tools/perf/config/feature-checks/test-stackprotector-all.c
 create mode 100644 tools/perf/config/feature-checks/test-stackprotector.c
 create mode 100644 tools/perf/config/feature-checks/test-volatile-register-var.c
 delete mode 100644 tools/perf/config/feature-tests.mak
tools/perf/Documentation/Makefile +4 -13
index 5a37a7c..eaa477f 100644
@@ -192,13 +192,14 @@ do-install-man: man
 
 install-man: check-man-tools man
 
-try-install-man:
 ifdef missing_tools
-	$(warning Please install $(missing_tools) to have the man pages installed)
+  DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed)
 else
-	$(MAKE) do-install-man
+  DO_INSTALL_MAN = do-install-man
 endif
 
+try-install-man: $(DO_INSTALL_MAN)
+
 install-info: info
 	$(INSTALL) -d -m 755 $(DESTDIR)$(infodir)
 	$(INSTALL) -m 644 $(OUTPUT)perf.info $(OUTPUT)perfman.info $(DESTDIR)$(infodir)
@@ -216,14 +217,6 @@ install-pdf: pdf
 #install-html: html
 #	'$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
 
-ifneq ($(MAKECMDGOALS),clean)
-ifneq ($(MAKECMDGOALS),tags)
-$(OUTPUT)PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE
-	$(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) $(OUTPUT)PERF-VERSION-FILE
-
--include $(OUTPUT)PERF-VERSION-FILE
-endif
-endif
 
 #
 # Determine "include::" file references in asciidoc files.
@@ -342,5 +335,3 @@ $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
 
 #quick-install-html:
 #	'$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)
-
-.PHONY: .FORCE-PERF-VERSION-FILE
tools/perf/Makefile +44 -797

863 lines not on this page · raw message

tools/perf/Makefile.perf new file +856 -0

856 lines not on this page · raw message

tools/perf/arch/x86/include/perf_regs.h +3 -3
index 7fcdcdb..e84ca76 100644
@@ -5,7 +5,7 @@
 #include "../../util/types.h"
 #include <asm/perf_regs.h>
 
-#ifndef ARCH_X86_64
+#ifndef HAVE_ARCH_X86_64_SUPPORT
 #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
 #else
 #define REG_NOSUPPORT ((1ULL << PERF_REG_X86_DS) | \
@@ -52,7 +52,7 @@ static inline const char *perf_reg_name(int id)
 		return "FS";
 	case PERF_REG_X86_GS:
 		return "GS";
-#ifdef ARCH_X86_64
+#ifdef HAVE_ARCH_X86_64_SUPPORT
 	case PERF_REG_X86_R8:
 		return "R8";
 	case PERF_REG_X86_R9:
@@ -69,7 +69,7 @@ static inline const char *perf_reg_name(int id)
 		return "R14";
 	case PERF_REG_X86_R15:
 		return "R15";
-#endif /* ARCH_X86_64 */
+#endif /* HAVE_ARCH_X86_64_SUPPORT */
 	default:
 		return NULL;
 	}
tools/perf/arch/x86/util/unwind.c +2 -2
index 78d956e..456a88c 100644
@@ -4,7 +4,7 @@
 #include "perf_regs.h"
 #include "../../util/unwind.h"
 
-#ifdef ARCH_X86_64
+#ifdef HAVE_ARCH_X86_64_SUPPORT
 int unwind__arch_reg_id(int regnum)
 {
 	int id;
@@ -108,4 +108,4 @@ int unwind__arch_reg_id(int regnum)
 
 	return id;
 }
-#endif /* ARCH_X86_64 */
+#endif /* HAVE_ARCH_X86_64_SUPPORT */
tools/perf/bench/mem-memcpy-arch.h +1 -1
index a72e36c..57b4ed8 100644
@@ -1,5 +1,5 @@
 
-#ifdef ARCH_X86_64
+#ifdef HAVE_ARCH_X86_64_SUPPORT
 
 #define MEMCPY_FN(fn, name, desc)		\
 	extern void *fn(void *, const void *, size_t);
tools/perf/bench/mem-memcpy.c +1 -1
index 8cdca43..5ce71d3 100644
@@ -58,7 +58,7 @@ struct routine routines[] = {
 	{ "default",
 	  "Default memcpy() provided by glibc",
 	  memcpy },
-#ifdef ARCH_X86_64
+#ifdef HAVE_ARCH_X86_64_SUPPORT
 
 #define MEMCPY_FN(fn, name, desc) { name, desc, fn },
 #include "mem-memcpy-x86-64-asm-def.h"
tools/perf/bench/mem-memset-arch.h +1 -1
index a040fa7..633800c 100644
@@ -1,5 +1,5 @@
 
-#ifdef ARCH_X86_64
+#ifdef HAVE_ARCH_X86_64_SUPPORT
 
 #define MEMSET_FN(fn, name, desc)		\
 	extern void *fn(void *, int, size_t);
tools/perf/bench/mem-memset.c +1 -1
index 4a2f120..9af79d2 100644
@@ -58,7 +58,7 @@ static const struct routine routines[] = {
 	{ "default",
 	  "Default memset() provided by glibc",
 	  memset },
-#ifdef ARCH_X86_64
+#ifdef HAVE_ARCH_X86_64_SUPPORT
 
 #define MEMSET_FN(fn, name, desc) { name, desc, fn },
 #include "mem-memset-x86-64-asm-def.h"
tools/perf/builtin-bench.c +2 -2
index 77298bf..33af80f 100644
@@ -35,7 +35,7 @@ struct bench_suite {
 /* sentinel: easy for help */
 #define suite_all { "all", "Test all benchmark suites", NULL }
 
-#ifdef LIBNUMA_SUPPORT
+#ifdef HAVE_LIBNUMA_SUPPORT
 static struct bench_suite numa_suites[] = {
 	{ "mem",
 	  "Benchmark for NUMA workloads",
@@ -80,7 +80,7 @@ struct bench_subsys {
 };
 
 static struct bench_subsys subsystems[] = {
-#ifdef LIBNUMA_SUPPORT
+#ifdef HAVE_LIBNUMA_SUPPORT
 	{ "numa",
 	  "NUMA scheduling and MM behavior",
 	  numa_suites },
tools/perf/builtin-inject.c +1 -1
index afe377b..f51a963 100644
@@ -231,7 +231,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
 				 * account this as unresolved.
 				 */
 			} else {
-#ifdef LIBELF_SUPPORT
+#ifdef HAVE_LIBELF_SUPPORT
 				pr_warning("no symbols found in %s, maybe "
 					   "install a debug package?\n",
 					   al.map->dso->long_name);
tools/perf/builtin-probe.c +7 -7
index e8a66f9..89acc17 100644
@@ -173,7 +173,7 @@ static int opt_set_target(const struct option *opt, const char *str,
 	if  (str && !params.target) {
 		if (!strcmp(opt->long_name, "exec"))
 			params.uprobes = true;
-#ifdef DWARF_SUPPORT
+#ifdef HAVE_DWARF_SUPPORT
 		else if (!strcmp(opt->long_name, "module"))
 			params.uprobes = false;
 #endif
@@ -187,7 +187,7 @@ static int opt_set_target(const struct option *opt, const char *str,
 	return ret;
 }
 
-#ifdef DWARF_SUPPORT
+#ifdef HAVE_DWARF_SUPPORT
 static int opt_show_lines(const struct option *opt __maybe_unused,
 			  const char *str, int unset __maybe_unused)
 {
@@ -257,7 +257,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		"perf probe [<options>] --add 'PROBEDEF' [--add 'PROBEDEF' ...]",
 		"perf probe [<options>] --del '[GROUP:]EVENT' ...",
 		"perf probe --list",
-#ifdef DWARF_SUPPORT
+#ifdef HAVE_DWARF_SUPPORT
 		"perf probe [<options>] --line 'LINEDESC'",
 		"perf probe [<options>] --vars 'PROBEPOINT'",
 #endif
@@ -271,7 +271,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 	OPT_CALLBACK('d', "del", NULL, "[GROUP:]EVENT", "delete a probe event.",
 		opt_del_probe_event),
 	OPT_CALLBACK('a', "add", NULL,
-#ifdef DWARF_SUPPORT
+#ifdef HAVE_DWARF_SUPPORT
 		"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT"
 		" [[NAME=]ARG ...]",
 #else
@@ -283,7 +283,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		"\t\tFUNC:\tFunction name\n"
 		"\t\tOFF:\tOffset from function entry (in byte)\n"
 		"\t\t%return:\tPut the probe at function return\n"
-#ifdef DWARF_SUPPORT
+#ifdef HAVE_DWARF_SUPPORT
 		"\t\tSRC:\tSource code path\n"
 		"\t\tRL:\tRelative line number from function entry.\n"
 		"\t\tAL:\tAbsolute line number in file.\n"
@@ -296,7 +296,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		opt_add_probe_event),
 	OPT_BOOLEAN('f', "force", &params.force_add, "forcibly add events"
 		    " with existing name"),
-#ifdef DWARF_SUPPORT
+#ifdef HAVE_DWARF_SUPPORT
 	OPT_CALLBACK('L', "line", NULL,
 		     "FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
 		     "Show source code lines.", opt_show_lines),
@@ -408,7 +408,7 @@ int cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
 		return ret;
 	}
 
-#ifdef DWARF_SUPPORT
+#ifdef HAVE_DWARF_SUPPORT
 	if (params.show_lines && !params.uprobes) {
 		if (params.mod_events) {
 			pr_err("  Error: Don't use --line with"
tools/perf/builtin-record.c +6 -6
index a78db3f..cf36ba2 100644
@@ -29,7 +29,7 @@
 #include <sched.h>
 #include <sys/mman.h>
 
-#ifndef HAVE_ON_EXIT
+#ifndef HAVE_ON_EXIT_SUPPORT
 #ifndef ATEXIT_MAX
 #define ATEXIT_MAX 32
 #endif
@@ -687,7 +687,7 @@ error:
 	return ret;
 }
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef HAVE_LIBUNWIND_SUPPORT
 static int get_stack_size(char *str, unsigned long *_size)
 {
 	char *endptr;
@@ -713,7 +713,7 @@ static int get_stack_size(char *str, unsigned long *_size)
 	       max_size, str);
 	return -1;
 }
-#endif /* LIBUNWIND_SUPPORT */
+#endif /* HAVE_LIBUNWIND_SUPPORT */
 
 int record_parse_callchain_opt(const struct option *opt,
 			       const char *arg, int unset)
@@ -751,7 +751,7 @@ int record_parse_callchain_opt(const struct option *opt,
 				       "needed for -g fp\n");
 			break;
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef HAVE_LIBUNWIND_SUPPORT
 		/* Dwarf style */
 		} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
 			const unsigned long default_stack_dump_size = 8192;
@@ -771,7 +771,7 @@ int record_parse_callchain_opt(const struct option *opt,
 			if (!ret)
 				pr_debug("callchain: stack dump size %d\n",
 					 opts->stack_dump_size);
-#endif /* LIBUNWIND_SUPPORT */
+#endif /* HAVE_LIBUNWIND_SUPPORT */
 		} else {
 			pr_err("callchain: Unknown -g option "
 			       "value: %s\n", arg);
@@ -818,7 +818,7 @@ static struct perf_record record = {
 
 #define CALLCHAIN_HELP "do call-graph (stack chain/backtrace) recording: "
 
-#ifdef LIBUNWIND_SUPPORT
+#ifdef HAVE_LIBUNWIND_SUPPORT
 const char record_callchain_help[] = CALLCHAIN_HELP "[fp] dwarf";
 #else
 const char record_callchain_help[] = CALLCHAIN_HELP "[fp]";
tools/perf/config/Makefile +216 -121

482 lines not on this page · raw message

tools/perf/config/feature-checks/Makefile new file +148 -0

148 lines not on this page · raw message

tools/perf/config/feature-checks/test-all.c new file +106 -0

106 lines not on this page · raw message

tools/perf/config/feature-checks/test-backtrace.c new file +13 -0
new file mode 100644
index 0000000..7124aa1
@@ -0,0 +1,13 @@
+#include <execinfo.h>
+#include <stdio.h>
+
+int main(void)
+{
+	void *backtrace_fns[10];
+	size_t entries;
+
+	entries = backtrace(backtrace_fns, 10);
+	backtrace_symbols_fd(backtrace_fns, entries, 1);
+
+	return 0;
+}
tools/perf/config/feature-checks/test-bionic.c new file +6 -0
new file mode 100644
index 0000000..eac24e9
@@ -0,0 +1,6 @@
+#include <android/api-level.h>
+
+int main(void)
+{
+	return __ANDROID_API__;
+}
tools/perf/config/feature-checks/test-cplus-demangle.c new file +14 -0
new file mode 100644
index 0000000..610c686
@@ -0,0 +1,14 @@
+extern int printf(const char *format, ...);
+extern char *cplus_demangle(const char *, int);
+
+int main(void)
+{
+	char symbol[4096] = "FieldName__9ClassNameFd";
+	char *tmp;
+
+	tmp = cplus_demangle(symbol, 0);
+
+	printf("demangled symbol: {%s}\n", tmp);
+
+	return 0;
+}
tools/perf/config/feature-checks/test-dwarf.c new file +10 -0
new file mode 100644
index 0000000..3fc1801
@@ -0,0 +1,10 @@
+#include <dwarf.h>
+#include <elfutils/libdw.h>
+#include <elfutils/version.h>
+
+int main(void)
+{
+	Dwarf *dbg = dwarf_begin(0, DWARF_C_READ);
+
+	return (long)dbg;
+}
tools/perf/config/feature-checks/test-fortify-source.c new file +6 -0
new file mode 100644
index 0000000..c9f398d
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void)
+{
+	return puts("hi");
+}
tools/perf/config/feature-checks/test-glibc.c new file +8 -0
new file mode 100644
index 0000000..b082034
@@ -0,0 +1,8 @@
+#include <gnu/libc-version.h>
+
+int main(void)
+{
+	const char *version = gnu_get_libc_version();
+
+	return (long)version;
+}
tools/perf/config/feature-checks/test-gtk2-infobar.c new file +11 -0
new file mode 100644
index 0000000..397b464
@@ -0,0 +1,11 @@
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#include <gtk/gtk.h>
+#pragma GCC diagnostic error "-Wstrict-prototypes"
+
+int main(int argc, char *argv[])
+{
+	gtk_init(&argc, &argv);
+	gtk_info_bar_new();
+
+	return 0;
+}
tools/perf/config/feature-checks/test-gtk2.c new file +10 -0
new file mode 100644
index 0000000..6bd80e5
@@ -0,0 +1,10 @@
+#pragma GCC diagnostic ignored "-Wstrict-prototypes"
+#include <gtk/gtk.h>
+#pragma GCC diagnostic error "-Wstrict-prototypes"
+
+int main(int argc, char *argv[])
+{
+	gtk_init(&argc, &argv);
+
+        return 0;
+}
tools/perf/config/feature-checks/test-hello.c new file +6 -0
new file mode 100644
index 0000000..c9f398d
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void)
+{
+	return puts("hi");
+}
tools/perf/config/feature-checks/test-libaudit.c new file +10 -0
new file mode 100644
index 0000000..afc019f
@@ -0,0 +1,10 @@
+#include <libaudit.h>
+
+extern int printf(const char *format, ...);
+
+int main(void)
+{
+	printf("error message: %s\n", audit_errno_to_name(0));
+
+	return audit_open();
+}
tools/perf/config/feature-checks/test-libbfd.c new file +15 -0
new file mode 100644
index 0000000..2405990
@@ -0,0 +1,15 @@
+#include <bfd.h>
+
+extern int printf(const char *format, ...);
+
+int main(void)
+{
+	char symbol[4096] = "FieldName__9ClassNameFd";
+	char *tmp;
+
+	tmp = bfd_demangle(0, symbol, 0);
+
+	printf("demangled symbol: {%s}\n", tmp);
+
+	return 0;
+}
tools/perf/config/feature-checks/test-libelf-getphdrnum.c new file +8 -0
new file mode 100644
index 0000000..d710459
@@ -0,0 +1,8 @@
+#include <libelf.h>
+
+int main(void)
+{
+	size_t dst;
+
+	return elf_getphdrnum(0, &dst);
+}
tools/perf/config/feature-checks/test-libelf-mmap.c new file +8 -0
new file mode 100644
index 0000000..564427d
@@ -0,0 +1,8 @@
+#include <libelf.h>
+
+int main(void)
+{
+	Elf *elf = elf_begin(0, ELF_C_READ_MMAP, 0);
+
+	return (long)elf;
+}
tools/perf/config/feature-checks/test-libelf.c new file +8 -0
new file mode 100644
index 0000000..08db322
@@ -0,0 +1,8 @@
+#include <libelf.h>
+
+int main(void)
+{
+	Elf *elf = elf_begin(0, ELF_C_READ, 0);
+
+	return (long)elf;
+}
tools/perf/config/feature-checks/test-libnuma.c new file +9 -0
new file mode 100644
index 0000000..4763d9c
@@ -0,0 +1,9 @@
+#include <numa.h>
+#include <numaif.h>
+
+int main(void)
+{
+	numa_available();
+
+	return 0;
+}
tools/perf/config/feature-checks/test-libperl.c new file +9 -0
new file mode 100644
index 0000000..8871f6a
@@ -0,0 +1,9 @@
+#include <EXTERN.h>
+#include <perl.h>
+
+int main(void)
+{
+	perl_alloc();
+
+	return 0;
+}
tools/perf/config/feature-checks/test-libpython-version.c new file +10 -0
new file mode 100644
index 0000000..facea12
@@ -0,0 +1,10 @@
+#include <Python.h>
+
+#if PY_VERSION_HEX >= 0x03000000
+	#error
+#endif
+
+int main(void)
+{
+	return 0;
+}
tools/perf/config/feature-checks/test-libpython.c new file +8 -0
new file mode 100644
index 0000000..b24b28a
@@ -0,0 +1,8 @@
+#include <Python.h>
+
+int main(void)
+{
+	Py_Initialize();
+
+	return 0;
+}
tools/perf/config/feature-checks/test-libslang.c new file +6 -0
new file mode 100644
index 0000000..22ff22e
@@ -0,0 +1,6 @@
+#include <slang.h>
+
+int main(void)
+{
+	return SLsmg_init_smg();
+}
tools/perf/config/feature-checks/test-libunwind.c new file +27 -0
new file mode 100644
index 0000000..43b9369
@@ -0,0 +1,27 @@
+#include <libunwind.h>
+#include <stdlib.h>
+
+extern int UNW_OBJ(dwarf_search_unwind_table) (unw_addr_space_t as,
+                                      unw_word_t ip,
+                                      unw_dyn_info_t *di,
+                                      unw_proc_info_t *pi,
+                                      int need_unwind_info, void *arg);
+
+
+#define dwarf_search_unwind_table UNW_OBJ(dwarf_search_unwind_table)
+
+static unw_accessors_t accessors;
+
+int main(void)
+{
+	unw_addr_space_t addr_space;
+
+	addr_space = unw_create_addr_space(&accessors, 0);
+	if (addr_space)
+		return 0;
+
+	unw_init_remote(NULL, addr_space, NULL);
+	dwarf_search_unwind_table(addr_space, 0, NULL, NULL, 0, NULL);
+
+	return 0;
+}
tools/perf/config/feature-checks/test-on-exit.c new file +15 -0
new file mode 100644
index 0000000..8f64ed3
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+static void exit_fn(int status, void *__data)
+{
+	printf("exit status: %d, data: %d\n", status, *(int *)__data);
+}
+
+static int data = 123;
+
+int main(void)
+{
+	on_exit(exit_fn, &data);
+
+	return 321;
+}
tools/perf/config/feature-checks/test-stackprotector-all.c new file +6 -0
new file mode 100644
index 0000000..c9f398d
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void)
+{
+	return puts("hi");
+}
tools/perf/config/feature-checks/test-stackprotector.c new file +6 -0
new file mode 100644
index 0000000..c9f398d
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void)
+{
+	return puts("hi");
+}
tools/perf/config/feature-checks/test-volatile-register-var.c new file +6 -0
new file mode 100644
index 0000000..c9f398d
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+int main(void)
+{
+	return puts("hi");
+}
tools/perf/config/feature-tests.mak deleted +0 -246

81 lines not on this page · raw message

tools/perf/config/utilities.mak +0 -14
index 94d2d4f..4d985e0 100644

Lines of this file are not shown. View the raw message.

tools/perf/perf.c +2 -2
index 85e1aed..245020c 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/gtk/browser.c +1 -1
index c95012c..c24d912 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/gtk/gtk.h +2 -2
index 3d96785..a72acbc 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/gtk/util.c +2 -2
index c06942a..696c1fb 100644

Lines of this file are not shown. View the raw message.

tools/perf/ui/ui.h +2 -2
index 70cb0d4..1349d14 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/annotate.h +2 -2
index af75515..f0699e9 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/cache.h +1 -2
index 26e3672..7b176dd 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/generate-cmdlist.sh +2 -2
index 3ac3803..36a885d 100755

Lines of this file are not shown. View the raw message.

tools/perf/util/hist.h +2 -2
index 6a048c0..ed4f90e 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/include/dwarf-regs.h +1 -1
index cf6727e..8f14965 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/include/linux/compiler.h +14 -5
index 96b919d..b003ad7 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/map.c +1 -1
index 4f6680d..17ee458 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/path.c +7 -3
index a8c4954..5d13cb4 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/perf_regs.h +2 -2
index 5a4f2b6f..a3d42cd 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/probe-event.c +2 -2
index aa04bf9..779b2da 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/probe-finder.h +2 -2
index 3b7d630..3f0c29d 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/symbol-elf.c +1 -1
index a9c829b..c376930 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/symbol.h +4 -4
index fd5b70e..2a97bb1 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/unwind.h +2 -2
index cb6bc50..ec0c71a 100644

Lines of this file are not shown. View the raw message.

tools/perf/util/util.c +2 -2
index 6d17b18..ccfdeb6 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.

#1 lore raw

Em Wed, Oct 09, 2013 at 09:01:49AM +0200, Ingo Molnar escreveu:

Quoted 8 lines

Arnaldo,

Please pull the tools/perf/build git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tmp.tools/perf/build

   # HEAD: 165108a92fc554d51e73b143b69b77e7c278da78 tools/perf/build: Clean up feature_print_code()
Quoted 5 lines

This tree contains the build system speedup series described at:

   https://lkml.org/lkml/2013/10/7/199

Reviewed by David Ahern and Jiri Olsa (thanks guys!).

One problem I just noticed, and that is not preventing me from merging this now, as it has a (obvious) workaround:

If I try using O= I better make sure the directory it points to exists:

[acme@sandy linux]$ ls -la tools/perf/*.o tools/perf/util/*.o
ls: cannot access tools/perf/*.o: No such file or directory
ls: cannot access tools/perf/util/*.o: No such file or directory [acme@sandy linux]$ mkdir -p /tmp/build/perf/
[acme@sandy linux]$ time make O=/tmp/build/perf -C tools/perf/ install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build

Auto-detecting system features:
... backtrace: [ on ]
... dwarf: [ on ]
<SNIP>
make: Leaving directory `/home/acme/git/linux/tools/perf'

real 0m2.751s
user 0m4.270s
sys 0m1.240s
[acme@sandy linux]$ ls -la tools/perf/*.o tools/perf/util/*.o
ls: cannot access tools/perf/*.o: No such file or directory
ls: cannot access tools/perf/util/*.o: No such file or directory [acme@sandy linux]$ ls -la /tmp/build/perf/perf -rwxrwxr-x. 1 acme acme 9791281 Oct 9 11:32 /tmp/build/perf/perf [acme@sandy linux]$

---------------------------------------------------------------------------------

Works as expected, but if I do:

[acme@sandy linux]$ rm -rf /tmp/build
[acme@sandy linux]$ time make O=/tmp/build/perf -C tools/perf/ install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build

Auto-detecting system features:
... backtrace: [ on ]
<SNIP>
make: Leaving directory `/home/acme/git/linux/tools/perf'

real 0m2.715s
user 0m4.118s
sys 0m1.204s
[acme@sandy linux]$ ls -la tools/perf/*.o tools/perf/util/*.o | wc -l 94
[acme@sandy linux]$ ls -la /tmp/build
ls: cannot access /tmp/build: No such file or directory [acme@sandy linux]$

---------------------------------------------------------------------------------

It silently ignores the O= target, as it doesn't exists.

Previous, expected behaviour is for the build process to stop, complaining that the target directory doesn't exists.

- Arnaldo

#2 lore raw
Quoted 67 lines · Arnaldo Carvalho de Melo

Em Wed, Oct 09, 2013 at 09:01:49AM +0200, Ingo Molnar escreveu:

Quoted 8 lines

Arnaldo,

Please pull the tools/perf/build git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git tmp.tools/perf/build

   # HEAD: 165108a92fc554d51e73b143b69b77e7c278da78 tools/perf/build: Clean up feature_print_code()
Quoted 5 lines

This tree contains the build system speedup series described at:

   https://lkml.org/lkml/2013/10/7/199

Reviewed by David Ahern and Jiri Olsa (thanks guys!).

One problem I just noticed, and that is not preventing me from merging this now, as it has a (obvious) workaround:

If I try using O= I better make sure the directory it points to exists:

[acme@sandy linux]$ ls -la tools/perf/*.o tools/perf/util/*.o
ls: cannot access tools/perf/*.o: No such file or directory
ls: cannot access tools/perf/util/*.o: No such file or directory [acme@sandy linux]$ mkdir -p /tmp/build/perf/
[acme@sandy linux]$ time make O=/tmp/build/perf -C tools/perf/ install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build

Auto-detecting system features:
... backtrace: [ on ]
... dwarf: [ on ]
<SNIP>
make: Leaving directory `/home/acme/git/linux/tools/perf'

real 0m2.751s
user 0m4.270s
sys 0m1.240s
[acme@sandy linux]$ ls -la tools/perf/*.o tools/perf/util/*.o
ls: cannot access tools/perf/*.o: No such file or directory
ls: cannot access tools/perf/util/*.o: No such file or directory [acme@sandy linux]$ ls -la /tmp/build/perf/perf -rwxrwxr-x. 1 acme acme 9791281 Oct 9 11:32 /tmp/build/perf/perf [acme@sandy linux]$

---------------------------------------------------------------------------------

Works as expected, but if I do:

[acme@sandy linux]$ rm -rf /tmp/build
[acme@sandy linux]$ time make O=/tmp/build/perf -C tools/perf/ install-bin
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build

Auto-detecting system features:
... backtrace: [ on ]
<SNIP>
make: Leaving directory `/home/acme/git/linux/tools/perf'

real 0m2.715s
user 0m4.118s
sys 0m1.204s
[acme@sandy linux]$ ls -la tools/perf/*.o tools/perf/util/*.o | wc -l 94
[acme@sandy linux]$ ls -la /tmp/build
ls: cannot access /tmp/build: No such file or directory [acme@sandy linux]$

Quoted 6 lines

---------------------------------------------------------------------------------

It silently ignores the O= target, as it doesn't exists.

Previous, expected behaviour is for the build process to stop, complaining that the target directory doesn't exists.

Yeah. So the reproducer for me is:

rm -rf /tmp/build
mkdir -p /tmp/build/perf
make O=/tmp/build/perf -C tools/perf/ install-bin rm -rf /tmp/build
make O=/tmp/build/perf -C tools/perf/ install-bin

the second install-bin should fail, and on the old tree it fails correctly
- but with the new tree it pretends that it succeeds.

Looking into it.

Thanks,

Ingo

#3 lore raw

PATCH 1/1 tools/perf/build: Fix non-existent build directory handling

Quoted 13 lines · Ingo Molnar
Quoted 4 lines

It silently ignores the O= target, as it doesn't exists.

Previous, expected behaviour is for the build process to stop, complaining that the target directory doesn't exists.

Yeah. So the reproducer for me is:

rm -rf /tmp/build
mkdir -p /tmp/build/perf
make O=/tmp/build/perf -C tools/perf/ install-bin rm -rf /tmp/build
make O=/tmp/build/perf -C tools/perf/ install-bin

Quoted 4 lines

the second install-bin should fail, and on the old tree it fails correctly
- but with the new tree it pretends that it succeeds.

Looking into it.

does the patch below fix it?

Thanks,

Ingo

=====================>
[PATCH] tools/perf/build: Fix non-existent build directory handling
From: Ingo Molnar <[email protected]>

Arnaldo reported that non-existent build directories were not recognized properly. The reason is readlink failure causing 'O' to become empty.

Solve it by passing through the 'O' variable unmodified if readlink fails.

tools/perf/Makefile +1 -1
index 5aa3d04..9147044 100644
@@ -34,7 +34,7 @@ endif
 # Only pass canonical directory names as the output directory:
 #
 ifneq ($(O),)
-  FULL_O := $(shell readlink -f $(O))
+  FULL_O := $(shell readlink -f $(O) || echo $(O))
 endif
 
 define print_msg
#5 lore raw
In reply to Ingo Molnar

So while merging what I have in my perf/core branch I got to Vitillo's, as peterz called it, "inlining" of addr2line, i.e. using libbfd to do that work, it will look if lbfd is in EXTLIBS and if so, use it, otherwise we continue exec'in the addr2line tool.

Since this appears when doing the feature check:

... libbfd: [ on ]

I wanted to build just one object file that is related to this:

[acme@sandy linux]$ ls -la /tmp/build/perf/util/util/srcline.o
ls: cannot access /tmp/build/perf/util/util/srcline.o: No such file or directory [acme@sandy linux]$ ls -la tools/perf/util/srcline.c
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$ ls -la tools/perf/util/srcline.*
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$ make V=1 O=/tmp/build/perf -C tools/perf/ util/srcline.o
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build
# Redirected target util/srcline.o => /tmp/build/perf/util/util/srcline.o
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@sandy linux]$
[acme@sandy linux]$ ls -la /tmp/build/perf/util/util/srcline.o
ls: cannot access /tmp/build/perf/util/util/srcline.o: No such file or directory [acme@sandy linux]$ make V=1 O=/tmp/build/perf -C tools/perf/ /tmp/build/perf/util/util/srcline.o
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build
make[1]: *** No rule to make target `/tmp/build/perf/util/util/srcline.o'. Stop.
make: *** [/tmp/build/perf/util/util/srcline.o] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@sandy linux]$ ls -la tools/perf/util/srcline.*
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$

What am I doing wrong here while trying to build just one .o file?

Back to checking why it is not using the 'inline' addr2line...

- Arnaldo

#6 lore raw

Em Wed, Oct 09, 2013 at 04:16:26PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 35 lines

So while merging what I have in my perf/core branch I got to Vitillo's, as peterz called it, "inlining" of addr2line, i.e. using libbfd to do that work, it will look if lbfd is in EXTLIBS and if so, use it, otherwise we continue exec'in the addr2line tool.

Since this appears when doing the feature check:

... libbfd: [ on ]

I wanted to build just one object file that is related to this:

[acme@sandy linux]$ ls -la /tmp/build/perf/util/util/srcline.o
ls: cannot access /tmp/build/perf/util/util/srcline.o: No such file or directory [acme@sandy linux]$ ls -la tools/perf/util/srcline.c
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$ ls -la tools/perf/util/srcline.*
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$ make V=1 O=/tmp/build/perf -C tools/perf/ util/srcline.o
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build
# Redirected target util/srcline.o => /tmp/build/perf/util/util/srcline.o
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@sandy linux]$
[acme@sandy linux]$ ls -la /tmp/build/perf/util/util/srcline.o
ls: cannot access /tmp/build/perf/util/util/srcline.o: No such file or directory [acme@sandy linux]$ make V=1 O=/tmp/build/perf -C tools/perf/ /tmp/build/perf/util/util/srcline.o
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build
make[1]: *** No rule to make target `/tmp/build/perf/util/util/srcline.o'. Stop.
make: *** [/tmp/build/perf/util/util/srcline.o] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@sandy linux]$ ls -la tools/perf/util/srcline.*
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$

Quoted 3 lines

What am I doing wrong here while trying to build just one .o file?

Back to checking why it is not using the 'inline' addr2line...

For the record, it is now working, HAVE_LIBBFD_SUPPORT is set once -lbfd is found on EXTLIBS, etc, as written by Robert in the original patch, thinko on my part, its just the building of single .o files that doesn't seem to work.

- Arnaldo

#7 lore raw

PATCH 1/1 tools/perf/build: Fix redirection printouts

In reply to Arnaldo Carvalho de Melo
Quoted 35 lines · Arnaldo Carvalho de Melo

So while merging what I have in my perf/core branch I got to Vitillo's, as peterz called it, "inlining" of addr2line, i.e. using libbfd to do that work, it will look if lbfd is in EXTLIBS and if so, use it, otherwise we continue exec'in the addr2line tool.

Since this appears when doing the feature check:

... libbfd: [ on ]

I wanted to build just one object file that is related to this:

[acme@sandy linux]$ ls -la /tmp/build/perf/util/util/srcline.o
ls: cannot access /tmp/build/perf/util/util/srcline.o: No such file or directory [acme@sandy linux]$ ls -la tools/perf/util/srcline.c
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$ ls -la tools/perf/util/srcline.*
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$ make V=1 O=/tmp/build/perf -C tools/perf/ util/srcline.o
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build
# Redirected target util/srcline.o => /tmp/build/perf/util/util/srcline.o
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@sandy linux]$
[acme@sandy linux]$ ls -la /tmp/build/perf/util/util/srcline.o
ls: cannot access /tmp/build/perf/util/util/srcline.o: No such file or directory [acme@sandy linux]$ make V=1 O=/tmp/build/perf -C tools/perf/ /tmp/build/perf/util/util/srcline.o
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j8' parallel build
make[1]: *** No rule to make target `/tmp/build/perf/util/util/srcline.o'. Stop.
make: *** [/tmp/build/perf/util/util/srcline.o] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@sandy linux]$ ls -la tools/perf/util/srcline.*
-rw-rw-r--. 1 acme acme 1777 Oct 9 16:06 tools/perf/util/srcline.c
[acme@sandy linux]$

Quoted 5 lines

What am I doing wrong here while trying to build just one .o file?

Back to checking why it is not using the 'inline' addr2line...

- Arnaldo

There's two things that I can see here.

1)

The printout is a bit off, duplicating util/util. The fix below should help with that.

2)

This issue is more difficult: if tools/perf/util/srcline.o exists, then the redirection will not happen and make just says:

comet:~/tip/tools/perf> rm -f /tmp/build/perf/util/pager.o comet:~/tip/tools/perf> make O=/tmp/build/perf/ util/pager.o
make: `util/pager.o' is up to date.

comet:~/tip/tools/perf> ll /tmp/build/perf/util/pager.o
ls: cannot access /tmp/build/perf/util/pager.o: No such file or directory comet:~/tip/tools/perf> ll util/pager.o
-rw-rw-r-- 1 mingo mingo 297488 Oct 10 07:34 util/pager.o

So the redirection quirks will only work in a clean tree. I think that should be fine - people who build via O= generally do it to keep their source trees clean.

Thanks,

Ingo

======================>

Quoted 1 line

From 881641d16f8445d8796c3b437cb33d6467af98b7 Mon Sep 17 00:00:00 2001

From: Ingo Molnar <[email protected]>
Date: Thu, 10 Oct 2013 07:36:52 +0200
Subject: [PATCH] tools/perf/bench: Fix redirection printouts

Fix the duplicate util/util printout Arnaldo reported:

       $ make V=1 O=/tmp/build/perf -C tools/perf/ util/srcline.o
   ...
       # Redirected target util/srcline.o =>     /tmp/build/perf/util/util/srcline.o
---
 tools/perf/Makefile.perf | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/Makefile.perf +3 -3
index ee97778..2d55480 100644
@@ -585,11 +585,11 @@ ifneq ($(OUTPUT),)
 %.o: $(OUTPUT)%.o
 	@echo "    # Redirected target $@ => $(OUTPUT)$@"
 util/%.o: $(OUTPUT)util/%.o
-	@echo "    # Redirected target $@ => $(OUTPUT)util/$@"
+	@echo "    # Redirected target $@ => $(OUTPUT)$@"
 bench/%.o: $(OUTPUT)bench/%.o
-	@echo "    # Redirected target $@ => $(OUTPUT)bench/$@"
+	@echo "    # Redirected target $@ => $(OUTPUT)$@"
 tests/%.o: $(OUTPUT)tests/%.o
-	@echo "    # Redirected target $@ => $(OUTPUT)tests/$@"
+	@echo "    # Redirected target $@ => $(OUTPUT)$@"
 endif
 
 # These two need to be here so that when O= is not used they take precedence
#9 lore raw

PATCH 1/1 tools/perf/build: Pass through DEBUG parameter

In reply to Arnaldo Carvalho de Melo

Arnaldo reported that 'make DEBUG=1' does not work anymore.

The reason is that 'Makefile' only passes it through to 'Makefile.perf' via the environment, but 'Makefile.perf' checks that it's a command line option:

    ifeq ("$(origin DEBUG)", "command line")
      PERF_DEBUG = $(DEBUG)
    endif

So pass it through properly, and also clean up DEBUG parameter handling while at it and fix a couple of annoyances:

- DEBUG=0 used to be interpreted as 'debugging on'. Turn it into 'debugging off' instead.

- Same was the case for 'DEBUG=' - turn that into debug-off as well.

- Pass in just a clean, sanitized 'DEBUG' value and get rid of the intermediate, unnecessary PERF_DEBUG variable.

---
 tools/perf/Makefile        | 15 ++++++++++++++-
 tools/perf/config/Makefile |  7 ++-----
 2 files changed, 16 insertions(+), 6 deletions(-)
tools/perf/Makefile +14 -1
index 9147044..4835618 100644
@@ -37,12 +37,25 @@ ifneq ($(O),)
   FULL_O := $(shell readlink -f $(O) || echo $(O))
 endif
 
+#
+# Only accept the 'DEBUG' variable from the command line:
+#
+ifeq ("$(origin DEBUG)", "command line")
+  ifeq ($(DEBUG),)
+    override DEBUG = 0
+  else
+    SET_DEBUG = "DEBUG=$(DEBUG)"
+  endif
+else
+  override DEBUG = 0
+endif
+
 define print_msg
   @printf '  BUILD:   Doing '\''make \033[33m-j'$(JOBS)'\033[m'\'' parallel build\n'
 endef
 
 define make
-  @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $@
+  @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
 endef
 
 #
tools/perf/config/Makefile +2 -5
index f5d661f..3227107 100644
@@ -66,10 +66,7 @@ ifneq ($(WERROR),0)
   CFLAGS += -Werror
 endif
 
-ifeq ("$(origin DEBUG)", "command line")
-  PERF_DEBUG = $(DEBUG)
-endif
-ifndef PERF_DEBUG
+ifeq ($(DEBUG),0)
   CFLAGS += -O6
 endif
 
@@ -210,7 +207,7 @@ ifeq ($(feature-volatile-register-var), 1)
   CFLAGS += -Wvolatile-register-var
 endif
 
-ifndef PERF_DEBUG
+ifeq ($(DEBUG),0)
   ifeq ($(feature-fortify-source), 1)
     CFLAGS += -D_FORTIFY_SOURCE=2
   endif
#10 lore raw
In reply to Ingo Molnar

Two problems:

the message:

BUILD: Doing 'make -j1' parallel build

Looks funny: 'parallel' && -j1? :-)

This is on fedora12, on a kvm guest, nfs mounting /home/acme/git, all works well up to the liblk.a part, cloning it to do it without NFS to continue testing the integration of acme/perf/core with the build speedup patches.

- Arnaldo

----------------------

[acme@fedora12 linux]$ make O=/tmp/build/perf/ -C tools/perf install
make: Entering directory `/home/acme/git/linux/tools/perf'
BUILD: Doing 'make -j1' parallel build

Auto-detecting system features:
... backtrace: [ on ]
... dwarf: [ OFF ]

...                fortify-source: [ on  ]
...                         glibc: [ on  ]
...                          gtk2: [ on  ]
...                  gtk2-infobar: [ on  ]
...                      libaudit: [ OFF ]
...                        libbfd: [ on  ]
...                        libelf: [ on  ]

... libelf-getphdrnum: [ OFF ]
... libelf-mmap: [ on ]
... libnuma: [ OFF ]
... libperl: [ OFF ]

...                     libpython: [ on  ]
...             libpython-version: [ on  ]
...                      libslang: [ on  ]
...                     libunwind: [ OFF ]
...                       on-exit: [ on  ]
...                stackprotector: [ on  ]
...            stackprotector-all: [ on  ]
...         volatile-register-var: [ on  ]

config/Makefile:278: No libdw.h found or old libdw.h found or elfutils is older than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev config/Makefile:335: No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 0.99
config/Makefile:349: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
config/Makefile:519: No numa.h found, disables 'perf bench numa mem' benchmark, please install numa-libs-devel or libnuma-dev
SUBDIR /home/acme/git/linux/tools/lib/lk/
AR liblk.a
rm: cannot remove `liblk.a': Permission denied
make[2]: *** [liblk.a] Error 1
make[1]: *** [/tmp/build/perf/liblk.a] Error 2
make: *** [install] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
[acme@fedora12 linux]$ fg
-bash: fg: current: no such job
[acme@fedora12 linux]$ vim tools/perf/Makefile.perf
[acme@fedora

#11 lore raw

Em Thu, Oct 10, 2013 at 04:26:08PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 11 lines

Two problems:

the message:

BUILD: Doing 'make -j1' parallel build

Looks funny: 'parallel' && -j1? :-)

This is on fedora12, on a kvm guest, nfs mounting /home/acme/git, all works well up to the liblk.a part, cloning it to do it without NFS to continue testing the integration of acme/perf/core with the build speedup patches.

<SNIP>

Quoted 9 lines

AR liblk.a
rm: cannot remove `liblk.a': Permission denied make[2]: *** [liblk.a] Error 1
make[1]: *** [/tmp/build/perf/liblk.a] Error 2
make: *** [install] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf' [acme@fedora12 linux]$ fg
-bash: fg: current: no such job
[acme@fedora12 linux]$ vim tools/perf/Makefile.perf

/me scratches head, tried this on another kvm guest, ubuntu 13.04, x86_64, works as expected, but stumbled in another problem:

acme@ubuntu-acme:~/git/linux$ time make -C tools/perf -f tests/make
make: Entering directory `/home/acme/git/linux/tools/perf'
make[3]: *** No rule to make target
`/home/git/linux/tools/lib/traceevent/trace-seq.c', needed by
`.trace-seq.d'.  Stop.
make[2]: ***
[/home/acme/git/linux/tools/lib/traceevent/libtraceevent.a-clean] Error
2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [clean] Error 2
make: *** [make_pure] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'

real 0m0.254s
user 0m0.064s
sys 0m0.084s
acme@ubuntu-acme:~/git/linux$

And this does work on a RHEL6 box, continue to investigate...

- Arnaldo

#12 lore raw

Em Thu, Oct 10, 2013 at 04:50:14PM -0300, Arnaldo Carvalho de Melo escreveu:

Quoted 16 lines

/me scratches head, tried this on another kvm guest, ubuntu 13.04, x86_64, works as expected, but stumbled in another problem:

acme@ubuntu-acme:~/git/linux$ time make -C tools/perf -f tests/make
make: Entering directory `/home/acme/git/linux/tools/perf'
make[3]: *** No rule to make target
`/home/git/linux/tools/lib/traceevent/trace-seq.c', needed by
`.trace-seq.d'.  Stop.
make[2]: ***
[/home/acme/git/linux/tools/lib/traceevent/libtraceevent.a-clean] Error
2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [clean] Error 2
make: *** [make_pure] Error 2
make: Leaving directory `/home/acme/git/linux/tools/perf'
Quoted 6 lines

real 0m0.254s
user 0m0.064s
sys 0m0.084s
acme@ubuntu-acme:~/git/linux$

And this does work on a RHEL6 box, continue to investigate...

Ok, if I do:

acme@ubuntu-acme:~/git/linux$ make -C tools clean
<SNIP>
make[1]: Entering directory `/home/acme/git/linux/tools/perf'
  CLEAN    libtraceevent
  CLEAN    config
make[3]: *** No rule to make target
`/home/git/linux/tools/lib/traceevent/trace-seq.c', needed by
`.trace-seq.d'.  Stop.
make[2]: ***
[/home/acme/git/linux/tools/lib/traceevent/libtraceevent.a-clean] Error
2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [clean] Error 2
make[1]: Leaving directory `/home/acme/git/linux/tools/perf'
make: *** [perf_clean] Error 2
make: Leaving directory `/home/acme/git/linux/tools'
acme@ubuntu-acme:~/git/linux$

So, if cleaning manually:

[acme@zoo linux]$ find tools -name ".*.d" tools/lib/traceevent/.trace-seq.d tools/lib/traceevent/.event-parse.d tools/lib/traceevent/.parse-filter.d tools/lib/traceevent/.kbuffer-parse.d tools/lib/traceevent/.parse-utils.d [acme@zoo linux]$ find tools -name ".*.d" | xargs rm [acme@zoo linux]$ find tools -name ".*.d" [acme@zoo linux]$

(on the NFS server, mind you)

And now trying again to clean on ubuntu (NFS client):

Works, trying again tests/make...

acme@ubuntu-acme:~/git/linux$ time make -C tools/perf -f tests/make
make: Entering directory `/home/acme/git/linux/tools/perf'
- make_pure: cd . && make -f Makefile DESTDIR=/tmp/tmp.2uwAzyGti8

-----------------------

Take a while, even more over NFS it seems, could do with some paralelization... ;-) :-)

Anyway, letting it run and not doing anything on that source tree in any other machine (NFS server or clients), will see..

- Arnaldo

#13 lore raw

Arnaldo, David,
wrt to our IRC discussion..

attached patch fixies the static build David is using:
make O=/tmp/perf LDFLAGS=-static DEBUG=1 -j 4

I still got some warning though:
LINK /tmp/perf/perf
/tmp/perf/libperf.a(target.o): In function `perf_target__parse_uid':
/home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:72: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:84: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x67f8): warning: the use of mktemp' is dangerous, better use mkstemp'

but I guess it's ok ;-) feel free to melt the
change into the original patch

This change is on top of the NO_DEMANGLE fix in:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
acme_test

jirka

tools/perf/config/Makefile +1 -1
index 233dd36..9680424 100644
@@ -504,7 +504,7 @@ else
   endif
 endif
 
-ifndef ($(filter -lbfd,$(EXTLIBS)),)
+ifneq ($(filter -lbfd,$(EXTLIBS)),)
   CFLAGS += -DHAVE_LIBBFD_SUPPORT
 endif
Tested-by
#14 lore raw
Quoted 7 lines · Jiri Olsa

I still got some warning though:
LINK /tmp/perf/perf
/tmp/perf/libperf.a(target.o): In function `perf_target__parse_uid':
/home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:72: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /home/jolsa/kernel.org/linux-perf/tools/perf/util/target.c:84: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../lib64/libpthread.a(libpthread.o): In function `sem_open':
(.text+0x67f8): warning: the use of mktemp' is dangerous, better use mkstemp'

harmless.

tools/perf/config/Makefile else · line 510

Quoted 13 lines
tools/perf/config/Makefile +1 -1
index 233dd36..9680424 100644
@@ -504,7 +504,7 @@ else
    endif
  endif
 
-ifndef ($(filter -lbfd,$(EXTLIBS)),)
+ifneq ($(filter -lbfd,$(EXTLIBS)),)
    CFLAGS += -DHAVE_LIBBFD_SUPPORT
  endif
 

Nice find.

#8 lore raw

[tip:perf/core] perf tools: Fix redirection printouts

In reply to Ingo Molnar
perf tools: Fix redirection printouts
Commit-ID:  cee972c0e6940ec75bab2d02f37e96d06ce143eb
Gitweb:     http://git.kernel.org/tip/cee972c0e6940ec75bab2d02f37e96d06ce143eb
Author:     Ingo Molnar <[email protected]>
AuthorDate: Thu, 10 Oct 2013 07:42:56 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 11 Oct 2013 12:18:04 -0300

perf tools: Fix redirection printouts

Fix the duplicate util/util printout Arnaldo reported:

       $ make V=1 O=/tmp/build/perf -C tools/perf/ util/srcline.o
   ...
       # Redirected target util/srcline.o =>     /tmp/build/perf/util/util/srcline.o
---
 tools/perf/Makefile.perf | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/Makefile.perf +3 -3
index 2badb08..8bc6d0c 100644
@@ -600,11 +600,11 @@ ifneq ($(OUTPUT),)
 %.o: $(OUTPUT)%.o
 	@echo "    # Redirected target $@ => $(OUTPUT)$@"
 util/%.o: $(OUTPUT)util/%.o
-	@echo "    # Redirected target $@ => $(OUTPUT)util/$@"
+	@echo "    # Redirected target $@ => $(OUTPUT)$@"
 bench/%.o: $(OUTPUT)bench/%.o
-	@echo "    # Redirected target $@ => $(OUTPUT)bench/$@"
+	@echo "    # Redirected target $@ => $(OUTPUT)$@"
 tests/%.o: $(OUTPUT)tests/%.o
-	@echo "    # Redirected target $@ => $(OUTPUT)tests/$@"
+	@echo "    # Redirected target $@ => $(OUTPUT)$@"
 endif
 
 # These two need to be here so that when O= is not used they take precedence
#4 lore raw

[tip:perf/core] tools/perf/build: Fix non-existent build directory handling

In reply to Ingo Molnar
tools/perf/build: Fix non-existent build directory handling
Commit-ID:  3fb66335e13ef7426affe9efa48c08857202c1cb
Gitweb:     http://git.kernel.org/tip/3fb66335e13ef7426affe9efa48c08857202c1cb
Author:     Ingo Molnar <[email protected]>
AuthorDate: Wed, 9 Oct 2013 17:00:23 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Mon, 14 Oct 2013 10:29:05 -0300

tools/perf/build: Fix non-existent build directory handling

Arnaldo reported that non-existent build directories were not recognized properly. The reason is readlink failure causing 'O' to become empty.

Solve it by passing through the 'O' variable unmodified if readlink fails.

---
 tools/perf/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Makefile +1 -1
index 5aa3d04..9147044 100644
@@ -34,7 +34,7 @@ endif
 # Only pass canonical directory names as the output directory:
 #
 ifneq ($(O),)
-  FULL_O := $(shell readlink -f $(O))
+  FULL_O := $(shell readlink -f $(O) || echo $(O))
 endif
 
 define print_msg