2014-10-23 21:58:55

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 00/14] Kbuild for perf

Hello,

Here is a proposal of perf's build process managed by Kbuild:
* The file Makefile.perf is replaced by Makefile.kbuild
* Makefile.kbuild generates a default .config file if none exists
(allyesconfig)
* Makefile.kbuild adapts the .config file according to the
features-check tests results
* Makefile.kbuild builds external dependencies (linux/tools/lib/*)
* Makefile.kbuild leaves the rest to Kbuild

Regards,

Alexis.

Alexis Berlemont (11):
kbuild: add support of custom paths for "auto.conf*" files
perf kbuild: remove Makefile.perf
perf kbuild: remove legacy tui/gui-related build variables
perf kbuild: remove legacy demangle-related build variables
perf kbuild: cross-compilation variables are now handled in Kconfig
perf kbuild: remove legacy misc build variables
perf kbuild: remove legacy libelf-related build variables
perf kbuild: remove legacy libdwarf-related build variables
perf kbuild: remove legacy script-related build variables
perf kbuild: final cosmetic changes
perf kbuild: add generated Kconfig build-test cases

Jiri Olsa (3):
perf tools: Kbuild builtin source related fixies
perf tools: Kbuild source related fixies
perf tools: Add kbuild support into Makefile.kbuild

scripts/Makefile.build | 3 +-
scripts/kconfig/confdata.c | 23 +-
scripts/kconfig/lkc.h | 1 +
tools/perf/Kbuild | 47 +
tools/perf/Kconfig | 436 ++++++++++
tools/perf/MANIFEST | 1 +
tools/perf/Makefile | 2 +-
tools/perf/Makefile.kbuild | 443 ++++++++++
tools/perf/Makefile.perf | 949 ---------------------
tools/perf/arch/Kbuild | 3 +
tools/perf/arch/arm/Kbuild | 2 +
tools/perf/arch/arm/Makefile | 14 -
tools/perf/arch/arm/tests/Kbuild | 2 +
tools/perf/arch/arm/util/Kbuild | 3 +
tools/perf/arch/arm64/Kbuild | 1 +
tools/perf/arch/arm64/Makefile | 7 -
tools/perf/arch/arm64/util/Kbuild | 2 +
tools/perf/arch/powerpc/Kbuild | 1 +
tools/perf/arch/powerpc/Makefile | 6 -
tools/perf/arch/powerpc/util/Kbuild | 3 +
tools/perf/arch/s390/Kbuild | 1 +
tools/perf/arch/s390/Makefile | 7 -
tools/perf/arch/s390/util/Kbuild | 2 +
tools/perf/arch/sh/Kbuild | 1 +
tools/perf/arch/sh/Makefile | 4 -
tools/perf/arch/sh/util/Kbuild | 1 +
tools/perf/arch/sparc/Kbuild | 1 +
tools/perf/arch/sparc/Makefile | 4 -
tools/perf/arch/sparc/util/Kbuild | 1 +
tools/perf/arch/x86/Kbuild | 2 +
tools/perf/arch/x86/Makefile | 19 -
tools/perf/arch/x86/include/perf_regs.h | 8 +-
tools/perf/arch/x86/tests/Kbuild | 3 +
tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 2 +-
tools/perf/arch/x86/tests/regs_load.S | 3 +-
tools/perf/arch/x86/util/Kbuild | 6 +
tools/perf/arch/x86/util/unwind-libunwind.c | 5 +-
tools/perf/bench/Kbuild | 12 +
tools/perf/bench/mem-memcpy-arch.h | 4 +-
tools/perf/bench/mem-memcpy.c | 4 +-
tools/perf/bench/mem-memset-arch.h | 4 +-
tools/perf/bench/mem-memset.c | 4 +-
tools/perf/builtin-annotate.c | 8 +-
tools/perf/builtin-bench.c | 5 +-
tools/perf/builtin-help.c | 1 +
tools/perf/builtin-inject.c | 2 +-
tools/perf/builtin-kvm.c | 38 +-
tools/perf/builtin-lock.c | 5 +-
tools/perf/builtin-probe.c | 15 +-
tools/perf/builtin-record.c | 4 +-
tools/perf/builtin-report.c | 3 +
tools/perf/builtin-sched.c | 3 +
tools/perf/builtin-script.c | 6 +-
tools/perf/builtin-top.c | 19 +-
tools/perf/config/Makefile | 430 +++++-----
tools/perf/config/defconfig | 54 ++
tools/perf/perf-sys.h | 4 +-
tools/perf/perf.c | 53 +-
tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
tools/perf/tests/Kbuild | 40 +
tools/perf/tests/builtin-test.c | 3 +-
tools/perf/tests/configs/MINIMAL_config | 60 ++
tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++
.../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++
.../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 ++
tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 ++
tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++
tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++
tools/perf/tests/configs/NO_DEMANGLE_config | 71 ++
tools/perf/tests/configs/NO_GTK2_config | 73 ++
tools/perf/tests/configs/NO_LIBAUDIT_config | 72 ++
tools/perf/tests/configs/NO_LIBDWARF_config | 71 ++
tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++
tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++
tools/perf/tests/configs/NO_LIBGTK2_config | 71 ++
tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++
tools/perf/tests/configs/NO_LIBPERL_config | 73 ++
tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++
tools/perf/tests/configs/NO_LIBSLANG_config | 72 ++
.../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++
tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++
tools/perf/tests/configs/NO_STDIO_config | 73 ++
tools/perf/tests/configs/NO_TIMERFD_config | 73 ++
tools/perf/tests/configs/NO_TUI_config | 73 ++
tools/perf/tests/configs/NO_UNWIND_config | 69 ++
tools/perf/tests/configs/REF_config | 73 ++
tools/perf/tests/generate_configs.py | 43 +
tools/perf/tests/make | 70 +-
tools/perf/tests/tests.h | 6 +-
tools/perf/ui/Kbuild | 15 +
tools/perf/ui/browsers/Kbuild | 9 +
tools/perf/ui/browsers/scripts.c | 4 +
tools/perf/ui/gtk/Kbuild | 9 +
tools/perf/ui/gtk/browser.c | 4 +-
tools/perf/ui/gtk/gtk.h | 5 +-
tools/perf/ui/gtk/util.c | 6 +-
tools/perf/ui/setup.c | 12 +-
tools/perf/ui/stdio/Kbuild | 1 +
tools/perf/ui/tui/Kbuild | 4 +
tools/perf/ui/ui.h | 4 +-
tools/perf/util/Kbuild | 128 +++
tools/perf/util/PERF-VERSION-GEN | 4 +
tools/perf/util/annotate.h | 4 +-
tools/perf/util/callchain.c | 11 +-
tools/perf/util/callchain.h | 3 +-
tools/perf/util/generate-cmdlist.sh | 22 +-
tools/perf/util/hist.h | 3 +-
tools/perf/util/include/dwarf-regs.h | 4 +-
tools/perf/util/machine.c | 3 +-
tools/perf/util/map.c | 3 +-
tools/perf/util/perf_regs.c | 1 +
tools/perf/util/perf_regs.h | 6 +-
tools/perf/util/probe-event.c | 6 +-
tools/perf/util/probe-finder.h | 5 +-
tools/perf/util/scripting-engines/Kbuild | 11 +
tools/perf/util/setup.py | 8 +-
tools/perf/util/srcline.c | 8 +-
tools/perf/util/symbol-elf.c | 3 +-
tools/perf/util/symbol.h | 33 +-
tools/perf/util/trace-event-scripting.c | 13 +-
tools/perf/util/unwind-libunwind.c | 5 +-
tools/perf/util/unwind.h | 7 +-
tools/perf/util/util.c | 5 +-
143 files changed, 4992 insertions(+), 1410 deletions(-)
create mode 100644 tools/perf/Kbuild
create mode 100644 tools/perf/Kconfig
create mode 100644 tools/perf/Makefile.kbuild
delete mode 100644 tools/perf/Makefile.perf
create mode 100644 tools/perf/arch/Kbuild
create mode 100644 tools/perf/arch/arm/Kbuild
delete mode 100644 tools/perf/arch/arm/Makefile
create mode 100644 tools/perf/arch/arm/tests/Kbuild
create mode 100644 tools/perf/arch/arm/util/Kbuild
create mode 100644 tools/perf/arch/arm64/Kbuild
delete mode 100644 tools/perf/arch/arm64/Makefile
create mode 100644 tools/perf/arch/arm64/util/Kbuild
create mode 100644 tools/perf/arch/powerpc/Kbuild
delete mode 100644 tools/perf/arch/powerpc/Makefile
create mode 100644 tools/perf/arch/powerpc/util/Kbuild
create mode 100644 tools/perf/arch/s390/Kbuild
delete mode 100644 tools/perf/arch/s390/Makefile
create mode 100644 tools/perf/arch/s390/util/Kbuild
create mode 100644 tools/perf/arch/sh/Kbuild
delete mode 100644 tools/perf/arch/sh/Makefile
create mode 100644 tools/perf/arch/sh/util/Kbuild
create mode 100644 tools/perf/arch/sparc/Kbuild
delete mode 100644 tools/perf/arch/sparc/Makefile
create mode 100644 tools/perf/arch/sparc/util/Kbuild
create mode 100644 tools/perf/arch/x86/Kbuild
delete mode 100644 tools/perf/arch/x86/Makefile
create mode 100644 tools/perf/arch/x86/tests/Kbuild
rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (99%)
create mode 100644 tools/perf/arch/x86/util/Kbuild
create mode 100644 tools/perf/bench/Kbuild
create mode 100644 tools/perf/config/defconfig
create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/tests/Kbuild
create mode 100644 tools/perf/tests/configs/MINIMAL_config
create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
create mode 100644 tools/perf/tests/configs/NO_GTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
create mode 100644 tools/perf/tests/configs/NO_STDIO_config
create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
create mode 100644 tools/perf/tests/configs/NO_TUI_config
create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
create mode 100644 tools/perf/tests/configs/REF_config
create mode 100644 tools/perf/tests/generate_configs.py
create mode 100644 tools/perf/ui/Kbuild
create mode 100644 tools/perf/ui/browsers/Kbuild
create mode 100644 tools/perf/ui/gtk/Kbuild
create mode 100644 tools/perf/ui/stdio/Kbuild
create mode 100644 tools/perf/ui/tui/Kbuild
create mode 100644 tools/perf/util/Kbuild
create mode 100644 tools/perf/util/scripting-engines/Kbuild

--
2.1.1


2014-10-23 21:58:57

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 01/14] kbuild: add support of custom paths for "auto.conf*" files

In the scripts/Makefile.build, use KCONFIG_AUTOCONFIG to include a
custom path for the "auto.conf" file.

The "*conf" programs were modified so as to work with the environment
variable KCONFIG_AUTOCONFIG.

Signed-off-by: Alexis Berlemont <[email protected]>
---

Changes since v1:
* Use PATH_MAX instead of PATH_MAXLENGTH
* Simplify conf_get_autoconfigdep_name() according to Micheal Marek's
advices
* Remove a superfluous assignment

scripts/Makefile.build | 3 ++-
scripts/kconfig/confdata.c | 23 ++++++++++++++++++++++-
scripts/kconfig/lkc.h | 1 +
3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 649ce68..2abb82f 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -31,7 +31,8 @@ subdir-asflags-y :=
subdir-ccflags-y :=

# Read auto.conf if it exists, otherwise ignore
--include include/config/auto.conf
+kconfig-autoconfig := $(if $(KCONFIG_AUTOCONFIG),$(KCONFIG_AUTOCONFIG),include/config/auto.conf)
+-include $(kconfig-autoconfig)

include scripts/Kbuild.include

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index f88d90f..75cf6bf 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -75,6 +75,23 @@ const char *conf_get_autoconfig_name(void)
return name ? name : "include/config/auto.conf";
}

+const char *conf_get_autoconfigdep_name(void)
+{
+ static char res_value[PATH_MAX+1];
+
+ const char *name = conf_get_autoconfig_name();
+
+ if (strlen(name) > PATH_MAX - 4)
+ name = NULL;
+ else {
+ strcpy(res_value, name);
+ strcat(res_value, ".cmd");
+ name = res_value;
+ }
+
+ return name;
+}
+
static char *conf_expand_value(const char *in)
{
struct symbol *sym;
@@ -953,7 +970,11 @@ int conf_write_autoconf(void)

sym_clear_all_valid();

- file_write_dep("include/config/auto.conf.cmd");
+ name = conf_get_autoconfigdep_name();
+ if (name == NULL)
+ return 1;
+
+ file_write_dep(name);

if (conf_split_config())
return 1;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index d5daa7a..ac99004 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -84,6 +84,7 @@ const char *zconf_curname(void);
/* confdata.c */
const char *conf_get_configname(void);
const char *conf_get_autoconfig_name(void);
+const char *conf_get_autoconfigdep_name(void);
char *conf_get_default_confname(void);
void sym_set_change_count(int count);
void sym_add_change_count(int count);
--
2.1.1

2014-10-23 21:59:10

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 02/14] perf tools: Kbuild builtin source related fixies

From: Jiri Olsa <[email protected]>

Adding CONFIG_BUILTIN_* defines to govern builtin commands.
This will be useful for kbuild process switch.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-annotate.c | 8 ++++++-
tools/perf/builtin-cmds.h | 27 ++++++++++++++++++++++
tools/perf/builtin-help.c | 1 +
tools/perf/builtin-kvm.c | 19 ++++++++++------
tools/perf/builtin-report.c | 3 +++
tools/perf/builtin-top.c | 19 ++++++++++++----
tools/perf/perf.c | 45 +++++++++++++++++++++++++++++++++++--
tools/perf/ui/setup.c | 6 +++--
tools/perf/util/generate-cmdlist.sh | 10 +++++++++
9 files changed, 122 insertions(+), 16 deletions(-)
create mode 100644 tools/perf/builtin-cmds.h

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index e7417fe..19cb967 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -5,6 +5,7 @@
* look up and read DSOs and symbol information and display
* a histogram of results, along various sorting keys.
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "util/util.h"
@@ -115,7 +116,7 @@ static void hists__find_annotations(struct hists *hists,
struct perf_evsel *evsel,
struct perf_annotate *ann)
{
- struct rb_node *nd = rb_first(&hists->entries), *next;
+ struct rb_node *nd = rb_first(&hists->entries);
int key = K_RIGHT;

while (nd) {
@@ -154,7 +155,9 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
+#ifdef CONFIG_TUI
} else if (use_browser == 1) {
+ struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
switch (key) {
case -1:
@@ -173,6 +176,7 @@ find_next:

if (next != NULL)
nd = next;
+#endif /* CONFIG_TUI */
} else {
hist_entry__tty_annotate(he, evsel, ann);
nd = rb_next(nd);
@@ -299,7 +303,9 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
+#ifdef CONFIG_TUI
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
+#endif /* CONFIG_TUI */
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
new file mode 100644
index 0000000..fec342a
--- /dev/null
+++ b/tools/perf/builtin-cmds.h
@@ -0,0 +1,27 @@
+#ifndef BUILTIN_CMDS_H
+#define BUILTIN_CMDS_H
+
+#define CONFIG_BUILTIN_REPORT 1
+#define CONFIG_BUILTIN_SCRIPT 1
+#define CONFIG_BUILTIN_BENCH 1
+#define CONFIG_BUILTIN_SCHED 1
+#define CONFIG_BUILTIN_TRACE 1
+#define CONFIG_BUILTIN_TOP 1
+#define CONFIG_BUILTIN_RECORD 1
+#define CONFIG_BUILTIN_BUILDID_LIST 1
+#define CONFIG_BUILTIN_INJECT 1
+#define CONFIG_BUILTIN_LOCK 1
+#define CONFIG_BUILTIN_KVM 1
+#define CONFIG_BUILTIN_BUILDID_CACHE 1
+#define CONFIG_BUILTIN_EVLIST 1
+#define CONFIG_BUILTIN_KMEM 1
+#define CONFIG_BUILTIN_STAT 1
+#define CONFIG_BUILTIN_DIFF 1
+#define CONFIG_BUILTIN_ANNOTATE 1
+#define CONFIG_BUILTIN_TIMECHART 1
+#define CONFIG_BUILTIN_LIST 1
+#define CONFIG_BUILTIN_HELP 1
+#define CONFIG_BUILTIN_PROBE 1
+#define CONFIG_BUILTIN_MEM 1
+
+#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 25d2062..fbbbaa4 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -7,6 +7,7 @@
#include "util/cache.h"
#include "builtin.h"
#include "util/exec_cmd.h"
+#include "builtin-cmds.h"
#include "common-cmds.h"
#include "util/parse-options.h"
#include "util/run-command.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index b65eb050..400e92e 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1531,20 +1531,25 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)

if (!strncmp(argv[0], "rec", 3))
return __cmd_record(file_name, argc, argv);
- else if (!strncmp(argv[0], "rep", 3))
+
+ if (!strncmp(argv[0], "rep", 3))
return __cmd_report(file_name, argc, argv);
- else if (!strncmp(argv[0], "diff", 4))
+
+ if (!strncmp(argv[0], "diff", 4))
return cmd_diff(argc, argv, NULL);
- else if (!strncmp(argv[0], "top", 3))
+
+ if (!strncmp(argv[0], "top", 3))
return cmd_top(argc, argv, NULL);
- else if (!strncmp(argv[0], "buildid-list", 12))
+
+ if (!strncmp(argv[0], "buildid-list", 12))
return __cmd_buildid_list(file_name, argc, argv);
+
#ifdef HAVE_KVM_STAT_SUPPORT
- else if (!strncmp(argv[0], "stat", 4))
+ if (!strncmp(argv[0], "stat", 4))
return kvm_cmd_stat(file_name, argc, argv);
#endif
- else
- usage_with_options(kvm_usage, kvm_options);
+
+ usage_with_options(kvm_usage, kvm_options);

return 0;
}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 140a6cd..00d93ff 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -5,6 +5,7 @@
* look up and read DSOs and symbol information and display
* a histogram of results, along various sorting keys.
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "util/util.h"
@@ -406,6 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
+#ifdef CONFIG_TUI
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
@@ -417,6 +419,7 @@ static int report__browse_hists(struct report *rep)
if (ret != K_SWITCH_INPUT_DATA)
ret = 0;
break;
+#endif /* CONFIG_TUI */
case 2:
ret = report__gtk_browse_hists(rep, help);
break;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 0aa7747..a2ff8b7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -17,6 +17,7 @@
*
* Released under the GPL v2. (and only v2, not any later version)
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "perf.h"
@@ -534,6 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

+#ifdef CONFIG_TUI
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -586,6 +588,7 @@ static void *display_thread_tui(void *arg)
done = 1;
return NULL;
}
+#endif /* CONFIG_TUI */

static void display_sig(int sig __maybe_unused)
{
@@ -926,9 +929,12 @@ static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused)
return 0;
}

+typedef void* (*display_fn_t)(void *);
+
static int __cmd_top(struct perf_top *top)
{
struct record_opts *opts = &top->record_opts;
+ display_fn_t display_fn = display_thread;
pthread_t thread;
int ret;

@@ -965,8 +971,8 @@ static int __cmd_top(struct perf_top *top)
* XXX 'top' still doesn't start workloads like record, trace, but should,
* so leave the check here.
*/
- if (!target__none(&opts->target))
- perf_evlist__enable(top->evlist);
+ if (!target__none(&opts->target))
+ perf_evlist__enable(top->evlist);

/* Wait for a minimal set of events before starting the snapshot */
perf_evlist__poll(top->evlist, 100);
@@ -974,8 +980,13 @@ static int __cmd_top(struct perf_top *top)
perf_top__mmap_read(top);

ret = -1;
- if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
- display_thread), top)) {
+
+#ifdef CONFIG_TUI
+ if (use_browser > 0)
+ display_fn = display_thread_tui;
+#endif
+
+ if (pthread_create(&thread, NULL, display_fn, top)) {
ui__error("Could not create display thread.\n");
goto out_delete;
}
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 452a847..ab363b5 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -7,6 +7,7 @@
* perf top, perf record, perf report, etc.) are started.
*/
#include "builtin.h"
+#include "builtin-cmds.h"

#include "util/exec_cmd.h"
#include "util/cache.h"
@@ -34,34 +35,74 @@ struct cmd_struct {
};

static struct cmd_struct commands[] = {
+#ifdef CONFIG_BUILTIN_BUILDID_CACHE
{ "buildid-cache", cmd_buildid_cache, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_BUILDID_LIST
{ "buildid-list", cmd_buildid_list, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_DIFF
{ "diff", cmd_diff, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_EVLIST
{ "evlist", cmd_evlist, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_HELP
{ "help", cmd_help, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_LIST
{ "list", cmd_list, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_RECORD
{ "record", cmd_record, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_REPORT
{ "report", cmd_report, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_BENCH
{ "bench", cmd_bench, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_STAT
{ "stat", cmd_stat, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_TIMECHART
{ "timechart", cmd_timechart, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_TOP
{ "top", cmd_top, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_ANNOTATE
{ "annotate", cmd_annotate, 0 },
+#endif
{ "version", cmd_version, 0 },
+#ifdef CONFIG_BUILTIN_SCRIPT
{ "script", cmd_script, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_SCHED
{ "sched", cmd_sched, 0 },
-#ifdef HAVE_LIBELF_SUPPORT
+#endif
+#if defined HAVE_LIBELF_SUPPORT && defined CONFIG_BUILTIN_PROBE
{ "probe", cmd_probe, 0 },
#endif
+#ifdef CONFIG_BUILTIN_KMEM
{ "kmem", cmd_kmem, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_LOCK
{ "lock", cmd_lock, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_KVM
{ "kvm", cmd_kvm, 0 },
+#endif
{ "test", cmd_test, 0 },
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#if defined HAVE_LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
{ "trace", cmd_trace, 0 },
#endif
+#ifdef CONFIG_BUILTIN_INJECT
{ "inject", cmd_inject, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_MEM
{ "mem", cmd_mem, 0 },
+#endif
};

struct pager_config {
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ba51fa8..ec7fd36 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,11 +77,13 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
+#ifdef CONFIG_TUI
case 1:
use_browser = 1;
if (ui__init() == 0)
break;
/* fall through */
+#endif
default:
use_browser = 0;
if (fallback_to_pager)
@@ -96,11 +98,11 @@ void exit_browser(bool wait_for_ok)
case 2:
exit_gtk_browser(wait_for_ok);
break;
-
+#ifdef CONFIG_TUI
case 1:
ui__exit(wait_for_ok);
break;
-
+#endif
default:
break;
}
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 36a885d..05ee30f 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -1,5 +1,11 @@
#!/bin/sh

+function cfg()
+{
+ cfg=`echo $1 | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'`
+ echo "$cfg"
+}
+
echo "/* Automatically generated by $0 */
struct cmdname_help
{
@@ -13,6 +19,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
sort |
while read cmd
do
+ echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)"
sed -n '
/^NAME/,/perf-'"$cmd"'/H
${
@@ -20,6 +27,7 @@ do
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
}' "Documentation/perf-$cmd.txt"
+ echo "#endif"
done

echo "#ifdef HAVE_LIBELF_SUPPORT"
@@ -27,6 +35,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
sort |
while read cmd
do
+ echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)"
sed -n '
/^NAME/,/perf-'"$cmd"'/H
${
@@ -34,6 +43,7 @@ do
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
}' "Documentation/perf-$cmd.txt"
+ echo "#endif"
done
echo "#endif /* HAVE_LIBELF_SUPPORT */"
echo "};"
--
2.1.1

2014-10-23 21:59:16

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 08/14] perf kbuild: cross-compilation variables are now handled in Kconfig

The variable CONFIG_ARCH and CONFIG_CROSS_COMPILE were added.

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 24 ++++++++++++++++++++++++
tools/perf/Makefile.kbuild | 8 ++++----
tools/perf/arch/x86/include/perf_regs.h | 8 +++++---
tools/perf/arch/x86/tests/regs_load.S | 3 ++-
tools/perf/arch/x86/util/unwind-libunwind.c | 5 +++--
tools/perf/bench/mem-memcpy-arch.h | 4 +++-
tools/perf/bench/mem-memcpy.c | 4 +++-
tools/perf/bench/mem-memset-arch.h | 4 +++-
tools/perf/bench/mem-memset.c | 4 +++-
tools/perf/config/Makefile | 7 ++-----
10 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 026ef67..5f85923 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -1,6 +1,30 @@

mainmenu "The perf configuration"

+config TARGET_ARCH
+ string
+ option env="ARCH"
+
+config TARGET_IS_X86_64
+ string
+ option env="IS_X86_64"
+
+config TARGET_CROSS_COMPILE
+ string
+ option env="CROSS_COMPILE"
+
+config ARCH
+ string
+ default TARGET_ARCH
+
+config X86_64
+ bool
+ default y if TARGET_ARCH = "x86" && TARGET_IS_X86_64 = "1"
+
+config CROSS_COMPILE
+ string
+ default TARGET_CROSS_COMPILE
+
menu "Built-in commands"

config BUILTIN_RECORD
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index 8d9e8b0..b48fe7f 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -123,9 +123,12 @@ export KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG KCONFIG_SCRIPT

# perf detected config
CONFIG_DETECTED := $(obj-perf)/.config-detected
-
export CONFIG_DETECTED

+# arch-related main variables
+include $(src-perf)/config/Makefile.arch
+export ARCH IS_X86_64 CROSS_COMPILE
+
# external .a libs
LIBTRACEEVENT := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
LIBAPIKFS := $(obj-kernel)/tools/lib/api/libapikfs.a
@@ -202,9 +205,6 @@ ifndef dont-detect
ifdef CONFIG_DETECTED_STORED
# Following variables are needed within Kbuild files, we need
# to export them as they are not part of the .config set.
-export CONFIG_ARCH := $(ARCH)
-export CROSS_COMPILE
-export CONFIG_X86_64
export htmldir_SQ
export infodir_SQ
export mandir_SQ
diff --git a/tools/perf/arch/x86/include/perf_regs.h b/tools/perf/arch/x86/include/perf_regs.h
index 7df517a..d969cca 100644
--- a/tools/perf/arch/x86/include/perf_regs.h
+++ b/tools/perf/arch/x86/include/perf_regs.h
@@ -5,9 +5,11 @@
#include <linux/types.h>
#include <asm/perf_regs.h>

+#include "generated/autoconf.h"
+
void perf_regs_load(u64 *regs);

-#ifndef HAVE_ARCH_X86_64_SUPPORT
+#ifndef CONFIG_X86_64
#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
#define PERF_REGS_MAX PERF_REG_X86_32_MAX
#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32
@@ -58,7 +60,7 @@ static inline const char *perf_reg_name(int id)
return "FS";
case PERF_REG_X86_GS:
return "GS";
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
case PERF_REG_X86_R8:
return "R8";
case PERF_REG_X86_R9:
@@ -75,7 +77,7 @@ static inline const char *perf_reg_name(int id)
return "R14";
case PERF_REG_X86_R15:
return "R15";
-#endif /* HAVE_ARCH_X86_64_SUPPORT */
+#endif /* CONFIG_X86_64 */
default:
return NULL;
}
diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S
index 60875d5..822a797 100644
--- a/tools/perf/arch/x86/tests/regs_load.S
+++ b/tools/perf/arch/x86/tests/regs_load.S
@@ -1,4 +1,5 @@
#include <linux/linkage.h>
+#include "generated/autoconf.h"

#define AX 0
#define BX 1 * 8
@@ -26,7 +27,7 @@
#define R15 23 * 8

.text
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
ENTRY(perf_regs_load)
movq %rax, AX(%rdi)
movq %rbx, BX(%rdi)
diff --git a/tools/perf/arch/x86/util/unwind-libunwind.c b/tools/perf/arch/x86/util/unwind-libunwind.c
index db25e93..e4960c1 100644
--- a/tools/perf/arch/x86/util/unwind-libunwind.c
+++ b/tools/perf/arch/x86/util/unwind-libunwind.c
@@ -1,11 +1,12 @@

#include <errno.h>
#include <libunwind.h>
+#include "generated/autoconf.h"
#include "perf_regs.h"
#include "../../util/unwind.h"
#include "../../util/debug.h"

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
int libunwind__arch_reg_id(int regnum)
{
int id;
@@ -109,4 +110,4 @@ int libunwind__arch_reg_id(int regnum)

return id;
}
-#endif /* HAVE_ARCH_X86_64_SUPPORT */
+#endif /* CONFIG_X86_64 */
diff --git a/tools/perf/bench/mem-memcpy-arch.h b/tools/perf/bench/mem-memcpy-arch.h
index 57b4ed8..8e3f0a9 100644
--- a/tools/perf/bench/mem-memcpy-arch.h
+++ b/tools/perf/bench/mem-memcpy-arch.h
@@ -1,5 +1,7 @@

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_X86_64

#define MEMCPY_FN(fn, name, desc) \
extern void *fn(void *, const void *, size_t);
diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c
index 2465141..9061d2b 100644
--- a/tools/perf/bench/mem-memcpy.c
+++ b/tools/perf/bench/mem-memcpy.c
@@ -6,6 +6,8 @@
* Written by Hitoshi Mitake <[email protected]>
*/

+#include "generated/autoconf.h"
+
#include "../perf.h"
#include "../util/util.h"
#include "../util/parse-options.h"
@@ -59,7 +61,7 @@ struct routine routines[] = {
{ "default",
"Default memcpy() provided by glibc",
memcpy },
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64

#define MEMCPY_FN(fn, name, desc) { name, desc, fn },
#include "mem-memcpy-x86-64-asm-def.h"
diff --git a/tools/perf/bench/mem-memset-arch.h b/tools/perf/bench/mem-memset-arch.h
index 633800c..5dfc4c5 100644
--- a/tools/perf/bench/mem-memset-arch.h
+++ b/tools/perf/bench/mem-memset-arch.h
@@ -1,5 +1,7 @@

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_X86_64

#define MEMSET_FN(fn, name, desc) \
extern void *fn(void *, int, size_t);
diff --git a/tools/perf/bench/mem-memset.c b/tools/perf/bench/mem-memset.c
index 75fc3e6..73e8d8d 100644
--- a/tools/perf/bench/mem-memset.c
+++ b/tools/perf/bench/mem-memset.c
@@ -6,6 +6,8 @@
* Trivial clone of mem-memcpy.c.
*/

+#include "generated/autoconf.h"
+
#include "../perf.h"
#include "../util/util.h"
#include "../util/parse-options.h"
@@ -59,7 +61,7 @@ static const struct routine routines[] = {
{ "default",
"Default memset() provided by glibc",
memset },
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64

#define MEMSET_FN(fn, name, desc) { name, desc, fn },
#include "mem-memset-x86-64-asm-def.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index ce3a726..7f87a45 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -20,11 +20,9 @@ NO_PERF_REGS := 1

# Additional ARCH settings for x86
ifeq ($(ARCH),x86)
- ifeq (${IS_X86_64}, 1)
- CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
- ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
+ ifeq ($(IS_X86_64),1)
LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
- CONFIG_X86_64=y
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_X86_64)
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
@@ -794,7 +792,6 @@ all:
$(call store,PARSER_DEBUG_FLEX)
$(call store,PYTHON_EMBED_CCOPTS)
$(call store,PERL_EMBED_CCOPTS)
- $(call store,CONFIG_X86_64)
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
--
2.1.1

2014-10-23 21:59:25

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 13/14] perf kbuild: final cosmetic changes

* Correctly rename internal makefile variables
* Remove makefiles in tools/perf/config which became empty and useless
* Remove builtin-cmds.h
* Remove arch/x86/Makefile
* Improve outputs of clean and install targets
* Remove creation of PERF-FEATURES file which is redundant with the
.config file generated by Kconfig.
* replace HAVE_KVM_STAT_SUPPORT by a Kconfig option
* replace HAVE_SKIP_CALLCHAIN_IDX by a Kconfig option

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 7 ++++
tools/perf/Makefile.kbuild | 74 ++++++++++++++++++--------------
tools/perf/arch/s390/util/Kbuild | 2 +-
tools/perf/arch/x86/Makefile | 17 --------
tools/perf/arch/x86/util/Kbuild | 2 +-
tools/perf/builtin-cmds.h | 6 ---
tools/perf/builtin-help.c | 2 +-
tools/perf/builtin-kvm.c | 6 +--
tools/perf/builtin-lock.c | 2 +-
tools/perf/builtin-sched.c | 2 +-
tools/perf/config/Makefile | 79 +++++++++++------------------------
tools/perf/config/Makefile.fix-config | 6 ---
tools/perf/config/Makefile.fix-legacy | 2 -
tools/perf/perf.c | 2 +-
14 files changed, 83 insertions(+), 126 deletions(-)
delete mode 100644 tools/perf/arch/x86/Makefile
delete mode 100644 tools/perf/builtin-cmds.h
delete mode 100644 tools/perf/config/Makefile.fix-config
delete mode 100644 tools/perf/config/Makefile.fix-legacy

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 54a194d..d1b44c3 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -128,6 +128,13 @@ config BUILTIN_KVM
---help---
Tool to trace/measure kvm guest os

+config BUILTIN_KVM_STAT
+ bool "kvm-stat"
+ default y
+ depends on BUILTIN_KVM && (ARCH = "x86" || ARCH = "s390")
+ ---help---
+ Get performance counter statistics on a kvm guest os.
+
config BUILTIN_LIST
bool "list"
default y
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index b48fe7f..90b168d 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -1,6 +1,5 @@
srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
-
VPATH := $(srctree)

export srctree VPATH
@@ -36,7 +35,8 @@ export quiet Q KBUILD_VERBOSE
ifndef V
QUIET_LINK = @echo ' LD $@';
QUIET_GEN = @echo ' GEN $@';
-QUIET_CLEAN = @echo ' CLEAN tools/perf';
+QUIET_CLEAN = @printf ' CLEAN %s\n' $1;
+QUIET_INSTALL = @printf ' INSTALL %s\n' $1;
endif

export QUIET_BISON QUIET_FLEX
@@ -158,7 +158,6 @@ $(CONFIG_DETECTED): $(KCONFIG_CONFIG)
# no need to include auto.conf.cmd, because .config
# is the only dependency here
$(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
- $(Q)$(MAKE) -f $(src-perf)/config/Makefile.fix-config
$(Q)mkdir -p $(obj-perf)/include/config
$(Q)mkdir -p $(obj-perf)/include/generated
$(Q)$(MAKE) -s $(build)=scripts/kconfig silentoldconfig
@@ -167,22 +166,26 @@ $(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
clean-dirs := $(addprefix _clean_, tools/perf/)

$(clean-dirs):
+ $(call QUIET_CLEAN, core-objs)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)

-clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean
- $(Q)$(QUIET_CLEAN)
- $(Q)rm -f $(obj-perf)/perf
- $(Q)rm -f $(obj-perf)/common-cmds.h
- $(Q)rm -f $(obj-perf)/python/perf.so
+config-clean:
+ $(call QUIET_CLEAN, config)
+ @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
$(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+ $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
+ $(Q)rm -f $(obj-perf)/common-cmds.h
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
+ $(call QUIET_CLEAN, core-progs)
+ $(Q)rm -f $(obj-perf)/perf
+ $(call QUIET_CLEAN, misc)
$(Q)find $(obj-perf) \
\( -name '*.[oas]' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' \
-o -name '*-flex.[ch]' -o -name '*-bison.[ch]' \
\) -type f -print | xargs rm -f
- $(Q)$(python-clean)
- $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
- @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
+ $(python-clean)

TAGS tags:
$(Q)rm -f $(src-perf)/tags
@@ -257,7 +260,7 @@ PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/

export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP

-python-clean := rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so
+python-clean := $(call QUIET_CLEAN, python) rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so

PYTHON_EXT_SRCS := $(addprefix $(src-perf)/,$(shell grep -v ^\# $(src-perf)/util/python-ext-sources))
PYTHON_EXT_DEPS := $(src-perf)/util/python-ext-sources $(src-perf)/util/setup.py
@@ -343,25 +346,34 @@ $(SCRIPTS) : % : %.sh
all: $(SCRIPTS)

install-bin: all
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
- $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
- $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
- $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
- $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
- $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
- $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
- $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
- $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(call QUIET_INSTALL, binaries) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' ; \
+ $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)' ; \
+ ln '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
+ $(call QUIET_INSTALL, libexec) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(call QUIET_INSTALL, perf-archive) \
+ $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(call QUIET_INSTALL, perl-scripts) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(call QUIET_INSTALL, python-scripts) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' ; \
+ $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' ; \
+ $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(call QUIET_INSTALL, perf_completion-script) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d' ; \
+ $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(call QUIET_INSTALL, tests) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' ; \
+ $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' ; \
+ $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'

install: install-bin try-install-man $(LIBTRACEEVENT)-install

diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
index 73df1ff..833e3b8 100644
--- a/tools/perf/arch/s390/util/Kbuild
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -1,2 +1,2 @@
-obj-y += kvm-stat.o
+obj-$(CONFIG_BUILTIN_KVM_STAT) += kvm-stat.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
deleted file mode 100644
index af36aad..0000000
--- a/tools/perf/arch/x86/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-ifeq ($(LIBDWARF), 1)
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifeq ($(LIBUNWIND), 1)
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifeq ($(LIBDWARF_UNWIND), 1)
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
-LIB_H += arch/$(ARCH)/util/tsc.h
-HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
index adca885..fe382ce 100644
--- a/tools/perf/arch/x86/util/Kbuild
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -1,6 +1,6 @@
obj-y += header.o
obj-y += tsc.o
-obj-y += kvm-stat.o
+obj-$(CONFIG_BUILTIN_KVM_STAT) += kvm-stat.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
deleted file mode 100644
index 863727f..0000000
--- a/tools/perf/builtin-cmds.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef BUILTIN_CMDS_H
-#define BUILTIN_CMDS_H
-
-#include "generated/autoconf.h"
-
-#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index fbbbaa4..3e9854c 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -3,11 +3,11 @@
*
* Builtin help command
*/
+#include "generated/autoconf.h"
#include "perf.h"
#include "util/cache.h"
#include "builtin.h"
#include "util/exec_cmd.h"
-#include "builtin-cmds.h"
#include "common-cmds.h"
#include "util/parse-options.h"
#include "util/run-command.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 28371f9..4d59f98 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -30,7 +30,7 @@
#include <pthread.h>
#include <math.h>

-#ifdef HAVE_KVM_STAT_SUPPORT
+#ifdef CONFIG_BUILTIN_KVM_STAT
#include <asm/kvm_perf.h>
#include "util/kvm-stat.h"

@@ -1423,7 +1423,7 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
perf_stat:
return cmd_stat(argc, argv, NULL);
}
-#endif /* HAVE_KVM_STAT_SUPPORT */
+#endif /* CONFIG_BUILTIN_KVM_STAT */

static int __cmd_record(const char *file_name, int argc, const char **argv)
{
@@ -1545,7 +1545,7 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
if (!strncmp(argv[0], "buildid-list", 12))
return __cmd_buildid_list(file_name, argc, argv);

-#ifdef HAVE_KVM_STAT_SUPPORT
+#ifdef CONFIG_BUILTIN_KVM_STAT
if (!strncmp(argv[0], "stat", 4))
return kvm_cmd_stat(file_name, argc, argv);
#endif
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 05c0e1c..5181224 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,5 +1,5 @@
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"
#include "perf.h"

#include "util/evlist.h"
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index e38b021..02b3bfe 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1,5 +1,5 @@
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"
#include "perf.h"

#include "util/util.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 00d118c..0b59225 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,10 +34,14 @@ ifeq ($(ARCH),arm64)
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

+ifdef KCONFIG_CONFIG
+include $(KCONFIG_CONFIG)
+endif
+
ifeq ($(LIBUNWIND_LIBS),)
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
else
- LIBUNWIND = 1
+ config-libunwind = 1
#
# For linking with debug library, run like:
#
@@ -65,10 +69,6 @@ ifdef CONFIG_LIBELF
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif

-ifdef KCONFIG_CONFIG
-include $(src-perf)/config/Makefile.fix-legacy
-endif
-
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

@@ -297,12 +297,12 @@ endif
ifdef CONFIG_LIBELF
ifeq ($(feature-libelf), 0)
ifeq ($(feature-glibc), 1)
- LIBC_SUPPORT := 1
+ config-libc := 1
endif
ifeq ($(BIONIC),1)
- LIBC_SUPPORT := 1
+ config-libc := 1
endif
- ifeq ($(LIBC_SUPPORT),1)
+ ifeq ($(config-libc),1)
msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF)
$(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBELF_MINIMAL)
@@ -315,27 +315,27 @@ ifdef CONFIG_LIBELF
endif
endif
else
- LIBELF = 1
+ config-libelf = 1
ifdef CONFIG_LIBDWARF
ifneq ($(feature-dwarf), 1)
msg := $(warning 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);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF)
else
- LIBDWARF = 1
+ config-libdwarf = 1
endif # Dwarf support
ifdef CONFIG_LIBDWARF_UNWIND
ifneq ($(feature-libdw-dwarf-unwind),1)
msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set CONFIG_LIBDWARF_DIR);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF_UNWIND)
else
- LIBDWARF_UNWIND = 1
+ config-libdwarf-unwind = 1
endif # Dwarf unwind support detected
endif # CONFIG_LIBDWARF_UNWIND
endif # CONFIG_LIBDWARF
endif # libelf support
endif # CONFIG_LIBELF

-ifeq ($(LIBELF), 1)
+ifeq ($(config-libelf), 1)

ifdef CONFIG_LIBELF_MMAP
ifneq ($(feature-libelf-mmap), 1)
@@ -343,16 +343,16 @@ ifeq ($(LIBELF), 1)
endif
endif

- ifdef CONFIG_LIBELF_MMAP
+ ifdef CONFIG_LIBELF_GETPHDRNUM
ifneq ($(feature-libelf-getphdrnum), 1)
- $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_GETPHDRNUM)
endif
endif

# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

- ifeq ($(LIBDWARF), 1)
+ ifeq ($(config-libdwarf), 1)
CFLAGS += $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += -lelf -ldw
@@ -363,17 +363,17 @@ ifdef CONFIG_UNWIND
# CONFIG_LIBUNWIND is the default choice; so, if it is not
# available, let's try another one
ifdef CONFIG_LIBUNWIND
- ifeq ($(LIBUNWIND), 1)
+ ifeq ($(config-libunwind), 1)
ifneq ($(feature-libunwind), 1)
- LIBUNWIND = 0
+ config-libunwind = 0
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
- ifeq ($(LIBDWARF_UNWIND), 1)
+ ifeq ($(config-libdwarf-unwind), 1)
msg := $(warning No libunwind found, post unwind will rely on libdwarf-unwind. Please install libunwind-dev[el] >= 1.1);
$(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBDWARF_UNWIND)
else
msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
- endif # LIBDWARF_UNWIND
+ endif # config-libdwarf-unwind
else # feature-libunwind OK
EXTLIBS += $(LIBUNWIND_LIBS)
CFLAGS += $(LIBUNWIND_CFLAGS)
@@ -385,7 +385,7 @@ ifdef CONFIG_UNWIND
# CONFIG_LIBDWARF_UNWIND is not the default choice (so the user's
# choice); so, we disable CONFIG_UNWIND if it is not available
ifdef CONFIG_LIBDWARF_UNWIND
- ifneq ($(LIBDWARF_UNWIND), 1)
+ ifneq ($(config-libdwarf-unwind), 1)
msg := $(warning Disabling post unwing because (libdwarf-unwind is not available));
$(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
endif
@@ -393,7 +393,7 @@ ifdef CONFIG_UNWIND

# if libunwind is OK, let's check the option DEBUG_FRAME
ifdef CONFIG_LIBUNWIND
- ifeq ($(LIBUNWIND), 1)
+ ifeq ($(config-libunwind), 1)
ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
$(call feature_check,libunwind-debug-frame)
ifneq ($(feature-libunwind-debug-frame), 1)
@@ -410,11 +410,11 @@ ifdef CONFIG_UNWIND
dwarf-post-unwind = 0
dwarf-post-unwind-text = BUG

-ifeq ($(LIBUNWIND), 1)
+ifeq ($(config-libunwind), 1)
dwarf-post-unwind := 1
dwarf-post-unwind-text := libunwind
else
- ifeq ($(LIBDWARF_UNWIND), 1)
+ ifeq ($(config-libdwarf-unwind), 1)
dwarf-post-unwind := 1
dwarf-post-unwind-text := libdw
endif
@@ -590,10 +590,6 @@ ifdef CONFIG_LIBNUMA
endif
endif

-ifdef HAVE_KVM_STAT_SUPPORT
- CFLAGS += -DHAVE_KVM_STAT_SUPPORT
-endif
-
# Among the variables below, these:
# perfexecdir
# template_dir
@@ -685,36 +681,9 @@ define feature_print_text_code
MSG = $(shell printf '...%30s: %s' $(1) $(2))
endef

-PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
-PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
-
-ifeq ($(dwarf-post-unwind),1)
- PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text))
-endif
-
-# The $(display_lib) controls the default detection message
-# output. It's set if:
-# - detected features differes from stored features from
-# last build (in PERF-FEATURES file)
-# - one of the $(LIB_FEATURE_TESTS) is not detected
-# - VF is enabled
-
-ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
- $(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES)
- display_lib := 1
-endif
-
-feature_check = $(eval $(feature_check_code))
-define feature_check_code
- ifneq ($(feature-$(1)), 1)
- display_lib := 1
- endif
-endef
-
-$(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_check,$(feat)))
+display_lib := 1

ifeq ($(VF),1)
- display_lib := 1
display_vf := 1
endif

diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
deleted file mode 100644
index 3f0e33e..0000000
--- a/tools/perf/config/Makefile.fix-config
+++ /dev/null
@@ -1,6 +0,0 @@
-include $(CONFIG_DETECTED)
-include $(KCONFIG_CONFIG)
-
-CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
-
-all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
deleted file mode 100644
index 431c9bf..0000000
--- a/tools/perf/config/Makefile.fix-legacy
+++ /dev/null
@@ -1,2 +0,0 @@
-
-include $(KCONFIG_CONFIG)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index b4fd910..69e9b9d 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -6,8 +6,8 @@
* This is the main hub from which the sub-commands (perf stat,
* perf top, perf record, perf report, etc.) are started.
*/
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"

#include "util/exec_cmd.h"
#include "util/cache.h"
--
2.1.1

2014-10-23 21:59:38

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 14/14] perf kbuild: add generated Kconfig build-test cases

Thanks to the python module kconfiglib, we were able to generate build
configurations. The set is, of course, not exhaustive but for each
option, all the possible states are tested.

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/MANIFEST | 1 +
tools/perf/tests/configs/MINIMAL_config | 60 ++++++++++++++++++
tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++++++++++++++++++++++
.../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++++++++++++++++++++++
.../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 +++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_DEMANGLE_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_GTK2_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBAUDIT_config | 72 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBDWARF_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBGTK2_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBPERL_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBSLANG_config | 72 +++++++++++++++++++++
.../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_STDIO_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_TIMERFD_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_TUI_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_UNWIND_config | 69 ++++++++++++++++++++
tools/perf/tests/configs/REF_config | 73 ++++++++++++++++++++++
tools/perf/tests/generate_configs.py | 43 +++++++++++++
tools/perf/tests/make | 70 ++++++---------------
47 files changed, 3227 insertions(+), 50 deletions(-)
create mode 100644 tools/perf/tests/configs/MINIMAL_config
create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
create mode 100644 tools/perf/tests/configs/NO_GTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
create mode 100644 tools/perf/tests/configs/NO_STDIO_config
create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
create mode 100644 tools/perf/tests/configs/NO_TUI_config
create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
create mode 100644 tools/perf/tests/configs/REF_config
create mode 100644 tools/perf/tests/generate_configs.py

diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 344c4d3..def2b5b 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -1,3 +1,4 @@
+scripts
tools/perf
tools/scripts
tools/lib/traceevent
diff --git a/tools/perf/tests/configs/MINIMAL_config b/tools/perf/tests/configs/MINIMAL_config
new file mode 100644
index 0000000..fa6503e
--- /dev/null
+++ b/tools/perf/tests/configs/MINIMAL_config
@@ -0,0 +1,60 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# The perf configuration
+#
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+
+#
+# Libraries / Dependencies
+#
+# CONFIG_LIBSLANG is not set
+# CONFIG_LIBAUDIT is not set
+# CONFIG_LIBGTK2 is not set
+# CONFIG_LIBPERL is not set
+# CONFIG_LIBPYTHON is not set
+# CONFIG_TIMERFD is not set
+# CONFIG_LIBELF is not set
+CONFIG_LIBELF_MINIMAL=y
+# CONFIG_LIBNUMA is not set
+# CONFIG_BIONIC is not set
+# CONFIG_PERF_REGS is not set
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BACKTRACE_config b/tools/perf/tests/configs/NO_BACKTRACE_config
new file mode 100644
index 0000000..e0be1a4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BACKTRACE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+# CONFIG_BACKTRACE is not set
diff --git a/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config b/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
new file mode 100644
index 0000000..4d38fb4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+# CONFIG_BUILTIN_ANNOTATE is not set
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BENCH_config b/tools/perf/tests/configs/NO_BUILTIN_BENCH_config
new file mode 100644
index 0000000..38a0cf2
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BENCH_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+# CONFIG_BUILTIN_BENCH is not set
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
new file mode 100644
index 0000000..d41e3e5
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+# CONFIG_BUILTIN_BUILDID_CACHE is not set
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
new file mode 100644
index 0000000..f8c7a98
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+# CONFIG_BUILTIN_BUILDID_LIST is not set
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_DIFF_config b/tools/perf/tests/configs/NO_BUILTIN_DIFF_config
new file mode 100644
index 0000000..4fdb2ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_DIFF_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+# CONFIG_BUILTIN_DIFF is not set
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config b/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
new file mode 100644
index 0000000..4d474a6
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+# CONFIG_BUILTIN_EVLIST is not set
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_HELP_config b/tools/perf/tests/configs/NO_BUILTIN_HELP_config
new file mode 100644
index 0000000..9611823
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_HELP_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+# CONFIG_BUILTIN_HELP is not set
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_INJECT_config b/tools/perf/tests/configs/NO_BUILTIN_INJECT_config
new file mode 100644
index 0000000..ac9e908
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_INJECT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+# CONFIG_BUILTIN_INJECT is not set
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KMEM_config b/tools/perf/tests/configs/NO_BUILTIN_KMEM_config
new file mode 100644
index 0000000..e808a30
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KMEM_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+# CONFIG_BUILTIN_KMEM is not set
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config b/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
new file mode 100644
index 0000000..b7d36d5
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+# CONFIG_BUILTIN_KVM_STAT is not set
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KVM_config b/tools/perf/tests/configs/NO_BUILTIN_KVM_config
new file mode 100644
index 0000000..dc47acb
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KVM_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+# CONFIG_BUILTIN_KVM is not set
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_LIST_config b/tools/perf/tests/configs/NO_BUILTIN_LIST_config
new file mode 100644
index 0000000..a573501
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_LIST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+# CONFIG_BUILTIN_LIST is not set
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_LOCK_config b/tools/perf/tests/configs/NO_BUILTIN_LOCK_config
new file mode 100644
index 0000000..6b3a100
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_LOCK_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+# CONFIG_BUILTIN_LOCK is not set
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_MEM_config b/tools/perf/tests/configs/NO_BUILTIN_MEM_config
new file mode 100644
index 0000000..247ab6e
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_MEM_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+# CONFIG_BUILTIN_MEM is not set
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_PROBE_config b/tools/perf/tests/configs/NO_BUILTIN_PROBE_config
new file mode 100644
index 0000000..19a083b
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_PROBE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+# CONFIG_BUILTIN_PROBE is not set
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_RECORD_config b/tools/perf/tests/configs/NO_BUILTIN_RECORD_config
new file mode 100644
index 0000000..151c0f7
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_RECORD_config
@@ -0,0 +1,63 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+# CONFIG_BUILTIN_RECORD is not set
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_REPORT_config b/tools/perf/tests/configs/NO_BUILTIN_REPORT_config
new file mode 100644
index 0000000..88c2c17
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_REPORT_config
@@ -0,0 +1,68 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+# CONFIG_BUILTIN_REPORT is not set
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_SCHED_config b/tools/perf/tests/configs/NO_BUILTIN_SCHED_config
new file mode 100644
index 0000000..ded3e68
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_SCHED_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+# CONFIG_BUILTIN_SCHED is not set
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config b/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
new file mode 100644
index 0000000..369c58e
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+# CONFIG_BUILTIN_SCRIPT is not set
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_STAT_config b/tools/perf/tests/configs/NO_BUILTIN_STAT_config
new file mode 100644
index 0000000..147f3ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_STAT_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+# CONFIG_BUILTIN_STAT is not set
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TEST_config b/tools/perf/tests/configs/NO_BUILTIN_TEST_config
new file mode 100644
index 0000000..66acb87
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TEST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+# CONFIG_BUILTIN_TEST is not set
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config b/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
new file mode 100644
index 0000000..04dba98
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+# CONFIG_BUILTIN_TIMECHART is not set
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TOP_config b/tools/perf/tests/configs/NO_BUILTIN_TOP_config
new file mode 100644
index 0000000..0af5579
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TOP_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+# CONFIG_BUILTIN_TOP is not set
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TRACE_config b/tools/perf/tests/configs/NO_BUILTIN_TRACE_config
new file mode 100644
index 0000000..5717064
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TRACE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+# CONFIG_BUILTIN_TRACE is not set
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_DEMANGLE_config b/tools/perf/tests/configs/NO_DEMANGLE_config
new file mode 100644
index 0000000..47c8263
--- /dev/null
+++ b/tools/perf/tests/configs/NO_DEMANGLE_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+# CONFIG_DEMANGLE is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_GTK2_config b/tools/perf/tests/configs/NO_GTK2_config
new file mode 100644
index 0000000..529872b
--- /dev/null
+++ b/tools/perf/tests/configs/NO_GTK2_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+# CONFIG_GTK2 is not set
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBAUDIT_config b/tools/perf/tests/configs/NO_LIBAUDIT_config
new file mode 100644
index 0000000..c7db9d2
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBAUDIT_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+# CONFIG_LIBAUDIT is not set
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBDWARF_config b/tools/perf/tests/configs/NO_LIBDWARF_config
new file mode 100644
index 0000000..45cb7c8
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBDWARF_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+# CONFIG_LIBDWARF is not set
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBELF_MMAP_config b/tools/perf/tests/configs/NO_LIBELF_MMAP_config
new file mode 100644
index 0000000..ec83684
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBELF_MMAP_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+# CONFIG_LIBELF_MMAP is not set
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config b/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
new file mode 100644
index 0000000..9b62c67
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+# CONFIG_LIBGTK2_INFOBAR is not set
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBGTK2_config b/tools/perf/tests/configs/NO_LIBGTK2_config
new file mode 100644
index 0000000..c16fc4d
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBGTK2_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+# CONFIG_LIBGTK2 is not set
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBNUMA_config b/tools/perf/tests/configs/NO_LIBNUMA_config
new file mode 100644
index 0000000..c3006b4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBNUMA_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+# CONFIG_LIBNUMA is not set
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBPERL_config b/tools/perf/tests/configs/NO_LIBPERL_config
new file mode 100644
index 0000000..317d3f28
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBPERL_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+# CONFIG_LIBPERL is not set
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBPYTHON_config b/tools/perf/tests/configs/NO_LIBPYTHON_config
new file mode 100644
index 0000000..a63acb3
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBPYTHON_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+# CONFIG_LIBPYTHON is not set
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBSLANG_config b/tools/perf/tests/configs/NO_LIBSLANG_config
new file mode 100644
index 0000000..fa7726c
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBSLANG_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+# CONFIG_LIBSLANG is not set
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config b/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
new file mode 100644
index 0000000..837a80f
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+# CONFIG_LIBUNWIND_DEBUG_FRAME is not set
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_PERF_REGS_config b/tools/perf/tests/configs/NO_PERF_REGS_config
new file mode 100644
index 0000000..eae8a16
--- /dev/null
+++ b/tools/perf/tests/configs/NO_PERF_REGS_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+# CONFIG_PERF_REGS is not set
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_STDIO_config b/tools/perf/tests/configs/NO_STDIO_config
new file mode 100644
index 0000000..b80e1ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_STDIO_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+# CONFIG_STDIO is not set
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_TIMERFD_config b/tools/perf/tests/configs/NO_TIMERFD_config
new file mode 100644
index 0000000..4a0d134
--- /dev/null
+++ b/tools/perf/tests/configs/NO_TIMERFD_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+# CONFIG_TIMERFD is not set
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_TUI_config b/tools/perf/tests/configs/NO_TUI_config
new file mode 100644
index 0000000..be233df
--- /dev/null
+++ b/tools/perf/tests/configs/NO_TUI_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+# CONFIG_TUI is not set
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_UNWIND_config b/tools/perf/tests/configs/NO_UNWIND_config
new file mode 100644
index 0000000..caefd3a
--- /dev/null
+++ b/tools/perf/tests/configs/NO_UNWIND_config
@@ -0,0 +1,69 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+# CONFIG_UNWIND is not set
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/REF_config b/tools/perf/tests/configs/REF_config
new file mode 100644
index 0000000..7708411
--- /dev/null
+++ b/tools/perf/tests/configs/REF_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/generate_configs.py b/tools/perf/tests/generate_configs.py
new file mode 100644
index 0000000..4502ecd
--- /dev/null
+++ b/tools/perf/tests/generate_configs.py
@@ -0,0 +1,43 @@
+import os
+import sys
+import itertools
+import kconfiglib
+
+# Let's set some environment variables to define the target
+# architecture; we choose x86 because, so far, nearly all features are
+# available on x86.
+os.environ['ARCH'] = 'x86'
+os.environ['IS_X86_64'] = '1'
+os.environ['CROSS_COMPILE'] = ''
+
+# Load Kconfig pattern
+ref_config = kconfiglib.Config(sys.argv[1])
+
+# Generate defconfig (by default, all options are set to y)
+ref_config.write_config('REF_config')
+
+# Get all the symbols
+symbols = dict([(s.get_name(), s) for s in ref_config.get_symbols()])
+
+# Remove odd symbols
+symbols.pop('y', None)
+symbols.pop('m', None)
+symbols.pop('n', None)
+
+# Remove choice-related symbols
+choices = ref_config.get_choices()
+items = [c.get_items() for c in choices]
+names = [i.get_name() for i in itertools.chain.from_iterable(items)]
+for name in names:
+ symbols.pop(name, None)
+
+for name in symbols:
+ symbol = symbols[name]
+ if not symbol.is_modifiable():
+ continue
+ if symbol.get_value() != 'y':
+ continue
+ symbol.set_user_value('n')
+ filename = 'NO_' + name + '_config'
+ ref_config.write_config(filename)
+ symbol.set_user_value('y')
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 69a71ff..7779fda 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -11,34 +11,17 @@ else
lib = lib
endif

+list = $(shell ls $1 2>/dev/null)
has = $(shell which $1 2>/dev/null)

# standard single make variable specified
+make_pure :=
make_clean_all := clean all
make_python_perf_so := python/perf.so
-make_debug := DEBUG=1
-make_no_libperl := NO_LIBPERL=1
-make_no_libpython := NO_LIBPYTHON=1
-make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
-make_no_newt := NO_NEWT=1
-make_no_slang := NO_SLANG=1
-make_no_gtk2 := NO_GTK2=1
-make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
-make_no_demangle := NO_DEMANGLE=1
-make_no_libelf := NO_LIBELF=1
-make_no_libunwind := NO_LIBUNWIND=1
-make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1
-make_no_backtrace := NO_BACKTRACE=1
-make_no_libnuma := NO_LIBNUMA=1
-make_no_libaudit := NO_LIBAUDIT=1
-make_no_libbionic := NO_LIBBIONIC=1
make_tags := tags
make_cscope := cscope
make_help := help
make_doc := doc
-make_perf_o := perf.o
-make_util_map_o := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
make_install := install
make_install_bin := install-bin
make_install_doc := install-doc
@@ -48,37 +31,11 @@ make_install_info := install-info
make_install_pdf := install-pdf
make_static := LDFLAGS=-static

-# all the NO_* variable combined
-make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
-make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
-make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
-make_minimal += NO_LIBDW_DWARF_UNWIND=1
-
# $(run) contains all available tests
run := make_pure
run += make_clean_all
-run += make_python_perf_so
-run += make_debug
-run += make_no_libperl
-run += make_no_libpython
-run += make_no_scripts
-run += make_no_newt
-run += make_no_slang
-run += make_no_gtk2
-run += make_no_ui
-run += make_no_demangle
-run += make_no_libelf
-run += make_no_libunwind
-run += make_no_libdw_dwarf_unwind
-run += make_no_backtrace
-run += make_no_libnuma
-run += make_no_libaudit
-run += make_no_libbionic
run += make_help
run += make_doc
-run += make_perf_o
-run += make_util_map_o
-run += make_util_pmu_bison_o
run += make_install
run += make_install_bin
# FIXME 'install-*' commented out till they're fixed
@@ -87,8 +44,7 @@ run += make_install_bin
# run += make_install_html
# run += make_install_info
# run += make_install_pdf
-run += make_minimal
-run += make_static
+# run += make_static

ifneq ($(call has,ctags),)
run += make_tags
@@ -104,6 +60,10 @@ run_O := $(addsuffix _O,$(run))
# disable some tests for O=...
run_O := $(filter-out make_python_perf_so_O,$(run_O))

+# $(run_CONFIGS) is a set of automatically-generated Kconfig
+# configurations
+run_CONFIGS := $(call list,$(PERF)/tests/configs/)
+
# define test for each compile as 'test_NAME' variable
# with the test itself as a value
test_make_tags = test -f tags
@@ -183,7 +143,7 @@ test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
test_default = test -x $(PERF)/perf
test = $(if $(test_$1),$(test_$1),$(test_default))

-test_default_O = test -x $$TMP_O/perf
+test_default_O = test -x $$TMP_O/tools/perf/perf
test_O = $(if $(test_$1),$(test_$1),$(test_default_O))

all:
@@ -218,13 +178,23 @@ $(run_O):
$(call test_O,$@) && \
rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false)

+$(run_CONFIGS):
+ $(call clean)
+ @TMP_DEST=$$(mktemp -d); \
+ cmd="cd $(PERF) && cp tests/configs/$@ .config && make -f $(MK) JOBS=4 DESTDIR=$$TMP_DEST $($@)"; \
+ echo "- $@: $$cmd" && echo $$cmd > $@ && \
+ ( eval $$cmd ) >> $@ 2>&1; \
+ echo " test: $(call test,$@)" >> $@ 2>&1; \
+ $(call test,$@) && \
+ rm -f $@ \
+ rm -rf $$TMP_DEST
+
tarpkg:
@cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \
echo "- $@: $$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1
-

-all: $(run) $(run_O) tarpkg
+all: $(run) $(run_O) $(run_CONFIGS) tarpkg
@echo OK

out: $(run_O)
--
2.1.1

2014-10-23 21:59:22

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 11/14] perf kbuild: remove legacy libdwarf-related build variables

* Remove NO_DWARF (replaced by CONFIG_LIBDWARF)
* Remove HAVE_DWARF_SUPPORT (replaced by CONFIG_LIBDWARF)
* Remove the useless variable PERF_HAVE_DWARF_REGS
* fix compilation issues if PERF_REGS is disabled

Signed-off-by: Alexis Berlemont <[email protected]>
---

Changes since v1:
* Add the config parameter SKIP_CALLCHAIN_IDX
* Fix LIBDWARF_UNWIND directives

tools/perf/Kconfig | 59 +++++++++-
tools/perf/arch/arm/tests/Kbuild | 2 +-
tools/perf/arch/arm/util/Kbuild | 4 +-
tools/perf/arch/arm64/util/Kbuild | 2 +-
tools/perf/arch/powerpc/util/Kbuild | 4 +-
tools/perf/arch/s390/util/Kbuild | 2 +-
tools/perf/arch/sh/util/Kbuild | 2 +-
tools/perf/arch/sparc/util/Kbuild | 2 +-
tools/perf/arch/x86/Kbuild | 1 +
tools/perf/arch/x86/Makefile | 8 +-
tools/perf/arch/x86/tests/Kbuild | 2 +-
tools/perf/arch/x86/tests/perf-time-to-tsc.c | 2 +-
tools/perf/arch/x86/util/Kbuild | 3 +-
tools/perf/builtin-probe.c | 15 +--
tools/perf/builtin-record.c | 2 +-
tools/perf/config/Makefile | 170 +++++++++++++--------------
tools/perf/config/Makefile.fix-config | 8 --
tools/perf/config/Makefile.fix-legacy | 4 -
tools/perf/tests/Kbuild | 2 +
tools/perf/tests/builtin-test.c | 3 +-
tools/perf/tests/tests.h | 6 +-
tools/perf/util/Kbuild | 11 +-
tools/perf/util/callchain.c | 11 +-
tools/perf/util/callchain.h | 3 +-
tools/perf/util/include/dwarf-regs.h | 4 +-
tools/perf/util/machine.c | 3 +-
tools/perf/util/perf_regs.c | 2 -
tools/perf/util/probe-event.c | 6 +-
tools/perf/util/probe-finder.h | 5 +-
tools/perf/util/unwind-libunwind.c | 5 +-
tools/perf/util/unwind.h | 7 +-
31 files changed, 203 insertions(+), 157 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 2eaf3ca..54a194d 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -287,7 +287,6 @@ choice
these tasks, perf can rely on either the libelf library or a
minimal builtin support.

-
config LIBELF
bool "elf"
---help---
@@ -318,15 +317,51 @@ config LIBDWARF
bool "Dwarf (libdwarf)"
default y
---help---
- libdwarf
+ A library for parsing DWARF debug information.
+
+config LIBDWARF_DIR
+ string "libdwarf directory"
+ depends on LIBDWARF
+ ---help---
+ Directory holding the libdwarf dependency (headers +
+ libraries)
+
+config UNWIND
+ depends on (LIBELF && PERF_REGS)
+ bool "User space unwind callchains"
+ default y
+ ---help---
+ Enable call-chain unwinding of user-space application.
+
+choice UNWIND_DEPS
+ prompt "Unwind dependency"
+ depends on UNWIND
+ default LIBUNWIND

config LIBUNWIND
- depends on LIBELF
- bool "User space libunwind callchains"
+ depends on (LIBELF && PERF_REGS)
+ bool "Libunwind"
+ ---help---
+ Rely on libunwind post unwind support to determine the
+ call-chain of a user-space program. The library libunwind
+ supports all the architectures.
+
+config LIBDWARF_UNWIND
+ depends on (LIBDWARF && PERF_REGS && (ARCH = "x86" || ARCH = "arm"))
+ bool "Libdwarf unwind"
+ ---help---
+ Rely on lidw DWARF post unwind support to determine the
+ call-chain of a user-space program. So far there's only x86
+ and arm libdw unwind support merged in perf.
+
+endchoice
+
+config LIBUNWIND_DEBUG_FRAME
+ depends on LIBUNWIND
+ bool "libunwind debug frame"
default y
---help---
- The library libunwind provides a portable C API to determine
- the call-chain of a program.
+ libunwind debug frame

config LIBUNWIND_DIR
string "libunwind directory"
@@ -335,6 +370,18 @@ config LIBUNWIND_DIR
Directory holding the libuwind dependency (headers +
libraries).

+config SKIP_CALLCHAIN_IDX
+ depends on (LIBDWARF && ARCH = "powerpc")
+ bool "Skip unnecessary callchain entries thanks to Dwarf"
+ default y
+ ---help---
+ When saving the callchain on Power, the kernel
+ conservatively saves excess entries in the callchain. A few
+ of these entries are needed in some cases but not others. If
+ the unnecessary entries are not ignored, we end up with
+ duplicate arcs in the call-graphs. Use DWARF debug
+ information to skip over any unnecessary callchain entries.
+
config LIBNUMA
bool "Libnuma support"
default y
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
index 1318ed0..f1d8426 100644
--- a/tools/perf/arch/arm/tests/Kbuild
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -1,2 +1,2 @@
obj-$(CONFIG_PERF_REGS) += regs_load.o
-obj-y += dwarf-unwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += dwarf-unwind.o
diff --git a/tools/perf/arch/arm/util/Kbuild b/tools/perf/arch/arm/util/Kbuild
index c96666a..df195c0 100644
--- a/tools/perf/arch/arm/util/Kbuild
+++ b/tools/perf/arch/arm/util/Kbuild
@@ -1,3 +1,3 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
-obj-y += unwind-libdw.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/arch/arm64/util/Kbuild b/tools/perf/arch/arm64/util/Kbuild
index 136bc86..bd35d10 100644
--- a/tools/perf/arch/arm64/util/Kbuild
+++ b/tools/perf/arch/arm64/util/Kbuild
@@ -1,2 +1,2 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/powerpc/util/Kbuild b/tools/perf/arch/powerpc/util/Kbuild
index 244ff2c..f33f79d 100644
--- a/tools/perf/arch/powerpc/util/Kbuild
+++ b/tools/perf/arch/powerpc/util/Kbuild
@@ -1,3 +1,3 @@
obj-y += header.o
-obj-y += skip-callchain-idx.o
-obj-y += dwarf-regs.o
+obj-$(CONFIG_SKIP_CALLCHAIN_IDX) += skip-callchain-idx.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
index 24e8ee7..73df1ff 100644
--- a/tools/perf/arch/s390/util/Kbuild
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -1,2 +1,2 @@
obj-y += kvm-stat.o
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/sh/util/Kbuild b/tools/perf/arch/sh/util/Kbuild
index 8e698ae..930ba99 100644
--- a/tools/perf/arch/sh/util/Kbuild
+++ b/tools/perf/arch/sh/util/Kbuild
@@ -1 +1 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/sparc/util/Kbuild b/tools/perf/arch/sparc/util/Kbuild
index 8e698ae..930ba99 100644
--- a/tools/perf/arch/sparc/util/Kbuild
+++ b/tools/perf/arch/sparc/util/Kbuild
@@ -1 +1 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Kbuild b/tools/perf/arch/x86/Kbuild
index 52fd6fa..f5581bee 100644
--- a/tools/perf/arch/x86/Kbuild
+++ b/tools/perf/arch/x86/Kbuild
@@ -1 +1,2 @@
obj-y += util/
+obj-y += tests/
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 9b21881..af36aad 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,14 +1,12 @@
-ifndef NO_DWARF
+ifeq ($(LIBDWARF), 1)
PERF_HAVE_DWARF_REGS := 1
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
endif
-ifndef NO_LIBUNWIND
+ifeq ($(LIBUNWIND), 1)
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
endif
-ifndef NO_LIBDW_DWARF_UNWIND
+ifeq ($(LIBDWARF_UNWIND), 1)
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-endif
-ifndef NO_DWARF_UNWIND
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
endif
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
index 8287dae..6d06051 100644
--- a/tools/perf/arch/x86/tests/Kbuild
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -1,3 +1,3 @@
obj-y += perf-time-to-tsc.o
obj-$(CONFIG_PERF_REGS) += regs_load.o
-obj-y += dwarf-unwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += dwarf-unwind.o
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
index f238442..4fff792 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -9,7 +9,7 @@
#include "thread_map.h"
#include "cpumap.h"
#include "tsc.h"
-#include "tests.h"
+#include "tests/tests.h"

#define CHECK__(x) { \
while ((x) < 0) { \
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
index c7b86c0..adca885 100644
--- a/tools/perf/arch/x86/util/Kbuild
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -1,5 +1,6 @@
-obj-y += dwarf-regs.o
obj-y += header.o
obj-y += tsc.o
obj-y += kvm-stat.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 04412b4..0a00a4d 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>

+#include "generated/autoconf.h"
#include "perf.h"
#include "builtin.h"
#include "util/util.h"
@@ -180,7 +181,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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
else if (!strcmp(opt->long_name, "module"))
params.uprobes = false;
#endif
@@ -206,7 +207,7 @@ static int opt_set_target(const struct option *opt, const char *str,
return ret;
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
static int opt_show_lines(const struct option *opt __maybe_unused,
const char *str, int unset __maybe_unused)
{
@@ -306,7 +307,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"perf probe [<options>] --line 'LINEDESC'",
"perf probe [<options>] --vars 'PROBEPOINT'",
#endif
@@ -320,7 +321,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT"
" [[NAME=]ARG ...]",
#else
@@ -332,7 +333,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"\t\tSRC:\tSource code path\n"
"\t\tRL:\tRelative line number from function entry.\n"
"\t\tAL:\tAbsolute line number in file.\n"
@@ -345,7 +346,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
OPT_CALLBACK('L', "line", NULL,
"FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
"Show source code lines.", opt_show_lines),
@@ -460,7 +461,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
return ret;
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
if (params.show_lines) {
if (params.mod_events) {
pr_err(" Error: Don't use --line with"
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index dbba96c..bf56425 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -714,7 +714,7 @@ static struct record record = {

#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf";
#else
const char record_callchain_help[] = CALLCHAIN_HELP "fp";
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 79fe047..f667229 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,23 +34,16 @@ ifeq ($(ARCH),arm64)
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

-# So far there's only x86 and arm libdw unwind support merged in perf.
-# Disable it on all other architectures in case libdw unwind
-# support is detected in system. Add supported architectures
-# to the check.
-ifneq ($(ARCH),$(filter $(ARCH),x86 arm))
- NO_LIBDW_DWARF_UNWIND := 1
-endif
-
ifeq ($(LIBUNWIND_LIBS),)
- NO_LIBUNWIND := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
else
+ LIBUNWIND = 1
#
# For linking with debug library, run like:
#
# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
#
- ifdef LIBUNWIND_DIR
+ ifdef CONFIG_LIBUNWIND_DIR
LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
endif
@@ -63,12 +56,10 @@ else
FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
endif

-ifndef NO_LIBELF
- # for linking with debug library, run like:
- # make DEBUG=1 LIBDW_DIR=/opt/libdw/
- ifdef LIBDW_DIR
- LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
- LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
+ifdef CONFIG_LIBELF
+ ifdef CONFIG_LIBDWARF_DIR
+ LIBDW_CFLAGS := -I$(CONFIG_LIBDWARF_DIR)/include
+ LIBDW_LDFLAGS := -L$(CONFIG_LIBDWARF_DIR)/lib
endif
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
@@ -325,16 +316,22 @@ ifdef CONFIG_LIBELF
endif
else
LIBELF = 1
- ifndef NO_LIBDW_DWARF_UNWIND
- ifneq ($(feature-libdw-dwarf-unwind),1)
- NO_LIBDW_DWARF_UNWIND := 1
- msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
- endif
- endif
- ifneq ($(feature-dwarf), 1)
- msg := $(warning 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);
- NO_DWARF := 1
- endif # Dwarf support
+ ifdef CONFIG_LIBDWARF
+ ifneq ($(feature-dwarf), 1)
+ msg := $(warning 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);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF)
+ else
+ LIBDWARF = 1
+ endif # Dwarf support
+ ifdef CONFIG_LIBDWARF_UNWIND
+ ifneq ($(feature-libdw-dwarf-unwind),1)
+ msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set CONFIG_LIBDWARF_DIR);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF_UNWIND)
+ else
+ LIBDWARF_UNWIND = 1
+ endif # Dwarf unwind support detected
+ endif # CONFIG_LIBDWARF_UNWIND
+ endif # CONFIG_LIBDWARF
endif # libelf support
endif # CONFIG_LIBELF

@@ -355,72 +352,75 @@ ifeq ($(LIBELF), 1)
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

- ifndef NO_DWARF
- ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
- msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
- NO_DWARF := 1
- else
- CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
- LDFLAGS += $(LIBDW_LDFLAGS)
- EXTLIBS += -lelf -ldw
- endif # PERF_HAVE_DWARF_REGS
- endif # NO_DWARF
+ ifeq ($(LIBDWARF), 1)
+ CFLAGS += $(LIBDW_CFLAGS)
+ LDFLAGS += $(LIBDW_LDFLAGS)
+ EXTLIBS += -lelf -ldw
+ endif # LIBDWARF
endif # LIBELF

-ifeq ($(ARCH),powerpc)
- ifndef NO_DWARF
- CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
- endif
-endif
-
-ifndef NO_LIBUNWIND
- ifneq ($(feature-libunwind), 1)
- msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
- NO_LIBUNWIND := 1
+ifdef CONFIG_UNWIND
+ # CONFIG_LIBUNWIND is the default choice; so, if it is not
+ # available, let's try another one
+ ifdef CONFIG_LIBUNWIND
+ ifeq ($(LIBUNWIND), 1)
+ ifneq ($(feature-libunwind), 1)
+ LIBUNWIND = 0
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
+ ifeq ($(LIBDWARF_UNWIND), 1)
+ msg := $(warning No libunwind found, post unwind will rely on libdwarf-unwind. Please install libunwind-dev[el] >= 1.1);
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBDWARF_UNWIND)
+ else
+ msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
+ endif # LIBDWARF_UNWIND
+ else # feature-libunwind OK
+ EXTLIBS += $(LIBUNWIND_LIBS)
+ CFLAGS += $(LIBUNWIND_CFLAGS)
+ LDFLAGS += $(LIBUNWIND_LDFLAGS)
+ endif # feature-libunwind
+ endif # LIBUNWIND
+ endif # CONFIG_LIBUNWIND
+
+ # CONFIG_LIBDWARF_UNWIND is not the default choice (so the user's
+ # choice); so, we disable CONFIG_UNWIND if it is not available
+ ifdef CONFIG_LIBDWARF_UNWIND
+ ifneq ($(LIBDWARF_UNWIND), 1)
+ msg := $(warning Disabling post unwing because (libdwarf-unwind is not available));
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
+ endif
+ endif # CONFIG_LIBDWARF_UNWIND
+
+ # if libunwind is OK, let's check the option DEBUG_FRAME
+ ifdef CONFIG_LIBUNWIND
+ ifeq ($(LIBUNWIND), 1)
+ ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
+ $(call feature_check,libunwind-debug-frame)
+ ifneq ($(feature-libunwind-debug-frame), 1)
+ msg := $(warning No debug_frame support found in libunwind);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND_DEBUG_FRAME)
+ endif
+ else
+ # non-ARM has no dwarf_find_debug_frame() function:
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND_DEBUG_FRAME)
+ endif
+ endif
endif
-endif

-dwarf-post-unwind := 1
-dwarf-post-unwind-text := BUG
+dwarf-post-unwind = 0
+dwarf-post-unwind-text = BUG

-# setup DWARF post unwinder
-ifdef NO_LIBUNWIND
- ifdef NO_LIBDW_DWARF_UNWIND
- msg := $(warning Disabling post unwind, no support found.);
- dwarf-post-unwind := 0
- else
- dwarf-post-unwind-text := libdw
- endif
-else
+ifeq ($(LIBUNWIND), 1)
+ dwarf-post-unwind := 1
dwarf-post-unwind-text := libunwind
- # Enable libunwind support by default.
- ifndef NO_LIBDW_DWARF_UNWIND
- NO_LIBDW_DWARF_UNWIND := 1
- endif
-endif
-
-ifeq ($(dwarf-post-unwind),1)
- CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
else
- NO_DWARF_UNWIND := 1
-endif
-
-ifndef NO_LIBUNWIND
- ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
- $(call feature_check,libunwind-debug-frame)
- ifneq ($(feature-libunwind-debug-frame), 1)
- msg := $(warning No debug_frame support found in libunwind);
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
- endif
- else
- # non-ARM has no dwarf_find_debug_frame() function:
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
+ ifeq ($(LIBDWARF_UNWIND), 1)
+ dwarf-post-unwind := 1
+ dwarf-post-unwind-text := libdw
endif
- CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
- EXTLIBS += $(LIBUNWIND_LIBS)
- CFLAGS += $(LIBUNWIND_CFLAGS)
- LDFLAGS += $(LIBUNWIND_LDFLAGS)
-endif
+endif # LIBUNWIND
+
+endif # CONFIG_UNWIND

ifdef CONFIG_LIBAUDIT
ifneq ($(feature-libaudit), 1)
@@ -783,8 +783,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_LIBUNWIND)
- $(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
$(call store,bindir_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 99948b7..e63539f 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,12 +19,4 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_LIBUNWIND
-ifdef CONFIG_LIBUNWIND
-ifdef NO_LIBUNWIND
-dummy := $(info Disabling CONFIG_LIBUNWIND)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 8568d37..20a4062 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -8,7 +8,3 @@ endif
ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif
-
-ifndef CONFIG_LIBUNWIND
-NO_LIBUNWIND := 1
-endif
diff --git a/tools/perf/tests/Kbuild b/tools/perf/tests/Kbuild
index 9f56ce8..f362620 100644
--- a/tools/perf/tests/Kbuild
+++ b/tools/perf/tests/Kbuild
@@ -31,6 +31,8 @@ obj-y += hists_cumulate.o
obj-y += hists_common.o
obj-y += hists_filter.o

+obj-$(LIBDWARF_UNWIND) += dwarf-unwind.o
+
CFLAGS_python-use.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
CFLAGS_python-use.o += -D"PYTHONPATH=KBUILD_STR(python)"

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 162c978..e3e21b1 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -5,6 +5,7 @@
*/
#include <unistd.h>
#include <string.h>
+#include "generated/autoconf.h"
#include "builtin.h"
#include "hist.h"
#include "intlist.h"
@@ -127,7 +128,7 @@ static struct test {
.func = test__parse_no_sample_id_all,
},
#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
{
.desc = "Test dwarf unwind",
.func = test__dwarf_unwind,
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 00e776a..a14555d 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -1,6 +1,8 @@
#ifndef TESTS_H
#define TESTS_H

+#include "generated/autoconf.h"
+
#define TEST_ASSERT_VAL(text, cond) \
do { \
if (!(cond)) { \
@@ -52,12 +54,10 @@ int test__switch_tracking(void);
int test__fdarray__filter(void);
int test__fdarray__add(void);

-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
struct thread;
struct perf_sample;
int test__arch_unwind_sample(struct perf_sample *sample,
struct thread *thread);
#endif
-#endif
#endif /* TESTS_H */
diff --git a/tools/perf/util/Kbuild b/tools/perf/util/Kbuild
index 98526db..4dd3e41 100644
--- a/tools/perf/util/Kbuild
+++ b/tools/perf/util/Kbuild
@@ -49,16 +49,19 @@ obj-y += string.o
obj-y += strlist.o
obj-y += svghelper.o
obj-y += symbol.o
-obj-y += perf_regs.o
obj-y += tsc.o
obj-y += cloexec.o

-obj-$(CONFIG_LIBUNWIND) += unwind.o
+obj-$(CONFIG_PERF_REGS) += perf_regs.o
+
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o

obj-$(CONFIG_LIBELF) += symbol-elf.o
-obj-$(CONFIG_LIBELF) += dwarf-aux.o
obj-$(CONFIG_LIBELF) += probe-event.o
-obj-$(CONFIG_LIBELF) += probe-finder.o
+
+obj-$(CONFIG_LIBDWARF) += dwarf-aux.o
+obj-$(CONFIG_LIBDWARF) += probe-finder.o

obj-$(CONFIG_LIBELF_MINIMAL) += symbol-minimal.o

diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index c84d3f8..b7c06b2 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -17,6 +17,7 @@

#include "asm/bug.h"

+#include "generated/autoconf.h"
#include "hist.h"
#include "util.h"
#include "sort.h"
@@ -25,7 +26,7 @@

__thread struct callchain_cursor callchain_cursor;

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
static int get_stack_size(const char *str, unsigned long *_size)
{
char *endptr;
@@ -51,7 +52,7 @@ static int get_stack_size(const char *str, unsigned long *_size)
max_size, str);
return -1;
}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_LIBDWARF_UNWIND */

int parse_callchain_record_opt(const char *arg)
{
@@ -80,7 +81,7 @@ int parse_callchain_record_opt(const char *arg)
"needed for -g fp\n");
break;

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
/* Dwarf style */
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
const unsigned long default_stack_dump_size = 8192;
@@ -96,7 +97,7 @@ int parse_callchain_record_opt(const char *arg)
ret = get_stack_size(tok, &size);
callchain_param.dump_size = size;
}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_LIBDWARF_UNWIND */
} else {
pr_err("callchain: Unknown --call-graph option "
"value: %s\n", arg);
@@ -208,7 +209,7 @@ int perf_callchain_config(const char *var, const char *value)

if (!strcmp(var, "record-mode"))
return parse_callchain_record_opt(value);
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
if (!strcmp(var, "dump-size")) {
unsigned long size = 0;
int ret;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 94cfefd..d9a9606 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -1,6 +1,7 @@
#ifndef __PERF_CALLCHAIN_H
#define __PERF_CALLCHAIN_H

+#include "generated/autoconf.h"
#include "../perf.h"
#include <linux/list.h>
#include <linux/rbtree.h>
@@ -183,7 +184,7 @@ static inline void callchain_cursor_snapshot(struct callchain_cursor *dest,
dest->nr -= src->pos;
}

-#ifdef HAVE_SKIP_CALLCHAIN_IDX
+#ifdef CONFIG_SKIP_CALLCHAIN_IDX
extern int arch_skip_callchain_idx(struct machine *machine,
struct thread *thread, struct ip_callchain *chain);
#else
diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h
index 8f14965..93cd69c 100644
--- a/tools/perf/util/include/dwarf-regs.h
+++ b/tools/perf/util/include/dwarf-regs.h
@@ -1,7 +1,9 @@
#ifndef _PERF_DWARF_REGS_H_
#define _PERF_DWARF_REGS_H_

-#ifdef HAVE_DWARF_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_LIBDWARF
const char *get_arch_regstr(unsigned int n);
#endif

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 34fc7c8..7804c6d 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "callchain.h"
#include "debug.h"
#include "event.h"
@@ -1407,7 +1408,7 @@ static int machine__resolve_callchain_sample(struct machine *machine,
else
j = chain->nr - i - 1;

-#ifdef HAVE_SKIP_CALLCHAIN_IDX
+#ifdef CONFIG_SKIP_CALLCHAIN_IDX
if (j == skip_idx)
continue;
#endif
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 01720b5..434f85b 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -3,7 +3,6 @@
#include "perf_regs.h"
#include "event.h"

-#ifdef CONFIG_PERF_REGS
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
{
int i, idx = 0;
@@ -27,4 +26,3 @@ out:
*valp = regs->cache_regs[id];
return 0;
}
-#endif /* CONFIG_PERF_REGS */
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index c150ca4..d31d5d0 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -32,6 +32,7 @@
#include <limits.h>
#include <elf.h>

+#include "generated/autoconf.h"
#include "util.h"
#include "event.h"
#include "strlist.h"
@@ -256,8 +257,7 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
clear_probe_trace_event(tevs + i);
}

-#ifdef HAVE_DWARF_SUPPORT
-
+#ifdef CONFIG_LIBDWARF
/* Open new debuginfo of given module */
static struct debuginfo *open_debuginfo(const char *module, bool silent)
{
@@ -799,7 +799,7 @@ out:
return ret;
}

-#else /* !HAVE_DWARF_SUPPORT */
+#else /* !CONFIG_LIBDWARF */

static int
find_perf_probe_point_from_dwarf(struct probe_trace_point *tp __maybe_unused,
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 92590b2..13cb054 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -2,6 +2,7 @@
#define _PROBE_FINDER_H

#include <stdbool.h>
+#include "generated/autoconf.h"
#include "util.h"
#include "intlist.h"
#include "probe-event.h"
@@ -16,7 +17,7 @@ static inline int is_c_varname(const char *name)
return isalpha(name[0]) || name[0] == '_';
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF

#include "dwarf-aux.h"

@@ -107,6 +108,6 @@ struct line_finder {
int found;
};

-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* CONFIG_LIBDWARF */

#endif /*_PROBE_FINDER_H */
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index e060386..dd98eb3 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -24,6 +24,7 @@
#include <linux/list.h>
#include <libunwind.h>
#include <libunwind-ptrace.h>
+#include "generated/autoconf.h"
#include "callchain.h"
#include "thread.h"
#include "session.h"
@@ -261,7 +262,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
return ret;
}

-#ifndef NO_LIBUNWIND_DEBUG_FRAME
+#ifdef CONFIG_LIBUNWIND_DEBUG_FRAME
static int read_unwind_spec_debug_frame(struct dso *dso,
struct machine *machine, u64 *offset)
{
@@ -319,7 +320,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
need_unwind_info, arg);
}

-#ifndef NO_LIBUNWIND_DEBUG_FRAME
+#ifdef CONFIG_LIBUNWIND_DEBUG_FRAME
/* Check the .debug_frame section for unwinding info */
if (!read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
memset(&di, 0, sizeof(di));
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index c17c485..63fdf3c 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -2,6 +2,7 @@
#define __UNWIND_H

#include <linux/types.h>
+#include "generated/autoconf.h"
#include "event.h"
#include "symbol.h"
#include "thread.h"
@@ -14,13 +15,13 @@ struct unwind_entry {

typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_UNWIND
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine,
struct thread *thread,
struct perf_sample *data, int max_stack);
/* libunwind specific */
-#ifdef HAVE_LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
int libunwind__arch_reg_id(int regnum);
int unwind__prepare_access(struct thread *thread);
void unwind__finish_access(struct thread *thread);
@@ -50,5 +51,5 @@ static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
}

static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_UNWIND */
#endif /* __UNWIND_H */
--
2.1.1

2014-10-23 22:00:14

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 10/14] perf kbuild: remove legacy libelf-related build variables

Remove NO_LIBELF (replaced by CONFIG_LIBELF)
Remove HAVE_LIBELF_SUPPORT (replaced by CONFIG_LIBELF)
Remove HAVE_LIBELF_MMAP_SUPPORT (replaced by CONFIG_LIBELF_MMAP)
Remove HAVE_LIBELF_GETPHDRNUM__SUPPORT (replaced by
CONFIG_LIBELF_GETPHDRNUM_)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 23 ++++++++++++++++++++++
tools/perf/builtin-inject.c | 2 +-
tools/perf/config/Makefile | 37 +++++++++++++++--------------------
tools/perf/config/Makefile.fix-config | 18 -----------------
tools/perf/config/Makefile.fix-legacy | 4 ----
tools/perf/perf.c | 2 +-
tools/perf/util/generate-cmdlist.sh | 4 ++--
tools/perf/util/map.c | 3 ++-
tools/perf/util/symbol-elf.c | 3 ++-
tools/perf/util/symbol.h | 8 ++++----
10 files changed, 51 insertions(+), 53 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 29853a6..2eaf3ca 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -256,6 +256,7 @@ config TIMERFD
Timer via file descriptor

config DEMANGLE
+ depends on LIBELF
bool "Demangle symbols"
default y
---help---
@@ -298,7 +299,29 @@ choice
Builtin elf support.
endchoice

+config LIBELF_MMAP
+ depends on LIBELF
+ bool "Libelf mmap support"
+ default y
+ ---help---
+ libdelf mmap
+
+config LIBELF_GETPHDRNUM
+ depends on LIBELF
+ default y
+ bool "Libelf getphdrnum support"
+ ---help---
+ libdelf mmap
+
+config LIBDWARF
+ depends on LIBELF
+ bool "Dwarf (libdwarf)"
+ default y
+ ---help---
+ libdwarf
+
config LIBUNWIND
+ depends on LIBELF
bool "User space libunwind callchains"
default y
---help---
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index de99ca1..9d59c7f 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -230,7 +230,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
* account this as unresolved.
*/
} else {
-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
pr_warning("no symbols found in %s, maybe "
"install a debug package?\n",
al.map->dso->long_name);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5be574c3..79fe047 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -303,12 +303,7 @@ ifdef CONFIG_BIONIC
endif
endif

-ifdef NO_LIBELF
- NO_DWARF := 1
- NO_DEMANGLE := 1
- NO_LIBUNWIND := 1
- NO_LIBDW_DWARF_UNWIND := 1
-else
+ifdef CONFIG_LIBELF
ifeq ($(feature-libelf), 0)
ifeq ($(feature-glibc), 1)
LIBC_SUPPORT := 1
@@ -318,12 +313,9 @@ else
endif
ifeq ($(LIBC_SUPPORT),1)
msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
-
- NO_LIBELF := 1
- NO_DWARF := 1
- NO_DEMANGLE := 1
- NO_LIBUNWIND := 1
- NO_LIBDW_DWARF_UNWIND := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF)
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBELF_MINIMAL)
+ EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
else
ifneq ($(filter s% -static%,$(LDFLAGS),),)
msg := $(error No static glibc found, please install glibc-static);
@@ -332,6 +324,7 @@ else
endif
endif
else
+ LIBELF = 1
ifndef NO_LIBDW_DWARF_UNWIND
ifneq ($(feature-libdw-dwarf-unwind),1)
NO_LIBDW_DWARF_UNWIND := 1
@@ -343,17 +336,20 @@ else
NO_DWARF := 1
endif # Dwarf support
endif # libelf support
-endif # NO_LIBELF
+endif # CONFIG_LIBELF

-ifndef NO_LIBELF
- CFLAGS += -DHAVE_LIBELF_SUPPORT
+ifeq ($(LIBELF), 1)

- ifeq ($(feature-libelf-mmap), 1)
- CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
+ ifdef CONFIG_LIBELF_MMAP
+ ifneq ($(feature-libelf-mmap), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ endif
endif

- ifeq ($(feature-libelf-getphdrnum), 1)
- CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
+ ifdef CONFIG_LIBELF_MMAP
+ ifneq ($(feature-libelf-getphdrnum), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ endif
endif

# include ARCH specific config
@@ -369,7 +365,7 @@ ifndef NO_LIBELF
EXTLIBS += -lelf -ldw
endif # PERF_HAVE_DWARF_REGS
endif # NO_DWARF
-endif # NO_LIBELF
+endif # LIBELF

ifeq ($(ARCH),powerpc)
ifndef NO_DWARF
@@ -787,7 +783,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 2ba684b..99948b7 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,24 +19,6 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_DEMANGLE
-ifdef CONFIG_DEMANGLE
-ifdef NO_DEMANGLE
-dummy := $(info Disabling CONFIG_DEMANGLE)
-dummy := $(shell $(CONFIG) -d CONFIG_DEMANGLE)
-endif
-endif
-
-# NO_LIBELF
-ifdef CONFIG_LIBELF
-ifdef NO_LIBELF
-dummy := $(info Disabling CONFIG_LIBELF)
-dummy := $(info Enabling CONFIG_LIBELF_MINIMAL)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBELF)
-dummy := $(shell $(CONFIG) -e CONFIG_LIBELF_MINIMAL)
-endif
-endif
-
# NO_LIBUNWIND
ifdef CONFIG_LIBUNWIND
ifdef NO_LIBUNWIND
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 8e32b74..8568d37 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,10 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_LIBELF
-NO_LIBELF := 1
-endif
-
ifndef CONFIG_LIBUNWIND
NO_LIBUNWIND := 1
endif
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 976ded6..b4fd910 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -81,7 +81,7 @@ static struct cmd_struct commands[] = {
#ifdef CONFIG_BUILTIN_SCHED
{ "sched", cmd_sched, 0 },
#endif
-#if defined HAVE_LIBELF_SUPPORT && defined CONFIG_BUILTIN_PROBE
+#if defined CONFIG_LIBELF && defined CONFIG_BUILTIN_PROBE
{ "probe", cmd_probe, 0 },
#endif
#ifdef CONFIG_BUILTIN_KMEM
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 5d84ffc..a8dbdc2 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -30,7 +30,7 @@ do
echo "#endif"
done

-echo "#ifdef HAVE_LIBELF_SUPPORT"
+echo "#ifdef CONFIG_LIBELF"
sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' $1/command-list.txt |
sort |
while read cmd
@@ -45,5 +45,5 @@ do
}' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done
-echo "#endif /* HAVE_LIBELF_SUPPORT */"
+echo "#endif /* CONFIG_LIBELF */"
echo "};"
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 2137c45..4164fca 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "symbol.h"
#include <errno.h>
#include <inttypes.h>
@@ -272,7 +273,7 @@ int map__load(struct map *map, symbol_filter_t filter)
pr_warning(", continuing without symbols\n");
return -1;
} else if (nr == 0) {
-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
const size_t len = strlen(name);
const size_t real_len = len - sizeof(DSO__DELETED);

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 1e23a5b..db340ab 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -5,13 +5,14 @@
#include <unistd.h>
#include <inttypes.h>

+#include "generated/autoconf.h"
#include "symbol.h"
#include "machine.h"
#include "vdso.h"
#include <symbol/kallsyms.h>
#include "debug.h"

-#ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
+#ifndef CONFIG_LIBELF_GETPHDRNUM
static int elf_getphdrnum(Elf *elf, size_t *dst)
{
GElf_Ehdr gehdr;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 7e3a003..53bf6df 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -17,7 +17,7 @@
#include "event.h"
#include "util.h"

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
#include <libelf.h>
#include <gelf.h>
#endif
@@ -57,13 +57,13 @@ static inline char *bfd_demangle(void __maybe_unused *v,
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
* for newer versions we can use mmap to reduce memory usage:
*/
-#ifdef HAVE_LIBELF_MMAP_SUPPORT
+#ifdef CONFIG_LIBELF_MMAP
# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
#else
# define PERF_ELF_C_READ_MMAP ELF_C_READ
#endif

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
extern Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
GElf_Shdr *shp, const char *name, size_t *idx);
#endif
@@ -220,7 +220,7 @@ struct symsrc {
int fd;
enum dso_binary_type type;

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
Elf *elf;
GElf_Ehdr ehdr;

--
2.1.1

2014-10-23 22:00:13

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 12/14] perf kbuild: remove legacy script-related build variables

Remove NO_LIBPERL (replaced by CONFIG_LIBPERL)
Remove NO_LIBPYTHON (replaced by CONFIG_LIBPYTHON)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-script.c | 6 +++--
tools/perf/config/Makefile | 41 +++++++++------------------------
tools/perf/config/Makefile.fix-config | 16 -------------
tools/perf/config/Makefile.fix-legacy | 8 -------
tools/perf/util/trace-event-scripting.c | 13 ++++++-----
5 files changed, 22 insertions(+), 62 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 9708a12..cc9c305 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "builtin.h"

#include "perf.h"
@@ -1372,11 +1374,11 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next) {
snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
lang_dirent.d_name);
-#ifdef NO_LIBPERL
+#ifndef CONFIG_LIBPERL
if (strstr(lang_path, "perl"))
continue;
#endif
-#ifdef NO_LIBPYTHON
+#ifndef CONFIG_LIBPYTHON
if (strstr(lang_path, "python"))
continue;
#endif
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f667229..00d118c 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -101,7 +101,7 @@ ifdef PARSER_DEBUG
CFLAGS += -DPARSER_DEBUG
endif

-ifndef NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
# Try different combinations to accommodate systems that only have
# python[2][-config] in weird combinations but always preferring
# python2 and python2-config as per pep-0394. If we catch a
@@ -460,9 +460,7 @@ endif
grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))

-ifdef NO_LIBPERL
- CFLAGS += -DNO_LIBPERL
-else
+ifdef CONFIG_LIBPERL
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
@@ -470,9 +468,8 @@ else
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)

ifneq ($(feature-libperl), 1)
- CFLAGS += -DNO_LIBPERL
- NO_LIBPERL := 1
msg := $(warning Missing perl devel files. Disabling perl scripting support, consider installing perl-ExtUtils-Embed);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBPERL)
else
LDFLAGS += $(PERL_EMBED_LDFLAGS)
EXTLIBS += $(PERL_EMBED_LIBADD)
@@ -486,17 +483,14 @@ ifdef CONFIG_TIMERFD
endif
endif

-disable-python = $(eval $(disable-python_code))
-define disable-python_code
- CFLAGS += -DNO_LIBPYTHON
- $(if $(1),$(warning No $(1) was found))
- $(warning Python support will not be built)
- NO_LIBPYTHON := 1
-endef
+ifdef CONFIG_LIBPYTHON

-ifdef NO_LIBPYTHON
- $(call disable-python)
-else
+ disable-python = $(eval $(disable-python_code))
+ define disable-python_code
+ $(if $(1),$(warning No $(1) was found))
+ $(warning Python support will not be built)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBPYTHON)
+ endef

ifndef PYTHON
$(call disable-python,python interpreter)
@@ -520,18 +514,7 @@ else
else

ifneq ($(feature-libpython-version), 1)
- $(warning Python 3 is not yet supported; please set)
- $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
- $(warning If you also have Python 2 installed, then)
- $(warning try something like:)
- $(warning $(and ,))
- $(warning $(and ,) make PYTHON=python2)
- $(warning $(and ,))
- $(warning Otherwise, disable Python support entirely:)
- $(warning $(and ,))
- $(warning $(and ,) make NO_LIBPYTHON=1)
- $(warning $(and ,))
- $(error $(and ,))
+ $(call disable-python,python2 interpreter)
else
LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
EXTLIBS += $(PYTHON_EMBED_LIBADD)
@@ -781,8 +764,6 @@ all:
$(call store,PYTHON_EMBED_CCOPTS)
$(call store,PERL_EMBED_CCOPTS)
$(call store,NO_LIBUNWIND)
- $(call store,NO_LIBPERL)
- $(call store,NO_LIBPYTHON)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
$(call store,bindir_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index e63539f..3f0e33e 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -3,20 +3,4 @@ include $(KCONFIG_CONFIG)

CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)

-# NO_LIBPERL
-ifdef CONFIG_LIBPERL
-ifdef NO_LIBPERL
-dummy := $(info Disabling CONFIG_LIBPERL)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBPERL)
-endif
-endif
-
-# NO_LIBPYTHON
-ifdef CONFIG_LIBPYTHON
-ifdef NO_LIBPYTHON
-dummy := $(info Disabling CONFIG_LIBPYTHON)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 20a4062..431c9bf 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -1,10 +1,2 @@

include $(KCONFIG_CONFIG)
-
-ifndef CONFIG_LIBPERL
-NO_LIBPERL := 1
-endif
-
-ifndef CONFIG_LIBPYTHON
-NO_LIBPYTHON := 1
-endif
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 5c9bdd1..a8319bb 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <errno.h>

+#include "generated/autoconf.h"
#include "../perf.h"
#include "util.h"
#include "trace-event.h"
@@ -99,7 +100,7 @@ static void register_python_scripting(struct scripting_ops *scripting_ops)
scripting_context = malloc(sizeof(struct scripting_context));
}

-#ifdef NO_LIBPYTHON
+#ifndef CONFIG_LIBPYTHON
void setup_python_scripting(void)
{
register_python_scripting(&python_scripting_unsupported_ops);
@@ -163,16 +164,16 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops)
scripting_context = malloc(sizeof(struct scripting_context));
}

-#ifdef NO_LIBPERL
+#ifdef CONFIG_LIBPERL
+extern struct scripting_ops perl_scripting_ops;
+
void setup_perl_scripting(void)
{
- register_perl_scripting(&perl_scripting_unsupported_ops);
+ register_perl_scripting(&perl_scripting_ops);
}
#else
-extern struct scripting_ops perl_scripting_ops;
-
void setup_perl_scripting(void)
{
- register_perl_scripting(&perl_scripting_ops);
+ register_perl_scripting(&perl_scripting_unsupported_ops);
}
#endif
--
2.1.1

2014-10-23 22:00:58

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 09/14] perf kbuild: remove legacy misc build variables

Remove NO_LIBAUDIT (replaced by CONFIG_LIBAUDIT)
Remove HAVE_LIBAUDIT_SUPPORT from CFLAGS (replaced by CONFIG_LIBAUDIT)
Remove HAVE_TIMERFD_SUPPORT (replaced by CONFIG_TIMERFD)
Remove HAVE_ON_EXIT_SUPPORT (replaced by CONFIG_ON_EXIT)
Remove HAVE_BACKTRACE_SUPPORT (replaced by CONFIG_BACKTRACE)
Remove HAVE_LIBNUMA_SUPPORT (replaced by CONFIG_LIBNUMA)
Remove NO_BIONIC (replaced by CONFIG_BIONIC)
Remove NO_PERF_REGS (replaced by CONFIG_PERF_REGS)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 12 ++++++++--
tools/perf/arch/arm/tests/Kbuild | 2 +-
tools/perf/arch/x86/tests/Kbuild | 2 +-
tools/perf/bench/Kbuild | 2 +-
tools/perf/builtin-bench.c | 5 ++--
tools/perf/builtin-kvm.c | 13 ++++++-----
tools/perf/builtin-record.c | 2 ++
tools/perf/config/Makefile | 43 +++++++++++++----------------------
tools/perf/config/Makefile.fix-config | 32 --------------------------
tools/perf/config/Makefile.fix-legacy | 16 -------------
tools/perf/util/perf_regs.c | 3 +++
tools/perf/util/perf_regs.h | 6 +++--
tools/perf/util/util.c | 5 ++--
13 files changed, 51 insertions(+), 92 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 5f85923..29853a6 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -312,8 +312,8 @@ config LIBUNWIND_DIR
Directory holding the libuwind dependency (headers +
libraries).

-config NUMA
- bool "Numa support (bench)"
+config LIBNUMA
+ bool "Libnuma support"
default y
---help---
The library libnuma offers facilities to configure NUMA
@@ -327,6 +327,14 @@ config BIONIC
library code developed by Google for their Android operating
system.

+config PERF_REGS
+ bool "Cache register accesses"
+ depends on (ARCH = "x86" || ARCH = "arm" || ARCH = "arm64")
+ default y
+ ---help---
+ Cache register accesses for unwind processing to speed-up
+ performances.
+
endmenu

menu "Build"
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
index 5d63e9d..1318ed0 100644
--- a/tools/perf/arch/arm/tests/Kbuild
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -1,2 +1,2 @@
-obj-y += regs_load.o
+obj-$(CONFIG_PERF_REGS) += regs_load.o
obj-y += dwarf-unwind.o
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
index 3b5aa14..8287dae 100644
--- a/tools/perf/arch/x86/tests/Kbuild
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -1,3 +1,3 @@
obj-y += perf-time-to-tsc.o
-obj-y += regs_load.o
+obj-$(CONFIG_PERF_REGS) += regs_load.o
obj-y += dwarf-unwind.o
diff --git a/tools/perf/bench/Kbuild b/tools/perf/bench/Kbuild
index e604fe2..863646a 100644
--- a/tools/perf/bench/Kbuild
+++ b/tools/perf/bench/Kbuild
@@ -6,7 +6,7 @@ obj-y += futex-hash.o
obj-y += futex-requeue.o
obj-y += futex-wake.o

-obj-$(CONFIG_NUMA) += numa.o
+obj-$(CONFIG_LIBNUMA) += numa.o

obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index b9a56fa..5116d25 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -14,6 +14,7 @@
* numa ... NUMA scheduling and MM performance
* futex ... Futex performance
*/
+#include "generated/autoconf.h"
#include "perf.h"
#include "util/util.h"
#include "util/parse-options.h"
@@ -33,7 +34,7 @@ struct bench {
bench_fn_t fn;
};

-#ifdef HAVE_LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
static struct bench numa_benchmarks[] = {
{ "mem", "Benchmark for NUMA workloads", bench_numa },
{ "all", "Test all NUMA benchmarks", NULL },
@@ -72,7 +73,7 @@ struct collection {
static struct collection collections[] = {
{ "sched", "Scheduler and IPC benchmarks", sched_benchmarks },
{ "mem", "Memory access benchmarks", mem_benchmarks },
-#ifdef HAVE_LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
{ "numa", "NUMA scheduling and MM benchmarks", numa_benchmarks },
#endif
{"futex", "Futex stressing benchmarks", futex_benchmarks },
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 400e92e..28371f9 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "builtin.h"
#include "perf.h"

@@ -20,7 +21,7 @@
#include "util/data.h"

#include <sys/prctl.h>
-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
#include <sys/timerfd.h>
#endif

@@ -123,7 +124,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)
INIT_LIST_HEAD(&kvm->kvm_events_cache[i]);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static void clear_events_cache_stats(struct list_head *kvm_events_cache)
{
struct list_head *head;
@@ -622,7 +623,7 @@ static void print_result(struct perf_kvm_stat *kvm)
pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static int process_lost_event(struct perf_tool *tool,
union perf_event *event __maybe_unused,
struct perf_sample *sample __maybe_unused,
@@ -707,7 +708,7 @@ static bool verify_vcpu(int vcpu)
return true;
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
/* keeping the max events to a modest level to keep
* the processing of samples per mmap smooth.
*/
@@ -1199,7 +1200,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
return kvm_events_report_vcpu(kvm);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static struct perf_evlist *kvm_live_event_list(void)
{
struct perf_evlist *evlist;
@@ -1414,7 +1415,7 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
if (!strncmp(argv[1], "rep", 3))
return kvm_events_report(&kvm, argc - 1 , argv + 1);

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
if (!strncmp(argv[1], "live", 4))
return kvm_events_live(&kvm, argc - 1 , argv + 1);
#endif
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 2583a9b..dbba96c 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -5,6 +5,8 @@
* (or a CPU, or a PID) into the perf.data output file - for
* later analysis via perf report.
*/
+
+#include "generated/autoconf.h"
#include "builtin.h"

#include "perf.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 7f87a45..5be574c3 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -16,8 +16,6 @@ CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)

include $(src-perf)/config/Makefile.arch

-NO_PERF_REGS := 1
-
# Additional ARCH settings for x86
ifeq ($(ARCH),x86)
ifeq ($(IS_X86_64),1)
@@ -26,16 +24,13 @@ ifeq ($(ARCH),x86)
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
- NO_PERF_REGS := 0
endif

ifeq ($(ARCH),arm)
- NO_PERF_REGS := 0
LIBUNWIND_LIBS = -lunwind -lunwind-arm
endif

ifeq ($(ARCH),arm64)
- NO_PERF_REGS := 0
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

@@ -68,10 +63,6 @@ else
FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
endif

-ifeq ($(NO_PERF_REGS),0)
- CFLAGS += -DHAVE_PERF_REGS_SUPPORT
-endif
-
ifndef NO_LIBELF
# for linking with debug library, run like:
# make DEBUG=1 LIBDW_DIR=/opt/libdw/
@@ -301,12 +292,14 @@ ifeq ($(feature-sync-compare-and-swap), 1)
CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
endif

-ifndef NO_BIONIC
+ifdef CONFIG_BIONIC
$(call feature_check,bionic)
ifeq ($(feature-bionic), 1)
BIONIC := 1
EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
+ else
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_BIONIC)
endif
endif

@@ -433,12 +426,11 @@ ifndef NO_LIBUNWIND
LDFLAGS += $(LIBUNWIND_LDFLAGS)
endif

-ifndef NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
ifneq ($(feature-libaudit), 1)
- msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
- NO_LIBAUDIT := 1
+ msg := $(warning No libaudit.h found, disables LIBAUDIT support and 'trace' tool, please install audit-libs-devel or libaudit-dev);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBAUDIT)
else
- CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
EXTLIBS += -laudit
endif
endif
@@ -491,10 +483,11 @@ else
endif
endif

-ifeq ($(feature-timerfd), 1)
- CFLAGS += -DHAVE_TIMERFD_SUPPORT
-else
- msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+ifdef CONFIG_TIMERFD
+ ifneq ($(feature-timerfd), 1)
+ msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_TIMERFD)
+ endif
endif

disable-python = $(eval $(disable-python_code))
@@ -603,18 +596,17 @@ ifdef CONFIG_LIBIBERTY_ONLY
endif
endif

-ifndef NO_BACKTRACE
- ifeq ($(feature-backtrace), 1)
- CFLAGS += -DHAVE_BACKTRACE_SUPPORT
+ifdef CONFIG_BACKTRACE
+ ifneq ($(feature-backtrace), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_BACKTRACE)
endif
endif

-ifndef NO_LIBNUMA
+ifdef CONFIG_LIBNUMA
ifeq ($(feature-libnuma), 0)
msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
- NO_LIBNUMA := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBNUMA)
else
- CFLAGS += -DHAVE_LIBNUMA_SUPPORT
EXTLIBS += -lnuma
endif
endif
@@ -797,9 +789,6 @@ all:
$(call store,NO_LIBPYTHON)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
- $(call store,NO_BACKTRACE)
- $(call store,NO_LIBNUMA)
- $(call store,NO_LIBAUDIT)
$(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 3d84008..2ba684b 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -45,36 +45,4 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
endif
endif

-# NO_BACKTRACE
-ifdef CONFIG_BACKTRACE
-ifdef NO_BACKTRACE
-dummy := $(info Disabling CONFIG_BACKTRACE)
-dummy := $(shell $(CONFIG) -d CONFIG_BACKTRACE)
-endif
-endif
-
-# NO_LIBNUMA
-ifdef CONFIG_NUMA
-ifdef NO_LIBNUMA
-dummy := $(info Disabling CONFIG_NUMA)
-dummy := $(shell $(CONFIG) -d CONFIG_NUMA)
-endif
-endif
-
-# NO_LIBAUDIT
-ifdef CONFIG_LIBAUDIT
-ifdef NO_LIBAUDIT
-dummy := $(info Disabling CONFIG_LIBAUDIT)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBAUDIT)
-endif
-endif
-
-# NO_LIBBIONIC
-ifdef CONFIG_BIONIC
-ifdef NO_LIBBIONIC
-dummy := $(info Disabling CONFIG_BIONIC)
-dummy := $(shell $(CONFIG) -d CONFIG_BIONIC)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 64dbb1a..8e32b74 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -16,19 +16,3 @@ endif
ifndef CONFIG_LIBUNWIND
NO_LIBUNWIND := 1
endif
-
-ifndef CONFIG_BACKTRACE
-NO_BACKTRACE := 1
-endif
-
-ifndef CONFIG_NUMA
-export NO_LIBNUMA := 1
-endif
-
-ifndef CONFIG_LIBAUDIT
-NO_LIBAUDIT := 1
-endif
-
-ifdef CONFIG_BIONIC
-NO_LIBBIONIC := 1
-endif
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 43168fb..01720b5 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -1,7 +1,9 @@
#include <errno.h>
+#include "generated/autoconf.h"
#include "perf_regs.h"
#include "event.h"

+#ifdef CONFIG_PERF_REGS
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
{
int i, idx = 0;
@@ -25,3 +27,4 @@ out:
*valp = regs->cache_regs[id];
return 0;
}
+#endif /* CONFIG_PERF_REGS */
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 980dbf7..44d9b08 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -1,11 +1,13 @@
#ifndef __PERF_REGS_H
#define __PERF_REGS_H

+#include <linux/compiler.h>
#include <linux/types.h>
+#include "generated/autoconf.h"

struct regs_dump;

-#ifdef HAVE_PERF_REGS_SUPPORT
+#ifdef CONFIG_PERF_REGS
#include <perf_regs.h>

int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
@@ -25,5 +27,5 @@ static inline int perf_reg_value(u64 *valp __maybe_unused,
{
return 0;
}
-#endif /* HAVE_PERF_REGS_SUPPORT */
+#endif /* CONFIG_PERF_REGS */
#endif /* __PERF_REGS_H */
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index d5eab3f..17667d8 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -1,9 +1,10 @@
+#include "generated/autoconf.h"
#include "../perf.h"
#include "util.h"
#include "debug.h"
#include <api/fs/fs.h>
#include <sys/mman.h>
-#ifdef HAVE_BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
#include <execinfo.h>
#endif
#include <stdio.h>
@@ -250,7 +251,7 @@ int hex2u64(const char *ptr, u64 *long_val)
}

/* Obtain a backtrace and print it to stdout. */
-#ifdef HAVE_BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
void dump_stack(void)
{
void *array[16];
--
2.1.1

2014-10-23 22:01:18

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 07/14] perf kbuild: remove legacy demangle-related build variables

Remove NO_DEMANGLE (replaced by CONFIG_DEMANGLE)
Remove HAVE_LIBBFD_SUPPORT (replaced by CONFIG_LIBBFD)
Remove HAVE_CPLUS_DEMANGLE_SUPPORT (replaced by CONFIG_LIBIBERTY_ONLY)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 36 +++++++++++++++++++++------
tools/perf/config/Makefile | 46 ++++++++++++++++++-----------------
tools/perf/config/Makefile.fix-legacy | 4 ---
tools/perf/util/srcline.c | 8 +++---
tools/perf/util/symbol.h | 25 +++++++++++++------
5 files changed, 75 insertions(+), 44 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index eb59567..026ef67 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -225,6 +225,35 @@ config LIBPYTHON
---help---
Libpython dependency needed by the perf script feature.

+config TIMERFD
+ bool "Timer via file descriptor"
+ default y
+ ---help---
+ Timer via file descriptor
+
+config DEMANGLE
+ bool "Demangle symbols"
+ default y
+ ---help---
+ Enable demangling so as to display human-readable
+ symbols. This option is convenient with C++ programs.
+
+choice DEMANGLE_DEPS
+ prompt "Demangle dependency(ies)"
+ depends on DEMANGLE
+ default LIBBFD
+
+config LIBBFD
+ bool "BFD + libiberty libraries"
+ ---help---
+ Binary File Descriptor and libiberty libraries
+
+config LIBIBERTY_ONLY
+ bool "Libiberty only"
+ ---help---
+ Libiberty
+endchoice
+
choice
prompt "Elf library"
default LIBELF
@@ -266,13 +295,6 @@ config NUMA
The library libnuma offers facilities to configure NUMA
policies supported by the linux kernel.

-config DEMANGLE
- bool "Demangle symbols"
- default y
- ---help---
- Enable demangling so as to display human-readable
- symbols. This option is convenient with C++ programs.
-
config BIONIC
bool "Bionic support"
default n
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 27b092c..ce3a726 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -573,33 +573,36 @@ ifeq ($(feature-libbfd), 1)
endif
endif

-ifdef NO_DEMANGLE
- CFLAGS += -DNO_DEMANGLE
-else
- ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
- EXTLIBS += -liberty
- CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
- else
- ifneq ($(feature-libbfd), 1)
- ifneq ($(feature-liberty), 1)
- ifneq ($(feature-liberty-z), 1)
- # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
- # or any of 'bfd iberty z' trinity
- ifeq ($(feature-cplus-demangle), 1)
- EXTLIBS += -liberty
- CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
- else
- msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
- CFLAGS += -DNO_DEMANGLE
- endif
+ifdef CONFIG_LIBBFD
+ ifneq ($(feature-libbfd), 1)
+ # TODO: there might be an issue here: feature-liberty and
+ # feature-liberty-z cannot be set; they can be set only if
+ # feature-libbfd is set
+ ifneq ($(feature-liberty), 1)
+ ifneq ($(feature-liberty-z), 1)
+ # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
+ # or any of 'bfd iberty z' trinity
+ ifeq ($(feature-cplus-demangle), 1)
+ EXTLIBS += -liberty
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBBFD)
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBIBERTY_ONLY)
+ else
+ msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_DEMANGLE)
endif
endif
endif
endif
endif

-ifneq ($(filter -lbfd,$(EXTLIBS)),)
- CFLAGS += -DHAVE_LIBBFD_SUPPORT
+ifdef CONFIG_LIBIBERTY_ONLY
+ $(call feature_check,cplus-demangle)
+ ifeq ($(feature-cplus-demangle), 1)
+ EXTLIBS += -liberty
+ else
+ msg := $(warning No libiberty found, install binutils-dev[el]/zlib-static to gain symbol demangling)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_DEMANGLE)
+ endif
endif

ifndef NO_BACKTRACE
@@ -795,7 +798,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_DEMANGLE)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
$(call store,NO_BACKTRACE)
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index ca219e7..64dbb1a 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,10 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_DEMANGLE
-NO_DEMANGLE := 1
-endif
-
ifndef CONFIG_LIBELF
NO_LIBELF := 1
endif
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index f3e4bc5..38df8f4 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -4,11 +4,13 @@

#include <linux/kernel.h>

+#include "generated/autoconf.h"
+
#include "util/dso.h"
#include "util/util.h"
#include "util/debug.h"

-#ifdef HAVE_LIBBFD_SUPPORT
+#ifdef CONFIG_LIBBFD

/*
* Implement addr2line using libbfd.
@@ -189,7 +191,7 @@ void dso__free_a2l(struct dso *dso)
dso->a2l = NULL;
}

-#else /* HAVE_LIBBFD_SUPPORT */
+#else /* !CONFIG_LIBBFD */

static int addr2line(const char *dso_name, unsigned long addr,
char **file, unsigned int *line_nr,
@@ -242,7 +244,7 @@ void dso__free_a2l(struct dso *dso __maybe_unused)
{
}

-#endif /* HAVE_LIBBFD_SUPPORT */
+#endif /* CONFIG_LIBBFD */

/*
* Number of addr2line failures (without success) before disabling it for that
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index eb2c19b..7e3a003 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -1,6 +1,8 @@
#ifndef __PERF_SYMBOL
#define __PERF_SYMBOL 1

+#include "generated/autoconf.h"
+
#include <linux/types.h>
#include <stdbool.h>
#include <stdint.h>
@@ -23,26 +25,33 @@

#include "dso.h"

-#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
+#ifdef CONFIG_DEMANGLE
+
+#ifdef CONFIG_LIBBFD
+
+#define PACKAGE 'perf'
+#include <bfd.h>
+
+#elif defined(CONFIG_LIBIBERTY_ONLY)
extern char *cplus_demangle(const char *, int);

static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
{
return cplus_demangle(c, i);
}
-#else
-#ifdef NO_DEMANGLE
+
+#else /* Unknown dependency */
+#error "Inconsistent demangling configuration"
+#endif
+
+#else /* !CONFIG_DEMANGLE */
static inline char *bfd_demangle(void __maybe_unused *v,
const char __maybe_unused *c,
int __maybe_unused i)
{
return NULL;
}
-#else
-#define PACKAGE 'perf'
-#include <bfd.h>
-#endif
-#endif
+#endif /* CONFIG_DEMANGLE */

/*
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
--
2.1.1

2014-10-23 22:01:41

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 06/14] perf kbuild: remove legacy tui/gui-related build variables

Remove NO_SLANG (replaced by CONFIG_LIBSLANG)
Remove HAVE_SLANG_SUPPORT from CFLAGS (replaced by CONFIG_LIBSLANG)
Remove NO_GTK2 (replaced by CONFIG_LIBGTK2 or CONFIG_GTK2)
Remove HAVE_GTK2_SUPPORT from CFLAGS (replaced by CONFIG_LIBGTK2)
Remove HAVE_GTK_INFO_BAR_SUPPORT from CFLAGS (replaced by
CONFIG_LIBGTK2_INFOBAR)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 21 +++++++++++++++++++++
tools/perf/config/Makefile | 20 ++++++--------------
tools/perf/config/Makefile.fix-config | 24 ------------------------
tools/perf/config/Makefile.fix-legacy | 8 --------
tools/perf/ui/gtk/browser.c | 4 +++-
tools/perf/ui/gtk/gtk.h | 5 +++--
tools/perf/ui/gtk/util.c | 6 ++++--
tools/perf/ui/setup.c | 4 +++-
tools/perf/ui/ui.h | 4 +++-
tools/perf/util/annotate.h | 4 +++-
tools/perf/util/hist.h | 3 ++-
11 files changed, 48 insertions(+), 55 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index f9fcf9e..eb59567 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -171,6 +171,7 @@ config STDIO

config TUI
bool "Tui (slang based)"
+ depends on LIBSLANG
default y
---help---
Text-based user interface which provides windowing
@@ -179,6 +180,7 @@ config TUI
config GTK2
bool "Gtk2"
default y
+ depends on LIBGTK2
---help---
Elaborate display mode based on libgtk2.

@@ -186,12 +188,31 @@ endmenu

menu "Libraries / Dependencies"

+config LIBSLANG
+ bool "Slang (libslang)"
+ default y
+ ---help---
+ libslang
+
config LIBAUDIT
bool "Audit (libaudit)"
default y
---help---
Linux audit framework dependency.

+config LIBGTK2
+ bool "Gtk2 (libgtk2)"
+ default y
+ ---help---
+ libgtk2
+
+config LIBGTK2_INFOBAR
+ bool "Gtk2 infobar (libgtk2)"
+ depends on LIBGTK2
+ default y
+ ---help---
+ libgtk2-infobar
+
config LIBPERL
bool "Perl"
default y
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 6106e24..27b092c 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -445,32 +445,26 @@ ifndef NO_LIBAUDIT
endif
endif

-ifdef NO_NEWT
- NO_SLANG=1
-endif
-
-ifndef NO_SLANG
+ifdef CONFIG_LIBSLANG
ifneq ($(feature-libslang), 1)
- msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
- NO_SLANG := 1
+ msg := $(warning slang not found, disables SLANG and TUI supports. Please install slang-devel or libslang-dev);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBSLANG)
else
# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
CFLAGS += -I/usr/include/slang
- CFLAGS += -DHAVE_SLANG_SUPPORT
EXTLIBS += -lslang
endif
endif

-ifndef NO_GTK2
+ifdef CONFIG_LIBGTK2
FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
ifneq ($(feature-gtk2), 1)
msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
- NO_GTK2 := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBGTK2)
else
ifeq ($(feature-gtk2-infobar), 1)
- GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBGTK2_INFOBAR)
endif
- CFLAGS += -DHAVE_GTK2_SUPPORT
GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
EXTLIBS += -ldl
@@ -801,8 +795,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_NEWT)
- $(call store,NO_GTK2)
$(call store,NO_DEMANGLE)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 7f65fdb..3d84008 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,30 +19,6 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_NEWT
-ifdef CONFIG_TUI
-ifdef NO_NEWT
-dummy := $(info Disabling CONFIG_TUI)
-dummy := $(shell $(CONFIG) -d CONFIG_TUI)
-endif
-endif
-
-# NO_NEWT
-ifdef CONFIG_TUI
-ifdef NO_SLANG
-dummy := $(info Disabling CONFIG_TUI)
-dummy := $(shell $(CONFIG) -d CONFIG_TUI)
-endif
-endif
-
-# NO_GTK2
-ifdef CONFIG_GTK2
-ifdef NO_GTK2
-dummy := $(info Disabling CONFIG_GTK2)
-dummy := $(shell $(CONFIG) -d CONFIG_GTK2)
-endif
-endif
-
# NO_DEMANGLE
ifdef CONFIG_DEMANGLE
ifdef NO_DEMANGLE
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 2ec91f3..ca219e7 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,14 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_TUI
-NO_SLANG := 1
-endif
-
-ifndef CONFIG_GTK2
-NO_GTK2 := 1
-endif
-
ifndef CONFIG_DEMANGLE
NO_DEMANGLE := 1
endif
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index c24d912..f4df6a6 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "../evlist.h"
#include "../cache.h"
#include "../evsel.h"
@@ -43,7 +45,7 @@ const char *perf_gtk__get_percent_color(double percent)
return NULL;
}

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *perf_gtk__setup_info_bar(void)
{
GtkWidget *info_bar;
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h
index 0a9173f..3762980 100644
--- a/tools/perf/ui/gtk/gtk.h
+++ b/tools/perf/ui/gtk/gtk.h
@@ -7,12 +7,13 @@
#include <gtk/gtk.h>
#pragma GCC diagnostic error "-Wstrict-prototypes"

+#include "generated/autoconf.h"

struct perf_gtk_context {
GtkWidget *main_window;
GtkWidget *notebook;

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *info_bar;
GtkWidget *message_label;
#endif
@@ -42,7 +43,7 @@ void perf_gtk__resize_window(GtkWidget *window);
const char *perf_gtk__get_percent_color(double percent);
GtkWidget *perf_gtk__setup_statusbar(void);

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *perf_gtk__setup_info_bar(void);
#else
static inline GtkWidget *perf_gtk__setup_info_bar(void)
diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c
index 52e7fc4..dde1615 100644
--- a/tools/perf/ui/gtk/util.c
+++ b/tools/perf/ui/gtk/util.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "../util.h"
#include "../../util/debug.h"
#include "gtk.h"
@@ -52,7 +54,7 @@ static int perf_gtk__error(const char *format, va_list args)
return 0;
}

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
static int perf_gtk__warning_info_bar(const char *format, va_list args)
{
char *msg;
@@ -104,7 +106,7 @@ static int perf_gtk__warning_statusbar(const char *format, va_list args)

struct perf_error_ops perf_gtk_eops = {
.error = perf_gtk__error,
-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
.warning = perf_gtk__warning_info_bar,
#else
.warning = perf_gtk__warning_statusbar,
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 7928984..0acaf1b 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -1,6 +1,8 @@
#include <pthread.h>
#include <dlfcn.h>

+#include "generated/autoconf.h"
+
#include "../util/cache.h"
#include "../util/debug.h"
#include "../util/hist.h"
@@ -8,7 +10,7 @@
pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
void *perf_gtk_handle;

-#ifdef HAVE_GTK2_SUPPORT
+#ifdef CONFIG_GTK2
static int setup_gtk_browser(void)
{
int (*perf_ui_init)(void);
diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h
index ab88383..bba3a0e 100644
--- a/tools/perf/ui/ui.h
+++ b/tools/perf/ui/ui.h
@@ -5,6 +5,8 @@
#include <stdbool.h>
#include <linux/compiler.h>

+#include "generated/autoconf.h"
+
extern pthread_mutex_t ui__lock;
extern void *perf_gtk_handle;

@@ -13,7 +15,7 @@ extern int use_browser;
void setup_browser(bool fallback_to_pager);
void exit_browser(bool wait_for_ok);

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
int ui__init(void);
void ui__exit(bool wait_for_ok);
#else
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 112d6e2..692f46c 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -11,6 +11,8 @@
#include <linux/rbtree.h>
#include <pthread.h>

+#include "generated/autoconf.h"
+
struct ins;

struct ins_operands {
@@ -157,7 +159,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, bool print_lines,
bool full_paths, int min_pcnt, int max_lines);

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
int symbol__tui_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel,
struct hist_browser_timer *hbt);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index d0ef9a1..622597d 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -3,6 +3,7 @@

#include <linux/types.h>
#include <pthread.h>
+#include "generated/autoconf.h"
#include "callchain.h"
#include "evsel.h"
#include "header.h"
@@ -298,7 +299,7 @@ struct hist_browser_timer {
int refresh;
};

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
#include "../ui/keysyms.h"
int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
struct hist_browser_timer *hbt);
--
2.1.1

2014-10-23 21:59:07

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 03/14] perf tools: Kbuild source related fixies

From: Jiri Olsa <[email protected]>

Fixing several sources config dependencies to allow
separate config builds.

This commit was originally created by Jiri Olsa in 2013. Minor changes
were needed to get it working one year later:
* Remove #ifdef directives related with GUI / TUI (because of code
changes in ui/setup.c)
* Fix a link issue if the option BUILTIN_TRACE is disabled.
* Fix typo (CONFIG_BULTIN_ instead CONFIG_BUILTIN_)

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-annotate.c | 6 +++---
tools/perf/builtin-lock.c | 5 ++++-
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-sched.c | 3 +++
tools/perf/builtin-top.c | 4 ++--
tools/perf/perf.c | 10 ++++++++--
tools/perf/ui/browsers/scripts.c | 4 ++++
tools/perf/ui/setup.c | 6 +++---
8 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 19cb967..a46af8f 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -155,7 +155,7 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
} else if (use_browser == 1) {
struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
@@ -303,9 +303,9 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
-#endif /* CONFIG_TUI */
+#endif
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index e7ec715..05c0e1c 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "builtin-cmds.h"
#include "perf.h"

#include "util/evlist.h"
@@ -995,9 +996,11 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
usage_with_options(report_usage, report_options);
}
rc = __cmd_report(false);
+#ifdef CONFIG_BUILTIN_SCRIPT
} else if (!strcmp(argv[0], "script")) {
/* Aliased to 'perf script' */
- return cmd_script(argc, argv, prefix);
+ rc = cmd_script(argc, argv, prefix);
+#endif
} else if (!strcmp(argv[0], "info")) {
if (argc) {
argc = parse_options(argc, argv,
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 00d93ff..b639e58 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -407,7 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 891c393..e38b021 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "builtin-cmds.h"
#include "perf.h"

#include "util/util.h"
@@ -1742,11 +1743,13 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
if (!argc)
usage_with_options(sched_usage, sched_options);

+#ifdef CONFIG_BUILTIN_SCRIPT
/*
* Aliased to 'perf script' for now:
*/
if (!strcmp(argv[0], "script"))
return cmd_script(argc, argv, prefix);
+#endif

if (!strncmp(argv[0], "rec", 3)) {
return __cmd_record(argc, argv);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a2ff8b7..6f04452 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -535,7 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -981,7 +981,7 @@ static int __cmd_top(struct perf_top *top)

ret = -1;

-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
if (use_browser > 0)
display_fn = display_thread_tui;
#endif
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index ab363b5..976ded6 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -93,8 +93,10 @@ static struct cmd_struct commands[] = {
#ifdef CONFIG_BUILTIN_KVM
{ "kvm", cmd_kvm, 0 },
#endif
+#ifdef CONFIG_BUILTIN_TEST
{ "test", cmd_test, 0 },
-#if defined HAVE_LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
+#endif
+#ifdef CONFIG_BUILTIN_TRACE
{ "trace", cmd_trace, 0 },
#endif
#ifdef CONFIG_BUILTIN_INJECT
@@ -539,7 +541,7 @@ int main(int argc, const char **argv)
goto out;
}
if (!prefixcmp(cmd, "trace")) {
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#ifdef CONFIG_BUILTIN_TRACE
set_buildid_dir();
setup_path();
argv[0] = "trace";
@@ -563,13 +565,17 @@ int main(int argc, const char **argv)
} else {
/* The user didn't specify a command; give them help */
printf("\n usage: %s\n\n", perf_usage_string);
+#ifdef CONFIG_BUILTIN_HELP
list_common_cmds_help();
printf("\n %s\n\n", perf_more_info_string);
+#endif
goto out;
}
cmd = argv[0];

+#ifdef CONFIG_BUILTIN_TEST
test_attr__init();
+#endif

/*
* We use PATH to find perf commands, but we prepend some higher
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 402d2bd..128988d 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -59,7 +59,11 @@ static int list_scripts(char *script_name)
paths[i] = names[i] + SCRIPT_NAMELEN;
}

+#ifdef CONFIG_BUILTIN_SCRIPT
num = find_scripts(names, paths);
+#else
+ num = 0;
+#endif
if (num > 0) {
choice = ui__popup_menu(num, names);
if (choice < num && choice >= 0) {
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ec7fd36..efc2b21 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,7 +77,7 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
use_browser = 1;
if (ui__init() == 0)
@@ -92,13 +92,13 @@ void setup_browser(bool fallback_to_pager)
}
}

-void exit_browser(bool wait_for_ok)
+void exit_browser(bool wait_for_ok __maybe_unused)
{
switch (use_browser) {
case 2:
exit_gtk_browser(wait_for_ok);
break;
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
ui__exit(wait_for_ok);
break;
--
2.1.1

2014-10-23 22:01:59

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 05/14] perf kbuild: remove Makefile.perf

The file Makefile.perf contained legacy build rules. It is replaced by
Makefile.kbuild which relies on Kbuild. Consequently, some minor
points need updates:
* The constant CONFIG_KBUILD can be removed
* The main Makefile wrapper now call Makefile.kbuild instead of
Makefile.perf

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Makefile | 2 +-
tools/perf/Makefile.kbuild | 2 +-
tools/perf/Makefile.perf | 949 ------------------------------------------
tools/perf/builtin-annotate.c | 4 +-
tools/perf/builtin-cmds.h | 25 --
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-top.c | 4 +-
tools/perf/ui/setup.c | 4 +-
8 files changed, 9 insertions(+), 983 deletions(-)
delete mode 100644 tools/perf/Makefile.perf

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index cb2e586..4512f16 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -55,7 +55,7 @@ define print_msg
endef

define make
- @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
+ @$(MAKE) -f Makefile.kbuild --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
endef

#
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index 51eba07..8d9e8b0 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -43,7 +43,7 @@ export QUIET_BISON QUIET_FLEX

ifeq ($(KBUILD_SRC),)

-ifeq ("$(origin O)", "command line")
+ifneq ($(O),)
KBUILD_OUTPUT := $(O)
else
KBUILD_OUTPUT := $(objtree)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
deleted file mode 100644
index dcf6248..0000000
--- a/tools/perf/Makefile.perf
+++ /dev/null
@@ -1,949 +0,0 @@
-include ../scripts/Makefile.include
-
-# The default target of this Makefile is...
-all:
-
-include config/utilities.mak
-
-# Define V to have a more verbose compile.
-#
-# Define VF to have a more verbose feature check output.
-#
-# Define O to save output files in a separate directory.
-#
-# Define ARCH as name of target architecture if you want cross-builds.
-#
-# Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
-#
-# Define NO_LIBPERL to disable perl script extension.
-#
-# Define NO_LIBPYTHON to disable python script extension.
-#
-# Define PYTHON to point to the python binary if the default
-# `python' is not correct; for example: PYTHON=python2
-#
-# Define PYTHON_CONFIG to point to the python-config binary if
-# the default `$(PYTHON)-config' is not correct.
-#
-# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
-#
-# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
-#
-# Define LDFLAGS=-static to build a static binary.
-#
-# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
-#
-# Define NO_DWARF if you do not want debug-info analysis feature at all.
-#
-# Define WERROR=0 to disable treating any warnings as errors.
-#
-# Define NO_NEWT if you do not want TUI support. (deprecated)
-#
-# Define NO_SLANG if you do not want TUI support.
-#
-# Define NO_GTK2 if you do not want GTK+ GUI support.
-#
-# Define NO_DEMANGLE if you do not want C++ symbol demangling.
-#
-# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
-#
-# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
-# backtrace post unwind.
-#
-# Define NO_BACKTRACE if you do not want stack backtrace debug feature
-#
-# Define NO_LIBNUMA if you do not want numa perf benchmark
-#
-# Define NO_LIBAUDIT if you do not want libaudit support
-#
-# Define NO_LIBBIONIC if you do not want bionic support
-#
-# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
-# for dwarf backtrace post unwind.
-
-ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
-srctree := $(patsubst %/,%,$(dir $(srctree)))
-#$(info Determined 'srctree' to be $(srctree))
-endif
-
-ifneq ($(objtree),)
-#$(info Determined 'objtree' to be $(objtree))
-endif
-
-ifneq ($(OUTPUT),)
-#$(info Determined 'OUTPUT' to be $(OUTPUT))
-endif
-
-$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
- @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
- @touch $(OUTPUT)PERF-VERSION-FILE
-
-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
-PKG_CONFIG = $(CROSS_COMPILE)pkg-config
-
-RM = rm -f
-LN = ln -f
-MKDIR = mkdir
-FIND = find
-INSTALL = install
-FLEX = flex
-BISON = bison
-STRIP = strip
-
-LIB_DIR = $(srctree)/tools/lib/api/
-TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
-
-# include config/Makefile by default and rule out
-# non-config cases
-config := 1
-
-NON_CONFIG_TARGETS := clean TAGS tags cscope help
-
-ifdef MAKECMDGOALS
-ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
- config := 0
-endif
-endif
-
-ifeq ($(config),1)
-include config/Makefile
-endif
-
-export prefix bindir sharedir sysconfdir DESTDIR
-
-# sparse is architecture-neutral, which means that we need to tell it
-# explicitly what architecture to check for. Fix this up for yours..
-SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
-
-# Guard against environment variables
-BUILTIN_OBJS =
-LIB_H =
-LIB_OBJS =
-GTK_OBJS =
-PYRF_OBJS =
-SCRIPT_SH =
-
-SCRIPT_SH += perf-archive.sh
-SCRIPT_SH += perf-with-kcore.sh
-
-grep-libs = $(filter -l%,$(1))
-strip-libs = $(filter-out -l%,$(1))
-
-ifneq ($(OUTPUT),)
- TE_PATH=$(OUTPUT)
-ifneq ($(subdir),)
- LIB_PATH=$(OUTPUT)/../lib/api/
-else
- LIB_PATH=$(OUTPUT)
-endif
-else
- TE_PATH=$(TRACE_EVENT_DIR)
- LIB_PATH=$(LIB_DIR)
-endif
-
-LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
-export LIBTRACEEVENT
-
-LIBAPIKFS = $(LIB_PATH)libapikfs.a
-export LIBAPIKFS
-
-# python extension build directories
-PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
-PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
-PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
-export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
-
-python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
-
-PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
-PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPIKFS)
-
-$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
- $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
- --quiet build_ext; \
- mkdir -p $(OUTPUT)python && \
- cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
-#
-# No Perl scripts right now:
-#
-
-SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
-
-#
-# Single 'perf' binary right now:
-#
-PROGRAMS += $(OUTPUT)perf
-
-# what 'all' will build and 'install' will install, in perfexecdir
-ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
-
-# what 'all' will build but not install in perfexecdir
-OTHER_PROGRAMS = $(OUTPUT)perf
-
-# Set paths to tools early so that they can be used for version tests.
-ifndef SHELL_PATH
- SHELL_PATH = /bin/sh
-endif
-ifndef PERL_PATH
- PERL_PATH = /usr/bin/perl
-endif
-
-export PERL_PATH
-
-$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
- $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
-
-$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
- $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
-
-$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
- $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
-
-$(OUTPUT)util/pmu-bison.c: util/pmu.y
- $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
-
-$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
-$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
-
-LIB_FILE=$(OUTPUT)libperf.a
-
-LIB_H += ../lib/symbol/kallsyms.h
-LIB_H += ../../include/uapi/linux/perf_event.h
-LIB_H += ../../include/linux/rbtree.h
-LIB_H += ../../include/linux/list.h
-LIB_H += ../../include/uapi/linux/const.h
-LIB_H += ../include/linux/hash.h
-LIB_H += ../../include/linux/stringify.h
-LIB_H += util/include/linux/bitmap.h
-LIB_H += util/include/linux/bitops.h
-LIB_H += ../include/linux/compiler.h
-LIB_H += util/include/linux/const.h
-LIB_H += util/include/linux/ctype.h
-LIB_H += util/include/linux/kernel.h
-LIB_H += util/include/linux/list.h
-LIB_H += ../include/linux/export.h
-LIB_H += util/include/linux/poison.h
-LIB_H += util/include/linux/rbtree.h
-LIB_H += util/include/linux/rbtree_augmented.h
-LIB_H += util/include/linux/string.h
-LIB_H += ../include/linux/types.h
-LIB_H += util/include/linux/linkage.h
-LIB_H += util/include/asm/asm-offsets.h
-LIB_H += ../include/asm/bug.h
-LIB_H += util/include/asm/byteorder.h
-LIB_H += util/include/asm/hweight.h
-LIB_H += util/include/asm/swab.h
-LIB_H += util/include/asm/system.h
-LIB_H += util/include/asm/uaccess.h
-LIB_H += util/include/dwarf-regs.h
-LIB_H += util/include/asm/dwarf2.h
-LIB_H += util/include/asm/cpufeature.h
-LIB_H += util/include/asm/unistd_32.h
-LIB_H += util/include/asm/unistd_64.h
-LIB_H += perf.h
-LIB_H += util/annotate.h
-LIB_H += util/cache.h
-LIB_H += util/callchain.h
-LIB_H += util/build-id.h
-LIB_H += util/debug.h
-LIB_H += util/pmu.h
-LIB_H += util/event.h
-LIB_H += util/evsel.h
-LIB_H += util/evlist.h
-LIB_H += util/exec_cmd.h
-LIB_H += util/levenshtein.h
-LIB_H += util/machine.h
-LIB_H += util/map.h
-LIB_H += util/parse-options.h
-LIB_H += util/parse-events.h
-LIB_H += util/quote.h
-LIB_H += util/util.h
-LIB_H += util/xyarray.h
-LIB_H += util/header.h
-LIB_H += util/help.h
-LIB_H += util/session.h
-LIB_H += util/ordered-events.h
-LIB_H += util/strbuf.h
-LIB_H += util/strlist.h
-LIB_H += util/strfilter.h
-LIB_H += util/svghelper.h
-LIB_H += util/tool.h
-LIB_H += util/run-command.h
-LIB_H += util/sigchain.h
-LIB_H += util/dso.h
-LIB_H += util/symbol.h
-LIB_H += util/color.h
-LIB_H += util/values.h
-LIB_H += util/sort.h
-LIB_H += util/hist.h
-LIB_H += util/comm.h
-LIB_H += util/thread.h
-LIB_H += util/thread_map.h
-LIB_H += util/trace-event.h
-LIB_H += util/probe-finder.h
-LIB_H += util/dwarf-aux.h
-LIB_H += util/probe-event.h
-LIB_H += util/pstack.h
-LIB_H += util/cpumap.h
-LIB_H += util/top.h
-LIB_H += $(ARCH_INCLUDE)
-LIB_H += util/cgroup.h
-LIB_H += $(LIB_INCLUDE)traceevent/event-parse.h
-LIB_H += util/target.h
-LIB_H += util/rblist.h
-LIB_H += util/intlist.h
-LIB_H += util/perf_regs.h
-LIB_H += util/unwind.h
-LIB_H += util/vdso.h
-LIB_H += util/tsc.h
-LIB_H += ui/helpline.h
-LIB_H += ui/progress.h
-LIB_H += ui/util.h
-LIB_H += ui/ui.h
-LIB_H += util/data.h
-LIB_H += util/kvm-stat.h
-
-LIB_OBJS += $(OUTPUT)util/abspath.o
-LIB_OBJS += $(OUTPUT)util/alias.o
-LIB_OBJS += $(OUTPUT)util/annotate.o
-LIB_OBJS += $(OUTPUT)util/build-id.o
-LIB_OBJS += $(OUTPUT)util/config.o
-LIB_OBJS += $(OUTPUT)util/ctype.o
-LIB_OBJS += $(OUTPUT)util/pmu.o
-LIB_OBJS += $(OUTPUT)util/environment.o
-LIB_OBJS += $(OUTPUT)util/event.o
-LIB_OBJS += $(OUTPUT)util/evlist.o
-LIB_OBJS += $(OUTPUT)util/evsel.o
-LIB_OBJS += $(OUTPUT)util/exec_cmd.o
-LIB_OBJS += $(OUTPUT)util/help.o
-LIB_OBJS += $(OUTPUT)util/kallsyms.o
-LIB_OBJS += $(OUTPUT)util/levenshtein.o
-LIB_OBJS += $(OUTPUT)util/parse-options.o
-LIB_OBJS += $(OUTPUT)util/parse-events.o
-LIB_OBJS += $(OUTPUT)util/path.o
-LIB_OBJS += $(OUTPUT)util/rbtree.o
-LIB_OBJS += $(OUTPUT)util/bitmap.o
-LIB_OBJS += $(OUTPUT)util/hweight.o
-LIB_OBJS += $(OUTPUT)util/run-command.o
-LIB_OBJS += $(OUTPUT)util/quote.o
-LIB_OBJS += $(OUTPUT)util/strbuf.o
-LIB_OBJS += $(OUTPUT)util/string.o
-LIB_OBJS += $(OUTPUT)util/strlist.o
-LIB_OBJS += $(OUTPUT)util/strfilter.o
-LIB_OBJS += $(OUTPUT)util/top.o
-LIB_OBJS += $(OUTPUT)util/usage.o
-LIB_OBJS += $(OUTPUT)util/wrapper.o
-LIB_OBJS += $(OUTPUT)util/sigchain.o
-LIB_OBJS += $(OUTPUT)util/dso.o
-LIB_OBJS += $(OUTPUT)util/symbol.o
-LIB_OBJS += $(OUTPUT)util/symbol-elf.o
-LIB_OBJS += $(OUTPUT)util/color.o
-LIB_OBJS += $(OUTPUT)util/pager.o
-LIB_OBJS += $(OUTPUT)util/header.o
-LIB_OBJS += $(OUTPUT)util/callchain.o
-LIB_OBJS += $(OUTPUT)util/values.o
-LIB_OBJS += $(OUTPUT)util/debug.o
-LIB_OBJS += $(OUTPUT)util/machine.o
-LIB_OBJS += $(OUTPUT)util/map.o
-LIB_OBJS += $(OUTPUT)util/pstack.o
-LIB_OBJS += $(OUTPUT)util/session.o
-LIB_OBJS += $(OUTPUT)util/ordered-events.o
-LIB_OBJS += $(OUTPUT)util/comm.o
-LIB_OBJS += $(OUTPUT)util/thread.o
-LIB_OBJS += $(OUTPUT)util/thread_map.o
-LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
-LIB_OBJS += $(OUTPUT)util/parse-events-flex.o
-LIB_OBJS += $(OUTPUT)util/parse-events-bison.o
-LIB_OBJS += $(OUTPUT)util/pmu-flex.o
-LIB_OBJS += $(OUTPUT)util/pmu-bison.o
-LIB_OBJS += $(OUTPUT)util/trace-event-read.o
-LIB_OBJS += $(OUTPUT)util/trace-event-info.o
-LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
-LIB_OBJS += $(OUTPUT)util/trace-event.o
-LIB_OBJS += $(OUTPUT)util/svghelper.o
-LIB_OBJS += $(OUTPUT)util/sort.o
-LIB_OBJS += $(OUTPUT)util/hist.o
-LIB_OBJS += $(OUTPUT)util/probe-event.o
-LIB_OBJS += $(OUTPUT)util/util.o
-LIB_OBJS += $(OUTPUT)util/xyarray.o
-LIB_OBJS += $(OUTPUT)util/cpumap.o
-LIB_OBJS += $(OUTPUT)util/cgroup.o
-LIB_OBJS += $(OUTPUT)util/target.o
-LIB_OBJS += $(OUTPUT)util/rblist.o
-LIB_OBJS += $(OUTPUT)util/intlist.o
-LIB_OBJS += $(OUTPUT)util/vdso.o
-LIB_OBJS += $(OUTPUT)util/stat.o
-LIB_OBJS += $(OUTPUT)util/record.o
-LIB_OBJS += $(OUTPUT)util/srcline.o
-LIB_OBJS += $(OUTPUT)util/data.o
-LIB_OBJS += $(OUTPUT)util/tsc.o
-LIB_OBJS += $(OUTPUT)util/cloexec.o
-
-LIB_OBJS += $(OUTPUT)ui/setup.o
-LIB_OBJS += $(OUTPUT)ui/helpline.o
-LIB_OBJS += $(OUTPUT)ui/progress.o
-LIB_OBJS += $(OUTPUT)ui/util.o
-LIB_OBJS += $(OUTPUT)ui/hist.o
-LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
-
-LIB_OBJS += $(OUTPUT)arch/common.o
-
-LIB_OBJS += $(OUTPUT)tests/parse-events.o
-LIB_OBJS += $(OUTPUT)tests/dso-data.o
-LIB_OBJS += $(OUTPUT)tests/attr.o
-LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
-LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
-LIB_OBJS += $(OUTPUT)tests/perf-record.o
-LIB_OBJS += $(OUTPUT)tests/rdpmc.o
-LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
-LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
-LIB_OBJS += $(OUTPUT)tests/fdarray.o
-LIB_OBJS += $(OUTPUT)tests/pmu.o
-LIB_OBJS += $(OUTPUT)tests/hists_common.o
-LIB_OBJS += $(OUTPUT)tests/hists_link.o
-LIB_OBJS += $(OUTPUT)tests/hists_filter.o
-LIB_OBJS += $(OUTPUT)tests/hists_output.o
-LIB_OBJS += $(OUTPUT)tests/hists_cumulate.o
-LIB_OBJS += $(OUTPUT)tests/python-use.o
-LIB_OBJS += $(OUTPUT)tests/bp_signal.o
-LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
-LIB_OBJS += $(OUTPUT)tests/task-exit.o
-LIB_OBJS += $(OUTPUT)tests/sw-clock.o
-ifeq ($(ARCH),x86)
-LIB_OBJS += $(OUTPUT)tests/perf-time-to-tsc.o
-endif
-LIB_OBJS += $(OUTPUT)tests/code-reading.o
-LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
-LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o
-ifndef NO_DWARF_UNWIND
-ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
-LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o
-endif
-endif
-LIB_OBJS += $(OUTPUT)tests/mmap-thread-lookup.o
-LIB_OBJS += $(OUTPUT)tests/thread-mg-share.o
-LIB_OBJS += $(OUTPUT)tests/switch-tracking.o
-
-BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
-BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
-# Benchmark modules
-BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
-BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
-ifeq ($(RAW_ARCH),x86_64)
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
-endif
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-requeue.o
-
-BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
-BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
-BUILTIN_OBJS += $(OUTPUT)builtin-help.o
-BUILTIN_OBJS += $(OUTPUT)builtin-sched.o
-BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o
-BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o
-BUILTIN_OBJS += $(OUTPUT)builtin-list.o
-BUILTIN_OBJS += $(OUTPUT)builtin-record.o
-BUILTIN_OBJS += $(OUTPUT)builtin-report.o
-BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
-BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
-BUILTIN_OBJS += $(OUTPUT)builtin-top.o
-BUILTIN_OBJS += $(OUTPUT)builtin-script.o
-BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
-BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
-BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
-BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
-BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
-BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
-BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
-
-PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
-
-# We choose to avoid "if .. else if .. else .. endif endif"
-# because maintaining the nesting to match is a pain. If
-# we had "elif" things would have been much nicer...
-
--include arch/$(ARCH)/Makefile
-
-ifneq ($(OUTPUT),)
- CFLAGS += -I$(OUTPUT)
-endif
-
-ifdef NO_LIBELF
-EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
-
-# Remove ELF/DWARF dependent codes
-LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
-
-BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
-
-# Use minimal symbol handling
-LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
-
-else # NO_LIBELF
-ifndef NO_DWARF
- LIB_OBJS += $(OUTPUT)util/probe-finder.o
- LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
-endif # NO_DWARF
-endif # NO_LIBELF
-
-ifndef NO_LIBDW_DWARF_UNWIND
- LIB_OBJS += $(OUTPUT)util/unwind-libdw.o
- LIB_H += util/unwind-libdw.h
-endif
-
-ifndef NO_LIBUNWIND
- LIB_OBJS += $(OUTPUT)util/unwind-libunwind.o
-endif
-LIB_OBJS += $(OUTPUT)tests/keep-tracking.o
-
-ifndef NO_LIBAUDIT
- BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
-endif
-
-ifndef NO_SLANG
- LIB_OBJS += $(OUTPUT)ui/browser.o
- LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
- LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
- LIB_OBJS += $(OUTPUT)ui/browsers/map.o
- LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
- LIB_OBJS += $(OUTPUT)ui/browsers/header.o
- LIB_OBJS += $(OUTPUT)ui/tui/setup.o
- LIB_OBJS += $(OUTPUT)ui/tui/util.o
- LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
- LIB_OBJS += $(OUTPUT)ui/tui/progress.o
- LIB_H += ui/tui/tui.h
- LIB_H += ui/browser.h
- LIB_H += ui/browsers/map.h
- LIB_H += ui/keysyms.h
- LIB_H += ui/libslang.h
-endif
-
-ifndef NO_GTK2
- ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
-
- GTK_OBJS += $(OUTPUT)ui/gtk/browser.o
- GTK_OBJS += $(OUTPUT)ui/gtk/hists.o
- GTK_OBJS += $(OUTPUT)ui/gtk/setup.o
- GTK_OBJS += $(OUTPUT)ui/gtk/util.o
- GTK_OBJS += $(OUTPUT)ui/gtk/helpline.o
- GTK_OBJS += $(OUTPUT)ui/gtk/progress.o
- GTK_OBJS += $(OUTPUT)ui/gtk/annotate.o
-
-install-gtk: $(OUTPUT)libperf-gtk.so
- $(call QUIET_INSTALL, 'GTK UI') \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
- $(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
-endif
-
-ifndef NO_LIBPERL
- LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
- LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
-endif
-
-ifndef NO_LIBPYTHON
- LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
- LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
-endif
-
-ifeq ($(NO_PERF_REGS),0)
- ifeq ($(ARCH),x86)
- LIB_H += arch/x86/include/perf_regs.h
- endif
- LIB_OBJS += $(OUTPUT)util/perf_regs.o
-endif
-
-ifndef NO_LIBNUMA
- BUILTIN_OBJS += $(OUTPUT)bench/numa.o
-endif
-
-ifdef ASCIIDOC8
- export ASCIIDOC8
-endif
-
-LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
-
-export INSTALL SHELL_PATH
-
-### Build rules
-
-SHELL = $(SHELL_PATH)
-
-all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
-
-please_set_SHELL_PATH_to_a_more_modern_shell:
- @$$(:)
-
-shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
-
-strip: $(PROGRAMS) $(OUTPUT)perf
- $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
-
-$(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- $(CFLAGS) -c $(filter %.c,$^) -o $@
-
-$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
- $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
- $(BUILTIN_OBJS) $(LIBS) -o $@
-
-$(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
- $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $<
-
-$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
- $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
-
-$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- '-DPERF_MAN_PATH="$(mandir_SQ)"' \
- '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
-
-$(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- '-DPERF_MAN_PATH="$(mandir_SQ)"' \
- '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
-
-$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
-
-$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
- $(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@
-
-$(SCRIPTS) : % : %.sh
- $(QUIET_GEN)$(INSTALL) '[email protected]' '$(OUTPUT)$@'
-
-# These can record PERF_VERSION
-$(OUTPUT)perf.o perf.spec \
- $(SCRIPTS) \
- : $(OUTPUT)PERF-VERSION-FILE
-
-.SUFFIXES:
-
-#
-# If a target does not match any of the later rules then prefix it by $(OUTPUT)
-# This makes targets like 'make O=/tmp/perf perf.o' work in a natural way.
-#
-ifneq ($(OUTPUT),)
-%.o: $(OUTPUT)%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-util/%.o: $(OUTPUT)util/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-bench/%.o: $(OUTPUT)bench/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-tests/%.o: $(OUTPUT)tests/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-endif
-
-# These two need to be here so that when O= is not used they take precedence
-# over the general rule for .o
-
-$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $<
-
-$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
-
-$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
-$(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $<
-$(OUTPUT)%.o: %.S
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-$(OUTPUT)%.s: %.S
- $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
-
-$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
- '-DPREFIX="$(prefix_SQ)"' \
- $<
-
-$(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \
- $<
-
-$(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- -DPYTHONPATH='"$(OUTPUT)python"' \
- -DPYTHON='"$(PYTHON_WORD)"' \
- $<
-
-$(OUTPUT)tests/dwarf-unwind.o: tests/dwarf-unwind.c
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -fno-optimize-sibling-calls $<
-
-$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
-
-$(OUTPUT)ui/setup.o: ui/setup.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DLIBDIR='"$(libdir_SQ)"' $<
-
-$(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-
-$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
-
-$(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $<
-
-$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default $<
-
-$(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-undef -Wno-switch-default $<
-
-$(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
-
-$(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
-
-$(OUTPUT)perf-%: %.o $(PERFLIBS)
- $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
-
-$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
-$(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
-
-# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
-# we depend the various files onto their directories.
-DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(GTK_OBJS)
-DIRECTORY_DEPS += $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
-# no need to add flex objects, because they depend on bison ones
-DIRECTORY_DEPS += $(OUTPUT)util/parse-events-bison.c
-DIRECTORY_DEPS += $(OUTPUT)util/pmu-bison.c
-
-OUTPUT_DIRECTORIES := $(sort $(dir $(DIRECTORY_DEPS)))
-
-$(DIRECTORY_DEPS): | $(OUTPUT_DIRECTORIES)
-# In the second step, we make a rule to actually create these directories
-$(OUTPUT_DIRECTORIES):
- $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null
-
-$(LIB_FILE): $(LIB_OBJS)
- $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
-
-# libtraceevent.a
-TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch])
-
-LIBTRACEEVENT_FLAGS = $(QUIET_SUBDIR1) O=$(OUTPUT)
-LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS)"
-LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
-
-$(LIBTRACEEVENT): $(TE_SOURCES) $(OUTPUT)PERF-CFLAGS
- $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) libtraceevent.a plugins
-
-$(LIBTRACEEVENT)-clean:
- $(call QUIET_CLEAN, libtraceevent)
- @$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
-
-install-traceevent-plugins: $(LIBTRACEEVENT)
- $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
-
-LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch] $(LIB_PATH)fd/*.[ch])
-
-# if subdir is set, we've been called from above so target has been built
-# already
-$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
-ifeq ($(subdir),)
- $(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
-endif
-
-$(LIBAPIKFS)-clean:
-ifeq ($(subdir),)
- $(call QUIET_CLEAN, libapikfs)
- @$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
-endif
-
-help:
- @echo 'Perf make targets:'
- @echo ' doc - make *all* documentation (see below)'
- @echo ' man - make manpage documentation (access with man <foo>)'
- @echo ' html - make html documentation'
- @echo ' info - make GNU info documentation (access with info <foo>)'
- @echo ' pdf - make pdf documentation'
- @echo ' TAGS - use etags to make tag information for source browsing'
- @echo ' tags - use ctags to make tag information for source browsing'
- @echo ' cscope - use cscope to make interactive browsing database'
- @echo ''
- @echo 'Perf install targets:'
- @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
- @echo ' HINT: use "prefix" or "DESTDIR" to install to a particular'
- @echo ' path like "make prefix=/usr/local install install-doc"'
- @echo ' install - install compiled binaries'
- @echo ' install-doc - install *all* documentation'
- @echo ' install-man - install manpage documentation'
- @echo ' install-html - install html documentation'
- @echo ' install-info - install GNU info documentation'
- @echo ' install-pdf - install pdf documentation'
- @echo ''
- @echo ' quick-install-doc - alias for quick-install-man'
- @echo ' quick-install-man - install the documentation quickly'
- @echo ' quick-install-html - install the html documentation quickly'
- @echo ''
- @echo 'Perf maintainer targets:'
- @echo ' clean - clean all binary objects and build output'
-
-
-DOC_TARGETS := doc man html info pdf
-
-INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
-INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
-
-# 'make doc' should call 'make -C Documentation all'
-$(DOC_TARGETS):
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
-
-TAG_FOLDERS= . ../lib/traceevent ../lib/api ../lib/symbol
-TAG_FILES= ../../include/uapi/linux/perf_event.h
-
-TAGS:
- $(QUIET_GEN)$(RM) TAGS; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES)
-
-tags:
- $(QUIET_GEN)$(RM) tags; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES)
-
-cscope:
- $(QUIET_GEN)$(RM) cscope*; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES)
-
-### Detect prefix changes
-TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
- $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):$(plugindir_SQ)
-
-$(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
- @FLAGS='$(TRACK_CFLAGS)'; \
- if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \
- echo 1>&2 " FLAGS: * new build flags or prefix"; \
- echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \
- fi
-
-### Testing rules
-
-# GNU make supports exporting all variables by "export" without parameters.
-# However, the environment gets quite big, and some programs have problems
-# with that.
-
-check: $(OUTPUT)common-cmds.h
- if sparse; \
- then \
- for i in *.c */*.c; \
- do \
- sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
- done; \
- else \
- exit 1; \
- fi
-
-### Installation rules
-
-install-gtk:
-
-install-bin: all install-gtk
- $(call QUIET_INSTALL, binaries) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \
- $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \
- $(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
- $(call QUIET_INSTALL, libexec) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(call QUIET_INSTALL, perf-archive) \
- $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(call QUIET_INSTALL, perf-with-kcore) \
- $(INSTALL) $(OUTPUT)perf-with-kcore -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
-ifndef NO_LIBPERL
- $(call QUIET_INSTALL, perl-scripts) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \
- $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
-endif
-ifndef NO_LIBPYTHON
- $(call QUIET_INSTALL, python-scripts) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \
- $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
- $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
-endif
- $(call QUIET_INSTALL, perf_completion-script) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
- $(INSTALL) perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
- $(call QUIET_INSTALL, tests) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
- $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
- $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
-
-install: install-bin try-install-man install-traceevent-plugins
-
-install-python_ext:
- $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
-
-# 'make install-doc' should call 'make -C Documentation install'
-$(INSTALL_DOC_TARGETS):
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
-
-### Cleaning rules
-
-#
-# This is here, not in config/Makefile, because config/Makefile does
-# not get included for the clean target:
-#
-config-clean:
- $(call QUIET_CLEAN, config)
- @$(MAKE) -C config/feature-checks clean >/dev/null
-
-clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
- $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
- $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
- $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
- $(python-clean)
-
-#
-# Trick: if ../../.git does not exist - we are building out of tree for example,
-# then force version regeneration:
-#
-ifeq ($(wildcard ../../.git/HEAD),)
- GIT-HEAD-PHONY = ../../.git/HEAD
-else
- GIT-HEAD-PHONY =
-endif
-
-.PHONY: all install clean config-clean strip install-gtk
-.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS
-
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index a46af8f..7b97b8a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -155,7 +155,7 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
} else if (use_browser == 1) {
struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
@@ -303,7 +303,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
#endif
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index 49550c9..863727f 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -1,31 +1,6 @@
#ifndef BUILTIN_CMDS_H
#define BUILTIN_CMDS_H

-#ifndef CONFIG_KBUILD
-#define CONFIG_BUILTIN_REPORT 1
-#define CONFIG_BUILTIN_SCRIPT 1
-#define CONFIG_BUILTIN_BENCH 1
-#define CONFIG_BUILTIN_SCHED 1
-#define CONFIG_BUILTIN_TRACE 1
-#define CONFIG_BUILTIN_TOP 1
-#define CONFIG_BUILTIN_RECORD 1
-#define CONFIG_BUILTIN_BUILDID_LIST 1
-#define CONFIG_BUILTIN_INJECT 1
-#define CONFIG_BUILTIN_LOCK 1
-#define CONFIG_BUILTIN_KVM 1
-#define CONFIG_BUILTIN_BUILDID_CACHE 1
-#define CONFIG_BUILTIN_EVLIST 1
-#define CONFIG_BUILTIN_KMEM 1
-#define CONFIG_BUILTIN_STAT 1
-#define CONFIG_BUILTIN_DIFF 1
-#define CONFIG_BUILTIN_ANNOTATE 1
-#define CONFIG_BUILTIN_TIMECHART 1
-#define CONFIG_BUILTIN_LIST 1
-#define CONFIG_BUILTIN_HELP 1
-#define CONFIG_BUILTIN_PROBE 1
-#define CONFIG_BUILTIN_MEM 1
-#else
#include "generated/autoconf.h"
-#endif /* CONFIG_KBUILD */

#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b639e58..00d93ff 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -407,7 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6f04452..a2ff8b7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -535,7 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -981,7 +981,7 @@ static int __cmd_top(struct perf_top *top)

ret = -1;

-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
if (use_browser > 0)
display_fn = display_thread_tui;
#endif
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index efc2b21..7928984 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,7 +77,7 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
use_browser = 1;
if (ui__init() == 0)
@@ -98,7 +98,7 @@ void exit_browser(bool wait_for_ok __maybe_unused)
case 2:
exit_gtk_browser(wait_for_ok);
break;
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
ui__exit(wait_for_ok);
break;
--
2.1.1

2014-10-23 22:02:01

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v2 04/14] perf tools: Add kbuild support into Makefile.kbuild

From: Jiri Olsa <[email protected]>

Adding kbuild support into Makefile.kbuild. The 'legacy'
Makefile still stays untouched as it was.

It's possible to use kbuild by running 'make -f Makefile.kbuild'
with any option supported by 'legacy' Makefile.

We now have 2 config files:
'.config' - user configured setup
'.config-detected' - system detected setup

The '.config-detected' affects '.config' and if there's
configured feature in '.config' which was not detected
it is automatically disabled.

The '.config-detected' is re/created if:
- there's no '.config-detected'
- '.config' was changed

In a cleaned tree the perf is built with 'allyesconfig'
having disabled all non-detected features, just as it is
done now.

You can change '.config' via:
make -f Makefile.kbuild menuconfig

There's difference for O=DIR build. The DIR is populated
based on kernel source tree, so the final binary is created
under DIR/tools/perf.

This commit was originally created by Jiri Olsa in February 2013; a
few changes were necessary to fit the perf version of June 2014:
* Add missing CFLAGS for specific .o targets
* Update Kbuild files (new source files, ...)
* Fix recursive invocation of config/features-checks
* Store .config-detected missing variables (libdir, ...)
* Fix missing dependencies between Kconfig options
* Fix installation of traceevent plugins
* Fix missing cleanings of feature-check binaries
* CROSS_COMPILE was not used to define AS, CC, ...
* CROSS_COMPILE was not stored in .config-detected
* Take into account DESTDIR and prefix set in the command line
* Add missing Kbuild files for non-x86 architectures
(powerpc, arm, arm64, sh, s390, sparc)
* Move perf-time-to-tsc.c into x86-specific tests directory

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kbuild | 47 +++
tools/perf/Kconfig | 284 ++++++++++++++
tools/perf/Makefile.kbuild | 431 +++++++++++++++++++++
tools/perf/Makefile.perf | 2 +-
tools/perf/arch/Kbuild | 3 +
tools/perf/arch/arm/Kbuild | 2 +
tools/perf/arch/arm/Makefile | 14 -
tools/perf/arch/arm/tests/Kbuild | 2 +
tools/perf/arch/arm/util/Kbuild | 3 +
tools/perf/arch/arm64/Kbuild | 1 +
tools/perf/arch/arm64/Makefile | 7 -
tools/perf/arch/arm64/util/Kbuild | 2 +
tools/perf/arch/powerpc/Kbuild | 1 +
tools/perf/arch/powerpc/Makefile | 6 -
tools/perf/arch/powerpc/util/Kbuild | 3 +
tools/perf/arch/s390/Kbuild | 1 +
tools/perf/arch/s390/Makefile | 7 -
tools/perf/arch/s390/util/Kbuild | 2 +
tools/perf/arch/sh/Kbuild | 1 +
tools/perf/arch/sh/Makefile | 4 -
tools/perf/arch/sh/util/Kbuild | 1 +
tools/perf/arch/sparc/Kbuild | 1 +
tools/perf/arch/sparc/Makefile | 4 -
tools/perf/arch/sparc/util/Kbuild | 1 +
tools/perf/arch/x86/Kbuild | 1 +
tools/perf/arch/x86/tests/Kbuild | 3 +
tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 0
tools/perf/arch/x86/util/Kbuild | 5 +
tools/perf/bench/Kbuild | 12 +
tools/perf/builtin-cmds.h | 4 +
tools/perf/config/Makefile | 55 ++-
tools/perf/config/Makefile.fix-config | 104 +++++
tools/perf/config/Makefile.fix-legacy | 46 +++
tools/perf/config/defconfig | 54 +++
tools/perf/perf-sys.h | 4 +-
tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
tools/perf/tests/Kbuild | 38 ++
tools/perf/ui/Kbuild | 15 +
tools/perf/ui/browsers/Kbuild | 9 +
tools/perf/ui/gtk/Kbuild | 9 +
tools/perf/ui/stdio/Kbuild | 1 +
tools/perf/ui/tui/Kbuild | 4 +
tools/perf/util/Kbuild | 125 ++++++
tools/perf/util/PERF-VERSION-GEN | 4 +
tools/perf/util/generate-cmdlist.sh | 8 +-
tools/perf/util/scripting-engines/Kbuild | 11 +
tools/perf/util/setup.py | 8 +-
48 files changed, 1309 insertions(+), 52 deletions(-)
create mode 100644 tools/perf/Kbuild
create mode 100644 tools/perf/Kconfig
create mode 100644 tools/perf/Makefile.kbuild
create mode 100644 tools/perf/arch/Kbuild
create mode 100644 tools/perf/arch/arm/Kbuild
delete mode 100644 tools/perf/arch/arm/Makefile
create mode 100644 tools/perf/arch/arm/tests/Kbuild
create mode 100644 tools/perf/arch/arm/util/Kbuild
create mode 100644 tools/perf/arch/arm64/Kbuild
delete mode 100644 tools/perf/arch/arm64/Makefile
create mode 100644 tools/perf/arch/arm64/util/Kbuild
create mode 100644 tools/perf/arch/powerpc/Kbuild
delete mode 100644 tools/perf/arch/powerpc/Makefile
create mode 100644 tools/perf/arch/powerpc/util/Kbuild
create mode 100644 tools/perf/arch/s390/Kbuild
delete mode 100644 tools/perf/arch/s390/Makefile
create mode 100644 tools/perf/arch/s390/util/Kbuild
create mode 100644 tools/perf/arch/sh/Kbuild
delete mode 100644 tools/perf/arch/sh/Makefile
create mode 100644 tools/perf/arch/sh/util/Kbuild
create mode 100644 tools/perf/arch/sparc/Kbuild
delete mode 100644 tools/perf/arch/sparc/Makefile
create mode 100644 tools/perf/arch/sparc/util/Kbuild
create mode 100644 tools/perf/arch/x86/Kbuild
create mode 100644 tools/perf/arch/x86/tests/Kbuild
rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (100%)
create mode 100644 tools/perf/arch/x86/util/Kbuild
create mode 100644 tools/perf/bench/Kbuild
create mode 100644 tools/perf/config/Makefile.fix-config
create mode 100644 tools/perf/config/Makefile.fix-legacy
create mode 100644 tools/perf/config/defconfig
create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/tests/Kbuild
create mode 100644 tools/perf/ui/Kbuild
create mode 100644 tools/perf/ui/browsers/Kbuild
create mode 100644 tools/perf/ui/gtk/Kbuild
create mode 100644 tools/perf/ui/stdio/Kbuild
create mode 100644 tools/perf/ui/tui/Kbuild
create mode 100644 tools/perf/util/Kbuild
create mode 100644 tools/perf/util/scripting-engines/Kbuild

diff --git a/tools/perf/Kbuild b/tools/perf/Kbuild
new file mode 100644
index 0000000..16cb804
--- /dev/null
+++ b/tools/perf/Kbuild
@@ -0,0 +1,47 @@
+obj-y += perf.o
+
+obj-$(CONFIG_BUILTIN_ANNOTATE) += builtin-annotate.o
+obj-$(CONFIG_BUILTIN_BENCH) += builtin-bench.o
+obj-$(CONFIG_BUILTIN_BENCH) += bench/
+obj-$(CONFIG_BUILTIN_BUILDID_CACHE) += builtin-buildid-cache.o
+obj-$(CONFIG_BUILTIN_BUILDID_LIST) += builtin-buildid-list.o
+obj-$(CONFIG_BUILTIN_DIFF) += builtin-diff.o
+obj-$(CONFIG_BUILTIN_EVLIST) += builtin-evlist.o
+obj-$(CONFIG_BUILTIN_HELP) += builtin-help.o
+obj-$(CONFIG_BUILTIN_INJECT) += builtin-inject.o
+obj-$(CONFIG_BUILTIN_KMEM) += builtin-kmem.o
+obj-$(CONFIG_BUILTIN_KVM) += builtin-kvm.o
+obj-$(CONFIG_BUILTIN_LIST) += builtin-list.o
+obj-$(CONFIG_BUILTIN_LOCK) += builtin-lock.o
+obj-$(CONFIG_BUILTIN_PROBE) += builtin-probe.o
+obj-$(CONFIG_BUILTIN_RECORD) += builtin-record.o
+obj-$(CONFIG_BUILTIN_REPORT) += builtin-report.o
+obj-$(CONFIG_BUILTIN_SCHED) += builtin-sched.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += builtin-script.o
+obj-$(CONFIG_BUILTIN_STAT) += builtin-stat.o
+obj-$(CONFIG_BUILTIN_TIMECHART) += builtin-timechart.o
+obj-$(CONFIG_BUILTIN_TOP) += builtin-top.o
+obj-$(CONFIG_BUILTIN_TRACE) += builtin-trace.o
+obj-$(CONFIG_BUILTIN_MEM) += builtin-mem.o
+obj-$(CONFIG_BUILTIN_TEST) += tests/
+
+obj-y += ../../lib/rbtree.o
+obj-y += ../lib/symbol/kallsyms.o
+
+obj-y += util/
+obj-y += ui/
+obj-y += arch/
+
+obj-$(CONFIG_LIBPERL) += scripts/perl/Perf-Trace-Util/
+obj-$(CONFIG_LIBPYTHON) += scripts/python/Perf-Trace-Util/
+
+CFLAGS_rbtree.o += -Wno-unused-parameter
+
+CFLAGS_perf.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_perf.o += -include PERF-VERSION-FILE
+
+$(obj)/perf.o: $(obj)/PERF-VERSION-FILE
+
+CFLAGS_builtin-help.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_INFO_PATH=KBUILD_STR($(infodir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_MAN_PATH=KBUILD_STR($(mandir_SQ))"
diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
new file mode 100644
index 0000000..f9fcf9e
--- /dev/null
+++ b/tools/perf/Kconfig
@@ -0,0 +1,284 @@
+
+mainmenu "The perf configuration"
+
+menu "Built-in commands"
+
+config BUILTIN_RECORD
+ bool "record"
+ default y
+ ---help---
+ Run a command and record its profile into a perf archive.
+
+config BUILTIN_REPORT
+ bool "report"
+ default y
+ ---help---
+ Read a perf archive (created by perf record) and display the
+ profile.
+
+config BUILTIN_STAT
+ bool "stat"
+ default y
+ ---help---
+ Run a command and gather performance counter statistics.
+
+config BUILTIN_TOP
+ bool "top"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Generate and display a performance counter profile in
+ real-time.
+
+config BUILTIN_TRACE
+ bool "trace"
+ default y
+ depends on BUILTIN_RECORD && LIBAUDIT
+ ---help---
+ Strace inspired tool.
+
+config BUILTIN_ANNOTATE
+ bool "annotate"
+ default y
+ ---help---
+ Read a perf archive (created by perf record) and display
+ annotated code.
+
+config BUILTIN_BENCH
+ bool "bench"
+ default y
+ ---help---
+ General framework for benchmark suites.
+
+config BUILTIN_BUILDID_CACHE
+ bool "buildid-cache"
+ default y
+ ---help---
+ Manage build-id cache.
+
+config BUILTIN_BUILDID_LIST
+ bool "buildid-list"
+ default y
+ ---help---
+ List the buildids in a perf archive file.
+
+config BUILTIN_DIFF
+ bool "diff"
+ default y
+ ---help---
+ Read perf archive files and display the differential
+ profile.
+
+config BUILTIN_EVLIST
+ bool "evlist"
+ default y
+ ---help---
+ List the event names in a perf archive file
+
+config BUILTIN_HELP
+ bool "help"
+ default y
+ ---help---
+ Display help information about perf
+
+config BUILTIN_INJECT
+ bool "inject"
+ default y
+ ---help---
+ The inject feature reads a perf-record event stream and
+ repipes it to stdout.
+
+config BUILTIN_KMEM
+ bool "kmem"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to trace/measure kernel memory(slab) properties.
+
+config BUILTIN_KVM
+ bool "kvm"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT && \
+ BUILTIN_RECORD && BUILTIN_BUILDID_LIST && \
+ BUILTIN_TOP && BUILTIN_DIFF && BUILTIN_STAT
+ ---help---
+ Tool to trace/measure kvm guest os
+
+config BUILTIN_LIST
+ bool "list"
+ default y
+ ---help---
+ List all symbolic event types.
+
+config BUILTIN_LOCK
+ bool "lock"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Analyze lock events.
+
+config BUILTIN_PROBE
+ bool "probe"
+ default y
+ depends on LIBELF
+ ---help---
+ Define new dynamic tracepoints
+
+config BUILTIN_SCHED
+ bool "sched"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to trace/measure scheduler properties (latencies).
+
+config BUILTIN_SCRIPT
+ bool "script"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Read perf archive file (created by perf record) and display
+ trace output.
+
+config BUILTIN_TIMECHART
+ bool "timechart"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to visualize total system behavior during a workload.
+
+config BUILTIN_MEM
+ bool "mem"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Profile memory accesses.
+
+config BUILTIN_TEST
+ bool "test"
+ default y
+ ---help---
+ Runs sanity tests.
+
+endmenu
+
+menu "GUI"
+
+config STDIO
+ bool "Terminal"
+ default y
+ ---help---
+ Most basic display mode.
+
+config TUI
+ bool "Tui (slang based)"
+ default y
+ ---help---
+ Text-based user interface which provides windowing
+ facilities.
+
+config GTK2
+ bool "Gtk2"
+ default y
+ ---help---
+ Elaborate display mode based on libgtk2.
+
+endmenu
+
+menu "Libraries / Dependencies"
+
+config LIBAUDIT
+ bool "Audit (libaudit)"
+ default y
+ ---help---
+ Linux audit framework dependency.
+
+config LIBPERL
+ bool "Perl"
+ default y
+ ---help---
+ Libperl dependency needed by the perf script feature.
+
+config LIBPYTHON
+ bool "Python"
+ default y
+ ---help---
+ Libpython dependency needed by the perf script feature.
+
+choice
+ prompt "Elf library"
+ default LIBELF
+ ---help---
+ Perf needs ELF files manipulation facilities. To fulfill
+ these tasks, perf can rely on either the libelf library or a
+ minimal builtin support.
+
+
+ config LIBELF
+ bool "elf"
+ ---help---
+ Libelf library.
+
+ config LIBELF_MINIMAL
+ bool "builtin support"
+ ---help---
+ Builtin elf support.
+endchoice
+
+config LIBUNWIND
+ bool "User space libunwind callchains"
+ default y
+ ---help---
+ The library libunwind provides a portable C API to determine
+ the call-chain of a program.
+
+config LIBUNWIND_DIR
+ string "libunwind directory"
+ depends on LIBUNWIND
+ ---help---
+ Directory holding the libuwind dependency (headers +
+ libraries).
+
+config NUMA
+ bool "Numa support (bench)"
+ default y
+ ---help---
+ The library libnuma offers facilities to configure NUMA
+ policies supported by the linux kernel.
+
+config DEMANGLE
+ bool "Demangle symbols"
+ default y
+ ---help---
+ Enable demangling so as to display human-readable
+ symbols. This option is convenient with C++ programs.
+
+config BIONIC
+ bool "Bionic support"
+ default n
+ ---help---
+ The Bionic libc is a derivation of the BSD's standard C
+ library code developed by Google for their Android operating
+ system.
+
+endmenu
+
+menu "Build"
+config DEBUG
+ bool "Compile with debug info"
+ default n
+ ---help---
+ Compile with debug info.
+
+config DEBUG_PARSER
+ bool "Compile with parsers debug info"
+ default n
+ ---help---
+ Compile with parsers debug info.
+
+config BACKTRACE
+ bool "Compile with dump_stack support"
+ default y
+ ---help---
+ Compile with dump_stack support.
+
+endmenu
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
new file mode 100644
index 0000000..51eba07
--- /dev/null
+++ b/tools/perf/Makefile.kbuild
@@ -0,0 +1,431 @@
+srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
+objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
+
+VPATH := $(srctree)
+
+export srctree VPATH
+
+MAKEFLAGS += --include-dir=$(srctree)
+MAKEFLAGS += --no-builtin-rules
+MAKEFLAGS += --no-print-directory
+
+ifeq ("$(origin V)", "command line")
+KBUILD_VERBOSE = $(V)
+endif
+
+ifndef KBUILD_VERBOSE
+KBUILD_VERBOSE = 0
+endif
+
+ifeq ($(KBUILD_VERBOSE),1)
+quiet =
+Q =
+else
+quiet=quiet_
+Q = @
+endif
+
+# If the user is running make -s (silent mode), suppress echoing of
+# commands
+ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+quiet=silent_
+endif
+
+export quiet Q KBUILD_VERBOSE
+
+ifndef V
+QUIET_LINK = @echo ' LD $@';
+QUIET_GEN = @echo ' GEN $@';
+QUIET_CLEAN = @echo ' CLEAN tools/perf';
+endif
+
+export QUIET_BISON QUIET_FLEX
+
+ifeq ($(KBUILD_SRC),)
+
+ifeq ("$(origin O)", "command line")
+KBUILD_OUTPUT := $(O)
+else
+KBUILD_OUTPUT := $(objtree)
+endif
+
+# Invoke a second make in the output directory, passing relevant variables
+# check that the output directory actually exists
+saved-output := $(KBUILD_OUTPUT)
+KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+$(if $(KBUILD_OUTPUT),, \
+ $(error output directory "$(saved-output)" does not exist))
+
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/lib)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/include/config)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/tools/perf)
+
+PHONY += $(MAKECMDGOALS) sub-make
+
+$(filter-out sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) all: sub-make
+ @:
+
+sub-make: FORCE
+ $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
+ KBUILD_SRC=$(srctree) \
+ -f $(CURDIR)/Makefile.kbuild \
+ $(filter-out sub-make,$(MAKECMDGOALS))
+
+# Leave processing to above invocation of make
+skip-makefile := 1
+endif # ifeq ($(KBUILD_SRC),)
+
+export KBUILD_SRC
+
+ifeq ($(skip-makefile),)
+
+build := -f $(srctree)/scripts/Makefile.build obj
+
+src-kernel := $(srctree)
+src-perf := $(srctree)/tools/perf
+obj-kernel := $(objtree)
+obj-perf := $(objtree)/tools/perf
+
+VPATH += $(src-perf)
+
+export src-perf obj-perf
+
+OUTPUT := $(obj-perf)/
+
+export OUTPUT DESTDIR
+
+AS = $(CROSS_COMPILE)as
+LD = $(CROSS_COMPILE)ld
+CC = $(CROSS_COMPILE)gcc
+CPP = $(CC) -E
+HOSTCC = gcc
+FLEX = flex
+BISON = bison
+INSTALL = install
+PKG_CONFIG = pkg-config
+
+export AS LD CC CPP HOSTCC FLEX BISON PKG_CONFIG
+
+# kbuild related config
+CONFIG_SHELL := /bin/sh
+
+KBUILD_KCONFIG := $(src-perf)/Kconfig
+KCONFIG_CONFIG ?= $(obj-perf)/.config
+KCONFIG_TRISTATE := $(obj-perf)/include/config/tristate.conf
+KCONFIG_AUTOHEADER := $(obj-perf)/include/generated/autoconf.h
+KCONFIG_AUTOCONFIG := $(obj-perf)/include/config/auto.conf
+KCONFIG_SCRIPT := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+export CONFIG_SHELL
+export KBUILD_KCONFIG
+export KCONFIG_CONFIG KCONFIG_TRISTATE
+export KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG KCONFIG_SCRIPT
+
+# perf detected config
+CONFIG_DETECTED := $(obj-perf)/.config-detected
+
+export CONFIG_DETECTED
+
+# external .a libs
+LIBTRACEEVENT := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
+LIBAPIKFS := $(obj-kernel)/tools/lib/api/libapikfs.a
+LIBS_A := $(LIBTRACEEVENT) $(LIBAPIKFS)
+
+export LIBTRACEEVENT LIBAPIKFS
+
+all:
+
+scripts_basic:
+ $(Q)$(MAKE) $(build)=scripts/basic
+
+defconfig: scripts_basic
+ $(Q)cp $(src-perf)/config/defconfig $(KCONFIG_CONFIG)
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig oldconfig
+
+%config: scripts_basic
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig $@
+
+$(KCONFIG_CONFIG):
+ $(Q)$(MAKE) $(build)=scripts/basic
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig allyesconfig
+
+$(CONFIG_DETECTED): $(KCONFIG_CONFIG)
+ $(Q)$(MAKE) -f $(src-perf)/config/Makefile
+
+# no need to include auto.conf.cmd, because .config
+# is the only dependency here
+$(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
+ $(Q)$(MAKE) -f $(src-perf)/config/Makefile.fix-config
+ $(Q)mkdir -p $(obj-perf)/include/config
+ $(Q)mkdir -p $(obj-perf)/include/generated
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig silentoldconfig
+ @touch $(CONFIG_DETECTED) # final touch.. to keep the time dependency correct
+
+clean-dirs := $(addprefix _clean_, tools/perf/)
+
+$(clean-dirs):
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean
+ $(Q)$(QUIET_CLEAN)
+ $(Q)rm -f $(obj-perf)/perf
+ $(Q)rm -f $(obj-perf)/common-cmds.h
+ $(Q)rm -f $(obj-perf)/python/perf.so
+ $(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+ $(Q)find $(obj-perf) \
+ \( -name '*.[oas]' -o -name '.*.cmd' \
+ -o -name '.*.d' -o -name '.*.tmp' \
+ -o -name '*-flex.[ch]' -o -name '*-bison.[ch]' \
+ \) -type f -print | xargs rm -f
+ $(Q)$(python-clean)
+ $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
+ @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
+
+TAGS tags:
+ $(Q)rm -f $(src-perf)/tags
+ $(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs ctags -a
+
+cscope:
+ $(Q)rm -f $(src-perf)/cscope*
+ $(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs cscope -b
+
+PHONY += clean $(clean-dirs) tags TAGS cscope
+
+ifneq ($(filter %config help clean tags TAGS cscope,$(MAKECMDGOALS)),)
+dont-detect := 1
+endif
+
+ifndef dont-detect
+# detected config variables
+-include $(CONFIG_DETECTED)
+
+ifdef CONFIG_DETECTED_STORED
+# Following variables are needed within Kbuild files, we need
+# to export them as they are not part of the .config set.
+export CONFIG_ARCH := $(ARCH)
+export CROSS_COMPILE
+export CONFIG_X86_64
+export htmldir_SQ
+export infodir_SQ
+export mandir_SQ
+export perfexecdir_SQ
+export PARSER_DEBUG_BISON
+export PARSER_DEBUG_FLEX
+export ETC_PERFCONFIG_SQ
+export libdir_SQ
+export plugindir_SQ
+export PYTHON_EMBED_CCOPTS
+export PERL_EMBED_CCOPTS
+export GTK_CFLAGS
+
+# The variable DESTDIR could be overloaded at make launch time
+ifdef DESTDIR
+ DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
+else
+ DESTDIR = $(DESTDIR_SQ)
+endif
+export DESTDIR DESTDIR_SQ
+
+# The variable prefix could be overloaded at make launch time
+ifdef prefix
+ prefix_SQ = $(subst ','\'',$(prefix))
+else
+ prefix = $(prefix_SQ)
+endif
+
+export prefix prefix_SQ
+
+endif # CONFIG_DETECTED_STORED
+
+endif # !dont-detect
+
+# let sources know it's kbuild
+CFLAGS += -DCONFIG_KBUILD
+
+# kbuild related config
+LINUXINCLUDE := $(CFLAGS)
+KBUILD_BUILTIN := 1
+KBUILD_CHECKSRC := 0
+
+export LINUXINCLUDE
+export KBUILD_BUILTIN KBUILD_CHECKSRC
+
+# pyuthon language binding
+PYTHON_EXTBUILD := $(src-perf)/python_ext_build/
+PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
+
+export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
+
+python-clean := rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so
+
+PYTHON_EXT_SRCS := $(addprefix $(src-perf)/,$(shell grep -v ^\# $(src-perf)/util/python-ext-sources))
+PYTHON_EXT_DEPS := $(src-perf)/util/python-ext-sources $(src-perf)/util/setup.py
+PYTHON_EXT_CFLAGS := $(CFLAGS) -w
+
+export PYTHON_EXT_SRCS
+
+
+$(obj-perf)/python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
+ $(QUIET_GEN)CFLAGS='$(PYTHON_EXT_CFLAGS)' $(PYTHON_WORD) $(src-perf)/util/setup.py \
+ --quiet build_ext; \
+ mkdir -p $(obj-perf)/python && \
+ cp $(PYTHON_EXTBUILD_LIB)perf.so $(obj-perf)/python/
+
+all: tools/perf/PERF-VERSION-FILE scripts_basic tools/perf/perf $(LANG_BINDINGS)
+
+$(obj-perf)/common-cmds.h: $(src-perf)/util/generate-cmdlist.sh $(src-perf)/command-list.txt
+ $(QUIET_GEN)$(src-perf)/util/generate-cmdlist.sh $(src-perf) > $@+ && mv $@+ $@
+
+PHONY += all scripts_basic
+
+$(obj-perf)/built-in.o: $(obj-perf)/common-cmds.h $(KCONFIG_AUTOCONFIG) FORCE
+ $(Q)$(MAKE) LDFLAGS="" $(build)=tools/perf
+
+LIBS = -Wl,--whole-archive $^ -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
+
+tools/perf/perf: $(obj-perf)/built-in.o $(LIBS_A)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $(LIBS) $(GTK_LIBS)
+
+$(LIBTRACEEVENT): FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/traceevent
+ $(Q)$(MAKE) -C $(src-kernel)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent
+
+$(LIBTRACEEVENT)-clean: FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/traceevent
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent clean
+
+$(LIBTRACEEVENT)-install: $(LIBTRACEEVENT) FORCE
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent plugin_dir=$(plugindir_SQ) install
+
+$(LIBAPIKFS): FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/api
+ $(Q)$(MAKE) -C $(srctree)/tools/lib/api O=$(obj-kernel)/tools/lib/api
+
+$(LIBAPIKFS)-clean: FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/api
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/api O=$(obj-kernel)/tools/lib/api clean
+
+tools/perf/PERF-VERSION-FILE: FORCE
+ $(QUIET_GEN)$(SHELL_PATH) $(src-perf)/util/PERF-VERSION-GEN $(obj-perf)/
+
+
+# Single targets
+# ---------------------------------------------------------------------------
+# Single targets are compatible with:
+# - build with mixed source and output
+# - build with separate output dir 'make O=...'
+# - external modules
+#
+# target-dir => where to store outputfile
+# build-dir => directory in kernel source tree to use
+
+build-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(patsubst %/,%,$(dir $@))))
+target-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(dir $@)))
+
+%.o: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.i: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.S scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.o: %.S scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+
+SCRIPT_SH += $(src-perf)/perf-archive.sh
+SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
+
+$(SCRIPTS) : % : %.sh
+ $(QUIET_GEN)$(INSTALL) '[email protected]' '$(perf-obj)$@'
+
+all: $(SCRIPTS)
+
+install-bin: all
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
+ $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
+ $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
+ $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+
+install: install-bin try-install-man $(LIBTRACEEVENT)-install
+
+DOC_TARGETS := doc man html info pdf
+
+$(DOC_TARGETS):
+ $(Q)$(MAKE) -C $(src-perf)/Documentation $(@:doc=all)
+
+INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
+INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
+
+# 'make install-doc' should call 'make -C Documentation install'
+$(INSTALL_DOC_TARGETS):
+ $(Q)$(MAKE) -C $(src-perf)/Documentation $(@:-doc=)
+
+help:
+ @echo 'Perf make targets:'
+ @echo ' doc - make *all* documentation (see below)'
+ @echo ' man - make manpage documentation (access with man <foo>)'
+ @echo ' html - make html documentation'
+ @echo ' info - make GNU info documentation (access with info <foo>)'
+ @echo ' pdf - make pdf documentation'
+ @echo ' TAGS - use etags to make tag information for source browsing'
+ @echo ' tags - use ctags to make tag information for source browsing'
+ @echo ' cscope - use cscope to make interactive browsing database'
+ @echo ''
+ @echo 'Perf install targets:'
+ @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
+ @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular'
+ @echo ' path like make prefix=/usr/local install install-doc'
+ @echo ' install - install compiled binaries'
+ @echo ' install-doc - install *all* documentation'
+ @echo ' install-man - install manpage documentation'
+ @echo ' install-html - install html documentation'
+ @echo ' install-info - install GNU info documentation'
+ @echo ' install-pdf - install pdf documentation'
+ @echo ''
+ @echo ' quick-install-doc - alias for quick-install-man'
+ @echo ' quick-install-man - install the documentation quickly'
+ @echo ' quick-install-html - install the html documentation quickly'
+ @echo ''
+ @echo 'Perf maintainer targets:'
+ @echo ' clean - clean all binary objects and build output'
+
+
+ifdef MAKE_DEBUG
+dummy := $(info DEBUG MAKEFLAGS $(MAKEFLAGS))
+dummy := $(info DEBUG VPATH $(VPATH))
+dummy := $(info DEBUG srctree $(srctree))
+dummy := $(info DEBUG objtree $(objtree))
+dummy := $(info DEBUG src-kernel $(src-kernel))
+dummy := $(info DEBUG src-perf $(src-perf))
+dummy := $(info DEBUG obj-kernel $(obj-kernel))
+dummy := $(info DEBUG obj-perf $(obj-perf))
+dummy := $(info DEBUG KBUILD_KCONFIG $(KBUILD_KCONFIG))
+dummy := $(info DEBUG KCONFIG_CONFIG $(KCONFIG_CONFIG))
+dummy := $(info DEBUG KCONFIG_TRISTATE $(KCONFIG_TRISTATE))
+dummy := $(info DEBUG KCONFIG_AUTOHEADER $(KCONFIG_AUTOHEADER))
+dummy := $(info DEBUG KCONFIG_AUTOCONFIG $(KCONFIG_AUTOCONFIG))
+dummy := $(info DEBUG TRACE_EVENT_DIR $(TRACE_EVENT_DIR))
+dummy := $(info DEBUG LIBAPIKFS $(LIBAPIKFS))
+endif
+
+endif # skip-makefile
+
+PHONY += FORCE
+.PHONY: $(PHONY)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 262916f..dcf6248 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -620,7 +620,7 @@ $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPU
$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt

$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
- $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
+ $(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@

$(SCRIPTS) : % : %.sh
$(QUIET_GEN)$(INSTALL) '[email protected]' '$(OUTPUT)$@'
diff --git a/tools/perf/arch/Kbuild b/tools/perf/arch/Kbuild
new file mode 100644
index 0000000..5cf419e
--- /dev/null
+++ b/tools/perf/arch/Kbuild
@@ -0,0 +1,3 @@
+obj-y += common.o
+
+obj-y += $(CONFIG_ARCH)/
diff --git a/tools/perf/arch/arm/Kbuild b/tools/perf/arch/arm/Kbuild
new file mode 100644
index 0000000..f5581bee
--- /dev/null
+++ b/tools/perf/arch/arm/Kbuild
@@ -0,0 +1,2 @@
+obj-y += util/
+obj-y += tests/
diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
deleted file mode 100644
index 09d6215..0000000
--- a/tools/perf/arch/arm/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifndef NO_LIBDW_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-endif
-ifndef NO_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
-endif
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
new file mode 100644
index 0000000..5d63e9d
--- /dev/null
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -0,0 +1,2 @@
+obj-y += regs_load.o
+obj-y += dwarf-unwind.o
diff --git a/tools/perf/arch/arm/util/Kbuild b/tools/perf/arch/arm/util/Kbuild
new file mode 100644
index 0000000..c96666a
--- /dev/null
+++ b/tools/perf/arch/arm/util/Kbuild
@@ -0,0 +1,3 @@
+obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-y += unwind-libdw.o
diff --git a/tools/perf/arch/arm64/Kbuild b/tools/perf/arch/arm64/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/arm64/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
deleted file mode 100644
index 67e9b3d..0000000
--- a/tools/perf/arch/arm64/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
diff --git a/tools/perf/arch/arm64/util/Kbuild b/tools/perf/arch/arm64/util/Kbuild
new file mode 100644
index 0000000..136bc86
--- /dev/null
+++ b/tools/perf/arch/arm64/util/Kbuild
@@ -0,0 +1,2 @@
+obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/powerpc/Kbuild b/tools/perf/arch/powerpc/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/powerpc/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
deleted file mode 100644
index 6f7782b..0000000
--- a/tools/perf/arch/powerpc/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
diff --git a/tools/perf/arch/powerpc/util/Kbuild b/tools/perf/arch/powerpc/util/Kbuild
new file mode 100644
index 0000000..244ff2c
--- /dev/null
+++ b/tools/perf/arch/powerpc/util/Kbuild
@@ -0,0 +1,3 @@
+obj-y += header.o
+obj-y += skip-callchain-idx.o
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/s390/Kbuild b/tools/perf/arch/s390/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/s390/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
deleted file mode 100644
index 798ac73..0000000
--- a/tools/perf/arch/s390/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
new file mode 100644
index 0000000..24e8ee7
--- /dev/null
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -0,0 +1,2 @@
+obj-y += kvm-stat.o
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/sh/Kbuild b/tools/perf/arch/sh/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/sh/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
deleted file mode 100644
index 15130b5..0000000
--- a/tools/perf/arch/sh/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
diff --git a/tools/perf/arch/sh/util/Kbuild b/tools/perf/arch/sh/util/Kbuild
new file mode 100644
index 0000000..8e698ae
--- /dev/null
+++ b/tools/perf/arch/sh/util/Kbuild
@@ -0,0 +1 @@
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/sparc/Kbuild b/tools/perf/arch/sparc/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/sparc/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
deleted file mode 100644
index 15130b5..0000000
--- a/tools/perf/arch/sparc/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
diff --git a/tools/perf/arch/sparc/util/Kbuild b/tools/perf/arch/sparc/util/Kbuild
new file mode 100644
index 0000000..8e698ae
--- /dev/null
+++ b/tools/perf/arch/sparc/util/Kbuild
@@ -0,0 +1 @@
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Kbuild b/tools/perf/arch/x86/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/x86/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
new file mode 100644
index 0000000..3b5aa14
--- /dev/null
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -0,0 +1,3 @@
+obj-y += perf-time-to-tsc.o
+obj-y += regs_load.o
+obj-y += dwarf-unwind.o
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
similarity index 100%
rename from tools/perf/tests/perf-time-to-tsc.c
rename to tools/perf/arch/x86/tests/perf-time-to-tsc.c
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
new file mode 100644
index 0000000..c7b86c0
--- /dev/null
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -0,0 +1,5 @@
+obj-y += dwarf-regs.o
+obj-y += header.o
+obj-y += tsc.o
+obj-y += kvm-stat.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/bench/Kbuild b/tools/perf/bench/Kbuild
new file mode 100644
index 0000000..e604fe2
--- /dev/null
+++ b/tools/perf/bench/Kbuild
@@ -0,0 +1,12 @@
+obj-y += mem-memcpy.o
+obj-y += mem-memset.o
+obj-y += sched-messaging.o
+obj-y += sched-pipe.o
+obj-y += futex-hash.o
+obj-y += futex-requeue.o
+obj-y += futex-wake.o
+
+obj-$(CONFIG_NUMA) += numa.o
+
+obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
+obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index fec342a..49550c9 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -1,6 +1,7 @@
#ifndef BUILTIN_CMDS_H
#define BUILTIN_CMDS_H

+#ifndef CONFIG_KBUILD
#define CONFIG_BUILTIN_REPORT 1
#define CONFIG_BUILTIN_SCRIPT 1
#define CONFIG_BUILTIN_BENCH 1
@@ -23,5 +24,8 @@
#define CONFIG_BUILTIN_HELP 1
#define CONFIG_BUILTIN_PROBE 1
#define CONFIG_BUILTIN_MEM 1
+#else
+#include "generated/autoconf.h"
+#endif /* CONFIG_KBUILD */

#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 58f6091..6106e24 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -24,6 +24,7 @@ ifeq ($(ARCH),x86)
CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
+ CONFIG_X86_64=y
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
@@ -84,6 +85,10 @@ ifndef NO_LIBELF
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif

+ifdef KCONFIG_CONFIG
+include $(src-perf)/config/Makefile.fix-legacy
+endif
+
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

@@ -159,7 +164,7 @@ endif

feature_check = $(eval $(feature_check_code))
define feature_check_code
- feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
+ feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(src-perf)/config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
endef

feature_set = $(eval $(feature_set_code))
@@ -258,7 +263,7 @@ ifeq ($(feature-all), 1)
#
$(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
else
- $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
+ $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C $(src-perf)/config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
$(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
endif

@@ -273,6 +278,7 @@ ifeq ($(DEBUG),0)
endif

CFLAGS += -I$(src-perf)/util/include
+CFLAGS += -I$(obj-perf)/include
CFLAGS += -I$(src-perf)/arch/$(ARCH)/include
CFLAGS += -I$(srctree)/tools/include/
CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi
@@ -770,3 +776,48 @@ endif
ifeq ($(display_lib),1)
$(info )
endif
+
+ifdef CONFIG_DETECTED
+
+store = @echo "$(1)=$($(1))" >> $(CONFIG_DETECTED)
+
+all:
+ @echo "CONFIG_DETECTED_STORED=1" > $(CONFIG_DETECTED)
+ $(call store,ARCH)
+ $(call store,CROSS_COMPILE)
+ $(call store,CFLAGS)
+ $(call store,LDFLAGS)
+ $(call store,EXTLIBS)
+ $(call store,htmldir_SQ)
+ $(call store,infodir_SQ)
+ $(call store,mandir_SQ)
+ $(call store,perfexecdir_SQ)
+ $(call store,prefix_SQ)
+ $(call store,PARSER_DEBUG_BISON)
+ $(call store,PARSER_DEBUG_FLEX)
+ $(call store,PYTHON_EMBED_CCOPTS)
+ $(call store,PERL_EMBED_CCOPTS)
+ $(call store,CONFIG_X86_64)
+ $(call store,NO_LIBUNWIND)
+ $(call store,NO_LIBPERL)
+ $(call store,NO_LIBPYTHON)
+ $(call store,NO_NEWT)
+ $(call store,NO_GTK2)
+ $(call store,NO_DEMANGLE)
+ $(call store,NO_LIBELF)
+ $(call store,NO_LIBUNWIND)
+ $(call store,NO_BACKTRACE)
+ $(call store,NO_LIBNUMA)
+ $(call store,NO_LIBAUDIT)
+ $(call store,NO_LIBBIONIC)
+ $(call store,ETC_PERFCONFIG_SQ)
+ $(call store,DESTDIR_SQ)
+ $(call store,bindir_SQ)
+ $(call store,libdir_SQ)
+ $(call store,plugindir_SQ)
+ $(call store,perfexec_instdir_SQ)
+ $(call store,sysconfdir_SQ)
+ $(call store,GTK_CFLAGS)
+ $(call store,GTK_LIBS)
+
+endif # CONFIG_DETECTED
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
new file mode 100644
index 0000000..7f65fdb
--- /dev/null
+++ b/tools/perf/config/Makefile.fix-config
@@ -0,0 +1,104 @@
+include $(CONFIG_DETECTED)
+include $(KCONFIG_CONFIG)
+
+CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+# NO_LIBPERL
+ifdef CONFIG_LIBPERL
+ifdef NO_LIBPERL
+dummy := $(info Disabling CONFIG_LIBPERL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPERL)
+endif
+endif
+
+# NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
+ifdef NO_LIBPYTHON
+dummy := $(info Disabling CONFIG_LIBPYTHON)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_NEWT
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_SLANG
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_GTK2
+ifdef CONFIG_GTK2
+ifdef NO_GTK2
+dummy := $(info Disabling CONFIG_GTK2)
+dummy := $(shell $(CONFIG) -d CONFIG_GTK2)
+endif
+endif
+
+# NO_DEMANGLE
+ifdef CONFIG_DEMANGLE
+ifdef NO_DEMANGLE
+dummy := $(info Disabling CONFIG_DEMANGLE)
+dummy := $(shell $(CONFIG) -d CONFIG_DEMANGLE)
+endif
+endif
+
+# NO_LIBELF
+ifdef CONFIG_LIBELF
+ifdef NO_LIBELF
+dummy := $(info Disabling CONFIG_LIBELF)
+dummy := $(info Enabling CONFIG_LIBELF_MINIMAL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBELF)
+dummy := $(shell $(CONFIG) -e CONFIG_LIBELF_MINIMAL)
+endif
+endif
+
+# NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
+ifdef NO_LIBUNWIND
+dummy := $(info Disabling CONFIG_LIBUNWIND)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
+endif
+endif
+
+# NO_BACKTRACE
+ifdef CONFIG_BACKTRACE
+ifdef NO_BACKTRACE
+dummy := $(info Disabling CONFIG_BACKTRACE)
+dummy := $(shell $(CONFIG) -d CONFIG_BACKTRACE)
+endif
+endif
+
+# NO_LIBNUMA
+ifdef CONFIG_NUMA
+ifdef NO_LIBNUMA
+dummy := $(info Disabling CONFIG_NUMA)
+dummy := $(shell $(CONFIG) -d CONFIG_NUMA)
+endif
+endif
+
+# NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
+ifdef NO_LIBAUDIT
+dummy := $(info Disabling CONFIG_LIBAUDIT)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBAUDIT)
+endif
+endif
+
+# NO_LIBBIONIC
+ifdef CONFIG_BIONIC
+ifdef NO_LIBBIONIC
+dummy := $(info Disabling CONFIG_BIONIC)
+dummy := $(shell $(CONFIG) -d CONFIG_BIONIC)
+endif
+endif
+
+all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
new file mode 100644
index 0000000..2ec91f3
--- /dev/null
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -0,0 +1,46 @@
+
+include $(KCONFIG_CONFIG)
+
+ifndef CONFIG_LIBPERL
+NO_LIBPERL := 1
+endif
+
+ifndef CONFIG_LIBPYTHON
+NO_LIBPYTHON := 1
+endif
+
+ifndef CONFIG_TUI
+NO_SLANG := 1
+endif
+
+ifndef CONFIG_GTK2
+NO_GTK2 := 1
+endif
+
+ifndef CONFIG_DEMANGLE
+NO_DEMANGLE := 1
+endif
+
+ifndef CONFIG_LIBELF
+NO_LIBELF := 1
+endif
+
+ifndef CONFIG_LIBUNWIND
+NO_LIBUNWIND := 1
+endif
+
+ifndef CONFIG_BACKTRACE
+NO_BACKTRACE := 1
+endif
+
+ifndef CONFIG_NUMA
+export NO_LIBNUMA := 1
+endif
+
+ifndef CONFIG_LIBAUDIT
+NO_LIBAUDIT := 1
+endif
+
+ifdef CONFIG_BIONIC
+NO_LIBBIONIC := 1
+endif
diff --git a/tools/perf/config/defconfig b/tools/perf/config/defconfig
new file mode 100644
index 0000000..7a385f1
--- /dev/null
+++ b/tools/perf/config/defconfig
@@ -0,0 +1,54 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux Kernel Configuration
+#
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+# CONFIG_BUILTIN_TOP is not set
+# CONFIG_BUILTIN_ANNOTATE is not set
+# CONFIG_BUILTIN_BENCH is not set
+# CONFIG_BUILTIN_BUILDID_CACHE is not set
+# CONFIG_BUILTIN_BUILDID_LIST is not set
+CONFIG_BUILTIN_DIFF=y
+# CONFIG_BUILTIN_EVLIST is not set
+CONFIG_BUILTIN_HELP=y
+# CONFIG_BUILTIN_INJECT is not set
+# CONFIG_BUILTIN_KMEM is not set
+# CONFIG_BUILTIN_KVM is not set
+# CONFIG_BUILTIN_LIST is not set
+# CONFIG_BUILTIN_LOCK is not set
+# CONFIG_BUILTIN_SCHED is not set
+CONFIG_BUILTIN_SCRIPT=y
+# CONFIG_BUILTIN_TIMECHART is not set
+# CONFIG_BUILTIN_TEST is not set
+
+#
+# Libraries
+#
+# CONFIG_LIBAUDIT is not set
+# CONFIG_LIBPERL is not set
+# CONFIG_LIBPYTHON is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_BACKTRACE=y
+# CONFIG_LIBUNWIND is not set
+# CONFIG_NUMA is not set
+# CONFIG_DEMANGLE is not set
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+# CONFIG_TUI is not set
+# CONFIG_GTK2 is not set
+
+#
+# Build
+#
+CONFIG_DEBUG=y
+# CONFIG_DEBUG_PARSER is not set
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index 937e432..d701dcf 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -8,6 +8,8 @@
#include <linux/perf_event.h>
#include <asm/unistd.h>

+#include "generated/autoconf.h"
+
#if defined(__i386__)
#define mb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
#define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
@@ -181,7 +183,7 @@ sys_perf_event_open(struct perf_event_attr *attr,
fd = syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags);

-#ifdef HAVE_ATTR_TEST
+#ifdef CONFIG_BUILTIN_TEST
if (unlikely(test_attr__enabled))
test_attr__open(attr, pid, cpu, fd, group_fd, flags);
#endif
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild b/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
new file mode 100644
index 0000000..fd9aa3c
--- /dev/null
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
@@ -0,0 +1,6 @@
+obj-y += Context.o
+
+CFLAGS_Context.o := $(PERL_EMBED_CCOPTS)
+CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs
+CFLAGS_Context.o += -Wno-undef -Wno-switch-default
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Kbuild b/tools/perf/scripts/python/Perf-Trace-Util/Kbuild
new file mode 100644
index 0000000..7884730
--- /dev/null
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Kbuild
@@ -0,0 +1,5 @@
+obj-y += Context.o
+
+CFLAGS_Context.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs
diff --git a/tools/perf/tests/Kbuild b/tools/perf/tests/Kbuild
new file mode 100644
index 0000000..9f56ce8
--- /dev/null
+++ b/tools/perf/tests/Kbuild
@@ -0,0 +1,38 @@
+obj-y += builtin-test.o
+obj-y += attr.o
+obj-y += dso-data.o
+obj-y += evsel-roundtrip-name.o
+obj-y += evsel-tp-sched.o
+obj-y += fdarray.o
+obj-y += hists_link.o
+obj-y += mmap-basic.o
+obj-y += open-syscall-all-cpus.o
+obj-y += open-syscall.o
+obj-y += open-syscall-tp-fields.o
+obj-y += parse-events.o
+obj-y += perf-record.o
+obj-y += pmu.o
+obj-y += python-use.o
+obj-y += rdpmc.o
+obj-y += vmlinux-kallsyms.o
+obj-y += bp_signal.o
+obj-y += bp_signal_overflow.o
+obj-y += sw-clock.o
+obj-y += task-exit.o
+obj-y += code-reading.o
+obj-y += sample-parsing.o
+obj-y += keep-tracking.o
+obj-y += parse-no-sample-id-all.o
+obj-y += mmap-thread-lookup.o
+obj-y += thread-mg-share.o
+obj-y += switch-tracking.o
+obj-y += hists_output.o
+obj-y += hists_cumulate.o
+obj-y += hists_common.o
+obj-y += hists_filter.o
+
+CFLAGS_python-use.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
+CFLAGS_python-use.o += -D"PYTHONPATH=KBUILD_STR(python)"
+
+CFLAGS_attr.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
+CFLAGS_attr.o += -D"BINDIR=KBUILD_STR($(bindir_SQ))"
diff --git a/tools/perf/ui/Kbuild b/tools/perf/ui/Kbuild
new file mode 100644
index 0000000..44ad988
--- /dev/null
+++ b/tools/perf/ui/Kbuild
@@ -0,0 +1,15 @@
+obj-$(CONFIG_TUI) += browser.o
+obj-y += helpline.o
+obj-y += hist.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
+
+obj-y += browsers/
+obj-y += stdio/
+
+obj-$(CONFIG_TUI) += tui/
+obj-$(CONFIG_GTK2) += gtk/
+
+CFLAGS_browser.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_setup.o += -D"LIBDIR=KBUILD_STR($(libdir_SQ))"
\ No newline at end of file
diff --git a/tools/perf/ui/browsers/Kbuild b/tools/perf/ui/browsers/Kbuild
new file mode 100644
index 0000000..3a5fd55
--- /dev/null
+++ b/tools/perf/ui/browsers/Kbuild
@@ -0,0 +1,9 @@
+obj-$(CONFIG_TUI) += annotate.o
+obj-$(CONFIG_TUI) += header.o
+obj-$(CONFIG_TUI) += hists.o
+obj-$(CONFIG_TUI) += map.o
+obj-$(CONFIG_TUI) += scripts.o
+
+CFLAGS_hists.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_map.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_scripts.o += -DENABLE_SLFUTURE_CONST
diff --git a/tools/perf/ui/gtk/Kbuild b/tools/perf/ui/gtk/Kbuild
new file mode 100644
index 0000000..83e3e58
--- /dev/null
+++ b/tools/perf/ui/gtk/Kbuild
@@ -0,0 +1,9 @@
+obj-y += browser.o
+obj-y += hists.o
+obj-y += setup.o
+obj-y += util.o
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += annotate.o
+
+subdir-ccflags-y := $(GTK_CFLAGS)
\ No newline at end of file
diff --git a/tools/perf/ui/stdio/Kbuild b/tools/perf/ui/stdio/Kbuild
new file mode 100644
index 0000000..9de4bd9
--- /dev/null
+++ b/tools/perf/ui/stdio/Kbuild
@@ -0,0 +1 @@
+obj-y += hist.o
diff --git a/tools/perf/ui/tui/Kbuild b/tools/perf/ui/tui/Kbuild
new file mode 100644
index 0000000..e282409
--- /dev/null
+++ b/tools/perf/ui/tui/Kbuild
@@ -0,0 +1,4 @@
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
diff --git a/tools/perf/util/Kbuild b/tools/perf/util/Kbuild
new file mode 100644
index 0000000..98526db
--- /dev/null
+++ b/tools/perf/util/Kbuild
@@ -0,0 +1,125 @@
+obj-y += abspath.o
+obj-y += alias.o
+obj-y += annotate.o
+obj-y += bitmap.o
+obj-y += build-id.o
+obj-y += callchain.o
+obj-y += cgroup.o
+obj-y += color.o
+obj-y += comm.o
+obj-y += config.o
+obj-y += cpumap.o
+obj-y += ctype.o
+obj-y += debug.o
+obj-y += dso.o
+obj-y += environment.o
+obj-y += event.o
+obj-y += evlist.o
+obj-y += evsel.o
+obj-y += exec_cmd.o
+obj-y += header.o
+obj-y += help.o
+obj-y += hist.o
+obj-y += hweight.o
+obj-y += intlist.o
+obj-y += levenshtein.o
+obj-y += machine.o
+obj-y += map.o
+obj-y += pager.o
+obj-y += parse-options.o
+obj-y += path.o
+obj-y += pmu-flex.o
+obj-y += pmu-bison.o
+obj-y += pmu.o
+obj-y += pstack.o
+obj-y += quote.o
+obj-y += rblist.o
+obj-y += run-command.o
+obj-y += session.o
+obj-y += ordered-events.o
+obj-y += sigchain.o
+obj-y += sort.o
+obj-y += stat.o
+obj-y += record.o
+obj-y += srcline.o
+obj-y += data.o
+obj-y += strbuf.o
+obj-y += strfilter.o
+obj-y += string.o
+obj-y += strlist.o
+obj-y += svghelper.o
+obj-y += symbol.o
+obj-y += perf_regs.o
+obj-y += tsc.o
+obj-y += cloexec.o
+
+obj-$(CONFIG_LIBUNWIND) += unwind.o
+
+obj-$(CONFIG_LIBELF) += symbol-elf.o
+obj-$(CONFIG_LIBELF) += dwarf-aux.o
+obj-$(CONFIG_LIBELF) += probe-event.o
+obj-$(CONFIG_LIBELF) += probe-finder.o
+
+obj-$(CONFIG_LIBELF_MINIMAL) += symbol-minimal.o
+
+obj-y += target.o
+obj-y += thread.o
+obj-y += thread_map.o
+obj-y += top.o
+obj-y += usage.o
+obj-y += util.o
+obj-y += values.o
+obj-y += xyarray.o
+obj-y += vdso.o
+obj-y += wrapper.o
+obj-y += trace-event.o
+obj-y += trace-event-info.o
+obj-y += trace-event-parse.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += trace-event-scripting.o
+obj-y += trace-event-read.o
+
+obj-$(CONFIG_BUILTIN_SCRIPT) += scripting-engines/
+
+define bison
+$(Q)echo ' BI $@'
+$(Q)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) -o $@ -p $1
+endef
+
+define flex
+$(Q)echo ' FL $@';
+$(Q)$(FLEX) --header-file=$(basename $@).h $(PARSER_DEBUG_FLEX) -t $< > $@
+endef
+
+obj-y += parse-events-flex.o
+obj-y += parse-events-bison.o
+obj-y += parse-events.o
+
+$(obj)/parse-events-bison.c: $(src)/parse-events.y
+ $(call bison,parse_events_)
+
+$(obj)/parse-events-flex.c: $(src)/parse-events.l $(obj)/parse-events-bison.c
+ $(call flex)
+
+$(src)/parse-events-flex.o: $(src)/parse-events-flex.c
+$(src)/parse-events-bison.o: $(src)/parse-events-bison.c
+
+$(src)/parse-events.o: $(src)/parse-events-flex.o
+
+$(src)/pmu-bison.c: $(src)/pmu.y
+ $(call bison,perf_pmu_)
+
+$(src)/pmu-flex.c: $(src)/pmu.l $(src)/pmu-bison.c
+ $(call flex)
+
+$(src)/pmu-flex.o: $(src)/pmu-flex.c
+$(src)/pmu-bison.o: $(src)/pmu-bison.c
+
+CFLAGS_parse-events-flex.o += -w
+CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+CFLAGS_parse-events.o += -Wno-redundant-decls
+CFLAGS_pmu-flex.o += -w
+CFLAGS_pmu-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+
+CFLAGS_config.o += -D"ETC_PERFCONFIG=KBUILD_STR($(ETC_PERFCONFIG_SQ))"
+CFLAGS_exec_cmd.o += -D"PERF_EXEC_PATH=KBUILD_STR($(perfexecdir_SQ))"
+CFLAGS_exec_cmd.o += -D"PREFIX=KBUILD_STR($(prefix_SQ))"
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 39f1750..efb74f0 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -9,6 +9,10 @@ GVF=${OUTPUT}PERF-VERSION-FILE
LF='
'

+if [ "${srctree}x" = "x" ]; then
+srctree=../..
+fi
+
#
# First check if there is a .git to get the version from git describe
# otherwise try to get the version from the kernel Makefile
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 05ee30f..5d84ffc 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -15,7 +15,7 @@ struct cmdname_help

static struct cmdname_help common_cmds[] = {"

-sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' $1/command-list.txt |
sort |
while read cmd
do
@@ -26,12 +26,12 @@ do
x
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/perf-$cmd.txt"
+ }' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done

echo "#ifdef HAVE_LIBELF_SUPPORT"
-sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' $1/command-list.txt |
sort |
while read cmd
do
@@ -42,7 +42,7 @@ do
x
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/perf-$cmd.txt"
+ }' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done
echo "#endif /* HAVE_LIBELF_SUPPORT */"
diff --git a/tools/perf/util/scripting-engines/Kbuild b/tools/perf/util/scripting-engines/Kbuild
new file mode 100644
index 0000000..ebe216c
--- /dev/null
+++ b/tools/perf/util/scripting-engines/Kbuild
@@ -0,0 +1,11 @@
+obj-$(CONFIG_LIBPERL) += trace-event-perl.o
+obj-$(CONFIG_LIBPYTHON) += trace-event-python.o
+
+CFLAGS_trace-event-perl.o := $(PERL_EMBED_CCOPTS)
+CFLAGS_trace-event-perl.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_trace-event-perl.o += -Wno-unused-parameter -Wno-shadow -Wno-undef
+CFLAGS_trace-event-perl.o += -Wno-switch-default
+
+CFLAGS_trace-event-python.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_trace-event-python.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_trace-event-python.o += -Wno-unused-parameter -Wno-shadow
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index d0aee4b..a5c73de 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -2,6 +2,7 @@

from distutils.core import setup, Extension
from os import getenv
+from os import environ

from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
@@ -27,8 +28,11 @@ build_tmp = getenv('PYTHON_EXTBUILD_TMP')
libtraceevent = getenv('LIBTRACEEVENT')
libapikfs = getenv('LIBAPIKFS')

-ext_sources = [f.strip() for f in file('util/python-ext-sources')
- if len(f.strip()) > 0 and f[0] != '#']
+if environ.has_key('PYTHON_EXT_SRCS'):
+ ext_sources = getenv('PYTHON_EXT_SRCS').split()
+else:
+ ext_sources = [f.strip() for f in file('util/python-ext-sources')
+ if len(f.strip()) > 0 and f[0] != '#']

perf = Extension('perf',
sources = ext_sources,
--
2.1.1

2014-10-23 22:30:46

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 00/14] Kbuild for perf

Hello,

Here is a proposal of perf's build process managed by Kbuild:
* The file Makefile.perf is replaced by Makefile.kbuild
* Makefile.kbuild generates a default .config file if none exists
(allyesconfig)
* Makefile.kbuild adapts the .config file according to the
features-check tests results
* Makefile.kbuild builds external dependencies (linux/tools/lib/*)
* Makefile.kbuild leaves the rest to Kbuild

Regards,

Alexis.

Alexis Berlemont (11):
kbuild: add support of custom paths for "auto.conf*" files
perf kbuild: remove Makefile.perf
perf kbuild: remove legacy tui/gui-related build variables
perf kbuild: remove legacy demangle-related build variables
perf kbuild: cross-compilation variables are now handled in Kconfig
perf kbuild: remove legacy misc build variables
perf kbuild: remove legacy libelf-related build variables
perf kbuild: remove legacy libdwarf-related build variables
perf kbuild: remove legacy script-related build variables
perf kbuild: final cosmetic changes
perf kbuild: add generated Kconfig build-test cases

Jiri Olsa (3):
perf tools: Kbuild builtin source related fixies
perf tools: Kbuild source related fixies
perf tools: Add kbuild support into Makefile.kbuild

scripts/Makefile.build | 3 +-
scripts/kconfig/confdata.c | 23 +-
scripts/kconfig/lkc.h | 1 +
tools/perf/Kbuild | 47 +
tools/perf/Kconfig | 436 ++++++++++
tools/perf/MANIFEST | 1 +
tools/perf/Makefile | 2 +-
tools/perf/Makefile.kbuild | 443 ++++++++++
tools/perf/Makefile.perf | 949 ---------------------
tools/perf/arch/Kbuild | 3 +
tools/perf/arch/arm/Kbuild | 2 +
tools/perf/arch/arm/Makefile | 14 -
tools/perf/arch/arm/tests/Kbuild | 2 +
tools/perf/arch/arm/util/Kbuild | 3 +
tools/perf/arch/arm64/Kbuild | 1 +
tools/perf/arch/arm64/Makefile | 7 -
tools/perf/arch/arm64/util/Kbuild | 2 +
tools/perf/arch/powerpc/Kbuild | 1 +
tools/perf/arch/powerpc/Makefile | 6 -
tools/perf/arch/powerpc/util/Kbuild | 3 +
tools/perf/arch/s390/Kbuild | 1 +
tools/perf/arch/s390/Makefile | 7 -
tools/perf/arch/s390/util/Kbuild | 2 +
tools/perf/arch/sh/Kbuild | 1 +
tools/perf/arch/sh/Makefile | 4 -
tools/perf/arch/sh/util/Kbuild | 1 +
tools/perf/arch/sparc/Kbuild | 1 +
tools/perf/arch/sparc/Makefile | 4 -
tools/perf/arch/sparc/util/Kbuild | 1 +
tools/perf/arch/x86/Kbuild | 2 +
tools/perf/arch/x86/Makefile | 19 -
tools/perf/arch/x86/include/perf_regs.h | 8 +-
tools/perf/arch/x86/tests/Kbuild | 3 +
tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 2 +-
tools/perf/arch/x86/tests/regs_load.S | 3 +-
tools/perf/arch/x86/util/Kbuild | 6 +
tools/perf/arch/x86/util/unwind-libunwind.c | 5 +-
tools/perf/bench/Kbuild | 12 +
tools/perf/bench/mem-memcpy-arch.h | 4 +-
tools/perf/bench/mem-memcpy.c | 4 +-
tools/perf/bench/mem-memset-arch.h | 4 +-
tools/perf/bench/mem-memset.c | 4 +-
tools/perf/builtin-annotate.c | 8 +-
tools/perf/builtin-bench.c | 5 +-
tools/perf/builtin-help.c | 1 +
tools/perf/builtin-inject.c | 2 +-
tools/perf/builtin-kvm.c | 38 +-
tools/perf/builtin-lock.c | 5 +-
tools/perf/builtin-probe.c | 15 +-
tools/perf/builtin-record.c | 4 +-
tools/perf/builtin-report.c | 3 +
tools/perf/builtin-sched.c | 3 +
tools/perf/builtin-script.c | 6 +-
tools/perf/builtin-top.c | 19 +-
tools/perf/config/Makefile | 430 +++++-----
tools/perf/config/defconfig | 54 ++
tools/perf/perf-sys.h | 4 +-
tools/perf/perf.c | 53 +-
tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
tools/perf/tests/Kbuild | 40 +
tools/perf/tests/builtin-test.c | 3 +-
tools/perf/tests/configs/MINIMAL_config | 60 ++
tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++
.../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++
.../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 ++
tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 ++
tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++
tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++
tools/perf/tests/configs/NO_DEMANGLE_config | 71 ++
tools/perf/tests/configs/NO_GTK2_config | 73 ++
tools/perf/tests/configs/NO_LIBAUDIT_config | 72 ++
tools/perf/tests/configs/NO_LIBDWARF_config | 71 ++
tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++
tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++
tools/perf/tests/configs/NO_LIBGTK2_config | 71 ++
tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++
tools/perf/tests/configs/NO_LIBPERL_config | 73 ++
tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++
tools/perf/tests/configs/NO_LIBSLANG_config | 72 ++
.../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++
tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++
tools/perf/tests/configs/NO_STDIO_config | 73 ++
tools/perf/tests/configs/NO_TIMERFD_config | 73 ++
tools/perf/tests/configs/NO_TUI_config | 73 ++
tools/perf/tests/configs/NO_UNWIND_config | 69 ++
tools/perf/tests/configs/REF_config | 73 ++
tools/perf/tests/generate_configs.py | 43 +
tools/perf/tests/make | 70 +-
tools/perf/tests/tests.h | 6 +-
tools/perf/ui/Kbuild | 15 +
tools/perf/ui/browsers/Kbuild | 9 +
tools/perf/ui/browsers/scripts.c | 4 +
tools/perf/ui/gtk/Kbuild | 9 +
tools/perf/ui/gtk/browser.c | 4 +-
tools/perf/ui/gtk/gtk.h | 5 +-
tools/perf/ui/gtk/util.c | 6 +-
tools/perf/ui/setup.c | 12 +-
tools/perf/ui/stdio/Kbuild | 1 +
tools/perf/ui/tui/Kbuild | 4 +
tools/perf/ui/ui.h | 4 +-
tools/perf/util/Kbuild | 128 +++
tools/perf/util/PERF-VERSION-GEN | 4 +
tools/perf/util/annotate.h | 4 +-
tools/perf/util/callchain.c | 11 +-
tools/perf/util/callchain.h | 3 +-
tools/perf/util/generate-cmdlist.sh | 22 +-
tools/perf/util/hist.h | 3 +-
tools/perf/util/include/dwarf-regs.h | 4 +-
tools/perf/util/machine.c | 3 +-
tools/perf/util/map.c | 3 +-
tools/perf/util/perf_regs.c | 1 +
tools/perf/util/perf_regs.h | 6 +-
tools/perf/util/probe-event.c | 6 +-
tools/perf/util/probe-finder.h | 5 +-
tools/perf/util/scripting-engines/Kbuild | 11 +
tools/perf/util/setup.py | 8 +-
tools/perf/util/srcline.c | 8 +-
tools/perf/util/symbol-elf.c | 3 +-
tools/perf/util/symbol.h | 33 +-
tools/perf/util/trace-event-scripting.c | 13 +-
tools/perf/util/unwind-libunwind.c | 5 +-
tools/perf/util/unwind.h | 7 +-
tools/perf/util/util.c | 5 +-
143 files changed, 4992 insertions(+), 1410 deletions(-)
create mode 100644 tools/perf/Kbuild
create mode 100644 tools/perf/Kconfig
create mode 100644 tools/perf/Makefile.kbuild
delete mode 100644 tools/perf/Makefile.perf
create mode 100644 tools/perf/arch/Kbuild
create mode 100644 tools/perf/arch/arm/Kbuild
delete mode 100644 tools/perf/arch/arm/Makefile
create mode 100644 tools/perf/arch/arm/tests/Kbuild
create mode 100644 tools/perf/arch/arm/util/Kbuild
create mode 100644 tools/perf/arch/arm64/Kbuild
delete mode 100644 tools/perf/arch/arm64/Makefile
create mode 100644 tools/perf/arch/arm64/util/Kbuild
create mode 100644 tools/perf/arch/powerpc/Kbuild
delete mode 100644 tools/perf/arch/powerpc/Makefile
create mode 100644 tools/perf/arch/powerpc/util/Kbuild
create mode 100644 tools/perf/arch/s390/Kbuild
delete mode 100644 tools/perf/arch/s390/Makefile
create mode 100644 tools/perf/arch/s390/util/Kbuild
create mode 100644 tools/perf/arch/sh/Kbuild
delete mode 100644 tools/perf/arch/sh/Makefile
create mode 100644 tools/perf/arch/sh/util/Kbuild
create mode 100644 tools/perf/arch/sparc/Kbuild
delete mode 100644 tools/perf/arch/sparc/Makefile
create mode 100644 tools/perf/arch/sparc/util/Kbuild
create mode 100644 tools/perf/arch/x86/Kbuild
delete mode 100644 tools/perf/arch/x86/Makefile
create mode 100644 tools/perf/arch/x86/tests/Kbuild
rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (99%)
create mode 100644 tools/perf/arch/x86/util/Kbuild
create mode 100644 tools/perf/bench/Kbuild
create mode 100644 tools/perf/config/defconfig
create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/tests/Kbuild
create mode 100644 tools/perf/tests/configs/MINIMAL_config
create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
create mode 100644 tools/perf/tests/configs/NO_GTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
create mode 100644 tools/perf/tests/configs/NO_STDIO_config
create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
create mode 100644 tools/perf/tests/configs/NO_TUI_config
create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
create mode 100644 tools/perf/tests/configs/REF_config
create mode 100644 tools/perf/tests/generate_configs.py
create mode 100644 tools/perf/ui/Kbuild
create mode 100644 tools/perf/ui/browsers/Kbuild
create mode 100644 tools/perf/ui/gtk/Kbuild
create mode 100644 tools/perf/ui/stdio/Kbuild
create mode 100644 tools/perf/ui/tui/Kbuild
create mode 100644 tools/perf/util/Kbuild
create mode 100644 tools/perf/util/scripting-engines/Kbuild

--

Changes since v2:
* All the CCs addresses were missing

2.1.1

2014-10-23 22:31:01

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 01/14] kbuild: add support of custom paths for "auto.conf*" files

In the scripts/Makefile.build, use KCONFIG_AUTOCONFIG to include a
custom path for the "auto.conf" file.

The "*conf" programs were modified so as to work with the environment
variable KCONFIG_AUTOCONFIG.

Signed-off-by: Alexis Berlemont <[email protected]>
---
scripts/Makefile.build | 3 ++-
scripts/kconfig/confdata.c | 23 ++++++++++++++++++++++-
scripts/kconfig/lkc.h | 1 +
3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 649ce68..2abb82f 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -31,7 +31,8 @@ subdir-asflags-y :=
subdir-ccflags-y :=

# Read auto.conf if it exists, otherwise ignore
--include include/config/auto.conf
+kconfig-autoconfig := $(if $(KCONFIG_AUTOCONFIG),$(KCONFIG_AUTOCONFIG),include/config/auto.conf)
+-include $(kconfig-autoconfig)

include scripts/Kbuild.include

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index f88d90f..75cf6bf 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -75,6 +75,23 @@ const char *conf_get_autoconfig_name(void)
return name ? name : "include/config/auto.conf";
}

+const char *conf_get_autoconfigdep_name(void)
+{
+ static char res_value[PATH_MAX+1];
+
+ const char *name = conf_get_autoconfig_name();
+
+ if (strlen(name) > PATH_MAX - 4)
+ name = NULL;
+ else {
+ strcpy(res_value, name);
+ strcat(res_value, ".cmd");
+ name = res_value;
+ }
+
+ return name;
+}
+
static char *conf_expand_value(const char *in)
{
struct symbol *sym;
@@ -953,7 +970,11 @@ int conf_write_autoconf(void)

sym_clear_all_valid();

- file_write_dep("include/config/auto.conf.cmd");
+ name = conf_get_autoconfigdep_name();
+ if (name == NULL)
+ return 1;
+
+ file_write_dep(name);

if (conf_split_config())
return 1;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index d5daa7a..ac99004 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -84,6 +84,7 @@ const char *zconf_curname(void);
/* confdata.c */
const char *conf_get_configname(void);
const char *conf_get_autoconfig_name(void);
+const char *conf_get_autoconfigdep_name(void);
char *conf_get_default_confname(void);
void sym_set_change_count(int count);
void sym_add_change_count(int count);
--
2.1.1

2014-10-23 22:31:06

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 02/14] perf tools: Kbuild builtin source related fixies

From: Jiri Olsa <[email protected]>

Adding CONFIG_BUILTIN_* defines to govern builtin commands.
This will be useful for kbuild process switch.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-annotate.c | 8 ++++++-
tools/perf/builtin-cmds.h | 27 ++++++++++++++++++++++
tools/perf/builtin-help.c | 1 +
tools/perf/builtin-kvm.c | 19 ++++++++++------
tools/perf/builtin-report.c | 3 +++
tools/perf/builtin-top.c | 19 ++++++++++++----
tools/perf/perf.c | 45 +++++++++++++++++++++++++++++++++++--
tools/perf/ui/setup.c | 6 +++--
tools/perf/util/generate-cmdlist.sh | 10 +++++++++
9 files changed, 122 insertions(+), 16 deletions(-)
create mode 100644 tools/perf/builtin-cmds.h

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index e7417fe..19cb967 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -5,6 +5,7 @@
* look up and read DSOs and symbol information and display
* a histogram of results, along various sorting keys.
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "util/util.h"
@@ -115,7 +116,7 @@ static void hists__find_annotations(struct hists *hists,
struct perf_evsel *evsel,
struct perf_annotate *ann)
{
- struct rb_node *nd = rb_first(&hists->entries), *next;
+ struct rb_node *nd = rb_first(&hists->entries);
int key = K_RIGHT;

while (nd) {
@@ -154,7 +155,9 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
+#ifdef CONFIG_TUI
} else if (use_browser == 1) {
+ struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
switch (key) {
case -1:
@@ -173,6 +176,7 @@ find_next:

if (next != NULL)
nd = next;
+#endif /* CONFIG_TUI */
} else {
hist_entry__tty_annotate(he, evsel, ann);
nd = rb_next(nd);
@@ -299,7 +303,9 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
+#ifdef CONFIG_TUI
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
+#endif /* CONFIG_TUI */
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
new file mode 100644
index 0000000..fec342a
--- /dev/null
+++ b/tools/perf/builtin-cmds.h
@@ -0,0 +1,27 @@
+#ifndef BUILTIN_CMDS_H
+#define BUILTIN_CMDS_H
+
+#define CONFIG_BUILTIN_REPORT 1
+#define CONFIG_BUILTIN_SCRIPT 1
+#define CONFIG_BUILTIN_BENCH 1
+#define CONFIG_BUILTIN_SCHED 1
+#define CONFIG_BUILTIN_TRACE 1
+#define CONFIG_BUILTIN_TOP 1
+#define CONFIG_BUILTIN_RECORD 1
+#define CONFIG_BUILTIN_BUILDID_LIST 1
+#define CONFIG_BUILTIN_INJECT 1
+#define CONFIG_BUILTIN_LOCK 1
+#define CONFIG_BUILTIN_KVM 1
+#define CONFIG_BUILTIN_BUILDID_CACHE 1
+#define CONFIG_BUILTIN_EVLIST 1
+#define CONFIG_BUILTIN_KMEM 1
+#define CONFIG_BUILTIN_STAT 1
+#define CONFIG_BUILTIN_DIFF 1
+#define CONFIG_BUILTIN_ANNOTATE 1
+#define CONFIG_BUILTIN_TIMECHART 1
+#define CONFIG_BUILTIN_LIST 1
+#define CONFIG_BUILTIN_HELP 1
+#define CONFIG_BUILTIN_PROBE 1
+#define CONFIG_BUILTIN_MEM 1
+
+#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 25d2062..fbbbaa4 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -7,6 +7,7 @@
#include "util/cache.h"
#include "builtin.h"
#include "util/exec_cmd.h"
+#include "builtin-cmds.h"
#include "common-cmds.h"
#include "util/parse-options.h"
#include "util/run-command.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index b65eb050..400e92e 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1531,20 +1531,25 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)

if (!strncmp(argv[0], "rec", 3))
return __cmd_record(file_name, argc, argv);
- else if (!strncmp(argv[0], "rep", 3))
+
+ if (!strncmp(argv[0], "rep", 3))
return __cmd_report(file_name, argc, argv);
- else if (!strncmp(argv[0], "diff", 4))
+
+ if (!strncmp(argv[0], "diff", 4))
return cmd_diff(argc, argv, NULL);
- else if (!strncmp(argv[0], "top", 3))
+
+ if (!strncmp(argv[0], "top", 3))
return cmd_top(argc, argv, NULL);
- else if (!strncmp(argv[0], "buildid-list", 12))
+
+ if (!strncmp(argv[0], "buildid-list", 12))
return __cmd_buildid_list(file_name, argc, argv);
+
#ifdef HAVE_KVM_STAT_SUPPORT
- else if (!strncmp(argv[0], "stat", 4))
+ if (!strncmp(argv[0], "stat", 4))
return kvm_cmd_stat(file_name, argc, argv);
#endif
- else
- usage_with_options(kvm_usage, kvm_options);
+
+ usage_with_options(kvm_usage, kvm_options);

return 0;
}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 140a6cd..00d93ff 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -5,6 +5,7 @@
* look up and read DSOs and symbol information and display
* a histogram of results, along various sorting keys.
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "util/util.h"
@@ -406,6 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
+#ifdef CONFIG_TUI
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
@@ -417,6 +419,7 @@ static int report__browse_hists(struct report *rep)
if (ret != K_SWITCH_INPUT_DATA)
ret = 0;
break;
+#endif /* CONFIG_TUI */
case 2:
ret = report__gtk_browse_hists(rep, help);
break;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 0aa7747..a2ff8b7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -17,6 +17,7 @@
*
* Released under the GPL v2. (and only v2, not any later version)
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "perf.h"
@@ -534,6 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

+#ifdef CONFIG_TUI
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -586,6 +588,7 @@ static void *display_thread_tui(void *arg)
done = 1;
return NULL;
}
+#endif /* CONFIG_TUI */

static void display_sig(int sig __maybe_unused)
{
@@ -926,9 +929,12 @@ static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused)
return 0;
}

+typedef void* (*display_fn_t)(void *);
+
static int __cmd_top(struct perf_top *top)
{
struct record_opts *opts = &top->record_opts;
+ display_fn_t display_fn = display_thread;
pthread_t thread;
int ret;

@@ -965,8 +971,8 @@ static int __cmd_top(struct perf_top *top)
* XXX 'top' still doesn't start workloads like record, trace, but should,
* so leave the check here.
*/
- if (!target__none(&opts->target))
- perf_evlist__enable(top->evlist);
+ if (!target__none(&opts->target))
+ perf_evlist__enable(top->evlist);

/* Wait for a minimal set of events before starting the snapshot */
perf_evlist__poll(top->evlist, 100);
@@ -974,8 +980,13 @@ static int __cmd_top(struct perf_top *top)
perf_top__mmap_read(top);

ret = -1;
- if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
- display_thread), top)) {
+
+#ifdef CONFIG_TUI
+ if (use_browser > 0)
+ display_fn = display_thread_tui;
+#endif
+
+ if (pthread_create(&thread, NULL, display_fn, top)) {
ui__error("Could not create display thread.\n");
goto out_delete;
}
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 452a847..ab363b5 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -7,6 +7,7 @@
* perf top, perf record, perf report, etc.) are started.
*/
#include "builtin.h"
+#include "builtin-cmds.h"

#include "util/exec_cmd.h"
#include "util/cache.h"
@@ -34,34 +35,74 @@ struct cmd_struct {
};

static struct cmd_struct commands[] = {
+#ifdef CONFIG_BUILTIN_BUILDID_CACHE
{ "buildid-cache", cmd_buildid_cache, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_BUILDID_LIST
{ "buildid-list", cmd_buildid_list, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_DIFF
{ "diff", cmd_diff, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_EVLIST
{ "evlist", cmd_evlist, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_HELP
{ "help", cmd_help, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_LIST
{ "list", cmd_list, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_RECORD
{ "record", cmd_record, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_REPORT
{ "report", cmd_report, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_BENCH
{ "bench", cmd_bench, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_STAT
{ "stat", cmd_stat, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_TIMECHART
{ "timechart", cmd_timechart, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_TOP
{ "top", cmd_top, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_ANNOTATE
{ "annotate", cmd_annotate, 0 },
+#endif
{ "version", cmd_version, 0 },
+#ifdef CONFIG_BUILTIN_SCRIPT
{ "script", cmd_script, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_SCHED
{ "sched", cmd_sched, 0 },
-#ifdef HAVE_LIBELF_SUPPORT
+#endif
+#if defined HAVE_LIBELF_SUPPORT && defined CONFIG_BUILTIN_PROBE
{ "probe", cmd_probe, 0 },
#endif
+#ifdef CONFIG_BUILTIN_KMEM
{ "kmem", cmd_kmem, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_LOCK
{ "lock", cmd_lock, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_KVM
{ "kvm", cmd_kvm, 0 },
+#endif
{ "test", cmd_test, 0 },
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#if defined HAVE_LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
{ "trace", cmd_trace, 0 },
#endif
+#ifdef CONFIG_BUILTIN_INJECT
{ "inject", cmd_inject, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_MEM
{ "mem", cmd_mem, 0 },
+#endif
};

struct pager_config {
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ba51fa8..ec7fd36 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,11 +77,13 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
+#ifdef CONFIG_TUI
case 1:
use_browser = 1;
if (ui__init() == 0)
break;
/* fall through */
+#endif
default:
use_browser = 0;
if (fallback_to_pager)
@@ -96,11 +98,11 @@ void exit_browser(bool wait_for_ok)
case 2:
exit_gtk_browser(wait_for_ok);
break;
-
+#ifdef CONFIG_TUI
case 1:
ui__exit(wait_for_ok);
break;
-
+#endif
default:
break;
}
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 36a885d..05ee30f 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -1,5 +1,11 @@
#!/bin/sh

+function cfg()
+{
+ cfg=`echo $1 | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'`
+ echo "$cfg"
+}
+
echo "/* Automatically generated by $0 */
struct cmdname_help
{
@@ -13,6 +19,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
sort |
while read cmd
do
+ echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)"
sed -n '
/^NAME/,/perf-'"$cmd"'/H
${
@@ -20,6 +27,7 @@ do
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
}' "Documentation/perf-$cmd.txt"
+ echo "#endif"
done

echo "#ifdef HAVE_LIBELF_SUPPORT"
@@ -27,6 +35,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
sort |
while read cmd
do
+ echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)"
sed -n '
/^NAME/,/perf-'"$cmd"'/H
${
@@ -34,6 +43,7 @@ do
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
}' "Documentation/perf-$cmd.txt"
+ echo "#endif"
done
echo "#endif /* HAVE_LIBELF_SUPPORT */"
echo "};"
--
2.1.1

2014-10-23 22:31:16

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 04/14] perf tools: Add kbuild support into Makefile.kbuild

From: Jiri Olsa <[email protected]>

Adding kbuild support into Makefile.kbuild. The 'legacy'
Makefile still stays untouched as it was.

It's possible to use kbuild by running 'make -f Makefile.kbuild'
with any option supported by 'legacy' Makefile.

We now have 2 config files:
'.config' - user configured setup
'.config-detected' - system detected setup

The '.config-detected' affects '.config' and if there's
configured feature in '.config' which was not detected
it is automatically disabled.

The '.config-detected' is re/created if:
- there's no '.config-detected'
- '.config' was changed

In a cleaned tree the perf is built with 'allyesconfig'
having disabled all non-detected features, just as it is
done now.

You can change '.config' via:
make -f Makefile.kbuild menuconfig

There's difference for O=DIR build. The DIR is populated
based on kernel source tree, so the final binary is created
under DIR/tools/perf.

This commit was originally created by Jiri Olsa in February 2013; a
few changes were necessary to fit the perf version of June 2014:
* Add missing CFLAGS for specific .o targets
* Update Kbuild files (new source files, ...)
* Fix recursive invocation of config/features-checks
* Store .config-detected missing variables (libdir, ...)
* Fix missing dependencies between Kconfig options
* Fix installation of traceevent plugins
* Fix missing cleanings of feature-check binaries
* CROSS_COMPILE was not used to define AS, CC, ...
* CROSS_COMPILE was not stored in .config-detected
* Take into account DESTDIR and prefix set in the command line
* Add missing Kbuild files for non-x86 architectures
(powerpc, arm, arm64, sh, s390, sparc)
* Move perf-time-to-tsc.c into x86-specific tests directory

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kbuild | 47 +++
tools/perf/Kconfig | 284 ++++++++++++++
tools/perf/Makefile.kbuild | 431 +++++++++++++++++++++
tools/perf/Makefile.perf | 2 +-
tools/perf/arch/Kbuild | 3 +
tools/perf/arch/arm/Kbuild | 2 +
tools/perf/arch/arm/Makefile | 14 -
tools/perf/arch/arm/tests/Kbuild | 2 +
tools/perf/arch/arm/util/Kbuild | 3 +
tools/perf/arch/arm64/Kbuild | 1 +
tools/perf/arch/arm64/Makefile | 7 -
tools/perf/arch/arm64/util/Kbuild | 2 +
tools/perf/arch/powerpc/Kbuild | 1 +
tools/perf/arch/powerpc/Makefile | 6 -
tools/perf/arch/powerpc/util/Kbuild | 3 +
tools/perf/arch/s390/Kbuild | 1 +
tools/perf/arch/s390/Makefile | 7 -
tools/perf/arch/s390/util/Kbuild | 2 +
tools/perf/arch/sh/Kbuild | 1 +
tools/perf/arch/sh/Makefile | 4 -
tools/perf/arch/sh/util/Kbuild | 1 +
tools/perf/arch/sparc/Kbuild | 1 +
tools/perf/arch/sparc/Makefile | 4 -
tools/perf/arch/sparc/util/Kbuild | 1 +
tools/perf/arch/x86/Kbuild | 1 +
tools/perf/arch/x86/tests/Kbuild | 3 +
tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 0
tools/perf/arch/x86/util/Kbuild | 5 +
tools/perf/bench/Kbuild | 12 +
tools/perf/builtin-cmds.h | 4 +
tools/perf/config/Makefile | 55 ++-
tools/perf/config/Makefile.fix-config | 104 +++++
tools/perf/config/Makefile.fix-legacy | 46 +++
tools/perf/config/defconfig | 54 +++
tools/perf/perf-sys.h | 4 +-
tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
tools/perf/tests/Kbuild | 38 ++
tools/perf/ui/Kbuild | 15 +
tools/perf/ui/browsers/Kbuild | 9 +
tools/perf/ui/gtk/Kbuild | 9 +
tools/perf/ui/stdio/Kbuild | 1 +
tools/perf/ui/tui/Kbuild | 4 +
tools/perf/util/Kbuild | 125 ++++++
tools/perf/util/PERF-VERSION-GEN | 4 +
tools/perf/util/generate-cmdlist.sh | 8 +-
tools/perf/util/scripting-engines/Kbuild | 11 +
tools/perf/util/setup.py | 8 +-
48 files changed, 1309 insertions(+), 52 deletions(-)
create mode 100644 tools/perf/Kbuild
create mode 100644 tools/perf/Kconfig
create mode 100644 tools/perf/Makefile.kbuild
create mode 100644 tools/perf/arch/Kbuild
create mode 100644 tools/perf/arch/arm/Kbuild
delete mode 100644 tools/perf/arch/arm/Makefile
create mode 100644 tools/perf/arch/arm/tests/Kbuild
create mode 100644 tools/perf/arch/arm/util/Kbuild
create mode 100644 tools/perf/arch/arm64/Kbuild
delete mode 100644 tools/perf/arch/arm64/Makefile
create mode 100644 tools/perf/arch/arm64/util/Kbuild
create mode 100644 tools/perf/arch/powerpc/Kbuild
delete mode 100644 tools/perf/arch/powerpc/Makefile
create mode 100644 tools/perf/arch/powerpc/util/Kbuild
create mode 100644 tools/perf/arch/s390/Kbuild
delete mode 100644 tools/perf/arch/s390/Makefile
create mode 100644 tools/perf/arch/s390/util/Kbuild
create mode 100644 tools/perf/arch/sh/Kbuild
delete mode 100644 tools/perf/arch/sh/Makefile
create mode 100644 tools/perf/arch/sh/util/Kbuild
create mode 100644 tools/perf/arch/sparc/Kbuild
delete mode 100644 tools/perf/arch/sparc/Makefile
create mode 100644 tools/perf/arch/sparc/util/Kbuild
create mode 100644 tools/perf/arch/x86/Kbuild
create mode 100644 tools/perf/arch/x86/tests/Kbuild
rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (100%)
create mode 100644 tools/perf/arch/x86/util/Kbuild
create mode 100644 tools/perf/bench/Kbuild
create mode 100644 tools/perf/config/Makefile.fix-config
create mode 100644 tools/perf/config/Makefile.fix-legacy
create mode 100644 tools/perf/config/defconfig
create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/tests/Kbuild
create mode 100644 tools/perf/ui/Kbuild
create mode 100644 tools/perf/ui/browsers/Kbuild
create mode 100644 tools/perf/ui/gtk/Kbuild
create mode 100644 tools/perf/ui/stdio/Kbuild
create mode 100644 tools/perf/ui/tui/Kbuild
create mode 100644 tools/perf/util/Kbuild
create mode 100644 tools/perf/util/scripting-engines/Kbuild

diff --git a/tools/perf/Kbuild b/tools/perf/Kbuild
new file mode 100644
index 0000000..16cb804
--- /dev/null
+++ b/tools/perf/Kbuild
@@ -0,0 +1,47 @@
+obj-y += perf.o
+
+obj-$(CONFIG_BUILTIN_ANNOTATE) += builtin-annotate.o
+obj-$(CONFIG_BUILTIN_BENCH) += builtin-bench.o
+obj-$(CONFIG_BUILTIN_BENCH) += bench/
+obj-$(CONFIG_BUILTIN_BUILDID_CACHE) += builtin-buildid-cache.o
+obj-$(CONFIG_BUILTIN_BUILDID_LIST) += builtin-buildid-list.o
+obj-$(CONFIG_BUILTIN_DIFF) += builtin-diff.o
+obj-$(CONFIG_BUILTIN_EVLIST) += builtin-evlist.o
+obj-$(CONFIG_BUILTIN_HELP) += builtin-help.o
+obj-$(CONFIG_BUILTIN_INJECT) += builtin-inject.o
+obj-$(CONFIG_BUILTIN_KMEM) += builtin-kmem.o
+obj-$(CONFIG_BUILTIN_KVM) += builtin-kvm.o
+obj-$(CONFIG_BUILTIN_LIST) += builtin-list.o
+obj-$(CONFIG_BUILTIN_LOCK) += builtin-lock.o
+obj-$(CONFIG_BUILTIN_PROBE) += builtin-probe.o
+obj-$(CONFIG_BUILTIN_RECORD) += builtin-record.o
+obj-$(CONFIG_BUILTIN_REPORT) += builtin-report.o
+obj-$(CONFIG_BUILTIN_SCHED) += builtin-sched.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += builtin-script.o
+obj-$(CONFIG_BUILTIN_STAT) += builtin-stat.o
+obj-$(CONFIG_BUILTIN_TIMECHART) += builtin-timechart.o
+obj-$(CONFIG_BUILTIN_TOP) += builtin-top.o
+obj-$(CONFIG_BUILTIN_TRACE) += builtin-trace.o
+obj-$(CONFIG_BUILTIN_MEM) += builtin-mem.o
+obj-$(CONFIG_BUILTIN_TEST) += tests/
+
+obj-y += ../../lib/rbtree.o
+obj-y += ../lib/symbol/kallsyms.o
+
+obj-y += util/
+obj-y += ui/
+obj-y += arch/
+
+obj-$(CONFIG_LIBPERL) += scripts/perl/Perf-Trace-Util/
+obj-$(CONFIG_LIBPYTHON) += scripts/python/Perf-Trace-Util/
+
+CFLAGS_rbtree.o += -Wno-unused-parameter
+
+CFLAGS_perf.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_perf.o += -include PERF-VERSION-FILE
+
+$(obj)/perf.o: $(obj)/PERF-VERSION-FILE
+
+CFLAGS_builtin-help.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_INFO_PATH=KBUILD_STR($(infodir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_MAN_PATH=KBUILD_STR($(mandir_SQ))"
diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
new file mode 100644
index 0000000..f9fcf9e
--- /dev/null
+++ b/tools/perf/Kconfig
@@ -0,0 +1,284 @@
+
+mainmenu "The perf configuration"
+
+menu "Built-in commands"
+
+config BUILTIN_RECORD
+ bool "record"
+ default y
+ ---help---
+ Run a command and record its profile into a perf archive.
+
+config BUILTIN_REPORT
+ bool "report"
+ default y
+ ---help---
+ Read a perf archive (created by perf record) and display the
+ profile.
+
+config BUILTIN_STAT
+ bool "stat"
+ default y
+ ---help---
+ Run a command and gather performance counter statistics.
+
+config BUILTIN_TOP
+ bool "top"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Generate and display a performance counter profile in
+ real-time.
+
+config BUILTIN_TRACE
+ bool "trace"
+ default y
+ depends on BUILTIN_RECORD && LIBAUDIT
+ ---help---
+ Strace inspired tool.
+
+config BUILTIN_ANNOTATE
+ bool "annotate"
+ default y
+ ---help---
+ Read a perf archive (created by perf record) and display
+ annotated code.
+
+config BUILTIN_BENCH
+ bool "bench"
+ default y
+ ---help---
+ General framework for benchmark suites.
+
+config BUILTIN_BUILDID_CACHE
+ bool "buildid-cache"
+ default y
+ ---help---
+ Manage build-id cache.
+
+config BUILTIN_BUILDID_LIST
+ bool "buildid-list"
+ default y
+ ---help---
+ List the buildids in a perf archive file.
+
+config BUILTIN_DIFF
+ bool "diff"
+ default y
+ ---help---
+ Read perf archive files and display the differential
+ profile.
+
+config BUILTIN_EVLIST
+ bool "evlist"
+ default y
+ ---help---
+ List the event names in a perf archive file
+
+config BUILTIN_HELP
+ bool "help"
+ default y
+ ---help---
+ Display help information about perf
+
+config BUILTIN_INJECT
+ bool "inject"
+ default y
+ ---help---
+ The inject feature reads a perf-record event stream and
+ repipes it to stdout.
+
+config BUILTIN_KMEM
+ bool "kmem"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to trace/measure kernel memory(slab) properties.
+
+config BUILTIN_KVM
+ bool "kvm"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT && \
+ BUILTIN_RECORD && BUILTIN_BUILDID_LIST && \
+ BUILTIN_TOP && BUILTIN_DIFF && BUILTIN_STAT
+ ---help---
+ Tool to trace/measure kvm guest os
+
+config BUILTIN_LIST
+ bool "list"
+ default y
+ ---help---
+ List all symbolic event types.
+
+config BUILTIN_LOCK
+ bool "lock"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Analyze lock events.
+
+config BUILTIN_PROBE
+ bool "probe"
+ default y
+ depends on LIBELF
+ ---help---
+ Define new dynamic tracepoints
+
+config BUILTIN_SCHED
+ bool "sched"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to trace/measure scheduler properties (latencies).
+
+config BUILTIN_SCRIPT
+ bool "script"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Read perf archive file (created by perf record) and display
+ trace output.
+
+config BUILTIN_TIMECHART
+ bool "timechart"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to visualize total system behavior during a workload.
+
+config BUILTIN_MEM
+ bool "mem"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Profile memory accesses.
+
+config BUILTIN_TEST
+ bool "test"
+ default y
+ ---help---
+ Runs sanity tests.
+
+endmenu
+
+menu "GUI"
+
+config STDIO
+ bool "Terminal"
+ default y
+ ---help---
+ Most basic display mode.
+
+config TUI
+ bool "Tui (slang based)"
+ default y
+ ---help---
+ Text-based user interface which provides windowing
+ facilities.
+
+config GTK2
+ bool "Gtk2"
+ default y
+ ---help---
+ Elaborate display mode based on libgtk2.
+
+endmenu
+
+menu "Libraries / Dependencies"
+
+config LIBAUDIT
+ bool "Audit (libaudit)"
+ default y
+ ---help---
+ Linux audit framework dependency.
+
+config LIBPERL
+ bool "Perl"
+ default y
+ ---help---
+ Libperl dependency needed by the perf script feature.
+
+config LIBPYTHON
+ bool "Python"
+ default y
+ ---help---
+ Libpython dependency needed by the perf script feature.
+
+choice
+ prompt "Elf library"
+ default LIBELF
+ ---help---
+ Perf needs ELF files manipulation facilities. To fulfill
+ these tasks, perf can rely on either the libelf library or a
+ minimal builtin support.
+
+
+ config LIBELF
+ bool "elf"
+ ---help---
+ Libelf library.
+
+ config LIBELF_MINIMAL
+ bool "builtin support"
+ ---help---
+ Builtin elf support.
+endchoice
+
+config LIBUNWIND
+ bool "User space libunwind callchains"
+ default y
+ ---help---
+ The library libunwind provides a portable C API to determine
+ the call-chain of a program.
+
+config LIBUNWIND_DIR
+ string "libunwind directory"
+ depends on LIBUNWIND
+ ---help---
+ Directory holding the libuwind dependency (headers +
+ libraries).
+
+config NUMA
+ bool "Numa support (bench)"
+ default y
+ ---help---
+ The library libnuma offers facilities to configure NUMA
+ policies supported by the linux kernel.
+
+config DEMANGLE
+ bool "Demangle symbols"
+ default y
+ ---help---
+ Enable demangling so as to display human-readable
+ symbols. This option is convenient with C++ programs.
+
+config BIONIC
+ bool "Bionic support"
+ default n
+ ---help---
+ The Bionic libc is a derivation of the BSD's standard C
+ library code developed by Google for their Android operating
+ system.
+
+endmenu
+
+menu "Build"
+config DEBUG
+ bool "Compile with debug info"
+ default n
+ ---help---
+ Compile with debug info.
+
+config DEBUG_PARSER
+ bool "Compile with parsers debug info"
+ default n
+ ---help---
+ Compile with parsers debug info.
+
+config BACKTRACE
+ bool "Compile with dump_stack support"
+ default y
+ ---help---
+ Compile with dump_stack support.
+
+endmenu
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
new file mode 100644
index 0000000..51eba07
--- /dev/null
+++ b/tools/perf/Makefile.kbuild
@@ -0,0 +1,431 @@
+srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
+objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
+
+VPATH := $(srctree)
+
+export srctree VPATH
+
+MAKEFLAGS += --include-dir=$(srctree)
+MAKEFLAGS += --no-builtin-rules
+MAKEFLAGS += --no-print-directory
+
+ifeq ("$(origin V)", "command line")
+KBUILD_VERBOSE = $(V)
+endif
+
+ifndef KBUILD_VERBOSE
+KBUILD_VERBOSE = 0
+endif
+
+ifeq ($(KBUILD_VERBOSE),1)
+quiet =
+Q =
+else
+quiet=quiet_
+Q = @
+endif
+
+# If the user is running make -s (silent mode), suppress echoing of
+# commands
+ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+quiet=silent_
+endif
+
+export quiet Q KBUILD_VERBOSE
+
+ifndef V
+QUIET_LINK = @echo ' LD $@';
+QUIET_GEN = @echo ' GEN $@';
+QUIET_CLEAN = @echo ' CLEAN tools/perf';
+endif
+
+export QUIET_BISON QUIET_FLEX
+
+ifeq ($(KBUILD_SRC),)
+
+ifeq ("$(origin O)", "command line")
+KBUILD_OUTPUT := $(O)
+else
+KBUILD_OUTPUT := $(objtree)
+endif
+
+# Invoke a second make in the output directory, passing relevant variables
+# check that the output directory actually exists
+saved-output := $(KBUILD_OUTPUT)
+KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+$(if $(KBUILD_OUTPUT),, \
+ $(error output directory "$(saved-output)" does not exist))
+
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/lib)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/include/config)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/tools/perf)
+
+PHONY += $(MAKECMDGOALS) sub-make
+
+$(filter-out sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) all: sub-make
+ @:
+
+sub-make: FORCE
+ $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
+ KBUILD_SRC=$(srctree) \
+ -f $(CURDIR)/Makefile.kbuild \
+ $(filter-out sub-make,$(MAKECMDGOALS))
+
+# Leave processing to above invocation of make
+skip-makefile := 1
+endif # ifeq ($(KBUILD_SRC),)
+
+export KBUILD_SRC
+
+ifeq ($(skip-makefile),)
+
+build := -f $(srctree)/scripts/Makefile.build obj
+
+src-kernel := $(srctree)
+src-perf := $(srctree)/tools/perf
+obj-kernel := $(objtree)
+obj-perf := $(objtree)/tools/perf
+
+VPATH += $(src-perf)
+
+export src-perf obj-perf
+
+OUTPUT := $(obj-perf)/
+
+export OUTPUT DESTDIR
+
+AS = $(CROSS_COMPILE)as
+LD = $(CROSS_COMPILE)ld
+CC = $(CROSS_COMPILE)gcc
+CPP = $(CC) -E
+HOSTCC = gcc
+FLEX = flex
+BISON = bison
+INSTALL = install
+PKG_CONFIG = pkg-config
+
+export AS LD CC CPP HOSTCC FLEX BISON PKG_CONFIG
+
+# kbuild related config
+CONFIG_SHELL := /bin/sh
+
+KBUILD_KCONFIG := $(src-perf)/Kconfig
+KCONFIG_CONFIG ?= $(obj-perf)/.config
+KCONFIG_TRISTATE := $(obj-perf)/include/config/tristate.conf
+KCONFIG_AUTOHEADER := $(obj-perf)/include/generated/autoconf.h
+KCONFIG_AUTOCONFIG := $(obj-perf)/include/config/auto.conf
+KCONFIG_SCRIPT := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+export CONFIG_SHELL
+export KBUILD_KCONFIG
+export KCONFIG_CONFIG KCONFIG_TRISTATE
+export KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG KCONFIG_SCRIPT
+
+# perf detected config
+CONFIG_DETECTED := $(obj-perf)/.config-detected
+
+export CONFIG_DETECTED
+
+# external .a libs
+LIBTRACEEVENT := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
+LIBAPIKFS := $(obj-kernel)/tools/lib/api/libapikfs.a
+LIBS_A := $(LIBTRACEEVENT) $(LIBAPIKFS)
+
+export LIBTRACEEVENT LIBAPIKFS
+
+all:
+
+scripts_basic:
+ $(Q)$(MAKE) $(build)=scripts/basic
+
+defconfig: scripts_basic
+ $(Q)cp $(src-perf)/config/defconfig $(KCONFIG_CONFIG)
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig oldconfig
+
+%config: scripts_basic
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig $@
+
+$(KCONFIG_CONFIG):
+ $(Q)$(MAKE) $(build)=scripts/basic
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig allyesconfig
+
+$(CONFIG_DETECTED): $(KCONFIG_CONFIG)
+ $(Q)$(MAKE) -f $(src-perf)/config/Makefile
+
+# no need to include auto.conf.cmd, because .config
+# is the only dependency here
+$(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
+ $(Q)$(MAKE) -f $(src-perf)/config/Makefile.fix-config
+ $(Q)mkdir -p $(obj-perf)/include/config
+ $(Q)mkdir -p $(obj-perf)/include/generated
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig silentoldconfig
+ @touch $(CONFIG_DETECTED) # final touch.. to keep the time dependency correct
+
+clean-dirs := $(addprefix _clean_, tools/perf/)
+
+$(clean-dirs):
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean
+ $(Q)$(QUIET_CLEAN)
+ $(Q)rm -f $(obj-perf)/perf
+ $(Q)rm -f $(obj-perf)/common-cmds.h
+ $(Q)rm -f $(obj-perf)/python/perf.so
+ $(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+ $(Q)find $(obj-perf) \
+ \( -name '*.[oas]' -o -name '.*.cmd' \
+ -o -name '.*.d' -o -name '.*.tmp' \
+ -o -name '*-flex.[ch]' -o -name '*-bison.[ch]' \
+ \) -type f -print | xargs rm -f
+ $(Q)$(python-clean)
+ $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
+ @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
+
+TAGS tags:
+ $(Q)rm -f $(src-perf)/tags
+ $(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs ctags -a
+
+cscope:
+ $(Q)rm -f $(src-perf)/cscope*
+ $(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs cscope -b
+
+PHONY += clean $(clean-dirs) tags TAGS cscope
+
+ifneq ($(filter %config help clean tags TAGS cscope,$(MAKECMDGOALS)),)
+dont-detect := 1
+endif
+
+ifndef dont-detect
+# detected config variables
+-include $(CONFIG_DETECTED)
+
+ifdef CONFIG_DETECTED_STORED
+# Following variables are needed within Kbuild files, we need
+# to export them as they are not part of the .config set.
+export CONFIG_ARCH := $(ARCH)
+export CROSS_COMPILE
+export CONFIG_X86_64
+export htmldir_SQ
+export infodir_SQ
+export mandir_SQ
+export perfexecdir_SQ
+export PARSER_DEBUG_BISON
+export PARSER_DEBUG_FLEX
+export ETC_PERFCONFIG_SQ
+export libdir_SQ
+export plugindir_SQ
+export PYTHON_EMBED_CCOPTS
+export PERL_EMBED_CCOPTS
+export GTK_CFLAGS
+
+# The variable DESTDIR could be overloaded at make launch time
+ifdef DESTDIR
+ DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
+else
+ DESTDIR = $(DESTDIR_SQ)
+endif
+export DESTDIR DESTDIR_SQ
+
+# The variable prefix could be overloaded at make launch time
+ifdef prefix
+ prefix_SQ = $(subst ','\'',$(prefix))
+else
+ prefix = $(prefix_SQ)
+endif
+
+export prefix prefix_SQ
+
+endif # CONFIG_DETECTED_STORED
+
+endif # !dont-detect
+
+# let sources know it's kbuild
+CFLAGS += -DCONFIG_KBUILD
+
+# kbuild related config
+LINUXINCLUDE := $(CFLAGS)
+KBUILD_BUILTIN := 1
+KBUILD_CHECKSRC := 0
+
+export LINUXINCLUDE
+export KBUILD_BUILTIN KBUILD_CHECKSRC
+
+# pyuthon language binding
+PYTHON_EXTBUILD := $(src-perf)/python_ext_build/
+PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
+
+export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
+
+python-clean := rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so
+
+PYTHON_EXT_SRCS := $(addprefix $(src-perf)/,$(shell grep -v ^\# $(src-perf)/util/python-ext-sources))
+PYTHON_EXT_DEPS := $(src-perf)/util/python-ext-sources $(src-perf)/util/setup.py
+PYTHON_EXT_CFLAGS := $(CFLAGS) -w
+
+export PYTHON_EXT_SRCS
+
+
+$(obj-perf)/python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
+ $(QUIET_GEN)CFLAGS='$(PYTHON_EXT_CFLAGS)' $(PYTHON_WORD) $(src-perf)/util/setup.py \
+ --quiet build_ext; \
+ mkdir -p $(obj-perf)/python && \
+ cp $(PYTHON_EXTBUILD_LIB)perf.so $(obj-perf)/python/
+
+all: tools/perf/PERF-VERSION-FILE scripts_basic tools/perf/perf $(LANG_BINDINGS)
+
+$(obj-perf)/common-cmds.h: $(src-perf)/util/generate-cmdlist.sh $(src-perf)/command-list.txt
+ $(QUIET_GEN)$(src-perf)/util/generate-cmdlist.sh $(src-perf) > $@+ && mv $@+ $@
+
+PHONY += all scripts_basic
+
+$(obj-perf)/built-in.o: $(obj-perf)/common-cmds.h $(KCONFIG_AUTOCONFIG) FORCE
+ $(Q)$(MAKE) LDFLAGS="" $(build)=tools/perf
+
+LIBS = -Wl,--whole-archive $^ -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
+
+tools/perf/perf: $(obj-perf)/built-in.o $(LIBS_A)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $(LIBS) $(GTK_LIBS)
+
+$(LIBTRACEEVENT): FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/traceevent
+ $(Q)$(MAKE) -C $(src-kernel)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent
+
+$(LIBTRACEEVENT)-clean: FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/traceevent
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent clean
+
+$(LIBTRACEEVENT)-install: $(LIBTRACEEVENT) FORCE
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent plugin_dir=$(plugindir_SQ) install
+
+$(LIBAPIKFS): FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/api
+ $(Q)$(MAKE) -C $(srctree)/tools/lib/api O=$(obj-kernel)/tools/lib/api
+
+$(LIBAPIKFS)-clean: FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/api
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/api O=$(obj-kernel)/tools/lib/api clean
+
+tools/perf/PERF-VERSION-FILE: FORCE
+ $(QUIET_GEN)$(SHELL_PATH) $(src-perf)/util/PERF-VERSION-GEN $(obj-perf)/
+
+
+# Single targets
+# ---------------------------------------------------------------------------
+# Single targets are compatible with:
+# - build with mixed source and output
+# - build with separate output dir 'make O=...'
+# - external modules
+#
+# target-dir => where to store outputfile
+# build-dir => directory in kernel source tree to use
+
+build-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(patsubst %/,%,$(dir $@))))
+target-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(dir $@)))
+
+%.o: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.i: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.S scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.o: %.S scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+
+SCRIPT_SH += $(src-perf)/perf-archive.sh
+SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
+
+$(SCRIPTS) : % : %.sh
+ $(QUIET_GEN)$(INSTALL) '[email protected]' '$(perf-obj)$@'
+
+all: $(SCRIPTS)
+
+install-bin: all
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
+ $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
+ $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
+ $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+
+install: install-bin try-install-man $(LIBTRACEEVENT)-install
+
+DOC_TARGETS := doc man html info pdf
+
+$(DOC_TARGETS):
+ $(Q)$(MAKE) -C $(src-perf)/Documentation $(@:doc=all)
+
+INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
+INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
+
+# 'make install-doc' should call 'make -C Documentation install'
+$(INSTALL_DOC_TARGETS):
+ $(Q)$(MAKE) -C $(src-perf)/Documentation $(@:-doc=)
+
+help:
+ @echo 'Perf make targets:'
+ @echo ' doc - make *all* documentation (see below)'
+ @echo ' man - make manpage documentation (access with man <foo>)'
+ @echo ' html - make html documentation'
+ @echo ' info - make GNU info documentation (access with info <foo>)'
+ @echo ' pdf - make pdf documentation'
+ @echo ' TAGS - use etags to make tag information for source browsing'
+ @echo ' tags - use ctags to make tag information for source browsing'
+ @echo ' cscope - use cscope to make interactive browsing database'
+ @echo ''
+ @echo 'Perf install targets:'
+ @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
+ @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular'
+ @echo ' path like make prefix=/usr/local install install-doc'
+ @echo ' install - install compiled binaries'
+ @echo ' install-doc - install *all* documentation'
+ @echo ' install-man - install manpage documentation'
+ @echo ' install-html - install html documentation'
+ @echo ' install-info - install GNU info documentation'
+ @echo ' install-pdf - install pdf documentation'
+ @echo ''
+ @echo ' quick-install-doc - alias for quick-install-man'
+ @echo ' quick-install-man - install the documentation quickly'
+ @echo ' quick-install-html - install the html documentation quickly'
+ @echo ''
+ @echo 'Perf maintainer targets:'
+ @echo ' clean - clean all binary objects and build output'
+
+
+ifdef MAKE_DEBUG
+dummy := $(info DEBUG MAKEFLAGS $(MAKEFLAGS))
+dummy := $(info DEBUG VPATH $(VPATH))
+dummy := $(info DEBUG srctree $(srctree))
+dummy := $(info DEBUG objtree $(objtree))
+dummy := $(info DEBUG src-kernel $(src-kernel))
+dummy := $(info DEBUG src-perf $(src-perf))
+dummy := $(info DEBUG obj-kernel $(obj-kernel))
+dummy := $(info DEBUG obj-perf $(obj-perf))
+dummy := $(info DEBUG KBUILD_KCONFIG $(KBUILD_KCONFIG))
+dummy := $(info DEBUG KCONFIG_CONFIG $(KCONFIG_CONFIG))
+dummy := $(info DEBUG KCONFIG_TRISTATE $(KCONFIG_TRISTATE))
+dummy := $(info DEBUG KCONFIG_AUTOHEADER $(KCONFIG_AUTOHEADER))
+dummy := $(info DEBUG KCONFIG_AUTOCONFIG $(KCONFIG_AUTOCONFIG))
+dummy := $(info DEBUG TRACE_EVENT_DIR $(TRACE_EVENT_DIR))
+dummy := $(info DEBUG LIBAPIKFS $(LIBAPIKFS))
+endif
+
+endif # skip-makefile
+
+PHONY += FORCE
+.PHONY: $(PHONY)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 262916f..dcf6248 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -620,7 +620,7 @@ $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPU
$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt

$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
- $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
+ $(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@

$(SCRIPTS) : % : %.sh
$(QUIET_GEN)$(INSTALL) '[email protected]' '$(OUTPUT)$@'
diff --git a/tools/perf/arch/Kbuild b/tools/perf/arch/Kbuild
new file mode 100644
index 0000000..5cf419e
--- /dev/null
+++ b/tools/perf/arch/Kbuild
@@ -0,0 +1,3 @@
+obj-y += common.o
+
+obj-y += $(CONFIG_ARCH)/
diff --git a/tools/perf/arch/arm/Kbuild b/tools/perf/arch/arm/Kbuild
new file mode 100644
index 0000000..f5581bee
--- /dev/null
+++ b/tools/perf/arch/arm/Kbuild
@@ -0,0 +1,2 @@
+obj-y += util/
+obj-y += tests/
diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
deleted file mode 100644
index 09d6215..0000000
--- a/tools/perf/arch/arm/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifndef NO_LIBDW_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-endif
-ifndef NO_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
-endif
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
new file mode 100644
index 0000000..5d63e9d
--- /dev/null
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -0,0 +1,2 @@
+obj-y += regs_load.o
+obj-y += dwarf-unwind.o
diff --git a/tools/perf/arch/arm/util/Kbuild b/tools/perf/arch/arm/util/Kbuild
new file mode 100644
index 0000000..c96666a
--- /dev/null
+++ b/tools/perf/arch/arm/util/Kbuild
@@ -0,0 +1,3 @@
+obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-y += unwind-libdw.o
diff --git a/tools/perf/arch/arm64/Kbuild b/tools/perf/arch/arm64/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/arm64/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
deleted file mode 100644
index 67e9b3d..0000000
--- a/tools/perf/arch/arm64/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
diff --git a/tools/perf/arch/arm64/util/Kbuild b/tools/perf/arch/arm64/util/Kbuild
new file mode 100644
index 0000000..136bc86
--- /dev/null
+++ b/tools/perf/arch/arm64/util/Kbuild
@@ -0,0 +1,2 @@
+obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/powerpc/Kbuild b/tools/perf/arch/powerpc/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/powerpc/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
deleted file mode 100644
index 6f7782b..0000000
--- a/tools/perf/arch/powerpc/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
diff --git a/tools/perf/arch/powerpc/util/Kbuild b/tools/perf/arch/powerpc/util/Kbuild
new file mode 100644
index 0000000..244ff2c
--- /dev/null
+++ b/tools/perf/arch/powerpc/util/Kbuild
@@ -0,0 +1,3 @@
+obj-y += header.o
+obj-y += skip-callchain-idx.o
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/s390/Kbuild b/tools/perf/arch/s390/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/s390/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
deleted file mode 100644
index 798ac73..0000000
--- a/tools/perf/arch/s390/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
new file mode 100644
index 0000000..24e8ee7
--- /dev/null
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -0,0 +1,2 @@
+obj-y += kvm-stat.o
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/sh/Kbuild b/tools/perf/arch/sh/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/sh/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
deleted file mode 100644
index 15130b5..0000000
--- a/tools/perf/arch/sh/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
diff --git a/tools/perf/arch/sh/util/Kbuild b/tools/perf/arch/sh/util/Kbuild
new file mode 100644
index 0000000..8e698ae
--- /dev/null
+++ b/tools/perf/arch/sh/util/Kbuild
@@ -0,0 +1 @@
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/sparc/Kbuild b/tools/perf/arch/sparc/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/sparc/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
deleted file mode 100644
index 15130b5..0000000
--- a/tools/perf/arch/sparc/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
diff --git a/tools/perf/arch/sparc/util/Kbuild b/tools/perf/arch/sparc/util/Kbuild
new file mode 100644
index 0000000..8e698ae
--- /dev/null
+++ b/tools/perf/arch/sparc/util/Kbuild
@@ -0,0 +1 @@
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Kbuild b/tools/perf/arch/x86/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/x86/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
new file mode 100644
index 0000000..3b5aa14
--- /dev/null
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -0,0 +1,3 @@
+obj-y += perf-time-to-tsc.o
+obj-y += regs_load.o
+obj-y += dwarf-unwind.o
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
similarity index 100%
rename from tools/perf/tests/perf-time-to-tsc.c
rename to tools/perf/arch/x86/tests/perf-time-to-tsc.c
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
new file mode 100644
index 0000000..c7b86c0
--- /dev/null
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -0,0 +1,5 @@
+obj-y += dwarf-regs.o
+obj-y += header.o
+obj-y += tsc.o
+obj-y += kvm-stat.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/bench/Kbuild b/tools/perf/bench/Kbuild
new file mode 100644
index 0000000..e604fe2
--- /dev/null
+++ b/tools/perf/bench/Kbuild
@@ -0,0 +1,12 @@
+obj-y += mem-memcpy.o
+obj-y += mem-memset.o
+obj-y += sched-messaging.o
+obj-y += sched-pipe.o
+obj-y += futex-hash.o
+obj-y += futex-requeue.o
+obj-y += futex-wake.o
+
+obj-$(CONFIG_NUMA) += numa.o
+
+obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
+obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index fec342a..49550c9 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -1,6 +1,7 @@
#ifndef BUILTIN_CMDS_H
#define BUILTIN_CMDS_H

+#ifndef CONFIG_KBUILD
#define CONFIG_BUILTIN_REPORT 1
#define CONFIG_BUILTIN_SCRIPT 1
#define CONFIG_BUILTIN_BENCH 1
@@ -23,5 +24,8 @@
#define CONFIG_BUILTIN_HELP 1
#define CONFIG_BUILTIN_PROBE 1
#define CONFIG_BUILTIN_MEM 1
+#else
+#include "generated/autoconf.h"
+#endif /* CONFIG_KBUILD */

#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 58f6091..6106e24 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -24,6 +24,7 @@ ifeq ($(ARCH),x86)
CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
+ CONFIG_X86_64=y
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
@@ -84,6 +85,10 @@ ifndef NO_LIBELF
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif

+ifdef KCONFIG_CONFIG
+include $(src-perf)/config/Makefile.fix-legacy
+endif
+
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

@@ -159,7 +164,7 @@ endif

feature_check = $(eval $(feature_check_code))
define feature_check_code
- feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
+ feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(src-perf)/config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
endef

feature_set = $(eval $(feature_set_code))
@@ -258,7 +263,7 @@ ifeq ($(feature-all), 1)
#
$(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
else
- $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
+ $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C $(src-perf)/config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
$(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
endif

@@ -273,6 +278,7 @@ ifeq ($(DEBUG),0)
endif

CFLAGS += -I$(src-perf)/util/include
+CFLAGS += -I$(obj-perf)/include
CFLAGS += -I$(src-perf)/arch/$(ARCH)/include
CFLAGS += -I$(srctree)/tools/include/
CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi
@@ -770,3 +776,48 @@ endif
ifeq ($(display_lib),1)
$(info )
endif
+
+ifdef CONFIG_DETECTED
+
+store = @echo "$(1)=$($(1))" >> $(CONFIG_DETECTED)
+
+all:
+ @echo "CONFIG_DETECTED_STORED=1" > $(CONFIG_DETECTED)
+ $(call store,ARCH)
+ $(call store,CROSS_COMPILE)
+ $(call store,CFLAGS)
+ $(call store,LDFLAGS)
+ $(call store,EXTLIBS)
+ $(call store,htmldir_SQ)
+ $(call store,infodir_SQ)
+ $(call store,mandir_SQ)
+ $(call store,perfexecdir_SQ)
+ $(call store,prefix_SQ)
+ $(call store,PARSER_DEBUG_BISON)
+ $(call store,PARSER_DEBUG_FLEX)
+ $(call store,PYTHON_EMBED_CCOPTS)
+ $(call store,PERL_EMBED_CCOPTS)
+ $(call store,CONFIG_X86_64)
+ $(call store,NO_LIBUNWIND)
+ $(call store,NO_LIBPERL)
+ $(call store,NO_LIBPYTHON)
+ $(call store,NO_NEWT)
+ $(call store,NO_GTK2)
+ $(call store,NO_DEMANGLE)
+ $(call store,NO_LIBELF)
+ $(call store,NO_LIBUNWIND)
+ $(call store,NO_BACKTRACE)
+ $(call store,NO_LIBNUMA)
+ $(call store,NO_LIBAUDIT)
+ $(call store,NO_LIBBIONIC)
+ $(call store,ETC_PERFCONFIG_SQ)
+ $(call store,DESTDIR_SQ)
+ $(call store,bindir_SQ)
+ $(call store,libdir_SQ)
+ $(call store,plugindir_SQ)
+ $(call store,perfexec_instdir_SQ)
+ $(call store,sysconfdir_SQ)
+ $(call store,GTK_CFLAGS)
+ $(call store,GTK_LIBS)
+
+endif # CONFIG_DETECTED
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
new file mode 100644
index 0000000..7f65fdb
--- /dev/null
+++ b/tools/perf/config/Makefile.fix-config
@@ -0,0 +1,104 @@
+include $(CONFIG_DETECTED)
+include $(KCONFIG_CONFIG)
+
+CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+# NO_LIBPERL
+ifdef CONFIG_LIBPERL
+ifdef NO_LIBPERL
+dummy := $(info Disabling CONFIG_LIBPERL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPERL)
+endif
+endif
+
+# NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
+ifdef NO_LIBPYTHON
+dummy := $(info Disabling CONFIG_LIBPYTHON)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_NEWT
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_SLANG
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_GTK2
+ifdef CONFIG_GTK2
+ifdef NO_GTK2
+dummy := $(info Disabling CONFIG_GTK2)
+dummy := $(shell $(CONFIG) -d CONFIG_GTK2)
+endif
+endif
+
+# NO_DEMANGLE
+ifdef CONFIG_DEMANGLE
+ifdef NO_DEMANGLE
+dummy := $(info Disabling CONFIG_DEMANGLE)
+dummy := $(shell $(CONFIG) -d CONFIG_DEMANGLE)
+endif
+endif
+
+# NO_LIBELF
+ifdef CONFIG_LIBELF
+ifdef NO_LIBELF
+dummy := $(info Disabling CONFIG_LIBELF)
+dummy := $(info Enabling CONFIG_LIBELF_MINIMAL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBELF)
+dummy := $(shell $(CONFIG) -e CONFIG_LIBELF_MINIMAL)
+endif
+endif
+
+# NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
+ifdef NO_LIBUNWIND
+dummy := $(info Disabling CONFIG_LIBUNWIND)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
+endif
+endif
+
+# NO_BACKTRACE
+ifdef CONFIG_BACKTRACE
+ifdef NO_BACKTRACE
+dummy := $(info Disabling CONFIG_BACKTRACE)
+dummy := $(shell $(CONFIG) -d CONFIG_BACKTRACE)
+endif
+endif
+
+# NO_LIBNUMA
+ifdef CONFIG_NUMA
+ifdef NO_LIBNUMA
+dummy := $(info Disabling CONFIG_NUMA)
+dummy := $(shell $(CONFIG) -d CONFIG_NUMA)
+endif
+endif
+
+# NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
+ifdef NO_LIBAUDIT
+dummy := $(info Disabling CONFIG_LIBAUDIT)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBAUDIT)
+endif
+endif
+
+# NO_LIBBIONIC
+ifdef CONFIG_BIONIC
+ifdef NO_LIBBIONIC
+dummy := $(info Disabling CONFIG_BIONIC)
+dummy := $(shell $(CONFIG) -d CONFIG_BIONIC)
+endif
+endif
+
+all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
new file mode 100644
index 0000000..2ec91f3
--- /dev/null
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -0,0 +1,46 @@
+
+include $(KCONFIG_CONFIG)
+
+ifndef CONFIG_LIBPERL
+NO_LIBPERL := 1
+endif
+
+ifndef CONFIG_LIBPYTHON
+NO_LIBPYTHON := 1
+endif
+
+ifndef CONFIG_TUI
+NO_SLANG := 1
+endif
+
+ifndef CONFIG_GTK2
+NO_GTK2 := 1
+endif
+
+ifndef CONFIG_DEMANGLE
+NO_DEMANGLE := 1
+endif
+
+ifndef CONFIG_LIBELF
+NO_LIBELF := 1
+endif
+
+ifndef CONFIG_LIBUNWIND
+NO_LIBUNWIND := 1
+endif
+
+ifndef CONFIG_BACKTRACE
+NO_BACKTRACE := 1
+endif
+
+ifndef CONFIG_NUMA
+export NO_LIBNUMA := 1
+endif
+
+ifndef CONFIG_LIBAUDIT
+NO_LIBAUDIT := 1
+endif
+
+ifdef CONFIG_BIONIC
+NO_LIBBIONIC := 1
+endif
diff --git a/tools/perf/config/defconfig b/tools/perf/config/defconfig
new file mode 100644
index 0000000..7a385f1
--- /dev/null
+++ b/tools/perf/config/defconfig
@@ -0,0 +1,54 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux Kernel Configuration
+#
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+# CONFIG_BUILTIN_TOP is not set
+# CONFIG_BUILTIN_ANNOTATE is not set
+# CONFIG_BUILTIN_BENCH is not set
+# CONFIG_BUILTIN_BUILDID_CACHE is not set
+# CONFIG_BUILTIN_BUILDID_LIST is not set
+CONFIG_BUILTIN_DIFF=y
+# CONFIG_BUILTIN_EVLIST is not set
+CONFIG_BUILTIN_HELP=y
+# CONFIG_BUILTIN_INJECT is not set
+# CONFIG_BUILTIN_KMEM is not set
+# CONFIG_BUILTIN_KVM is not set
+# CONFIG_BUILTIN_LIST is not set
+# CONFIG_BUILTIN_LOCK is not set
+# CONFIG_BUILTIN_SCHED is not set
+CONFIG_BUILTIN_SCRIPT=y
+# CONFIG_BUILTIN_TIMECHART is not set
+# CONFIG_BUILTIN_TEST is not set
+
+#
+# Libraries
+#
+# CONFIG_LIBAUDIT is not set
+# CONFIG_LIBPERL is not set
+# CONFIG_LIBPYTHON is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_BACKTRACE=y
+# CONFIG_LIBUNWIND is not set
+# CONFIG_NUMA is not set
+# CONFIG_DEMANGLE is not set
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+# CONFIG_TUI is not set
+# CONFIG_GTK2 is not set
+
+#
+# Build
+#
+CONFIG_DEBUG=y
+# CONFIG_DEBUG_PARSER is not set
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index 937e432..d701dcf 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -8,6 +8,8 @@
#include <linux/perf_event.h>
#include <asm/unistd.h>

+#include "generated/autoconf.h"
+
#if defined(__i386__)
#define mb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
#define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
@@ -181,7 +183,7 @@ sys_perf_event_open(struct perf_event_attr *attr,
fd = syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags);

-#ifdef HAVE_ATTR_TEST
+#ifdef CONFIG_BUILTIN_TEST
if (unlikely(test_attr__enabled))
test_attr__open(attr, pid, cpu, fd, group_fd, flags);
#endif
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild b/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
new file mode 100644
index 0000000..fd9aa3c
--- /dev/null
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
@@ -0,0 +1,6 @@
+obj-y += Context.o
+
+CFLAGS_Context.o := $(PERL_EMBED_CCOPTS)
+CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs
+CFLAGS_Context.o += -Wno-undef -Wno-switch-default
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Kbuild b/tools/perf/scripts/python/Perf-Trace-Util/Kbuild
new file mode 100644
index 0000000..7884730
--- /dev/null
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Kbuild
@@ -0,0 +1,5 @@
+obj-y += Context.o
+
+CFLAGS_Context.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs
diff --git a/tools/perf/tests/Kbuild b/tools/perf/tests/Kbuild
new file mode 100644
index 0000000..9f56ce8
--- /dev/null
+++ b/tools/perf/tests/Kbuild
@@ -0,0 +1,38 @@
+obj-y += builtin-test.o
+obj-y += attr.o
+obj-y += dso-data.o
+obj-y += evsel-roundtrip-name.o
+obj-y += evsel-tp-sched.o
+obj-y += fdarray.o
+obj-y += hists_link.o
+obj-y += mmap-basic.o
+obj-y += open-syscall-all-cpus.o
+obj-y += open-syscall.o
+obj-y += open-syscall-tp-fields.o
+obj-y += parse-events.o
+obj-y += perf-record.o
+obj-y += pmu.o
+obj-y += python-use.o
+obj-y += rdpmc.o
+obj-y += vmlinux-kallsyms.o
+obj-y += bp_signal.o
+obj-y += bp_signal_overflow.o
+obj-y += sw-clock.o
+obj-y += task-exit.o
+obj-y += code-reading.o
+obj-y += sample-parsing.o
+obj-y += keep-tracking.o
+obj-y += parse-no-sample-id-all.o
+obj-y += mmap-thread-lookup.o
+obj-y += thread-mg-share.o
+obj-y += switch-tracking.o
+obj-y += hists_output.o
+obj-y += hists_cumulate.o
+obj-y += hists_common.o
+obj-y += hists_filter.o
+
+CFLAGS_python-use.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
+CFLAGS_python-use.o += -D"PYTHONPATH=KBUILD_STR(python)"
+
+CFLAGS_attr.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
+CFLAGS_attr.o += -D"BINDIR=KBUILD_STR($(bindir_SQ))"
diff --git a/tools/perf/ui/Kbuild b/tools/perf/ui/Kbuild
new file mode 100644
index 0000000..44ad988
--- /dev/null
+++ b/tools/perf/ui/Kbuild
@@ -0,0 +1,15 @@
+obj-$(CONFIG_TUI) += browser.o
+obj-y += helpline.o
+obj-y += hist.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
+
+obj-y += browsers/
+obj-y += stdio/
+
+obj-$(CONFIG_TUI) += tui/
+obj-$(CONFIG_GTK2) += gtk/
+
+CFLAGS_browser.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_setup.o += -D"LIBDIR=KBUILD_STR($(libdir_SQ))"
\ No newline at end of file
diff --git a/tools/perf/ui/browsers/Kbuild b/tools/perf/ui/browsers/Kbuild
new file mode 100644
index 0000000..3a5fd55
--- /dev/null
+++ b/tools/perf/ui/browsers/Kbuild
@@ -0,0 +1,9 @@
+obj-$(CONFIG_TUI) += annotate.o
+obj-$(CONFIG_TUI) += header.o
+obj-$(CONFIG_TUI) += hists.o
+obj-$(CONFIG_TUI) += map.o
+obj-$(CONFIG_TUI) += scripts.o
+
+CFLAGS_hists.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_map.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_scripts.o += -DENABLE_SLFUTURE_CONST
diff --git a/tools/perf/ui/gtk/Kbuild b/tools/perf/ui/gtk/Kbuild
new file mode 100644
index 0000000..83e3e58
--- /dev/null
+++ b/tools/perf/ui/gtk/Kbuild
@@ -0,0 +1,9 @@
+obj-y += browser.o
+obj-y += hists.o
+obj-y += setup.o
+obj-y += util.o
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += annotate.o
+
+subdir-ccflags-y := $(GTK_CFLAGS)
\ No newline at end of file
diff --git a/tools/perf/ui/stdio/Kbuild b/tools/perf/ui/stdio/Kbuild
new file mode 100644
index 0000000..9de4bd9
--- /dev/null
+++ b/tools/perf/ui/stdio/Kbuild
@@ -0,0 +1 @@
+obj-y += hist.o
diff --git a/tools/perf/ui/tui/Kbuild b/tools/perf/ui/tui/Kbuild
new file mode 100644
index 0000000..e282409
--- /dev/null
+++ b/tools/perf/ui/tui/Kbuild
@@ -0,0 +1,4 @@
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
diff --git a/tools/perf/util/Kbuild b/tools/perf/util/Kbuild
new file mode 100644
index 0000000..98526db
--- /dev/null
+++ b/tools/perf/util/Kbuild
@@ -0,0 +1,125 @@
+obj-y += abspath.o
+obj-y += alias.o
+obj-y += annotate.o
+obj-y += bitmap.o
+obj-y += build-id.o
+obj-y += callchain.o
+obj-y += cgroup.o
+obj-y += color.o
+obj-y += comm.o
+obj-y += config.o
+obj-y += cpumap.o
+obj-y += ctype.o
+obj-y += debug.o
+obj-y += dso.o
+obj-y += environment.o
+obj-y += event.o
+obj-y += evlist.o
+obj-y += evsel.o
+obj-y += exec_cmd.o
+obj-y += header.o
+obj-y += help.o
+obj-y += hist.o
+obj-y += hweight.o
+obj-y += intlist.o
+obj-y += levenshtein.o
+obj-y += machine.o
+obj-y += map.o
+obj-y += pager.o
+obj-y += parse-options.o
+obj-y += path.o
+obj-y += pmu-flex.o
+obj-y += pmu-bison.o
+obj-y += pmu.o
+obj-y += pstack.o
+obj-y += quote.o
+obj-y += rblist.o
+obj-y += run-command.o
+obj-y += session.o
+obj-y += ordered-events.o
+obj-y += sigchain.o
+obj-y += sort.o
+obj-y += stat.o
+obj-y += record.o
+obj-y += srcline.o
+obj-y += data.o
+obj-y += strbuf.o
+obj-y += strfilter.o
+obj-y += string.o
+obj-y += strlist.o
+obj-y += svghelper.o
+obj-y += symbol.o
+obj-y += perf_regs.o
+obj-y += tsc.o
+obj-y += cloexec.o
+
+obj-$(CONFIG_LIBUNWIND) += unwind.o
+
+obj-$(CONFIG_LIBELF) += symbol-elf.o
+obj-$(CONFIG_LIBELF) += dwarf-aux.o
+obj-$(CONFIG_LIBELF) += probe-event.o
+obj-$(CONFIG_LIBELF) += probe-finder.o
+
+obj-$(CONFIG_LIBELF_MINIMAL) += symbol-minimal.o
+
+obj-y += target.o
+obj-y += thread.o
+obj-y += thread_map.o
+obj-y += top.o
+obj-y += usage.o
+obj-y += util.o
+obj-y += values.o
+obj-y += xyarray.o
+obj-y += vdso.o
+obj-y += wrapper.o
+obj-y += trace-event.o
+obj-y += trace-event-info.o
+obj-y += trace-event-parse.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += trace-event-scripting.o
+obj-y += trace-event-read.o
+
+obj-$(CONFIG_BUILTIN_SCRIPT) += scripting-engines/
+
+define bison
+$(Q)echo ' BI $@'
+$(Q)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) -o $@ -p $1
+endef
+
+define flex
+$(Q)echo ' FL $@';
+$(Q)$(FLEX) --header-file=$(basename $@).h $(PARSER_DEBUG_FLEX) -t $< > $@
+endef
+
+obj-y += parse-events-flex.o
+obj-y += parse-events-bison.o
+obj-y += parse-events.o
+
+$(obj)/parse-events-bison.c: $(src)/parse-events.y
+ $(call bison,parse_events_)
+
+$(obj)/parse-events-flex.c: $(src)/parse-events.l $(obj)/parse-events-bison.c
+ $(call flex)
+
+$(src)/parse-events-flex.o: $(src)/parse-events-flex.c
+$(src)/parse-events-bison.o: $(src)/parse-events-bison.c
+
+$(src)/parse-events.o: $(src)/parse-events-flex.o
+
+$(src)/pmu-bison.c: $(src)/pmu.y
+ $(call bison,perf_pmu_)
+
+$(src)/pmu-flex.c: $(src)/pmu.l $(src)/pmu-bison.c
+ $(call flex)
+
+$(src)/pmu-flex.o: $(src)/pmu-flex.c
+$(src)/pmu-bison.o: $(src)/pmu-bison.c
+
+CFLAGS_parse-events-flex.o += -w
+CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+CFLAGS_parse-events.o += -Wno-redundant-decls
+CFLAGS_pmu-flex.o += -w
+CFLAGS_pmu-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+
+CFLAGS_config.o += -D"ETC_PERFCONFIG=KBUILD_STR($(ETC_PERFCONFIG_SQ))"
+CFLAGS_exec_cmd.o += -D"PERF_EXEC_PATH=KBUILD_STR($(perfexecdir_SQ))"
+CFLAGS_exec_cmd.o += -D"PREFIX=KBUILD_STR($(prefix_SQ))"
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 39f1750..efb74f0 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -9,6 +9,10 @@ GVF=${OUTPUT}PERF-VERSION-FILE
LF='
'

+if [ "${srctree}x" = "x" ]; then
+srctree=../..
+fi
+
#
# First check if there is a .git to get the version from git describe
# otherwise try to get the version from the kernel Makefile
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 05ee30f..5d84ffc 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -15,7 +15,7 @@ struct cmdname_help

static struct cmdname_help common_cmds[] = {"

-sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' $1/command-list.txt |
sort |
while read cmd
do
@@ -26,12 +26,12 @@ do
x
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/perf-$cmd.txt"
+ }' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done

echo "#ifdef HAVE_LIBELF_SUPPORT"
-sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' $1/command-list.txt |
sort |
while read cmd
do
@@ -42,7 +42,7 @@ do
x
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/perf-$cmd.txt"
+ }' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done
echo "#endif /* HAVE_LIBELF_SUPPORT */"
diff --git a/tools/perf/util/scripting-engines/Kbuild b/tools/perf/util/scripting-engines/Kbuild
new file mode 100644
index 0000000..ebe216c
--- /dev/null
+++ b/tools/perf/util/scripting-engines/Kbuild
@@ -0,0 +1,11 @@
+obj-$(CONFIG_LIBPERL) += trace-event-perl.o
+obj-$(CONFIG_LIBPYTHON) += trace-event-python.o
+
+CFLAGS_trace-event-perl.o := $(PERL_EMBED_CCOPTS)
+CFLAGS_trace-event-perl.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_trace-event-perl.o += -Wno-unused-parameter -Wno-shadow -Wno-undef
+CFLAGS_trace-event-perl.o += -Wno-switch-default
+
+CFLAGS_trace-event-python.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_trace-event-python.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_trace-event-python.o += -Wno-unused-parameter -Wno-shadow
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index d0aee4b..a5c73de 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -2,6 +2,7 @@

from distutils.core import setup, Extension
from os import getenv
+from os import environ

from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
@@ -27,8 +28,11 @@ build_tmp = getenv('PYTHON_EXTBUILD_TMP')
libtraceevent = getenv('LIBTRACEEVENT')
libapikfs = getenv('LIBAPIKFS')

-ext_sources = [f.strip() for f in file('util/python-ext-sources')
- if len(f.strip()) > 0 and f[0] != '#']
+if environ.has_key('PYTHON_EXT_SRCS'):
+ ext_sources = getenv('PYTHON_EXT_SRCS').split()
+else:
+ ext_sources = [f.strip() for f in file('util/python-ext-sources')
+ if len(f.strip()) > 0 and f[0] != '#']

perf = Extension('perf',
sources = ext_sources,
--
2.1.1

2014-10-23 22:31:11

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 03/14] perf tools: Kbuild source related fixies

From: Jiri Olsa <[email protected]>

Fixing several sources config dependencies to allow
separate config builds.

This commit was originally created by Jiri Olsa in 2013. Minor changes
were needed to get it working one year later:
* Remove #ifdef directives related with GUI / TUI (because of code
changes in ui/setup.c)
* Fix a link issue if the option BUILTIN_TRACE is disabled.
* Fix typo (CONFIG_BULTIN_ instead CONFIG_BUILTIN_)

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-annotate.c | 6 +++---
tools/perf/builtin-lock.c | 5 ++++-
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-sched.c | 3 +++
tools/perf/builtin-top.c | 4 ++--
tools/perf/perf.c | 10 ++++++++--
tools/perf/ui/browsers/scripts.c | 4 ++++
tools/perf/ui/setup.c | 6 +++---
8 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 19cb967..a46af8f 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -155,7 +155,7 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
} else if (use_browser == 1) {
struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
@@ -303,9 +303,9 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
-#endif /* CONFIG_TUI */
+#endif
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index e7ec715..05c0e1c 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "builtin-cmds.h"
#include "perf.h"

#include "util/evlist.h"
@@ -995,9 +996,11 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
usage_with_options(report_usage, report_options);
}
rc = __cmd_report(false);
+#ifdef CONFIG_BUILTIN_SCRIPT
} else if (!strcmp(argv[0], "script")) {
/* Aliased to 'perf script' */
- return cmd_script(argc, argv, prefix);
+ rc = cmd_script(argc, argv, prefix);
+#endif
} else if (!strcmp(argv[0], "info")) {
if (argc) {
argc = parse_options(argc, argv,
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 00d93ff..b639e58 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -407,7 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 891c393..e38b021 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "builtin-cmds.h"
#include "perf.h"

#include "util/util.h"
@@ -1742,11 +1743,13 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
if (!argc)
usage_with_options(sched_usage, sched_options);

+#ifdef CONFIG_BUILTIN_SCRIPT
/*
* Aliased to 'perf script' for now:
*/
if (!strcmp(argv[0], "script"))
return cmd_script(argc, argv, prefix);
+#endif

if (!strncmp(argv[0], "rec", 3)) {
return __cmd_record(argc, argv);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a2ff8b7..6f04452 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -535,7 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -981,7 +981,7 @@ static int __cmd_top(struct perf_top *top)

ret = -1;

-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
if (use_browser > 0)
display_fn = display_thread_tui;
#endif
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index ab363b5..976ded6 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -93,8 +93,10 @@ static struct cmd_struct commands[] = {
#ifdef CONFIG_BUILTIN_KVM
{ "kvm", cmd_kvm, 0 },
#endif
+#ifdef CONFIG_BUILTIN_TEST
{ "test", cmd_test, 0 },
-#if defined HAVE_LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
+#endif
+#ifdef CONFIG_BUILTIN_TRACE
{ "trace", cmd_trace, 0 },
#endif
#ifdef CONFIG_BUILTIN_INJECT
@@ -539,7 +541,7 @@ int main(int argc, const char **argv)
goto out;
}
if (!prefixcmp(cmd, "trace")) {
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#ifdef CONFIG_BUILTIN_TRACE
set_buildid_dir();
setup_path();
argv[0] = "trace";
@@ -563,13 +565,17 @@ int main(int argc, const char **argv)
} else {
/* The user didn't specify a command; give them help */
printf("\n usage: %s\n\n", perf_usage_string);
+#ifdef CONFIG_BUILTIN_HELP
list_common_cmds_help();
printf("\n %s\n\n", perf_more_info_string);
+#endif
goto out;
}
cmd = argv[0];

+#ifdef CONFIG_BUILTIN_TEST
test_attr__init();
+#endif

/*
* We use PATH to find perf commands, but we prepend some higher
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 402d2bd..128988d 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -59,7 +59,11 @@ static int list_scripts(char *script_name)
paths[i] = names[i] + SCRIPT_NAMELEN;
}

+#ifdef CONFIG_BUILTIN_SCRIPT
num = find_scripts(names, paths);
+#else
+ num = 0;
+#endif
if (num > 0) {
choice = ui__popup_menu(num, names);
if (choice < num && choice >= 0) {
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ec7fd36..efc2b21 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,7 +77,7 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
use_browser = 1;
if (ui__init() == 0)
@@ -92,13 +92,13 @@ void setup_browser(bool fallback_to_pager)
}
}

-void exit_browser(bool wait_for_ok)
+void exit_browser(bool wait_for_ok __maybe_unused)
{
switch (use_browser) {
case 2:
exit_gtk_browser(wait_for_ok);
break;
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
ui__exit(wait_for_ok);
break;
--
2.1.1

2014-10-23 22:31:24

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 07/14] perf kbuild: remove legacy demangle-related build variables

Remove NO_DEMANGLE (replaced by CONFIG_DEMANGLE)
Remove HAVE_LIBBFD_SUPPORT (replaced by CONFIG_LIBBFD)
Remove HAVE_CPLUS_DEMANGLE_SUPPORT (replaced by CONFIG_LIBIBERTY_ONLY)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 36 +++++++++++++++++++++------
tools/perf/config/Makefile | 46 ++++++++++++++++++-----------------
tools/perf/config/Makefile.fix-legacy | 4 ---
tools/perf/util/srcline.c | 8 +++---
tools/perf/util/symbol.h | 25 +++++++++++++------
5 files changed, 75 insertions(+), 44 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index eb59567..026ef67 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -225,6 +225,35 @@ config LIBPYTHON
---help---
Libpython dependency needed by the perf script feature.

+config TIMERFD
+ bool "Timer via file descriptor"
+ default y
+ ---help---
+ Timer via file descriptor
+
+config DEMANGLE
+ bool "Demangle symbols"
+ default y
+ ---help---
+ Enable demangling so as to display human-readable
+ symbols. This option is convenient with C++ programs.
+
+choice DEMANGLE_DEPS
+ prompt "Demangle dependency(ies)"
+ depends on DEMANGLE
+ default LIBBFD
+
+config LIBBFD
+ bool "BFD + libiberty libraries"
+ ---help---
+ Binary File Descriptor and libiberty libraries
+
+config LIBIBERTY_ONLY
+ bool "Libiberty only"
+ ---help---
+ Libiberty
+endchoice
+
choice
prompt "Elf library"
default LIBELF
@@ -266,13 +295,6 @@ config NUMA
The library libnuma offers facilities to configure NUMA
policies supported by the linux kernel.

-config DEMANGLE
- bool "Demangle symbols"
- default y
- ---help---
- Enable demangling so as to display human-readable
- symbols. This option is convenient with C++ programs.
-
config BIONIC
bool "Bionic support"
default n
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 27b092c..ce3a726 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -573,33 +573,36 @@ ifeq ($(feature-libbfd), 1)
endif
endif

-ifdef NO_DEMANGLE
- CFLAGS += -DNO_DEMANGLE
-else
- ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
- EXTLIBS += -liberty
- CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
- else
- ifneq ($(feature-libbfd), 1)
- ifneq ($(feature-liberty), 1)
- ifneq ($(feature-liberty-z), 1)
- # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
- # or any of 'bfd iberty z' trinity
- ifeq ($(feature-cplus-demangle), 1)
- EXTLIBS += -liberty
- CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
- else
- msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
- CFLAGS += -DNO_DEMANGLE
- endif
+ifdef CONFIG_LIBBFD
+ ifneq ($(feature-libbfd), 1)
+ # TODO: there might be an issue here: feature-liberty and
+ # feature-liberty-z cannot be set; they can be set only if
+ # feature-libbfd is set
+ ifneq ($(feature-liberty), 1)
+ ifneq ($(feature-liberty-z), 1)
+ # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
+ # or any of 'bfd iberty z' trinity
+ ifeq ($(feature-cplus-demangle), 1)
+ EXTLIBS += -liberty
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBBFD)
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBIBERTY_ONLY)
+ else
+ msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_DEMANGLE)
endif
endif
endif
endif
endif

-ifneq ($(filter -lbfd,$(EXTLIBS)),)
- CFLAGS += -DHAVE_LIBBFD_SUPPORT
+ifdef CONFIG_LIBIBERTY_ONLY
+ $(call feature_check,cplus-demangle)
+ ifeq ($(feature-cplus-demangle), 1)
+ EXTLIBS += -liberty
+ else
+ msg := $(warning No libiberty found, install binutils-dev[el]/zlib-static to gain symbol demangling)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_DEMANGLE)
+ endif
endif

ifndef NO_BACKTRACE
@@ -795,7 +798,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_DEMANGLE)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
$(call store,NO_BACKTRACE)
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index ca219e7..64dbb1a 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,10 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_DEMANGLE
-NO_DEMANGLE := 1
-endif
-
ifndef CONFIG_LIBELF
NO_LIBELF := 1
endif
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index f3e4bc5..38df8f4 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -4,11 +4,13 @@

#include <linux/kernel.h>

+#include "generated/autoconf.h"
+
#include "util/dso.h"
#include "util/util.h"
#include "util/debug.h"

-#ifdef HAVE_LIBBFD_SUPPORT
+#ifdef CONFIG_LIBBFD

/*
* Implement addr2line using libbfd.
@@ -189,7 +191,7 @@ void dso__free_a2l(struct dso *dso)
dso->a2l = NULL;
}

-#else /* HAVE_LIBBFD_SUPPORT */
+#else /* !CONFIG_LIBBFD */

static int addr2line(const char *dso_name, unsigned long addr,
char **file, unsigned int *line_nr,
@@ -242,7 +244,7 @@ void dso__free_a2l(struct dso *dso __maybe_unused)
{
}

-#endif /* HAVE_LIBBFD_SUPPORT */
+#endif /* CONFIG_LIBBFD */

/*
* Number of addr2line failures (without success) before disabling it for that
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index eb2c19b..7e3a003 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -1,6 +1,8 @@
#ifndef __PERF_SYMBOL
#define __PERF_SYMBOL 1

+#include "generated/autoconf.h"
+
#include <linux/types.h>
#include <stdbool.h>
#include <stdint.h>
@@ -23,26 +25,33 @@

#include "dso.h"

-#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
+#ifdef CONFIG_DEMANGLE
+
+#ifdef CONFIG_LIBBFD
+
+#define PACKAGE 'perf'
+#include <bfd.h>
+
+#elif defined(CONFIG_LIBIBERTY_ONLY)
extern char *cplus_demangle(const char *, int);

static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
{
return cplus_demangle(c, i);
}
-#else
-#ifdef NO_DEMANGLE
+
+#else /* Unknown dependency */
+#error "Inconsistent demangling configuration"
+#endif
+
+#else /* !CONFIG_DEMANGLE */
static inline char *bfd_demangle(void __maybe_unused *v,
const char __maybe_unused *c,
int __maybe_unused i)
{
return NULL;
}
-#else
-#define PACKAGE 'perf'
-#include <bfd.h>
-#endif
-#endif
+#endif /* CONFIG_DEMANGLE */

/*
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
--
2.1.1

2014-10-23 22:31:36

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 13/14] perf kbuild: final cosmetic changes

* Correctly rename internal makefile variables
* Remove makefiles in tools/perf/config which became empty and useless
* Remove builtin-cmds.h
* Remove arch/x86/Makefile
* Improve outputs of clean and install targets
* Remove creation of PERF-FEATURES file which is redundant with the
.config file generated by Kconfig.
* replace HAVE_KVM_STAT_SUPPORT by a Kconfig option
* replace HAVE_SKIP_CALLCHAIN_IDX by a Kconfig option

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 7 ++++
tools/perf/Makefile.kbuild | 74 ++++++++++++++++++--------------
tools/perf/arch/s390/util/Kbuild | 2 +-
tools/perf/arch/x86/Makefile | 17 --------
tools/perf/arch/x86/util/Kbuild | 2 +-
tools/perf/builtin-cmds.h | 6 ---
tools/perf/builtin-help.c | 2 +-
tools/perf/builtin-kvm.c | 6 +--
tools/perf/builtin-lock.c | 2 +-
tools/perf/builtin-sched.c | 2 +-
tools/perf/config/Makefile | 79 +++++++++++------------------------
tools/perf/config/Makefile.fix-config | 6 ---
tools/perf/config/Makefile.fix-legacy | 2 -
tools/perf/perf.c | 2 +-
14 files changed, 83 insertions(+), 126 deletions(-)
delete mode 100644 tools/perf/arch/x86/Makefile
delete mode 100644 tools/perf/builtin-cmds.h
delete mode 100644 tools/perf/config/Makefile.fix-config
delete mode 100644 tools/perf/config/Makefile.fix-legacy

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 54a194d..d1b44c3 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -128,6 +128,13 @@ config BUILTIN_KVM
---help---
Tool to trace/measure kvm guest os

+config BUILTIN_KVM_STAT
+ bool "kvm-stat"
+ default y
+ depends on BUILTIN_KVM && (ARCH = "x86" || ARCH = "s390")
+ ---help---
+ Get performance counter statistics on a kvm guest os.
+
config BUILTIN_LIST
bool "list"
default y
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index b48fe7f..90b168d 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -1,6 +1,5 @@
srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
-
VPATH := $(srctree)

export srctree VPATH
@@ -36,7 +35,8 @@ export quiet Q KBUILD_VERBOSE
ifndef V
QUIET_LINK = @echo ' LD $@';
QUIET_GEN = @echo ' GEN $@';
-QUIET_CLEAN = @echo ' CLEAN tools/perf';
+QUIET_CLEAN = @printf ' CLEAN %s\n' $1;
+QUIET_INSTALL = @printf ' INSTALL %s\n' $1;
endif

export QUIET_BISON QUIET_FLEX
@@ -158,7 +158,6 @@ $(CONFIG_DETECTED): $(KCONFIG_CONFIG)
# no need to include auto.conf.cmd, because .config
# is the only dependency here
$(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
- $(Q)$(MAKE) -f $(src-perf)/config/Makefile.fix-config
$(Q)mkdir -p $(obj-perf)/include/config
$(Q)mkdir -p $(obj-perf)/include/generated
$(Q)$(MAKE) -s $(build)=scripts/kconfig silentoldconfig
@@ -167,22 +166,26 @@ $(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
clean-dirs := $(addprefix _clean_, tools/perf/)

$(clean-dirs):
+ $(call QUIET_CLEAN, core-objs)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)

-clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean
- $(Q)$(QUIET_CLEAN)
- $(Q)rm -f $(obj-perf)/perf
- $(Q)rm -f $(obj-perf)/common-cmds.h
- $(Q)rm -f $(obj-perf)/python/perf.so
+config-clean:
+ $(call QUIET_CLEAN, config)
+ @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
$(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+ $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
+ $(Q)rm -f $(obj-perf)/common-cmds.h
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
+ $(call QUIET_CLEAN, core-progs)
+ $(Q)rm -f $(obj-perf)/perf
+ $(call QUIET_CLEAN, misc)
$(Q)find $(obj-perf) \
\( -name '*.[oas]' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' \
-o -name '*-flex.[ch]' -o -name '*-bison.[ch]' \
\) -type f -print | xargs rm -f
- $(Q)$(python-clean)
- $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
- @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
+ $(python-clean)

TAGS tags:
$(Q)rm -f $(src-perf)/tags
@@ -257,7 +260,7 @@ PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/

export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP

-python-clean := rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so
+python-clean := $(call QUIET_CLEAN, python) rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so

PYTHON_EXT_SRCS := $(addprefix $(src-perf)/,$(shell grep -v ^\# $(src-perf)/util/python-ext-sources))
PYTHON_EXT_DEPS := $(src-perf)/util/python-ext-sources $(src-perf)/util/setup.py
@@ -343,25 +346,34 @@ $(SCRIPTS) : % : %.sh
all: $(SCRIPTS)

install-bin: all
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
- $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
- $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
- $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
- $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
- $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
- $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
- $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
- $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(call QUIET_INSTALL, binaries) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' ; \
+ $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)' ; \
+ ln '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
+ $(call QUIET_INSTALL, libexec) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(call QUIET_INSTALL, perf-archive) \
+ $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(call QUIET_INSTALL, perl-scripts) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(call QUIET_INSTALL, python-scripts) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' ; \
+ $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' ; \
+ $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(call QUIET_INSTALL, perf_completion-script) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d' ; \
+ $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(call QUIET_INSTALL, tests) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' ; \
+ $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' ; \
+ $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'

install: install-bin try-install-man $(LIBTRACEEVENT)-install

diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
index 73df1ff..833e3b8 100644
--- a/tools/perf/arch/s390/util/Kbuild
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -1,2 +1,2 @@
-obj-y += kvm-stat.o
+obj-$(CONFIG_BUILTIN_KVM_STAT) += kvm-stat.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
deleted file mode 100644
index af36aad..0000000
--- a/tools/perf/arch/x86/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-ifeq ($(LIBDWARF), 1)
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifeq ($(LIBUNWIND), 1)
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifeq ($(LIBDWARF_UNWIND), 1)
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
-LIB_H += arch/$(ARCH)/util/tsc.h
-HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
index adca885..fe382ce 100644
--- a/tools/perf/arch/x86/util/Kbuild
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -1,6 +1,6 @@
obj-y += header.o
obj-y += tsc.o
-obj-y += kvm-stat.o
+obj-$(CONFIG_BUILTIN_KVM_STAT) += kvm-stat.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
deleted file mode 100644
index 863727f..0000000
--- a/tools/perf/builtin-cmds.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef BUILTIN_CMDS_H
-#define BUILTIN_CMDS_H
-
-#include "generated/autoconf.h"
-
-#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index fbbbaa4..3e9854c 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -3,11 +3,11 @@
*
* Builtin help command
*/
+#include "generated/autoconf.h"
#include "perf.h"
#include "util/cache.h"
#include "builtin.h"
#include "util/exec_cmd.h"
-#include "builtin-cmds.h"
#include "common-cmds.h"
#include "util/parse-options.h"
#include "util/run-command.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 28371f9..4d59f98 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -30,7 +30,7 @@
#include <pthread.h>
#include <math.h>

-#ifdef HAVE_KVM_STAT_SUPPORT
+#ifdef CONFIG_BUILTIN_KVM_STAT
#include <asm/kvm_perf.h>
#include "util/kvm-stat.h"

@@ -1423,7 +1423,7 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
perf_stat:
return cmd_stat(argc, argv, NULL);
}
-#endif /* HAVE_KVM_STAT_SUPPORT */
+#endif /* CONFIG_BUILTIN_KVM_STAT */

static int __cmd_record(const char *file_name, int argc, const char **argv)
{
@@ -1545,7 +1545,7 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
if (!strncmp(argv[0], "buildid-list", 12))
return __cmd_buildid_list(file_name, argc, argv);

-#ifdef HAVE_KVM_STAT_SUPPORT
+#ifdef CONFIG_BUILTIN_KVM_STAT
if (!strncmp(argv[0], "stat", 4))
return kvm_cmd_stat(file_name, argc, argv);
#endif
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 05c0e1c..5181224 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,5 +1,5 @@
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"
#include "perf.h"

#include "util/evlist.h"
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index e38b021..02b3bfe 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1,5 +1,5 @@
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"
#include "perf.h"

#include "util/util.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 00d118c..0b59225 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,10 +34,14 @@ ifeq ($(ARCH),arm64)
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

+ifdef KCONFIG_CONFIG
+include $(KCONFIG_CONFIG)
+endif
+
ifeq ($(LIBUNWIND_LIBS),)
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
else
- LIBUNWIND = 1
+ config-libunwind = 1
#
# For linking with debug library, run like:
#
@@ -65,10 +69,6 @@ ifdef CONFIG_LIBELF
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif

-ifdef KCONFIG_CONFIG
-include $(src-perf)/config/Makefile.fix-legacy
-endif
-
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

@@ -297,12 +297,12 @@ endif
ifdef CONFIG_LIBELF
ifeq ($(feature-libelf), 0)
ifeq ($(feature-glibc), 1)
- LIBC_SUPPORT := 1
+ config-libc := 1
endif
ifeq ($(BIONIC),1)
- LIBC_SUPPORT := 1
+ config-libc := 1
endif
- ifeq ($(LIBC_SUPPORT),1)
+ ifeq ($(config-libc),1)
msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF)
$(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBELF_MINIMAL)
@@ -315,27 +315,27 @@ ifdef CONFIG_LIBELF
endif
endif
else
- LIBELF = 1
+ config-libelf = 1
ifdef CONFIG_LIBDWARF
ifneq ($(feature-dwarf), 1)
msg := $(warning 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);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF)
else
- LIBDWARF = 1
+ config-libdwarf = 1
endif # Dwarf support
ifdef CONFIG_LIBDWARF_UNWIND
ifneq ($(feature-libdw-dwarf-unwind),1)
msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set CONFIG_LIBDWARF_DIR);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF_UNWIND)
else
- LIBDWARF_UNWIND = 1
+ config-libdwarf-unwind = 1
endif # Dwarf unwind support detected
endif # CONFIG_LIBDWARF_UNWIND
endif # CONFIG_LIBDWARF
endif # libelf support
endif # CONFIG_LIBELF

-ifeq ($(LIBELF), 1)
+ifeq ($(config-libelf), 1)

ifdef CONFIG_LIBELF_MMAP
ifneq ($(feature-libelf-mmap), 1)
@@ -343,16 +343,16 @@ ifeq ($(LIBELF), 1)
endif
endif

- ifdef CONFIG_LIBELF_MMAP
+ ifdef CONFIG_LIBELF_GETPHDRNUM
ifneq ($(feature-libelf-getphdrnum), 1)
- $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_GETPHDRNUM)
endif
endif

# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

- ifeq ($(LIBDWARF), 1)
+ ifeq ($(config-libdwarf), 1)
CFLAGS += $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += -lelf -ldw
@@ -363,17 +363,17 @@ ifdef CONFIG_UNWIND
# CONFIG_LIBUNWIND is the default choice; so, if it is not
# available, let's try another one
ifdef CONFIG_LIBUNWIND
- ifeq ($(LIBUNWIND), 1)
+ ifeq ($(config-libunwind), 1)
ifneq ($(feature-libunwind), 1)
- LIBUNWIND = 0
+ config-libunwind = 0
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
- ifeq ($(LIBDWARF_UNWIND), 1)
+ ifeq ($(config-libdwarf-unwind), 1)
msg := $(warning No libunwind found, post unwind will rely on libdwarf-unwind. Please install libunwind-dev[el] >= 1.1);
$(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBDWARF_UNWIND)
else
msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
- endif # LIBDWARF_UNWIND
+ endif # config-libdwarf-unwind
else # feature-libunwind OK
EXTLIBS += $(LIBUNWIND_LIBS)
CFLAGS += $(LIBUNWIND_CFLAGS)
@@ -385,7 +385,7 @@ ifdef CONFIG_UNWIND
# CONFIG_LIBDWARF_UNWIND is not the default choice (so the user's
# choice); so, we disable CONFIG_UNWIND if it is not available
ifdef CONFIG_LIBDWARF_UNWIND
- ifneq ($(LIBDWARF_UNWIND), 1)
+ ifneq ($(config-libdwarf-unwind), 1)
msg := $(warning Disabling post unwing because (libdwarf-unwind is not available));
$(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
endif
@@ -393,7 +393,7 @@ ifdef CONFIG_UNWIND

# if libunwind is OK, let's check the option DEBUG_FRAME
ifdef CONFIG_LIBUNWIND
- ifeq ($(LIBUNWIND), 1)
+ ifeq ($(config-libunwind), 1)
ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
$(call feature_check,libunwind-debug-frame)
ifneq ($(feature-libunwind-debug-frame), 1)
@@ -410,11 +410,11 @@ ifdef CONFIG_UNWIND
dwarf-post-unwind = 0
dwarf-post-unwind-text = BUG

-ifeq ($(LIBUNWIND), 1)
+ifeq ($(config-libunwind), 1)
dwarf-post-unwind := 1
dwarf-post-unwind-text := libunwind
else
- ifeq ($(LIBDWARF_UNWIND), 1)
+ ifeq ($(config-libdwarf-unwind), 1)
dwarf-post-unwind := 1
dwarf-post-unwind-text := libdw
endif
@@ -590,10 +590,6 @@ ifdef CONFIG_LIBNUMA
endif
endif

-ifdef HAVE_KVM_STAT_SUPPORT
- CFLAGS += -DHAVE_KVM_STAT_SUPPORT
-endif
-
# Among the variables below, these:
# perfexecdir
# template_dir
@@ -685,36 +681,9 @@ define feature_print_text_code
MSG = $(shell printf '...%30s: %s' $(1) $(2))
endef

-PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
-PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
-
-ifeq ($(dwarf-post-unwind),1)
- PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text))
-endif
-
-# The $(display_lib) controls the default detection message
-# output. It's set if:
-# - detected features differes from stored features from
-# last build (in PERF-FEATURES file)
-# - one of the $(LIB_FEATURE_TESTS) is not detected
-# - VF is enabled
-
-ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
- $(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES)
- display_lib := 1
-endif
-
-feature_check = $(eval $(feature_check_code))
-define feature_check_code
- ifneq ($(feature-$(1)), 1)
- display_lib := 1
- endif
-endef
-
-$(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_check,$(feat)))
+display_lib := 1

ifeq ($(VF),1)
- display_lib := 1
display_vf := 1
endif

diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
deleted file mode 100644
index 3f0e33e..0000000
--- a/tools/perf/config/Makefile.fix-config
+++ /dev/null
@@ -1,6 +0,0 @@
-include $(CONFIG_DETECTED)
-include $(KCONFIG_CONFIG)
-
-CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
-
-all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
deleted file mode 100644
index 431c9bf..0000000
--- a/tools/perf/config/Makefile.fix-legacy
+++ /dev/null
@@ -1,2 +0,0 @@
-
-include $(KCONFIG_CONFIG)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index b4fd910..69e9b9d 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -6,8 +6,8 @@
* This is the main hub from which the sub-commands (perf stat,
* perf top, perf record, perf report, etc.) are started.
*/
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"

#include "util/exec_cmd.h"
#include "util/cache.h"
--
2.1.1

2014-10-23 22:31:31

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 12/14] perf kbuild: remove legacy script-related build variables

Remove NO_LIBPERL (replaced by CONFIG_LIBPERL)
Remove NO_LIBPYTHON (replaced by CONFIG_LIBPYTHON)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-script.c | 6 +++--
tools/perf/config/Makefile | 41 +++++++++------------------------
tools/perf/config/Makefile.fix-config | 16 -------------
tools/perf/config/Makefile.fix-legacy | 8 -------
tools/perf/util/trace-event-scripting.c | 13 ++++++-----
5 files changed, 22 insertions(+), 62 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 9708a12..cc9c305 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "builtin.h"

#include "perf.h"
@@ -1372,11 +1374,11 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next) {
snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
lang_dirent.d_name);
-#ifdef NO_LIBPERL
+#ifndef CONFIG_LIBPERL
if (strstr(lang_path, "perl"))
continue;
#endif
-#ifdef NO_LIBPYTHON
+#ifndef CONFIG_LIBPYTHON
if (strstr(lang_path, "python"))
continue;
#endif
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index f667229..00d118c 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -101,7 +101,7 @@ ifdef PARSER_DEBUG
CFLAGS += -DPARSER_DEBUG
endif

-ifndef NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
# Try different combinations to accommodate systems that only have
# python[2][-config] in weird combinations but always preferring
# python2 and python2-config as per pep-0394. If we catch a
@@ -460,9 +460,7 @@ endif
grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))

-ifdef NO_LIBPERL
- CFLAGS += -DNO_LIBPERL
-else
+ifdef CONFIG_LIBPERL
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
@@ -470,9 +468,8 @@ else
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)

ifneq ($(feature-libperl), 1)
- CFLAGS += -DNO_LIBPERL
- NO_LIBPERL := 1
msg := $(warning Missing perl devel files. Disabling perl scripting support, consider installing perl-ExtUtils-Embed);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBPERL)
else
LDFLAGS += $(PERL_EMBED_LDFLAGS)
EXTLIBS += $(PERL_EMBED_LIBADD)
@@ -486,17 +483,14 @@ ifdef CONFIG_TIMERFD
endif
endif

-disable-python = $(eval $(disable-python_code))
-define disable-python_code
- CFLAGS += -DNO_LIBPYTHON
- $(if $(1),$(warning No $(1) was found))
- $(warning Python support will not be built)
- NO_LIBPYTHON := 1
-endef
+ifdef CONFIG_LIBPYTHON

-ifdef NO_LIBPYTHON
- $(call disable-python)
-else
+ disable-python = $(eval $(disable-python_code))
+ define disable-python_code
+ $(if $(1),$(warning No $(1) was found))
+ $(warning Python support will not be built)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBPYTHON)
+ endef

ifndef PYTHON
$(call disable-python,python interpreter)
@@ -520,18 +514,7 @@ else
else

ifneq ($(feature-libpython-version), 1)
- $(warning Python 3 is not yet supported; please set)
- $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
- $(warning If you also have Python 2 installed, then)
- $(warning try something like:)
- $(warning $(and ,))
- $(warning $(and ,) make PYTHON=python2)
- $(warning $(and ,))
- $(warning Otherwise, disable Python support entirely:)
- $(warning $(and ,))
- $(warning $(and ,) make NO_LIBPYTHON=1)
- $(warning $(and ,))
- $(error $(and ,))
+ $(call disable-python,python2 interpreter)
else
LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
EXTLIBS += $(PYTHON_EMBED_LIBADD)
@@ -781,8 +764,6 @@ all:
$(call store,PYTHON_EMBED_CCOPTS)
$(call store,PERL_EMBED_CCOPTS)
$(call store,NO_LIBUNWIND)
- $(call store,NO_LIBPERL)
- $(call store,NO_LIBPYTHON)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
$(call store,bindir_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index e63539f..3f0e33e 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -3,20 +3,4 @@ include $(KCONFIG_CONFIG)

CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)

-# NO_LIBPERL
-ifdef CONFIG_LIBPERL
-ifdef NO_LIBPERL
-dummy := $(info Disabling CONFIG_LIBPERL)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBPERL)
-endif
-endif
-
-# NO_LIBPYTHON
-ifdef CONFIG_LIBPYTHON
-ifdef NO_LIBPYTHON
-dummy := $(info Disabling CONFIG_LIBPYTHON)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 20a4062..431c9bf 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -1,10 +1,2 @@

include $(KCONFIG_CONFIG)
-
-ifndef CONFIG_LIBPERL
-NO_LIBPERL := 1
-endif
-
-ifndef CONFIG_LIBPYTHON
-NO_LIBPYTHON := 1
-endif
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 5c9bdd1..a8319bb 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <errno.h>

+#include "generated/autoconf.h"
#include "../perf.h"
#include "util.h"
#include "trace-event.h"
@@ -99,7 +100,7 @@ static void register_python_scripting(struct scripting_ops *scripting_ops)
scripting_context = malloc(sizeof(struct scripting_context));
}

-#ifdef NO_LIBPYTHON
+#ifndef CONFIG_LIBPYTHON
void setup_python_scripting(void)
{
register_python_scripting(&python_scripting_unsupported_ops);
@@ -163,16 +164,16 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops)
scripting_context = malloc(sizeof(struct scripting_context));
}

-#ifdef NO_LIBPERL
+#ifdef CONFIG_LIBPERL
+extern struct scripting_ops perl_scripting_ops;
+
void setup_perl_scripting(void)
{
- register_perl_scripting(&perl_scripting_unsupported_ops);
+ register_perl_scripting(&perl_scripting_ops);
}
#else
-extern struct scripting_ops perl_scripting_ops;
-
void setup_perl_scripting(void)
{
- register_perl_scripting(&perl_scripting_ops);
+ register_perl_scripting(&perl_scripting_unsupported_ops);
}
#endif
--
2.1.1

2014-10-23 22:31:43

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 14/14] perf kbuild: add generated Kconfig build-test cases

Thanks to the python module kconfiglib, we were able to generate build
configurations. The set is, of course, not exhaustive but for each
option, all the possible states are tested.

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/MANIFEST | 1 +
tools/perf/tests/configs/MINIMAL_config | 60 ++++++++++++++++++
tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++++++++++++++++++++++
.../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++++++++++++++++++++++
.../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 +++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_DEMANGLE_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_GTK2_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBAUDIT_config | 72 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBDWARF_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBGTK2_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBPERL_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBSLANG_config | 72 +++++++++++++++++++++
.../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_STDIO_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_TIMERFD_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_TUI_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_UNWIND_config | 69 ++++++++++++++++++++
tools/perf/tests/configs/REF_config | 73 ++++++++++++++++++++++
tools/perf/tests/generate_configs.py | 43 +++++++++++++
tools/perf/tests/make | 70 ++++++---------------
47 files changed, 3227 insertions(+), 50 deletions(-)
create mode 100644 tools/perf/tests/configs/MINIMAL_config
create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
create mode 100644 tools/perf/tests/configs/NO_GTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
create mode 100644 tools/perf/tests/configs/NO_STDIO_config
create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
create mode 100644 tools/perf/tests/configs/NO_TUI_config
create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
create mode 100644 tools/perf/tests/configs/REF_config
create mode 100644 tools/perf/tests/generate_configs.py

diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 344c4d3..def2b5b 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -1,3 +1,4 @@
+scripts
tools/perf
tools/scripts
tools/lib/traceevent
diff --git a/tools/perf/tests/configs/MINIMAL_config b/tools/perf/tests/configs/MINIMAL_config
new file mode 100644
index 0000000..fa6503e
--- /dev/null
+++ b/tools/perf/tests/configs/MINIMAL_config
@@ -0,0 +1,60 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# The perf configuration
+#
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+
+#
+# Libraries / Dependencies
+#
+# CONFIG_LIBSLANG is not set
+# CONFIG_LIBAUDIT is not set
+# CONFIG_LIBGTK2 is not set
+# CONFIG_LIBPERL is not set
+# CONFIG_LIBPYTHON is not set
+# CONFIG_TIMERFD is not set
+# CONFIG_LIBELF is not set
+CONFIG_LIBELF_MINIMAL=y
+# CONFIG_LIBNUMA is not set
+# CONFIG_BIONIC is not set
+# CONFIG_PERF_REGS is not set
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BACKTRACE_config b/tools/perf/tests/configs/NO_BACKTRACE_config
new file mode 100644
index 0000000..e0be1a4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BACKTRACE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+# CONFIG_BACKTRACE is not set
diff --git a/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config b/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
new file mode 100644
index 0000000..4d38fb4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+# CONFIG_BUILTIN_ANNOTATE is not set
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BENCH_config b/tools/perf/tests/configs/NO_BUILTIN_BENCH_config
new file mode 100644
index 0000000..38a0cf2
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BENCH_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+# CONFIG_BUILTIN_BENCH is not set
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
new file mode 100644
index 0000000..d41e3e5
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+# CONFIG_BUILTIN_BUILDID_CACHE is not set
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
new file mode 100644
index 0000000..f8c7a98
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+# CONFIG_BUILTIN_BUILDID_LIST is not set
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_DIFF_config b/tools/perf/tests/configs/NO_BUILTIN_DIFF_config
new file mode 100644
index 0000000..4fdb2ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_DIFF_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+# CONFIG_BUILTIN_DIFF is not set
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config b/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
new file mode 100644
index 0000000..4d474a6
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+# CONFIG_BUILTIN_EVLIST is not set
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_HELP_config b/tools/perf/tests/configs/NO_BUILTIN_HELP_config
new file mode 100644
index 0000000..9611823
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_HELP_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+# CONFIG_BUILTIN_HELP is not set
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_INJECT_config b/tools/perf/tests/configs/NO_BUILTIN_INJECT_config
new file mode 100644
index 0000000..ac9e908
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_INJECT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+# CONFIG_BUILTIN_INJECT is not set
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KMEM_config b/tools/perf/tests/configs/NO_BUILTIN_KMEM_config
new file mode 100644
index 0000000..e808a30
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KMEM_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+# CONFIG_BUILTIN_KMEM is not set
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config b/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
new file mode 100644
index 0000000..b7d36d5
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+# CONFIG_BUILTIN_KVM_STAT is not set
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KVM_config b/tools/perf/tests/configs/NO_BUILTIN_KVM_config
new file mode 100644
index 0000000..dc47acb
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KVM_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+# CONFIG_BUILTIN_KVM is not set
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_LIST_config b/tools/perf/tests/configs/NO_BUILTIN_LIST_config
new file mode 100644
index 0000000..a573501
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_LIST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+# CONFIG_BUILTIN_LIST is not set
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_LOCK_config b/tools/perf/tests/configs/NO_BUILTIN_LOCK_config
new file mode 100644
index 0000000..6b3a100
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_LOCK_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+# CONFIG_BUILTIN_LOCK is not set
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_MEM_config b/tools/perf/tests/configs/NO_BUILTIN_MEM_config
new file mode 100644
index 0000000..247ab6e
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_MEM_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+# CONFIG_BUILTIN_MEM is not set
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_PROBE_config b/tools/perf/tests/configs/NO_BUILTIN_PROBE_config
new file mode 100644
index 0000000..19a083b
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_PROBE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+# CONFIG_BUILTIN_PROBE is not set
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_RECORD_config b/tools/perf/tests/configs/NO_BUILTIN_RECORD_config
new file mode 100644
index 0000000..151c0f7
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_RECORD_config
@@ -0,0 +1,63 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+# CONFIG_BUILTIN_RECORD is not set
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_REPORT_config b/tools/perf/tests/configs/NO_BUILTIN_REPORT_config
new file mode 100644
index 0000000..88c2c17
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_REPORT_config
@@ -0,0 +1,68 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+# CONFIG_BUILTIN_REPORT is not set
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_SCHED_config b/tools/perf/tests/configs/NO_BUILTIN_SCHED_config
new file mode 100644
index 0000000..ded3e68
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_SCHED_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+# CONFIG_BUILTIN_SCHED is not set
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config b/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
new file mode 100644
index 0000000..369c58e
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+# CONFIG_BUILTIN_SCRIPT is not set
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_STAT_config b/tools/perf/tests/configs/NO_BUILTIN_STAT_config
new file mode 100644
index 0000000..147f3ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_STAT_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+# CONFIG_BUILTIN_STAT is not set
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TEST_config b/tools/perf/tests/configs/NO_BUILTIN_TEST_config
new file mode 100644
index 0000000..66acb87
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TEST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+# CONFIG_BUILTIN_TEST is not set
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config b/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
new file mode 100644
index 0000000..04dba98
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+# CONFIG_BUILTIN_TIMECHART is not set
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TOP_config b/tools/perf/tests/configs/NO_BUILTIN_TOP_config
new file mode 100644
index 0000000..0af5579
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TOP_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+# CONFIG_BUILTIN_TOP is not set
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TRACE_config b/tools/perf/tests/configs/NO_BUILTIN_TRACE_config
new file mode 100644
index 0000000..5717064
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TRACE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+# CONFIG_BUILTIN_TRACE is not set
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_DEMANGLE_config b/tools/perf/tests/configs/NO_DEMANGLE_config
new file mode 100644
index 0000000..47c8263
--- /dev/null
+++ b/tools/perf/tests/configs/NO_DEMANGLE_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+# CONFIG_DEMANGLE is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_GTK2_config b/tools/perf/tests/configs/NO_GTK2_config
new file mode 100644
index 0000000..529872b
--- /dev/null
+++ b/tools/perf/tests/configs/NO_GTK2_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+# CONFIG_GTK2 is not set
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBAUDIT_config b/tools/perf/tests/configs/NO_LIBAUDIT_config
new file mode 100644
index 0000000..c7db9d2
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBAUDIT_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+# CONFIG_LIBAUDIT is not set
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBDWARF_config b/tools/perf/tests/configs/NO_LIBDWARF_config
new file mode 100644
index 0000000..45cb7c8
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBDWARF_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+# CONFIG_LIBDWARF is not set
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBELF_MMAP_config b/tools/perf/tests/configs/NO_LIBELF_MMAP_config
new file mode 100644
index 0000000..ec83684
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBELF_MMAP_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+# CONFIG_LIBELF_MMAP is not set
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config b/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
new file mode 100644
index 0000000..9b62c67
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+# CONFIG_LIBGTK2_INFOBAR is not set
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBGTK2_config b/tools/perf/tests/configs/NO_LIBGTK2_config
new file mode 100644
index 0000000..c16fc4d
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBGTK2_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+# CONFIG_LIBGTK2 is not set
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBNUMA_config b/tools/perf/tests/configs/NO_LIBNUMA_config
new file mode 100644
index 0000000..c3006b4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBNUMA_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+# CONFIG_LIBNUMA is not set
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBPERL_config b/tools/perf/tests/configs/NO_LIBPERL_config
new file mode 100644
index 0000000..317d3f28
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBPERL_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+# CONFIG_LIBPERL is not set
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBPYTHON_config b/tools/perf/tests/configs/NO_LIBPYTHON_config
new file mode 100644
index 0000000..a63acb3
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBPYTHON_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+# CONFIG_LIBPYTHON is not set
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBSLANG_config b/tools/perf/tests/configs/NO_LIBSLANG_config
new file mode 100644
index 0000000..fa7726c
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBSLANG_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+# CONFIG_LIBSLANG is not set
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config b/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
new file mode 100644
index 0000000..837a80f
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+# CONFIG_LIBUNWIND_DEBUG_FRAME is not set
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_PERF_REGS_config b/tools/perf/tests/configs/NO_PERF_REGS_config
new file mode 100644
index 0000000..eae8a16
--- /dev/null
+++ b/tools/perf/tests/configs/NO_PERF_REGS_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+# CONFIG_PERF_REGS is not set
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_STDIO_config b/tools/perf/tests/configs/NO_STDIO_config
new file mode 100644
index 0000000..b80e1ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_STDIO_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+# CONFIG_STDIO is not set
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_TIMERFD_config b/tools/perf/tests/configs/NO_TIMERFD_config
new file mode 100644
index 0000000..4a0d134
--- /dev/null
+++ b/tools/perf/tests/configs/NO_TIMERFD_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+# CONFIG_TIMERFD is not set
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_TUI_config b/tools/perf/tests/configs/NO_TUI_config
new file mode 100644
index 0000000..be233df
--- /dev/null
+++ b/tools/perf/tests/configs/NO_TUI_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+# CONFIG_TUI is not set
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_UNWIND_config b/tools/perf/tests/configs/NO_UNWIND_config
new file mode 100644
index 0000000..caefd3a
--- /dev/null
+++ b/tools/perf/tests/configs/NO_UNWIND_config
@@ -0,0 +1,69 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+# CONFIG_UNWIND is not set
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/REF_config b/tools/perf/tests/configs/REF_config
new file mode 100644
index 0000000..7708411
--- /dev/null
+++ b/tools/perf/tests/configs/REF_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/generate_configs.py b/tools/perf/tests/generate_configs.py
new file mode 100644
index 0000000..4502ecd
--- /dev/null
+++ b/tools/perf/tests/generate_configs.py
@@ -0,0 +1,43 @@
+import os
+import sys
+import itertools
+import kconfiglib
+
+# Let's set some environment variables to define the target
+# architecture; we choose x86 because, so far, nearly all features are
+# available on x86.
+os.environ['ARCH'] = 'x86'
+os.environ['IS_X86_64'] = '1'
+os.environ['CROSS_COMPILE'] = ''
+
+# Load Kconfig pattern
+ref_config = kconfiglib.Config(sys.argv[1])
+
+# Generate defconfig (by default, all options are set to y)
+ref_config.write_config('REF_config')
+
+# Get all the symbols
+symbols = dict([(s.get_name(), s) for s in ref_config.get_symbols()])
+
+# Remove odd symbols
+symbols.pop('y', None)
+symbols.pop('m', None)
+symbols.pop('n', None)
+
+# Remove choice-related symbols
+choices = ref_config.get_choices()
+items = [c.get_items() for c in choices]
+names = [i.get_name() for i in itertools.chain.from_iterable(items)]
+for name in names:
+ symbols.pop(name, None)
+
+for name in symbols:
+ symbol = symbols[name]
+ if not symbol.is_modifiable():
+ continue
+ if symbol.get_value() != 'y':
+ continue
+ symbol.set_user_value('n')
+ filename = 'NO_' + name + '_config'
+ ref_config.write_config(filename)
+ symbol.set_user_value('y')
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 69a71ff..7779fda 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -11,34 +11,17 @@ else
lib = lib
endif

+list = $(shell ls $1 2>/dev/null)
has = $(shell which $1 2>/dev/null)

# standard single make variable specified
+make_pure :=
make_clean_all := clean all
make_python_perf_so := python/perf.so
-make_debug := DEBUG=1
-make_no_libperl := NO_LIBPERL=1
-make_no_libpython := NO_LIBPYTHON=1
-make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
-make_no_newt := NO_NEWT=1
-make_no_slang := NO_SLANG=1
-make_no_gtk2 := NO_GTK2=1
-make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
-make_no_demangle := NO_DEMANGLE=1
-make_no_libelf := NO_LIBELF=1
-make_no_libunwind := NO_LIBUNWIND=1
-make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1
-make_no_backtrace := NO_BACKTRACE=1
-make_no_libnuma := NO_LIBNUMA=1
-make_no_libaudit := NO_LIBAUDIT=1
-make_no_libbionic := NO_LIBBIONIC=1
make_tags := tags
make_cscope := cscope
make_help := help
make_doc := doc
-make_perf_o := perf.o
-make_util_map_o := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
make_install := install
make_install_bin := install-bin
make_install_doc := install-doc
@@ -48,37 +31,11 @@ make_install_info := install-info
make_install_pdf := install-pdf
make_static := LDFLAGS=-static

-# all the NO_* variable combined
-make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
-make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
-make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
-make_minimal += NO_LIBDW_DWARF_UNWIND=1
-
# $(run) contains all available tests
run := make_pure
run += make_clean_all
-run += make_python_perf_so
-run += make_debug
-run += make_no_libperl
-run += make_no_libpython
-run += make_no_scripts
-run += make_no_newt
-run += make_no_slang
-run += make_no_gtk2
-run += make_no_ui
-run += make_no_demangle
-run += make_no_libelf
-run += make_no_libunwind
-run += make_no_libdw_dwarf_unwind
-run += make_no_backtrace
-run += make_no_libnuma
-run += make_no_libaudit
-run += make_no_libbionic
run += make_help
run += make_doc
-run += make_perf_o
-run += make_util_map_o
-run += make_util_pmu_bison_o
run += make_install
run += make_install_bin
# FIXME 'install-*' commented out till they're fixed
@@ -87,8 +44,7 @@ run += make_install_bin
# run += make_install_html
# run += make_install_info
# run += make_install_pdf
-run += make_minimal
-run += make_static
+# run += make_static

ifneq ($(call has,ctags),)
run += make_tags
@@ -104,6 +60,10 @@ run_O := $(addsuffix _O,$(run))
# disable some tests for O=...
run_O := $(filter-out make_python_perf_so_O,$(run_O))

+# $(run_CONFIGS) is a set of automatically-generated Kconfig
+# configurations
+run_CONFIGS := $(call list,$(PERF)/tests/configs/)
+
# define test for each compile as 'test_NAME' variable
# with the test itself as a value
test_make_tags = test -f tags
@@ -183,7 +143,7 @@ test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
test_default = test -x $(PERF)/perf
test = $(if $(test_$1),$(test_$1),$(test_default))

-test_default_O = test -x $$TMP_O/perf
+test_default_O = test -x $$TMP_O/tools/perf/perf
test_O = $(if $(test_$1),$(test_$1),$(test_default_O))

all:
@@ -218,13 +178,23 @@ $(run_O):
$(call test_O,$@) && \
rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false)

+$(run_CONFIGS):
+ $(call clean)
+ @TMP_DEST=$$(mktemp -d); \
+ cmd="cd $(PERF) && cp tests/configs/$@ .config && make -f $(MK) JOBS=4 DESTDIR=$$TMP_DEST $($@)"; \
+ echo "- $@: $$cmd" && echo $$cmd > $@ && \
+ ( eval $$cmd ) >> $@ 2>&1; \
+ echo " test: $(call test,$@)" >> $@ 2>&1; \
+ $(call test,$@) && \
+ rm -f $@ \
+ rm -rf $$TMP_DEST
+
tarpkg:
@cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \
echo "- $@: $$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1
-

-all: $(run) $(run_O) tarpkg
+all: $(run) $(run_O) $(run_CONFIGS) tarpkg
@echo OK

out: $(run_O)
--
2.1.1

2014-10-23 22:31:28

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 10/14] perf kbuild: remove legacy libelf-related build variables

Remove NO_LIBELF (replaced by CONFIG_LIBELF)
Remove HAVE_LIBELF_SUPPORT (replaced by CONFIG_LIBELF)
Remove HAVE_LIBELF_MMAP_SUPPORT (replaced by CONFIG_LIBELF_MMAP)
Remove HAVE_LIBELF_GETPHDRNUM__SUPPORT (replaced by
CONFIG_LIBELF_GETPHDRNUM_)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 23 ++++++++++++++++++++++
tools/perf/builtin-inject.c | 2 +-
tools/perf/config/Makefile | 37 +++++++++++++++--------------------
tools/perf/config/Makefile.fix-config | 18 -----------------
tools/perf/config/Makefile.fix-legacy | 4 ----
tools/perf/perf.c | 2 +-
tools/perf/util/generate-cmdlist.sh | 4 ++--
tools/perf/util/map.c | 3 ++-
tools/perf/util/symbol-elf.c | 3 ++-
tools/perf/util/symbol.h | 8 ++++----
10 files changed, 51 insertions(+), 53 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 29853a6..2eaf3ca 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -256,6 +256,7 @@ config TIMERFD
Timer via file descriptor

config DEMANGLE
+ depends on LIBELF
bool "Demangle symbols"
default y
---help---
@@ -298,7 +299,29 @@ choice
Builtin elf support.
endchoice

+config LIBELF_MMAP
+ depends on LIBELF
+ bool "Libelf mmap support"
+ default y
+ ---help---
+ libdelf mmap
+
+config LIBELF_GETPHDRNUM
+ depends on LIBELF
+ default y
+ bool "Libelf getphdrnum support"
+ ---help---
+ libdelf mmap
+
+config LIBDWARF
+ depends on LIBELF
+ bool "Dwarf (libdwarf)"
+ default y
+ ---help---
+ libdwarf
+
config LIBUNWIND
+ depends on LIBELF
bool "User space libunwind callchains"
default y
---help---
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index de99ca1..9d59c7f 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -230,7 +230,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
* account this as unresolved.
*/
} else {
-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
pr_warning("no symbols found in %s, maybe "
"install a debug package?\n",
al.map->dso->long_name);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 5be574c3..79fe047 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -303,12 +303,7 @@ ifdef CONFIG_BIONIC
endif
endif

-ifdef NO_LIBELF
- NO_DWARF := 1
- NO_DEMANGLE := 1
- NO_LIBUNWIND := 1
- NO_LIBDW_DWARF_UNWIND := 1
-else
+ifdef CONFIG_LIBELF
ifeq ($(feature-libelf), 0)
ifeq ($(feature-glibc), 1)
LIBC_SUPPORT := 1
@@ -318,12 +313,9 @@ else
endif
ifeq ($(LIBC_SUPPORT),1)
msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
-
- NO_LIBELF := 1
- NO_DWARF := 1
- NO_DEMANGLE := 1
- NO_LIBUNWIND := 1
- NO_LIBDW_DWARF_UNWIND := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF)
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBELF_MINIMAL)
+ EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
else
ifneq ($(filter s% -static%,$(LDFLAGS),),)
msg := $(error No static glibc found, please install glibc-static);
@@ -332,6 +324,7 @@ else
endif
endif
else
+ LIBELF = 1
ifndef NO_LIBDW_DWARF_UNWIND
ifneq ($(feature-libdw-dwarf-unwind),1)
NO_LIBDW_DWARF_UNWIND := 1
@@ -343,17 +336,20 @@ else
NO_DWARF := 1
endif # Dwarf support
endif # libelf support
-endif # NO_LIBELF
+endif # CONFIG_LIBELF

-ifndef NO_LIBELF
- CFLAGS += -DHAVE_LIBELF_SUPPORT
+ifeq ($(LIBELF), 1)

- ifeq ($(feature-libelf-mmap), 1)
- CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
+ ifdef CONFIG_LIBELF_MMAP
+ ifneq ($(feature-libelf-mmap), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ endif
endif

- ifeq ($(feature-libelf-getphdrnum), 1)
- CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
+ ifdef CONFIG_LIBELF_MMAP
+ ifneq ($(feature-libelf-getphdrnum), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ endif
endif

# include ARCH specific config
@@ -369,7 +365,7 @@ ifndef NO_LIBELF
EXTLIBS += -lelf -ldw
endif # PERF_HAVE_DWARF_REGS
endif # NO_DWARF
-endif # NO_LIBELF
+endif # LIBELF

ifeq ($(ARCH),powerpc)
ifndef NO_DWARF
@@ -787,7 +783,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 2ba684b..99948b7 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,24 +19,6 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_DEMANGLE
-ifdef CONFIG_DEMANGLE
-ifdef NO_DEMANGLE
-dummy := $(info Disabling CONFIG_DEMANGLE)
-dummy := $(shell $(CONFIG) -d CONFIG_DEMANGLE)
-endif
-endif
-
-# NO_LIBELF
-ifdef CONFIG_LIBELF
-ifdef NO_LIBELF
-dummy := $(info Disabling CONFIG_LIBELF)
-dummy := $(info Enabling CONFIG_LIBELF_MINIMAL)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBELF)
-dummy := $(shell $(CONFIG) -e CONFIG_LIBELF_MINIMAL)
-endif
-endif
-
# NO_LIBUNWIND
ifdef CONFIG_LIBUNWIND
ifdef NO_LIBUNWIND
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 8e32b74..8568d37 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,10 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_LIBELF
-NO_LIBELF := 1
-endif
-
ifndef CONFIG_LIBUNWIND
NO_LIBUNWIND := 1
endif
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 976ded6..b4fd910 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -81,7 +81,7 @@ static struct cmd_struct commands[] = {
#ifdef CONFIG_BUILTIN_SCHED
{ "sched", cmd_sched, 0 },
#endif
-#if defined HAVE_LIBELF_SUPPORT && defined CONFIG_BUILTIN_PROBE
+#if defined CONFIG_LIBELF && defined CONFIG_BUILTIN_PROBE
{ "probe", cmd_probe, 0 },
#endif
#ifdef CONFIG_BUILTIN_KMEM
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 5d84ffc..a8dbdc2 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -30,7 +30,7 @@ do
echo "#endif"
done

-echo "#ifdef HAVE_LIBELF_SUPPORT"
+echo "#ifdef CONFIG_LIBELF"
sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' $1/command-list.txt |
sort |
while read cmd
@@ -45,5 +45,5 @@ do
}' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done
-echo "#endif /* HAVE_LIBELF_SUPPORT */"
+echo "#endif /* CONFIG_LIBELF */"
echo "};"
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 2137c45..4164fca 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "symbol.h"
#include <errno.h>
#include <inttypes.h>
@@ -272,7 +273,7 @@ int map__load(struct map *map, symbol_filter_t filter)
pr_warning(", continuing without symbols\n");
return -1;
} else if (nr == 0) {
-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
const size_t len = strlen(name);
const size_t real_len = len - sizeof(DSO__DELETED);

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 1e23a5b..db340ab 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -5,13 +5,14 @@
#include <unistd.h>
#include <inttypes.h>

+#include "generated/autoconf.h"
#include "symbol.h"
#include "machine.h"
#include "vdso.h"
#include <symbol/kallsyms.h>
#include "debug.h"

-#ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
+#ifndef CONFIG_LIBELF_GETPHDRNUM
static int elf_getphdrnum(Elf *elf, size_t *dst)
{
GElf_Ehdr gehdr;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 7e3a003..53bf6df 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -17,7 +17,7 @@
#include "event.h"
#include "util.h"

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
#include <libelf.h>
#include <gelf.h>
#endif
@@ -57,13 +57,13 @@ static inline char *bfd_demangle(void __maybe_unused *v,
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
* for newer versions we can use mmap to reduce memory usage:
*/
-#ifdef HAVE_LIBELF_MMAP_SUPPORT
+#ifdef CONFIG_LIBELF_MMAP
# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
#else
# define PERF_ELF_C_READ_MMAP ELF_C_READ
#endif

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
extern Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
GElf_Shdr *shp, const char *name, size_t *idx);
#endif
@@ -220,7 +220,7 @@ struct symsrc {
int fd;
enum dso_binary_type type;

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
Elf *elf;
GElf_Ehdr ehdr;

--
2.1.1

2014-10-23 22:32:36

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 11/14] perf kbuild: remove legacy libdwarf-related build variables

* Remove NO_DWARF (replaced by CONFIG_LIBDWARF)
* Remove HAVE_DWARF_SUPPORT (replaced by CONFIG_LIBDWARF)
* Remove the useless variable PERF_HAVE_DWARF_REGS
* fix compilation issues if PERF_REGS is disabled

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 59 +++++++++-
tools/perf/arch/arm/tests/Kbuild | 2 +-
tools/perf/arch/arm/util/Kbuild | 4 +-
tools/perf/arch/arm64/util/Kbuild | 2 +-
tools/perf/arch/powerpc/util/Kbuild | 4 +-
tools/perf/arch/s390/util/Kbuild | 2 +-
tools/perf/arch/sh/util/Kbuild | 2 +-
tools/perf/arch/sparc/util/Kbuild | 2 +-
tools/perf/arch/x86/Kbuild | 1 +
tools/perf/arch/x86/Makefile | 8 +-
tools/perf/arch/x86/tests/Kbuild | 2 +-
tools/perf/arch/x86/tests/perf-time-to-tsc.c | 2 +-
tools/perf/arch/x86/util/Kbuild | 3 +-
tools/perf/builtin-probe.c | 15 +--
tools/perf/builtin-record.c | 2 +-
tools/perf/config/Makefile | 170 +++++++++++++--------------
tools/perf/config/Makefile.fix-config | 8 --
tools/perf/config/Makefile.fix-legacy | 4 -
tools/perf/tests/Kbuild | 2 +
tools/perf/tests/builtin-test.c | 3 +-
tools/perf/tests/tests.h | 6 +-
tools/perf/util/Kbuild | 11 +-
tools/perf/util/callchain.c | 11 +-
tools/perf/util/callchain.h | 3 +-
tools/perf/util/include/dwarf-regs.h | 4 +-
tools/perf/util/machine.c | 3 +-
tools/perf/util/perf_regs.c | 2 -
tools/perf/util/probe-event.c | 6 +-
tools/perf/util/probe-finder.h | 5 +-
tools/perf/util/unwind-libunwind.c | 5 +-
tools/perf/util/unwind.h | 7 +-
31 files changed, 203 insertions(+), 157 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 2eaf3ca..54a194d 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -287,7 +287,6 @@ choice
these tasks, perf can rely on either the libelf library or a
minimal builtin support.

-
config LIBELF
bool "elf"
---help---
@@ -318,15 +317,51 @@ config LIBDWARF
bool "Dwarf (libdwarf)"
default y
---help---
- libdwarf
+ A library for parsing DWARF debug information.
+
+config LIBDWARF_DIR
+ string "libdwarf directory"
+ depends on LIBDWARF
+ ---help---
+ Directory holding the libdwarf dependency (headers +
+ libraries)
+
+config UNWIND
+ depends on (LIBELF && PERF_REGS)
+ bool "User space unwind callchains"
+ default y
+ ---help---
+ Enable call-chain unwinding of user-space application.
+
+choice UNWIND_DEPS
+ prompt "Unwind dependency"
+ depends on UNWIND
+ default LIBUNWIND

config LIBUNWIND
- depends on LIBELF
- bool "User space libunwind callchains"
+ depends on (LIBELF && PERF_REGS)
+ bool "Libunwind"
+ ---help---
+ Rely on libunwind post unwind support to determine the
+ call-chain of a user-space program. The library libunwind
+ supports all the architectures.
+
+config LIBDWARF_UNWIND
+ depends on (LIBDWARF && PERF_REGS && (ARCH = "x86" || ARCH = "arm"))
+ bool "Libdwarf unwind"
+ ---help---
+ Rely on lidw DWARF post unwind support to determine the
+ call-chain of a user-space program. So far there's only x86
+ and arm libdw unwind support merged in perf.
+
+endchoice
+
+config LIBUNWIND_DEBUG_FRAME
+ depends on LIBUNWIND
+ bool "libunwind debug frame"
default y
---help---
- The library libunwind provides a portable C API to determine
- the call-chain of a program.
+ libunwind debug frame

config LIBUNWIND_DIR
string "libunwind directory"
@@ -335,6 +370,18 @@ config LIBUNWIND_DIR
Directory holding the libuwind dependency (headers +
libraries).

+config SKIP_CALLCHAIN_IDX
+ depends on (LIBDWARF && ARCH = "powerpc")
+ bool "Skip unnecessary callchain entries thanks to Dwarf"
+ default y
+ ---help---
+ When saving the callchain on Power, the kernel
+ conservatively saves excess entries in the callchain. A few
+ of these entries are needed in some cases but not others. If
+ the unnecessary entries are not ignored, we end up with
+ duplicate arcs in the call-graphs. Use DWARF debug
+ information to skip over any unnecessary callchain entries.
+
config LIBNUMA
bool "Libnuma support"
default y
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
index 1318ed0..f1d8426 100644
--- a/tools/perf/arch/arm/tests/Kbuild
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -1,2 +1,2 @@
obj-$(CONFIG_PERF_REGS) += regs_load.o
-obj-y += dwarf-unwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += dwarf-unwind.o
diff --git a/tools/perf/arch/arm/util/Kbuild b/tools/perf/arch/arm/util/Kbuild
index c96666a..df195c0 100644
--- a/tools/perf/arch/arm/util/Kbuild
+++ b/tools/perf/arch/arm/util/Kbuild
@@ -1,3 +1,3 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
-obj-y += unwind-libdw.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/arch/arm64/util/Kbuild b/tools/perf/arch/arm64/util/Kbuild
index 136bc86..bd35d10 100644
--- a/tools/perf/arch/arm64/util/Kbuild
+++ b/tools/perf/arch/arm64/util/Kbuild
@@ -1,2 +1,2 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/powerpc/util/Kbuild b/tools/perf/arch/powerpc/util/Kbuild
index 244ff2c..f33f79d 100644
--- a/tools/perf/arch/powerpc/util/Kbuild
+++ b/tools/perf/arch/powerpc/util/Kbuild
@@ -1,3 +1,3 @@
obj-y += header.o
-obj-y += skip-callchain-idx.o
-obj-y += dwarf-regs.o
+obj-$(CONFIG_SKIP_CALLCHAIN_IDX) += skip-callchain-idx.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
index 24e8ee7..73df1ff 100644
--- a/tools/perf/arch/s390/util/Kbuild
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -1,2 +1,2 @@
obj-y += kvm-stat.o
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/sh/util/Kbuild b/tools/perf/arch/sh/util/Kbuild
index 8e698ae..930ba99 100644
--- a/tools/perf/arch/sh/util/Kbuild
+++ b/tools/perf/arch/sh/util/Kbuild
@@ -1 +1 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/sparc/util/Kbuild b/tools/perf/arch/sparc/util/Kbuild
index 8e698ae..930ba99 100644
--- a/tools/perf/arch/sparc/util/Kbuild
+++ b/tools/perf/arch/sparc/util/Kbuild
@@ -1 +1 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Kbuild b/tools/perf/arch/x86/Kbuild
index 52fd6fa..f5581bee 100644
--- a/tools/perf/arch/x86/Kbuild
+++ b/tools/perf/arch/x86/Kbuild
@@ -1 +1,2 @@
obj-y += util/
+obj-y += tests/
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 9b21881..af36aad 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,14 +1,12 @@
-ifndef NO_DWARF
+ifeq ($(LIBDWARF), 1)
PERF_HAVE_DWARF_REGS := 1
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
endif
-ifndef NO_LIBUNWIND
+ifeq ($(LIBUNWIND), 1)
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
endif
-ifndef NO_LIBDW_DWARF_UNWIND
+ifeq ($(LIBDWARF_UNWIND), 1)
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-endif
-ifndef NO_DWARF_UNWIND
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
endif
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
index 8287dae..6d06051 100644
--- a/tools/perf/arch/x86/tests/Kbuild
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -1,3 +1,3 @@
obj-y += perf-time-to-tsc.o
obj-$(CONFIG_PERF_REGS) += regs_load.o
-obj-y += dwarf-unwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += dwarf-unwind.o
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
index f238442..4fff792 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -9,7 +9,7 @@
#include "thread_map.h"
#include "cpumap.h"
#include "tsc.h"
-#include "tests.h"
+#include "tests/tests.h"

#define CHECK__(x) { \
while ((x) < 0) { \
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
index c7b86c0..adca885 100644
--- a/tools/perf/arch/x86/util/Kbuild
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -1,5 +1,6 @@
-obj-y += dwarf-regs.o
obj-y += header.o
obj-y += tsc.o
obj-y += kvm-stat.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 04412b4..0a00a4d 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>

+#include "generated/autoconf.h"
#include "perf.h"
#include "builtin.h"
#include "util/util.h"
@@ -180,7 +181,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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
else if (!strcmp(opt->long_name, "module"))
params.uprobes = false;
#endif
@@ -206,7 +207,7 @@ static int opt_set_target(const struct option *opt, const char *str,
return ret;
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
static int opt_show_lines(const struct option *opt __maybe_unused,
const char *str, int unset __maybe_unused)
{
@@ -306,7 +307,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"perf probe [<options>] --line 'LINEDESC'",
"perf probe [<options>] --vars 'PROBEPOINT'",
#endif
@@ -320,7 +321,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT"
" [[NAME=]ARG ...]",
#else
@@ -332,7 +333,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"\t\tSRC:\tSource code path\n"
"\t\tRL:\tRelative line number from function entry.\n"
"\t\tAL:\tAbsolute line number in file.\n"
@@ -345,7 +346,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
OPT_CALLBACK('L', "line", NULL,
"FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
"Show source code lines.", opt_show_lines),
@@ -460,7 +461,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
return ret;
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
if (params.show_lines) {
if (params.mod_events) {
pr_err(" Error: Don't use --line with"
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index dbba96c..bf56425 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -714,7 +714,7 @@ static struct record record = {

#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf";
#else
const char record_callchain_help[] = CALLCHAIN_HELP "fp";
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 79fe047..f667229 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,23 +34,16 @@ ifeq ($(ARCH),arm64)
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

-# So far there's only x86 and arm libdw unwind support merged in perf.
-# Disable it on all other architectures in case libdw unwind
-# support is detected in system. Add supported architectures
-# to the check.
-ifneq ($(ARCH),$(filter $(ARCH),x86 arm))
- NO_LIBDW_DWARF_UNWIND := 1
-endif
-
ifeq ($(LIBUNWIND_LIBS),)
- NO_LIBUNWIND := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
else
+ LIBUNWIND = 1
#
# For linking with debug library, run like:
#
# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
#
- ifdef LIBUNWIND_DIR
+ ifdef CONFIG_LIBUNWIND_DIR
LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
endif
@@ -63,12 +56,10 @@ else
FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
endif

-ifndef NO_LIBELF
- # for linking with debug library, run like:
- # make DEBUG=1 LIBDW_DIR=/opt/libdw/
- ifdef LIBDW_DIR
- LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
- LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
+ifdef CONFIG_LIBELF
+ ifdef CONFIG_LIBDWARF_DIR
+ LIBDW_CFLAGS := -I$(CONFIG_LIBDWARF_DIR)/include
+ LIBDW_LDFLAGS := -L$(CONFIG_LIBDWARF_DIR)/lib
endif
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
@@ -325,16 +316,22 @@ ifdef CONFIG_LIBELF
endif
else
LIBELF = 1
- ifndef NO_LIBDW_DWARF_UNWIND
- ifneq ($(feature-libdw-dwarf-unwind),1)
- NO_LIBDW_DWARF_UNWIND := 1
- msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
- endif
- endif
- ifneq ($(feature-dwarf), 1)
- msg := $(warning 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);
- NO_DWARF := 1
- endif # Dwarf support
+ ifdef CONFIG_LIBDWARF
+ ifneq ($(feature-dwarf), 1)
+ msg := $(warning 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);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF)
+ else
+ LIBDWARF = 1
+ endif # Dwarf support
+ ifdef CONFIG_LIBDWARF_UNWIND
+ ifneq ($(feature-libdw-dwarf-unwind),1)
+ msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set CONFIG_LIBDWARF_DIR);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF_UNWIND)
+ else
+ LIBDWARF_UNWIND = 1
+ endif # Dwarf unwind support detected
+ endif # CONFIG_LIBDWARF_UNWIND
+ endif # CONFIG_LIBDWARF
endif # libelf support
endif # CONFIG_LIBELF

@@ -355,72 +352,75 @@ ifeq ($(LIBELF), 1)
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

- ifndef NO_DWARF
- ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
- msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
- NO_DWARF := 1
- else
- CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
- LDFLAGS += $(LIBDW_LDFLAGS)
- EXTLIBS += -lelf -ldw
- endif # PERF_HAVE_DWARF_REGS
- endif # NO_DWARF
+ ifeq ($(LIBDWARF), 1)
+ CFLAGS += $(LIBDW_CFLAGS)
+ LDFLAGS += $(LIBDW_LDFLAGS)
+ EXTLIBS += -lelf -ldw
+ endif # LIBDWARF
endif # LIBELF

-ifeq ($(ARCH),powerpc)
- ifndef NO_DWARF
- CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
- endif
-endif
-
-ifndef NO_LIBUNWIND
- ifneq ($(feature-libunwind), 1)
- msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
- NO_LIBUNWIND := 1
+ifdef CONFIG_UNWIND
+ # CONFIG_LIBUNWIND is the default choice; so, if it is not
+ # available, let's try another one
+ ifdef CONFIG_LIBUNWIND
+ ifeq ($(LIBUNWIND), 1)
+ ifneq ($(feature-libunwind), 1)
+ LIBUNWIND = 0
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
+ ifeq ($(LIBDWARF_UNWIND), 1)
+ msg := $(warning No libunwind found, post unwind will rely on libdwarf-unwind. Please install libunwind-dev[el] >= 1.1);
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBDWARF_UNWIND)
+ else
+ msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
+ endif # LIBDWARF_UNWIND
+ else # feature-libunwind OK
+ EXTLIBS += $(LIBUNWIND_LIBS)
+ CFLAGS += $(LIBUNWIND_CFLAGS)
+ LDFLAGS += $(LIBUNWIND_LDFLAGS)
+ endif # feature-libunwind
+ endif # LIBUNWIND
+ endif # CONFIG_LIBUNWIND
+
+ # CONFIG_LIBDWARF_UNWIND is not the default choice (so the user's
+ # choice); so, we disable CONFIG_UNWIND if it is not available
+ ifdef CONFIG_LIBDWARF_UNWIND
+ ifneq ($(LIBDWARF_UNWIND), 1)
+ msg := $(warning Disabling post unwing because (libdwarf-unwind is not available));
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
+ endif
+ endif # CONFIG_LIBDWARF_UNWIND
+
+ # if libunwind is OK, let's check the option DEBUG_FRAME
+ ifdef CONFIG_LIBUNWIND
+ ifeq ($(LIBUNWIND), 1)
+ ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
+ $(call feature_check,libunwind-debug-frame)
+ ifneq ($(feature-libunwind-debug-frame), 1)
+ msg := $(warning No debug_frame support found in libunwind);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND_DEBUG_FRAME)
+ endif
+ else
+ # non-ARM has no dwarf_find_debug_frame() function:
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND_DEBUG_FRAME)
+ endif
+ endif
endif
-endif

-dwarf-post-unwind := 1
-dwarf-post-unwind-text := BUG
+dwarf-post-unwind = 0
+dwarf-post-unwind-text = BUG

-# setup DWARF post unwinder
-ifdef NO_LIBUNWIND
- ifdef NO_LIBDW_DWARF_UNWIND
- msg := $(warning Disabling post unwind, no support found.);
- dwarf-post-unwind := 0
- else
- dwarf-post-unwind-text := libdw
- endif
-else
+ifeq ($(LIBUNWIND), 1)
+ dwarf-post-unwind := 1
dwarf-post-unwind-text := libunwind
- # Enable libunwind support by default.
- ifndef NO_LIBDW_DWARF_UNWIND
- NO_LIBDW_DWARF_UNWIND := 1
- endif
-endif
-
-ifeq ($(dwarf-post-unwind),1)
- CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
else
- NO_DWARF_UNWIND := 1
-endif
-
-ifndef NO_LIBUNWIND
- ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
- $(call feature_check,libunwind-debug-frame)
- ifneq ($(feature-libunwind-debug-frame), 1)
- msg := $(warning No debug_frame support found in libunwind);
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
- endif
- else
- # non-ARM has no dwarf_find_debug_frame() function:
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
+ ifeq ($(LIBDWARF_UNWIND), 1)
+ dwarf-post-unwind := 1
+ dwarf-post-unwind-text := libdw
endif
- CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
- EXTLIBS += $(LIBUNWIND_LIBS)
- CFLAGS += $(LIBUNWIND_CFLAGS)
- LDFLAGS += $(LIBUNWIND_LDFLAGS)
-endif
+endif # LIBUNWIND
+
+endif # CONFIG_UNWIND

ifdef CONFIG_LIBAUDIT
ifneq ($(feature-libaudit), 1)
@@ -783,8 +783,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_LIBUNWIND)
- $(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
$(call store,bindir_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 99948b7..e63539f 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,12 +19,4 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_LIBUNWIND
-ifdef CONFIG_LIBUNWIND
-ifdef NO_LIBUNWIND
-dummy := $(info Disabling CONFIG_LIBUNWIND)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 8568d37..20a4062 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -8,7 +8,3 @@ endif
ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif
-
-ifndef CONFIG_LIBUNWIND
-NO_LIBUNWIND := 1
-endif
diff --git a/tools/perf/tests/Kbuild b/tools/perf/tests/Kbuild
index 9f56ce8..f362620 100644
--- a/tools/perf/tests/Kbuild
+++ b/tools/perf/tests/Kbuild
@@ -31,6 +31,8 @@ obj-y += hists_cumulate.o
obj-y += hists_common.o
obj-y += hists_filter.o

+obj-$(LIBDWARF_UNWIND) += dwarf-unwind.o
+
CFLAGS_python-use.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
CFLAGS_python-use.o += -D"PYTHONPATH=KBUILD_STR(python)"

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 162c978..e3e21b1 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -5,6 +5,7 @@
*/
#include <unistd.h>
#include <string.h>
+#include "generated/autoconf.h"
#include "builtin.h"
#include "hist.h"
#include "intlist.h"
@@ -127,7 +128,7 @@ static struct test {
.func = test__parse_no_sample_id_all,
},
#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
{
.desc = "Test dwarf unwind",
.func = test__dwarf_unwind,
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 00e776a..a14555d 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -1,6 +1,8 @@
#ifndef TESTS_H
#define TESTS_H

+#include "generated/autoconf.h"
+
#define TEST_ASSERT_VAL(text, cond) \
do { \
if (!(cond)) { \
@@ -52,12 +54,10 @@ int test__switch_tracking(void);
int test__fdarray__filter(void);
int test__fdarray__add(void);

-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
struct thread;
struct perf_sample;
int test__arch_unwind_sample(struct perf_sample *sample,
struct thread *thread);
#endif
-#endif
#endif /* TESTS_H */
diff --git a/tools/perf/util/Kbuild b/tools/perf/util/Kbuild
index 98526db..4dd3e41 100644
--- a/tools/perf/util/Kbuild
+++ b/tools/perf/util/Kbuild
@@ -49,16 +49,19 @@ obj-y += string.o
obj-y += strlist.o
obj-y += svghelper.o
obj-y += symbol.o
-obj-y += perf_regs.o
obj-y += tsc.o
obj-y += cloexec.o

-obj-$(CONFIG_LIBUNWIND) += unwind.o
+obj-$(CONFIG_PERF_REGS) += perf_regs.o
+
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o

obj-$(CONFIG_LIBELF) += symbol-elf.o
-obj-$(CONFIG_LIBELF) += dwarf-aux.o
obj-$(CONFIG_LIBELF) += probe-event.o
-obj-$(CONFIG_LIBELF) += probe-finder.o
+
+obj-$(CONFIG_LIBDWARF) += dwarf-aux.o
+obj-$(CONFIG_LIBDWARF) += probe-finder.o

obj-$(CONFIG_LIBELF_MINIMAL) += symbol-minimal.o

diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index c84d3f8..b7c06b2 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -17,6 +17,7 @@

#include "asm/bug.h"

+#include "generated/autoconf.h"
#include "hist.h"
#include "util.h"
#include "sort.h"
@@ -25,7 +26,7 @@

__thread struct callchain_cursor callchain_cursor;

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
static int get_stack_size(const char *str, unsigned long *_size)
{
char *endptr;
@@ -51,7 +52,7 @@ static int get_stack_size(const char *str, unsigned long *_size)
max_size, str);
return -1;
}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_LIBDWARF_UNWIND */

int parse_callchain_record_opt(const char *arg)
{
@@ -80,7 +81,7 @@ int parse_callchain_record_opt(const char *arg)
"needed for -g fp\n");
break;

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
/* Dwarf style */
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
const unsigned long default_stack_dump_size = 8192;
@@ -96,7 +97,7 @@ int parse_callchain_record_opt(const char *arg)
ret = get_stack_size(tok, &size);
callchain_param.dump_size = size;
}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_LIBDWARF_UNWIND */
} else {
pr_err("callchain: Unknown --call-graph option "
"value: %s\n", arg);
@@ -208,7 +209,7 @@ int perf_callchain_config(const char *var, const char *value)

if (!strcmp(var, "record-mode"))
return parse_callchain_record_opt(value);
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
if (!strcmp(var, "dump-size")) {
unsigned long size = 0;
int ret;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 94cfefd..d9a9606 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -1,6 +1,7 @@
#ifndef __PERF_CALLCHAIN_H
#define __PERF_CALLCHAIN_H

+#include "generated/autoconf.h"
#include "../perf.h"
#include <linux/list.h>
#include <linux/rbtree.h>
@@ -183,7 +184,7 @@ static inline void callchain_cursor_snapshot(struct callchain_cursor *dest,
dest->nr -= src->pos;
}

-#ifdef HAVE_SKIP_CALLCHAIN_IDX
+#ifdef CONFIG_SKIP_CALLCHAIN_IDX
extern int arch_skip_callchain_idx(struct machine *machine,
struct thread *thread, struct ip_callchain *chain);
#else
diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h
index 8f14965..93cd69c 100644
--- a/tools/perf/util/include/dwarf-regs.h
+++ b/tools/perf/util/include/dwarf-regs.h
@@ -1,7 +1,9 @@
#ifndef _PERF_DWARF_REGS_H_
#define _PERF_DWARF_REGS_H_

-#ifdef HAVE_DWARF_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_LIBDWARF
const char *get_arch_regstr(unsigned int n);
#endif

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 34fc7c8..7804c6d 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "callchain.h"
#include "debug.h"
#include "event.h"
@@ -1407,7 +1408,7 @@ static int machine__resolve_callchain_sample(struct machine *machine,
else
j = chain->nr - i - 1;

-#ifdef HAVE_SKIP_CALLCHAIN_IDX
+#ifdef CONFIG_SKIP_CALLCHAIN_IDX
if (j == skip_idx)
continue;
#endif
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 01720b5..434f85b 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -3,7 +3,6 @@
#include "perf_regs.h"
#include "event.h"

-#ifdef CONFIG_PERF_REGS
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
{
int i, idx = 0;
@@ -27,4 +26,3 @@ out:
*valp = regs->cache_regs[id];
return 0;
}
-#endif /* CONFIG_PERF_REGS */
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index c150ca4..d31d5d0 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -32,6 +32,7 @@
#include <limits.h>
#include <elf.h>

+#include "generated/autoconf.h"
#include "util.h"
#include "event.h"
#include "strlist.h"
@@ -256,8 +257,7 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
clear_probe_trace_event(tevs + i);
}

-#ifdef HAVE_DWARF_SUPPORT
-
+#ifdef CONFIG_LIBDWARF
/* Open new debuginfo of given module */
static struct debuginfo *open_debuginfo(const char *module, bool silent)
{
@@ -799,7 +799,7 @@ out:
return ret;
}

-#else /* !HAVE_DWARF_SUPPORT */
+#else /* !CONFIG_LIBDWARF */

static int
find_perf_probe_point_from_dwarf(struct probe_trace_point *tp __maybe_unused,
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 92590b2..13cb054 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -2,6 +2,7 @@
#define _PROBE_FINDER_H

#include <stdbool.h>
+#include "generated/autoconf.h"
#include "util.h"
#include "intlist.h"
#include "probe-event.h"
@@ -16,7 +17,7 @@ static inline int is_c_varname(const char *name)
return isalpha(name[0]) || name[0] == '_';
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF

#include "dwarf-aux.h"

@@ -107,6 +108,6 @@ struct line_finder {
int found;
};

-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* CONFIG_LIBDWARF */

#endif /*_PROBE_FINDER_H */
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index e060386..dd98eb3 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -24,6 +24,7 @@
#include <linux/list.h>
#include <libunwind.h>
#include <libunwind-ptrace.h>
+#include "generated/autoconf.h"
#include "callchain.h"
#include "thread.h"
#include "session.h"
@@ -261,7 +262,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
return ret;
}

-#ifndef NO_LIBUNWIND_DEBUG_FRAME
+#ifdef CONFIG_LIBUNWIND_DEBUG_FRAME
static int read_unwind_spec_debug_frame(struct dso *dso,
struct machine *machine, u64 *offset)
{
@@ -319,7 +320,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
need_unwind_info, arg);
}

-#ifndef NO_LIBUNWIND_DEBUG_FRAME
+#ifdef CONFIG_LIBUNWIND_DEBUG_FRAME
/* Check the .debug_frame section for unwinding info */
if (!read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
memset(&di, 0, sizeof(di));
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index c17c485..63fdf3c 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -2,6 +2,7 @@
#define __UNWIND_H

#include <linux/types.h>
+#include "generated/autoconf.h"
#include "event.h"
#include "symbol.h"
#include "thread.h"
@@ -14,13 +15,13 @@ struct unwind_entry {

typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_UNWIND
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct machine *machine,
struct thread *thread,
struct perf_sample *data, int max_stack);
/* libunwind specific */
-#ifdef HAVE_LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
int libunwind__arch_reg_id(int regnum);
int unwind__prepare_access(struct thread *thread);
void unwind__finish_access(struct thread *thread);
@@ -50,5 +51,5 @@ static inline int unwind__prepare_access(struct thread *thread __maybe_unused)
}

static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_UNWIND */
#endif /* __UNWIND_H */
--
2.1.1

2014-10-23 22:32:50

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 09/14] perf kbuild: remove legacy misc build variables

Remove NO_LIBAUDIT (replaced by CONFIG_LIBAUDIT)
Remove HAVE_LIBAUDIT_SUPPORT from CFLAGS (replaced by CONFIG_LIBAUDIT)
Remove HAVE_TIMERFD_SUPPORT (replaced by CONFIG_TIMERFD)
Remove HAVE_ON_EXIT_SUPPORT (replaced by CONFIG_ON_EXIT)
Remove HAVE_BACKTRACE_SUPPORT (replaced by CONFIG_BACKTRACE)
Remove HAVE_LIBNUMA_SUPPORT (replaced by CONFIG_LIBNUMA)
Remove NO_BIONIC (replaced by CONFIG_BIONIC)
Remove NO_PERF_REGS (replaced by CONFIG_PERF_REGS)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 12 ++++++++--
tools/perf/arch/arm/tests/Kbuild | 2 +-
tools/perf/arch/x86/tests/Kbuild | 2 +-
tools/perf/bench/Kbuild | 2 +-
tools/perf/builtin-bench.c | 5 ++--
tools/perf/builtin-kvm.c | 13 ++++++-----
tools/perf/builtin-record.c | 2 ++
tools/perf/config/Makefile | 43 +++++++++++++----------------------
tools/perf/config/Makefile.fix-config | 32 --------------------------
tools/perf/config/Makefile.fix-legacy | 16 -------------
tools/perf/util/perf_regs.c | 3 +++
tools/perf/util/perf_regs.h | 6 +++--
tools/perf/util/util.c | 5 ++--
13 files changed, 51 insertions(+), 92 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 5f85923..29853a6 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -312,8 +312,8 @@ config LIBUNWIND_DIR
Directory holding the libuwind dependency (headers +
libraries).

-config NUMA
- bool "Numa support (bench)"
+config LIBNUMA
+ bool "Libnuma support"
default y
---help---
The library libnuma offers facilities to configure NUMA
@@ -327,6 +327,14 @@ config BIONIC
library code developed by Google for their Android operating
system.

+config PERF_REGS
+ bool "Cache register accesses"
+ depends on (ARCH = "x86" || ARCH = "arm" || ARCH = "arm64")
+ default y
+ ---help---
+ Cache register accesses for unwind processing to speed-up
+ performances.
+
endmenu

menu "Build"
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
index 5d63e9d..1318ed0 100644
--- a/tools/perf/arch/arm/tests/Kbuild
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -1,2 +1,2 @@
-obj-y += regs_load.o
+obj-$(CONFIG_PERF_REGS) += regs_load.o
obj-y += dwarf-unwind.o
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
index 3b5aa14..8287dae 100644
--- a/tools/perf/arch/x86/tests/Kbuild
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -1,3 +1,3 @@
obj-y += perf-time-to-tsc.o
-obj-y += regs_load.o
+obj-$(CONFIG_PERF_REGS) += regs_load.o
obj-y += dwarf-unwind.o
diff --git a/tools/perf/bench/Kbuild b/tools/perf/bench/Kbuild
index e604fe2..863646a 100644
--- a/tools/perf/bench/Kbuild
+++ b/tools/perf/bench/Kbuild
@@ -6,7 +6,7 @@ obj-y += futex-hash.o
obj-y += futex-requeue.o
obj-y += futex-wake.o

-obj-$(CONFIG_NUMA) += numa.o
+obj-$(CONFIG_LIBNUMA) += numa.o

obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index b9a56fa..5116d25 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -14,6 +14,7 @@
* numa ... NUMA scheduling and MM performance
* futex ... Futex performance
*/
+#include "generated/autoconf.h"
#include "perf.h"
#include "util/util.h"
#include "util/parse-options.h"
@@ -33,7 +34,7 @@ struct bench {
bench_fn_t fn;
};

-#ifdef HAVE_LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
static struct bench numa_benchmarks[] = {
{ "mem", "Benchmark for NUMA workloads", bench_numa },
{ "all", "Test all NUMA benchmarks", NULL },
@@ -72,7 +73,7 @@ struct collection {
static struct collection collections[] = {
{ "sched", "Scheduler and IPC benchmarks", sched_benchmarks },
{ "mem", "Memory access benchmarks", mem_benchmarks },
-#ifdef HAVE_LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
{ "numa", "NUMA scheduling and MM benchmarks", numa_benchmarks },
#endif
{"futex", "Futex stressing benchmarks", futex_benchmarks },
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 400e92e..28371f9 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "builtin.h"
#include "perf.h"

@@ -20,7 +21,7 @@
#include "util/data.h"

#include <sys/prctl.h>
-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
#include <sys/timerfd.h>
#endif

@@ -123,7 +124,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)
INIT_LIST_HEAD(&kvm->kvm_events_cache[i]);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static void clear_events_cache_stats(struct list_head *kvm_events_cache)
{
struct list_head *head;
@@ -622,7 +623,7 @@ static void print_result(struct perf_kvm_stat *kvm)
pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static int process_lost_event(struct perf_tool *tool,
union perf_event *event __maybe_unused,
struct perf_sample *sample __maybe_unused,
@@ -707,7 +708,7 @@ static bool verify_vcpu(int vcpu)
return true;
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
/* keeping the max events to a modest level to keep
* the processing of samples per mmap smooth.
*/
@@ -1199,7 +1200,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
return kvm_events_report_vcpu(kvm);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static struct perf_evlist *kvm_live_event_list(void)
{
struct perf_evlist *evlist;
@@ -1414,7 +1415,7 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
if (!strncmp(argv[1], "rep", 3))
return kvm_events_report(&kvm, argc - 1 , argv + 1);

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
if (!strncmp(argv[1], "live", 4))
return kvm_events_live(&kvm, argc - 1 , argv + 1);
#endif
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 2583a9b..dbba96c 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -5,6 +5,8 @@
* (or a CPU, or a PID) into the perf.data output file - for
* later analysis via perf report.
*/
+
+#include "generated/autoconf.h"
#include "builtin.h"

#include "perf.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 7f87a45..5be574c3 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -16,8 +16,6 @@ CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)

include $(src-perf)/config/Makefile.arch

-NO_PERF_REGS := 1
-
# Additional ARCH settings for x86
ifeq ($(ARCH),x86)
ifeq ($(IS_X86_64),1)
@@ -26,16 +24,13 @@ ifeq ($(ARCH),x86)
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
- NO_PERF_REGS := 0
endif

ifeq ($(ARCH),arm)
- NO_PERF_REGS := 0
LIBUNWIND_LIBS = -lunwind -lunwind-arm
endif

ifeq ($(ARCH),arm64)
- NO_PERF_REGS := 0
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

@@ -68,10 +63,6 @@ else
FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
endif

-ifeq ($(NO_PERF_REGS),0)
- CFLAGS += -DHAVE_PERF_REGS_SUPPORT
-endif
-
ifndef NO_LIBELF
# for linking with debug library, run like:
# make DEBUG=1 LIBDW_DIR=/opt/libdw/
@@ -301,12 +292,14 @@ ifeq ($(feature-sync-compare-and-swap), 1)
CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
endif

-ifndef NO_BIONIC
+ifdef CONFIG_BIONIC
$(call feature_check,bionic)
ifeq ($(feature-bionic), 1)
BIONIC := 1
EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
+ else
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_BIONIC)
endif
endif

@@ -433,12 +426,11 @@ ifndef NO_LIBUNWIND
LDFLAGS += $(LIBUNWIND_LDFLAGS)
endif

-ifndef NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
ifneq ($(feature-libaudit), 1)
- msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
- NO_LIBAUDIT := 1
+ msg := $(warning No libaudit.h found, disables LIBAUDIT support and 'trace' tool, please install audit-libs-devel or libaudit-dev);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBAUDIT)
else
- CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
EXTLIBS += -laudit
endif
endif
@@ -491,10 +483,11 @@ else
endif
endif

-ifeq ($(feature-timerfd), 1)
- CFLAGS += -DHAVE_TIMERFD_SUPPORT
-else
- msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+ifdef CONFIG_TIMERFD
+ ifneq ($(feature-timerfd), 1)
+ msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_TIMERFD)
+ endif
endif

disable-python = $(eval $(disable-python_code))
@@ -603,18 +596,17 @@ ifdef CONFIG_LIBIBERTY_ONLY
endif
endif

-ifndef NO_BACKTRACE
- ifeq ($(feature-backtrace), 1)
- CFLAGS += -DHAVE_BACKTRACE_SUPPORT
+ifdef CONFIG_BACKTRACE
+ ifneq ($(feature-backtrace), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_BACKTRACE)
endif
endif

-ifndef NO_LIBNUMA
+ifdef CONFIG_LIBNUMA
ifeq ($(feature-libnuma), 0)
msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
- NO_LIBNUMA := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBNUMA)
else
- CFLAGS += -DHAVE_LIBNUMA_SUPPORT
EXTLIBS += -lnuma
endif
endif
@@ -797,9 +789,6 @@ all:
$(call store,NO_LIBPYTHON)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
- $(call store,NO_BACKTRACE)
- $(call store,NO_LIBNUMA)
- $(call store,NO_LIBAUDIT)
$(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 3d84008..2ba684b 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -45,36 +45,4 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
endif
endif

-# NO_BACKTRACE
-ifdef CONFIG_BACKTRACE
-ifdef NO_BACKTRACE
-dummy := $(info Disabling CONFIG_BACKTRACE)
-dummy := $(shell $(CONFIG) -d CONFIG_BACKTRACE)
-endif
-endif
-
-# NO_LIBNUMA
-ifdef CONFIG_NUMA
-ifdef NO_LIBNUMA
-dummy := $(info Disabling CONFIG_NUMA)
-dummy := $(shell $(CONFIG) -d CONFIG_NUMA)
-endif
-endif
-
-# NO_LIBAUDIT
-ifdef CONFIG_LIBAUDIT
-ifdef NO_LIBAUDIT
-dummy := $(info Disabling CONFIG_LIBAUDIT)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBAUDIT)
-endif
-endif
-
-# NO_LIBBIONIC
-ifdef CONFIG_BIONIC
-ifdef NO_LIBBIONIC
-dummy := $(info Disabling CONFIG_BIONIC)
-dummy := $(shell $(CONFIG) -d CONFIG_BIONIC)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 64dbb1a..8e32b74 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -16,19 +16,3 @@ endif
ifndef CONFIG_LIBUNWIND
NO_LIBUNWIND := 1
endif
-
-ifndef CONFIG_BACKTRACE
-NO_BACKTRACE := 1
-endif
-
-ifndef CONFIG_NUMA
-export NO_LIBNUMA := 1
-endif
-
-ifndef CONFIG_LIBAUDIT
-NO_LIBAUDIT := 1
-endif
-
-ifdef CONFIG_BIONIC
-NO_LIBBIONIC := 1
-endif
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 43168fb..01720b5 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -1,7 +1,9 @@
#include <errno.h>
+#include "generated/autoconf.h"
#include "perf_regs.h"
#include "event.h"

+#ifdef CONFIG_PERF_REGS
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
{
int i, idx = 0;
@@ -25,3 +27,4 @@ out:
*valp = regs->cache_regs[id];
return 0;
}
+#endif /* CONFIG_PERF_REGS */
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 980dbf7..44d9b08 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -1,11 +1,13 @@
#ifndef __PERF_REGS_H
#define __PERF_REGS_H

+#include <linux/compiler.h>
#include <linux/types.h>
+#include "generated/autoconf.h"

struct regs_dump;

-#ifdef HAVE_PERF_REGS_SUPPORT
+#ifdef CONFIG_PERF_REGS
#include <perf_regs.h>

int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
@@ -25,5 +27,5 @@ static inline int perf_reg_value(u64 *valp __maybe_unused,
{
return 0;
}
-#endif /* HAVE_PERF_REGS_SUPPORT */
+#endif /* CONFIG_PERF_REGS */
#endif /* __PERF_REGS_H */
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index d5eab3f..17667d8 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -1,9 +1,10 @@
+#include "generated/autoconf.h"
#include "../perf.h"
#include "util.h"
#include "debug.h"
#include <api/fs/fs.h>
#include <sys/mman.h>
-#ifdef HAVE_BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
#include <execinfo.h>
#endif
#include <stdio.h>
@@ -250,7 +251,7 @@ int hex2u64(const char *ptr, u64 *long_val)
}

/* Obtain a backtrace and print it to stdout. */
-#ifdef HAVE_BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
void dump_stack(void)
{
void *array[16];
--
2.1.1

2014-10-23 22:33:29

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 08/14] perf kbuild: cross-compilation variables are now handled in Kconfig

The variable CONFIG_ARCH and CONFIG_CROSS_COMPILE were added.

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 24 ++++++++++++++++++++++++
tools/perf/Makefile.kbuild | 8 ++++----
tools/perf/arch/x86/include/perf_regs.h | 8 +++++---
tools/perf/arch/x86/tests/regs_load.S | 3 ++-
tools/perf/arch/x86/util/unwind-libunwind.c | 5 +++--
tools/perf/bench/mem-memcpy-arch.h | 4 +++-
tools/perf/bench/mem-memcpy.c | 4 +++-
tools/perf/bench/mem-memset-arch.h | 4 +++-
tools/perf/bench/mem-memset.c | 4 +++-
tools/perf/config/Makefile | 7 ++-----
10 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 026ef67..5f85923 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -1,6 +1,30 @@

mainmenu "The perf configuration"

+config TARGET_ARCH
+ string
+ option env="ARCH"
+
+config TARGET_IS_X86_64
+ string
+ option env="IS_X86_64"
+
+config TARGET_CROSS_COMPILE
+ string
+ option env="CROSS_COMPILE"
+
+config ARCH
+ string
+ default TARGET_ARCH
+
+config X86_64
+ bool
+ default y if TARGET_ARCH = "x86" && TARGET_IS_X86_64 = "1"
+
+config CROSS_COMPILE
+ string
+ default TARGET_CROSS_COMPILE
+
menu "Built-in commands"

config BUILTIN_RECORD
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index 8d9e8b0..b48fe7f 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -123,9 +123,12 @@ export KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG KCONFIG_SCRIPT

# perf detected config
CONFIG_DETECTED := $(obj-perf)/.config-detected
-
export CONFIG_DETECTED

+# arch-related main variables
+include $(src-perf)/config/Makefile.arch
+export ARCH IS_X86_64 CROSS_COMPILE
+
# external .a libs
LIBTRACEEVENT := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
LIBAPIKFS := $(obj-kernel)/tools/lib/api/libapikfs.a
@@ -202,9 +205,6 @@ ifndef dont-detect
ifdef CONFIG_DETECTED_STORED
# Following variables are needed within Kbuild files, we need
# to export them as they are not part of the .config set.
-export CONFIG_ARCH := $(ARCH)
-export CROSS_COMPILE
-export CONFIG_X86_64
export htmldir_SQ
export infodir_SQ
export mandir_SQ
diff --git a/tools/perf/arch/x86/include/perf_regs.h b/tools/perf/arch/x86/include/perf_regs.h
index 7df517a..d969cca 100644
--- a/tools/perf/arch/x86/include/perf_regs.h
+++ b/tools/perf/arch/x86/include/perf_regs.h
@@ -5,9 +5,11 @@
#include <linux/types.h>
#include <asm/perf_regs.h>

+#include "generated/autoconf.h"
+
void perf_regs_load(u64 *regs);

-#ifndef HAVE_ARCH_X86_64_SUPPORT
+#ifndef CONFIG_X86_64
#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
#define PERF_REGS_MAX PERF_REG_X86_32_MAX
#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32
@@ -58,7 +60,7 @@ static inline const char *perf_reg_name(int id)
return "FS";
case PERF_REG_X86_GS:
return "GS";
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
case PERF_REG_X86_R8:
return "R8";
case PERF_REG_X86_R9:
@@ -75,7 +77,7 @@ static inline const char *perf_reg_name(int id)
return "R14";
case PERF_REG_X86_R15:
return "R15";
-#endif /* HAVE_ARCH_X86_64_SUPPORT */
+#endif /* CONFIG_X86_64 */
default:
return NULL;
}
diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S
index 60875d5..822a797 100644
--- a/tools/perf/arch/x86/tests/regs_load.S
+++ b/tools/perf/arch/x86/tests/regs_load.S
@@ -1,4 +1,5 @@
#include <linux/linkage.h>
+#include "generated/autoconf.h"

#define AX 0
#define BX 1 * 8
@@ -26,7 +27,7 @@
#define R15 23 * 8

.text
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
ENTRY(perf_regs_load)
movq %rax, AX(%rdi)
movq %rbx, BX(%rdi)
diff --git a/tools/perf/arch/x86/util/unwind-libunwind.c b/tools/perf/arch/x86/util/unwind-libunwind.c
index db25e93..e4960c1 100644
--- a/tools/perf/arch/x86/util/unwind-libunwind.c
+++ b/tools/perf/arch/x86/util/unwind-libunwind.c
@@ -1,11 +1,12 @@

#include <errno.h>
#include <libunwind.h>
+#include "generated/autoconf.h"
#include "perf_regs.h"
#include "../../util/unwind.h"
#include "../../util/debug.h"

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
int libunwind__arch_reg_id(int regnum)
{
int id;
@@ -109,4 +110,4 @@ int libunwind__arch_reg_id(int regnum)

return id;
}
-#endif /* HAVE_ARCH_X86_64_SUPPORT */
+#endif /* CONFIG_X86_64 */
diff --git a/tools/perf/bench/mem-memcpy-arch.h b/tools/perf/bench/mem-memcpy-arch.h
index 57b4ed8..8e3f0a9 100644
--- a/tools/perf/bench/mem-memcpy-arch.h
+++ b/tools/perf/bench/mem-memcpy-arch.h
@@ -1,5 +1,7 @@

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_X86_64

#define MEMCPY_FN(fn, name, desc) \
extern void *fn(void *, const void *, size_t);
diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c
index 2465141..9061d2b 100644
--- a/tools/perf/bench/mem-memcpy.c
+++ b/tools/perf/bench/mem-memcpy.c
@@ -6,6 +6,8 @@
* Written by Hitoshi Mitake <[email protected]>
*/

+#include "generated/autoconf.h"
+
#include "../perf.h"
#include "../util/util.h"
#include "../util/parse-options.h"
@@ -59,7 +61,7 @@ struct routine routines[] = {
{ "default",
"Default memcpy() provided by glibc",
memcpy },
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64

#define MEMCPY_FN(fn, name, desc) { name, desc, fn },
#include "mem-memcpy-x86-64-asm-def.h"
diff --git a/tools/perf/bench/mem-memset-arch.h b/tools/perf/bench/mem-memset-arch.h
index 633800c..5dfc4c5 100644
--- a/tools/perf/bench/mem-memset-arch.h
+++ b/tools/perf/bench/mem-memset-arch.h
@@ -1,5 +1,7 @@

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_X86_64

#define MEMSET_FN(fn, name, desc) \
extern void *fn(void *, int, size_t);
diff --git a/tools/perf/bench/mem-memset.c b/tools/perf/bench/mem-memset.c
index 75fc3e6..73e8d8d 100644
--- a/tools/perf/bench/mem-memset.c
+++ b/tools/perf/bench/mem-memset.c
@@ -6,6 +6,8 @@
* Trivial clone of mem-memcpy.c.
*/

+#include "generated/autoconf.h"
+
#include "../perf.h"
#include "../util/util.h"
#include "../util/parse-options.h"
@@ -59,7 +61,7 @@ static const struct routine routines[] = {
{ "default",
"Default memset() provided by glibc",
memset },
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64

#define MEMSET_FN(fn, name, desc) { name, desc, fn },
#include "mem-memset-x86-64-asm-def.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index ce3a726..7f87a45 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -20,11 +20,9 @@ NO_PERF_REGS := 1

# Additional ARCH settings for x86
ifeq ($(ARCH),x86)
- ifeq (${IS_X86_64}, 1)
- CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
- ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
+ ifeq ($(IS_X86_64),1)
LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
- CONFIG_X86_64=y
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_X86_64)
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
@@ -794,7 +792,6 @@ all:
$(call store,PARSER_DEBUG_FLEX)
$(call store,PYTHON_EMBED_CCOPTS)
$(call store,PERL_EMBED_CCOPTS)
- $(call store,CONFIG_X86_64)
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
--
2.1.1

2014-10-23 22:33:55

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 05/14] perf kbuild: remove Makefile.perf

The file Makefile.perf contained legacy build rules. It is replaced by
Makefile.kbuild which relies on Kbuild. Consequently, some minor
points need updates:
* The constant CONFIG_KBUILD can be removed
* The main Makefile wrapper now call Makefile.kbuild instead of
Makefile.perf

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Makefile | 2 +-
tools/perf/Makefile.kbuild | 2 +-
tools/perf/Makefile.perf | 949 ------------------------------------------
tools/perf/builtin-annotate.c | 4 +-
tools/perf/builtin-cmds.h | 25 --
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-top.c | 4 +-
tools/perf/ui/setup.c | 4 +-
8 files changed, 9 insertions(+), 983 deletions(-)
delete mode 100644 tools/perf/Makefile.perf

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index cb2e586..4512f16 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -55,7 +55,7 @@ define print_msg
endef

define make
- @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
+ @$(MAKE) -f Makefile.kbuild --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
endef

#
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index 51eba07..8d9e8b0 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -43,7 +43,7 @@ export QUIET_BISON QUIET_FLEX

ifeq ($(KBUILD_SRC),)

-ifeq ("$(origin O)", "command line")
+ifneq ($(O),)
KBUILD_OUTPUT := $(O)
else
KBUILD_OUTPUT := $(objtree)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
deleted file mode 100644
index dcf6248..0000000
--- a/tools/perf/Makefile.perf
+++ /dev/null
@@ -1,949 +0,0 @@
-include ../scripts/Makefile.include
-
-# The default target of this Makefile is...
-all:
-
-include config/utilities.mak
-
-# Define V to have a more verbose compile.
-#
-# Define VF to have a more verbose feature check output.
-#
-# Define O to save output files in a separate directory.
-#
-# Define ARCH as name of target architecture if you want cross-builds.
-#
-# Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
-#
-# Define NO_LIBPERL to disable perl script extension.
-#
-# Define NO_LIBPYTHON to disable python script extension.
-#
-# Define PYTHON to point to the python binary if the default
-# `python' is not correct; for example: PYTHON=python2
-#
-# Define PYTHON_CONFIG to point to the python-config binary if
-# the default `$(PYTHON)-config' is not correct.
-#
-# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
-#
-# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
-#
-# Define LDFLAGS=-static to build a static binary.
-#
-# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
-#
-# Define NO_DWARF if you do not want debug-info analysis feature at all.
-#
-# Define WERROR=0 to disable treating any warnings as errors.
-#
-# Define NO_NEWT if you do not want TUI support. (deprecated)
-#
-# Define NO_SLANG if you do not want TUI support.
-#
-# Define NO_GTK2 if you do not want GTK+ GUI support.
-#
-# Define NO_DEMANGLE if you do not want C++ symbol demangling.
-#
-# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
-#
-# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
-# backtrace post unwind.
-#
-# Define NO_BACKTRACE if you do not want stack backtrace debug feature
-#
-# Define NO_LIBNUMA if you do not want numa perf benchmark
-#
-# Define NO_LIBAUDIT if you do not want libaudit support
-#
-# Define NO_LIBBIONIC if you do not want bionic support
-#
-# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
-# for dwarf backtrace post unwind.
-
-ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
-srctree := $(patsubst %/,%,$(dir $(srctree)))
-#$(info Determined 'srctree' to be $(srctree))
-endif
-
-ifneq ($(objtree),)
-#$(info Determined 'objtree' to be $(objtree))
-endif
-
-ifneq ($(OUTPUT),)
-#$(info Determined 'OUTPUT' to be $(OUTPUT))
-endif
-
-$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
- @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
- @touch $(OUTPUT)PERF-VERSION-FILE
-
-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
-PKG_CONFIG = $(CROSS_COMPILE)pkg-config
-
-RM = rm -f
-LN = ln -f
-MKDIR = mkdir
-FIND = find
-INSTALL = install
-FLEX = flex
-BISON = bison
-STRIP = strip
-
-LIB_DIR = $(srctree)/tools/lib/api/
-TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
-
-# include config/Makefile by default and rule out
-# non-config cases
-config := 1
-
-NON_CONFIG_TARGETS := clean TAGS tags cscope help
-
-ifdef MAKECMDGOALS
-ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
- config := 0
-endif
-endif
-
-ifeq ($(config),1)
-include config/Makefile
-endif
-
-export prefix bindir sharedir sysconfdir DESTDIR
-
-# sparse is architecture-neutral, which means that we need to tell it
-# explicitly what architecture to check for. Fix this up for yours..
-SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
-
-# Guard against environment variables
-BUILTIN_OBJS =
-LIB_H =
-LIB_OBJS =
-GTK_OBJS =
-PYRF_OBJS =
-SCRIPT_SH =
-
-SCRIPT_SH += perf-archive.sh
-SCRIPT_SH += perf-with-kcore.sh
-
-grep-libs = $(filter -l%,$(1))
-strip-libs = $(filter-out -l%,$(1))
-
-ifneq ($(OUTPUT),)
- TE_PATH=$(OUTPUT)
-ifneq ($(subdir),)
- LIB_PATH=$(OUTPUT)/../lib/api/
-else
- LIB_PATH=$(OUTPUT)
-endif
-else
- TE_PATH=$(TRACE_EVENT_DIR)
- LIB_PATH=$(LIB_DIR)
-endif
-
-LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
-export LIBTRACEEVENT
-
-LIBAPIKFS = $(LIB_PATH)libapikfs.a
-export LIBAPIKFS
-
-# python extension build directories
-PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
-PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
-PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
-export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
-
-python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
-
-PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
-PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPIKFS)
-
-$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
- $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
- --quiet build_ext; \
- mkdir -p $(OUTPUT)python && \
- cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
-#
-# No Perl scripts right now:
-#
-
-SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
-
-#
-# Single 'perf' binary right now:
-#
-PROGRAMS += $(OUTPUT)perf
-
-# what 'all' will build and 'install' will install, in perfexecdir
-ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
-
-# what 'all' will build but not install in perfexecdir
-OTHER_PROGRAMS = $(OUTPUT)perf
-
-# Set paths to tools early so that they can be used for version tests.
-ifndef SHELL_PATH
- SHELL_PATH = /bin/sh
-endif
-ifndef PERL_PATH
- PERL_PATH = /usr/bin/perl
-endif
-
-export PERL_PATH
-
-$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
- $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
-
-$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
- $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
-
-$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
- $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
-
-$(OUTPUT)util/pmu-bison.c: util/pmu.y
- $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
-
-$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
-$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
-
-LIB_FILE=$(OUTPUT)libperf.a
-
-LIB_H += ../lib/symbol/kallsyms.h
-LIB_H += ../../include/uapi/linux/perf_event.h
-LIB_H += ../../include/linux/rbtree.h
-LIB_H += ../../include/linux/list.h
-LIB_H += ../../include/uapi/linux/const.h
-LIB_H += ../include/linux/hash.h
-LIB_H += ../../include/linux/stringify.h
-LIB_H += util/include/linux/bitmap.h
-LIB_H += util/include/linux/bitops.h
-LIB_H += ../include/linux/compiler.h
-LIB_H += util/include/linux/const.h
-LIB_H += util/include/linux/ctype.h
-LIB_H += util/include/linux/kernel.h
-LIB_H += util/include/linux/list.h
-LIB_H += ../include/linux/export.h
-LIB_H += util/include/linux/poison.h
-LIB_H += util/include/linux/rbtree.h
-LIB_H += util/include/linux/rbtree_augmented.h
-LIB_H += util/include/linux/string.h
-LIB_H += ../include/linux/types.h
-LIB_H += util/include/linux/linkage.h
-LIB_H += util/include/asm/asm-offsets.h
-LIB_H += ../include/asm/bug.h
-LIB_H += util/include/asm/byteorder.h
-LIB_H += util/include/asm/hweight.h
-LIB_H += util/include/asm/swab.h
-LIB_H += util/include/asm/system.h
-LIB_H += util/include/asm/uaccess.h
-LIB_H += util/include/dwarf-regs.h
-LIB_H += util/include/asm/dwarf2.h
-LIB_H += util/include/asm/cpufeature.h
-LIB_H += util/include/asm/unistd_32.h
-LIB_H += util/include/asm/unistd_64.h
-LIB_H += perf.h
-LIB_H += util/annotate.h
-LIB_H += util/cache.h
-LIB_H += util/callchain.h
-LIB_H += util/build-id.h
-LIB_H += util/debug.h
-LIB_H += util/pmu.h
-LIB_H += util/event.h
-LIB_H += util/evsel.h
-LIB_H += util/evlist.h
-LIB_H += util/exec_cmd.h
-LIB_H += util/levenshtein.h
-LIB_H += util/machine.h
-LIB_H += util/map.h
-LIB_H += util/parse-options.h
-LIB_H += util/parse-events.h
-LIB_H += util/quote.h
-LIB_H += util/util.h
-LIB_H += util/xyarray.h
-LIB_H += util/header.h
-LIB_H += util/help.h
-LIB_H += util/session.h
-LIB_H += util/ordered-events.h
-LIB_H += util/strbuf.h
-LIB_H += util/strlist.h
-LIB_H += util/strfilter.h
-LIB_H += util/svghelper.h
-LIB_H += util/tool.h
-LIB_H += util/run-command.h
-LIB_H += util/sigchain.h
-LIB_H += util/dso.h
-LIB_H += util/symbol.h
-LIB_H += util/color.h
-LIB_H += util/values.h
-LIB_H += util/sort.h
-LIB_H += util/hist.h
-LIB_H += util/comm.h
-LIB_H += util/thread.h
-LIB_H += util/thread_map.h
-LIB_H += util/trace-event.h
-LIB_H += util/probe-finder.h
-LIB_H += util/dwarf-aux.h
-LIB_H += util/probe-event.h
-LIB_H += util/pstack.h
-LIB_H += util/cpumap.h
-LIB_H += util/top.h
-LIB_H += $(ARCH_INCLUDE)
-LIB_H += util/cgroup.h
-LIB_H += $(LIB_INCLUDE)traceevent/event-parse.h
-LIB_H += util/target.h
-LIB_H += util/rblist.h
-LIB_H += util/intlist.h
-LIB_H += util/perf_regs.h
-LIB_H += util/unwind.h
-LIB_H += util/vdso.h
-LIB_H += util/tsc.h
-LIB_H += ui/helpline.h
-LIB_H += ui/progress.h
-LIB_H += ui/util.h
-LIB_H += ui/ui.h
-LIB_H += util/data.h
-LIB_H += util/kvm-stat.h
-
-LIB_OBJS += $(OUTPUT)util/abspath.o
-LIB_OBJS += $(OUTPUT)util/alias.o
-LIB_OBJS += $(OUTPUT)util/annotate.o
-LIB_OBJS += $(OUTPUT)util/build-id.o
-LIB_OBJS += $(OUTPUT)util/config.o
-LIB_OBJS += $(OUTPUT)util/ctype.o
-LIB_OBJS += $(OUTPUT)util/pmu.o
-LIB_OBJS += $(OUTPUT)util/environment.o
-LIB_OBJS += $(OUTPUT)util/event.o
-LIB_OBJS += $(OUTPUT)util/evlist.o
-LIB_OBJS += $(OUTPUT)util/evsel.o
-LIB_OBJS += $(OUTPUT)util/exec_cmd.o
-LIB_OBJS += $(OUTPUT)util/help.o
-LIB_OBJS += $(OUTPUT)util/kallsyms.o
-LIB_OBJS += $(OUTPUT)util/levenshtein.o
-LIB_OBJS += $(OUTPUT)util/parse-options.o
-LIB_OBJS += $(OUTPUT)util/parse-events.o
-LIB_OBJS += $(OUTPUT)util/path.o
-LIB_OBJS += $(OUTPUT)util/rbtree.o
-LIB_OBJS += $(OUTPUT)util/bitmap.o
-LIB_OBJS += $(OUTPUT)util/hweight.o
-LIB_OBJS += $(OUTPUT)util/run-command.o
-LIB_OBJS += $(OUTPUT)util/quote.o
-LIB_OBJS += $(OUTPUT)util/strbuf.o
-LIB_OBJS += $(OUTPUT)util/string.o
-LIB_OBJS += $(OUTPUT)util/strlist.o
-LIB_OBJS += $(OUTPUT)util/strfilter.o
-LIB_OBJS += $(OUTPUT)util/top.o
-LIB_OBJS += $(OUTPUT)util/usage.o
-LIB_OBJS += $(OUTPUT)util/wrapper.o
-LIB_OBJS += $(OUTPUT)util/sigchain.o
-LIB_OBJS += $(OUTPUT)util/dso.o
-LIB_OBJS += $(OUTPUT)util/symbol.o
-LIB_OBJS += $(OUTPUT)util/symbol-elf.o
-LIB_OBJS += $(OUTPUT)util/color.o
-LIB_OBJS += $(OUTPUT)util/pager.o
-LIB_OBJS += $(OUTPUT)util/header.o
-LIB_OBJS += $(OUTPUT)util/callchain.o
-LIB_OBJS += $(OUTPUT)util/values.o
-LIB_OBJS += $(OUTPUT)util/debug.o
-LIB_OBJS += $(OUTPUT)util/machine.o
-LIB_OBJS += $(OUTPUT)util/map.o
-LIB_OBJS += $(OUTPUT)util/pstack.o
-LIB_OBJS += $(OUTPUT)util/session.o
-LIB_OBJS += $(OUTPUT)util/ordered-events.o
-LIB_OBJS += $(OUTPUT)util/comm.o
-LIB_OBJS += $(OUTPUT)util/thread.o
-LIB_OBJS += $(OUTPUT)util/thread_map.o
-LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
-LIB_OBJS += $(OUTPUT)util/parse-events-flex.o
-LIB_OBJS += $(OUTPUT)util/parse-events-bison.o
-LIB_OBJS += $(OUTPUT)util/pmu-flex.o
-LIB_OBJS += $(OUTPUT)util/pmu-bison.o
-LIB_OBJS += $(OUTPUT)util/trace-event-read.o
-LIB_OBJS += $(OUTPUT)util/trace-event-info.o
-LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
-LIB_OBJS += $(OUTPUT)util/trace-event.o
-LIB_OBJS += $(OUTPUT)util/svghelper.o
-LIB_OBJS += $(OUTPUT)util/sort.o
-LIB_OBJS += $(OUTPUT)util/hist.o
-LIB_OBJS += $(OUTPUT)util/probe-event.o
-LIB_OBJS += $(OUTPUT)util/util.o
-LIB_OBJS += $(OUTPUT)util/xyarray.o
-LIB_OBJS += $(OUTPUT)util/cpumap.o
-LIB_OBJS += $(OUTPUT)util/cgroup.o
-LIB_OBJS += $(OUTPUT)util/target.o
-LIB_OBJS += $(OUTPUT)util/rblist.o
-LIB_OBJS += $(OUTPUT)util/intlist.o
-LIB_OBJS += $(OUTPUT)util/vdso.o
-LIB_OBJS += $(OUTPUT)util/stat.o
-LIB_OBJS += $(OUTPUT)util/record.o
-LIB_OBJS += $(OUTPUT)util/srcline.o
-LIB_OBJS += $(OUTPUT)util/data.o
-LIB_OBJS += $(OUTPUT)util/tsc.o
-LIB_OBJS += $(OUTPUT)util/cloexec.o
-
-LIB_OBJS += $(OUTPUT)ui/setup.o
-LIB_OBJS += $(OUTPUT)ui/helpline.o
-LIB_OBJS += $(OUTPUT)ui/progress.o
-LIB_OBJS += $(OUTPUT)ui/util.o
-LIB_OBJS += $(OUTPUT)ui/hist.o
-LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
-
-LIB_OBJS += $(OUTPUT)arch/common.o
-
-LIB_OBJS += $(OUTPUT)tests/parse-events.o
-LIB_OBJS += $(OUTPUT)tests/dso-data.o
-LIB_OBJS += $(OUTPUT)tests/attr.o
-LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
-LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
-LIB_OBJS += $(OUTPUT)tests/perf-record.o
-LIB_OBJS += $(OUTPUT)tests/rdpmc.o
-LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
-LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
-LIB_OBJS += $(OUTPUT)tests/fdarray.o
-LIB_OBJS += $(OUTPUT)tests/pmu.o
-LIB_OBJS += $(OUTPUT)tests/hists_common.o
-LIB_OBJS += $(OUTPUT)tests/hists_link.o
-LIB_OBJS += $(OUTPUT)tests/hists_filter.o
-LIB_OBJS += $(OUTPUT)tests/hists_output.o
-LIB_OBJS += $(OUTPUT)tests/hists_cumulate.o
-LIB_OBJS += $(OUTPUT)tests/python-use.o
-LIB_OBJS += $(OUTPUT)tests/bp_signal.o
-LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
-LIB_OBJS += $(OUTPUT)tests/task-exit.o
-LIB_OBJS += $(OUTPUT)tests/sw-clock.o
-ifeq ($(ARCH),x86)
-LIB_OBJS += $(OUTPUT)tests/perf-time-to-tsc.o
-endif
-LIB_OBJS += $(OUTPUT)tests/code-reading.o
-LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
-LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o
-ifndef NO_DWARF_UNWIND
-ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
-LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o
-endif
-endif
-LIB_OBJS += $(OUTPUT)tests/mmap-thread-lookup.o
-LIB_OBJS += $(OUTPUT)tests/thread-mg-share.o
-LIB_OBJS += $(OUTPUT)tests/switch-tracking.o
-
-BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
-BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
-# Benchmark modules
-BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
-BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
-ifeq ($(RAW_ARCH),x86_64)
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
-endif
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-requeue.o
-
-BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
-BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
-BUILTIN_OBJS += $(OUTPUT)builtin-help.o
-BUILTIN_OBJS += $(OUTPUT)builtin-sched.o
-BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o
-BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o
-BUILTIN_OBJS += $(OUTPUT)builtin-list.o
-BUILTIN_OBJS += $(OUTPUT)builtin-record.o
-BUILTIN_OBJS += $(OUTPUT)builtin-report.o
-BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
-BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
-BUILTIN_OBJS += $(OUTPUT)builtin-top.o
-BUILTIN_OBJS += $(OUTPUT)builtin-script.o
-BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
-BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
-BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
-BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
-BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
-BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
-BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
-
-PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
-
-# We choose to avoid "if .. else if .. else .. endif endif"
-# because maintaining the nesting to match is a pain. If
-# we had "elif" things would have been much nicer...
-
--include arch/$(ARCH)/Makefile
-
-ifneq ($(OUTPUT),)
- CFLAGS += -I$(OUTPUT)
-endif
-
-ifdef NO_LIBELF
-EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
-
-# Remove ELF/DWARF dependent codes
-LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
-
-BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
-
-# Use minimal symbol handling
-LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
-
-else # NO_LIBELF
-ifndef NO_DWARF
- LIB_OBJS += $(OUTPUT)util/probe-finder.o
- LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
-endif # NO_DWARF
-endif # NO_LIBELF
-
-ifndef NO_LIBDW_DWARF_UNWIND
- LIB_OBJS += $(OUTPUT)util/unwind-libdw.o
- LIB_H += util/unwind-libdw.h
-endif
-
-ifndef NO_LIBUNWIND
- LIB_OBJS += $(OUTPUT)util/unwind-libunwind.o
-endif
-LIB_OBJS += $(OUTPUT)tests/keep-tracking.o
-
-ifndef NO_LIBAUDIT
- BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
-endif
-
-ifndef NO_SLANG
- LIB_OBJS += $(OUTPUT)ui/browser.o
- LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
- LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
- LIB_OBJS += $(OUTPUT)ui/browsers/map.o
- LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
- LIB_OBJS += $(OUTPUT)ui/browsers/header.o
- LIB_OBJS += $(OUTPUT)ui/tui/setup.o
- LIB_OBJS += $(OUTPUT)ui/tui/util.o
- LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
- LIB_OBJS += $(OUTPUT)ui/tui/progress.o
- LIB_H += ui/tui/tui.h
- LIB_H += ui/browser.h
- LIB_H += ui/browsers/map.h
- LIB_H += ui/keysyms.h
- LIB_H += ui/libslang.h
-endif
-
-ifndef NO_GTK2
- ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
-
- GTK_OBJS += $(OUTPUT)ui/gtk/browser.o
- GTK_OBJS += $(OUTPUT)ui/gtk/hists.o
- GTK_OBJS += $(OUTPUT)ui/gtk/setup.o
- GTK_OBJS += $(OUTPUT)ui/gtk/util.o
- GTK_OBJS += $(OUTPUT)ui/gtk/helpline.o
- GTK_OBJS += $(OUTPUT)ui/gtk/progress.o
- GTK_OBJS += $(OUTPUT)ui/gtk/annotate.o
-
-install-gtk: $(OUTPUT)libperf-gtk.so
- $(call QUIET_INSTALL, 'GTK UI') \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
- $(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
-endif
-
-ifndef NO_LIBPERL
- LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
- LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
-endif
-
-ifndef NO_LIBPYTHON
- LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
- LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
-endif
-
-ifeq ($(NO_PERF_REGS),0)
- ifeq ($(ARCH),x86)
- LIB_H += arch/x86/include/perf_regs.h
- endif
- LIB_OBJS += $(OUTPUT)util/perf_regs.o
-endif
-
-ifndef NO_LIBNUMA
- BUILTIN_OBJS += $(OUTPUT)bench/numa.o
-endif
-
-ifdef ASCIIDOC8
- export ASCIIDOC8
-endif
-
-LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
-
-export INSTALL SHELL_PATH
-
-### Build rules
-
-SHELL = $(SHELL_PATH)
-
-all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
-
-please_set_SHELL_PATH_to_a_more_modern_shell:
- @$$(:)
-
-shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
-
-strip: $(PROGRAMS) $(OUTPUT)perf
- $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
-
-$(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- $(CFLAGS) -c $(filter %.c,$^) -o $@
-
-$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
- $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
- $(BUILTIN_OBJS) $(LIBS) -o $@
-
-$(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
- $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $<
-
-$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
- $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
-
-$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- '-DPERF_MAN_PATH="$(mandir_SQ)"' \
- '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
-
-$(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- '-DPERF_MAN_PATH="$(mandir_SQ)"' \
- '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
-
-$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
-
-$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
- $(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@
-
-$(SCRIPTS) : % : %.sh
- $(QUIET_GEN)$(INSTALL) '[email protected]' '$(OUTPUT)$@'
-
-# These can record PERF_VERSION
-$(OUTPUT)perf.o perf.spec \
- $(SCRIPTS) \
- : $(OUTPUT)PERF-VERSION-FILE
-
-.SUFFIXES:
-
-#
-# If a target does not match any of the later rules then prefix it by $(OUTPUT)
-# This makes targets like 'make O=/tmp/perf perf.o' work in a natural way.
-#
-ifneq ($(OUTPUT),)
-%.o: $(OUTPUT)%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-util/%.o: $(OUTPUT)util/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-bench/%.o: $(OUTPUT)bench/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-tests/%.o: $(OUTPUT)tests/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-endif
-
-# These two need to be here so that when O= is not used they take precedence
-# over the general rule for .o
-
-$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $<
-
-$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
-
-$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
-$(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $<
-$(OUTPUT)%.o: %.S
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-$(OUTPUT)%.s: %.S
- $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
-
-$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
- '-DPREFIX="$(prefix_SQ)"' \
- $<
-
-$(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \
- $<
-
-$(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- -DPYTHONPATH='"$(OUTPUT)python"' \
- -DPYTHON='"$(PYTHON_WORD)"' \
- $<
-
-$(OUTPUT)tests/dwarf-unwind.o: tests/dwarf-unwind.c
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -fno-optimize-sibling-calls $<
-
-$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
-
-$(OUTPUT)ui/setup.o: ui/setup.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DLIBDIR='"$(libdir_SQ)"' $<
-
-$(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-
-$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
-
-$(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $<
-
-$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default $<
-
-$(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-undef -Wno-switch-default $<
-
-$(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
-
-$(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
-
-$(OUTPUT)perf-%: %.o $(PERFLIBS)
- $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
-
-$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
-$(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
-
-# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
-# we depend the various files onto their directories.
-DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(GTK_OBJS)
-DIRECTORY_DEPS += $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
-# no need to add flex objects, because they depend on bison ones
-DIRECTORY_DEPS += $(OUTPUT)util/parse-events-bison.c
-DIRECTORY_DEPS += $(OUTPUT)util/pmu-bison.c
-
-OUTPUT_DIRECTORIES := $(sort $(dir $(DIRECTORY_DEPS)))
-
-$(DIRECTORY_DEPS): | $(OUTPUT_DIRECTORIES)
-# In the second step, we make a rule to actually create these directories
-$(OUTPUT_DIRECTORIES):
- $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null
-
-$(LIB_FILE): $(LIB_OBJS)
- $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
-
-# libtraceevent.a
-TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch])
-
-LIBTRACEEVENT_FLAGS = $(QUIET_SUBDIR1) O=$(OUTPUT)
-LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS)"
-LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
-
-$(LIBTRACEEVENT): $(TE_SOURCES) $(OUTPUT)PERF-CFLAGS
- $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) libtraceevent.a plugins
-
-$(LIBTRACEEVENT)-clean:
- $(call QUIET_CLEAN, libtraceevent)
- @$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
-
-install-traceevent-plugins: $(LIBTRACEEVENT)
- $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
-
-LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch] $(LIB_PATH)fd/*.[ch])
-
-# if subdir is set, we've been called from above so target has been built
-# already
-$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
-ifeq ($(subdir),)
- $(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
-endif
-
-$(LIBAPIKFS)-clean:
-ifeq ($(subdir),)
- $(call QUIET_CLEAN, libapikfs)
- @$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
-endif
-
-help:
- @echo 'Perf make targets:'
- @echo ' doc - make *all* documentation (see below)'
- @echo ' man - make manpage documentation (access with man <foo>)'
- @echo ' html - make html documentation'
- @echo ' info - make GNU info documentation (access with info <foo>)'
- @echo ' pdf - make pdf documentation'
- @echo ' TAGS - use etags to make tag information for source browsing'
- @echo ' tags - use ctags to make tag information for source browsing'
- @echo ' cscope - use cscope to make interactive browsing database'
- @echo ''
- @echo 'Perf install targets:'
- @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
- @echo ' HINT: use "prefix" or "DESTDIR" to install to a particular'
- @echo ' path like "make prefix=/usr/local install install-doc"'
- @echo ' install - install compiled binaries'
- @echo ' install-doc - install *all* documentation'
- @echo ' install-man - install manpage documentation'
- @echo ' install-html - install html documentation'
- @echo ' install-info - install GNU info documentation'
- @echo ' install-pdf - install pdf documentation'
- @echo ''
- @echo ' quick-install-doc - alias for quick-install-man'
- @echo ' quick-install-man - install the documentation quickly'
- @echo ' quick-install-html - install the html documentation quickly'
- @echo ''
- @echo 'Perf maintainer targets:'
- @echo ' clean - clean all binary objects and build output'
-
-
-DOC_TARGETS := doc man html info pdf
-
-INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
-INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
-
-# 'make doc' should call 'make -C Documentation all'
-$(DOC_TARGETS):
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
-
-TAG_FOLDERS= . ../lib/traceevent ../lib/api ../lib/symbol
-TAG_FILES= ../../include/uapi/linux/perf_event.h
-
-TAGS:
- $(QUIET_GEN)$(RM) TAGS; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES)
-
-tags:
- $(QUIET_GEN)$(RM) tags; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES)
-
-cscope:
- $(QUIET_GEN)$(RM) cscope*; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES)
-
-### Detect prefix changes
-TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
- $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):$(plugindir_SQ)
-
-$(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
- @FLAGS='$(TRACK_CFLAGS)'; \
- if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \
- echo 1>&2 " FLAGS: * new build flags or prefix"; \
- echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \
- fi
-
-### Testing rules
-
-# GNU make supports exporting all variables by "export" without parameters.
-# However, the environment gets quite big, and some programs have problems
-# with that.
-
-check: $(OUTPUT)common-cmds.h
- if sparse; \
- then \
- for i in *.c */*.c; \
- do \
- sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
- done; \
- else \
- exit 1; \
- fi
-
-### Installation rules
-
-install-gtk:
-
-install-bin: all install-gtk
- $(call QUIET_INSTALL, binaries) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \
- $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \
- $(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
- $(call QUIET_INSTALL, libexec) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(call QUIET_INSTALL, perf-archive) \
- $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(call QUIET_INSTALL, perf-with-kcore) \
- $(INSTALL) $(OUTPUT)perf-with-kcore -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
-ifndef NO_LIBPERL
- $(call QUIET_INSTALL, perl-scripts) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \
- $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
-endif
-ifndef NO_LIBPYTHON
- $(call QUIET_INSTALL, python-scripts) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \
- $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
- $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
-endif
- $(call QUIET_INSTALL, perf_completion-script) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
- $(INSTALL) perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
- $(call QUIET_INSTALL, tests) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
- $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
- $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
-
-install: install-bin try-install-man install-traceevent-plugins
-
-install-python_ext:
- $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
-
-# 'make install-doc' should call 'make -C Documentation install'
-$(INSTALL_DOC_TARGETS):
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
-
-### Cleaning rules
-
-#
-# This is here, not in config/Makefile, because config/Makefile does
-# not get included for the clean target:
-#
-config-clean:
- $(call QUIET_CLEAN, config)
- @$(MAKE) -C config/feature-checks clean >/dev/null
-
-clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
- $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
- $(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf
- $(call QUIET_CLEAN, core-gen) $(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
- $(python-clean)
-
-#
-# Trick: if ../../.git does not exist - we are building out of tree for example,
-# then force version regeneration:
-#
-ifeq ($(wildcard ../../.git/HEAD),)
- GIT-HEAD-PHONY = ../../.git/HEAD
-else
- GIT-HEAD-PHONY =
-endif
-
-.PHONY: all install clean config-clean strip install-gtk
-.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS
-
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index a46af8f..7b97b8a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -155,7 +155,7 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
} else if (use_browser == 1) {
struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
@@ -303,7 +303,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
#endif
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index 49550c9..863727f 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -1,31 +1,6 @@
#ifndef BUILTIN_CMDS_H
#define BUILTIN_CMDS_H

-#ifndef CONFIG_KBUILD
-#define CONFIG_BUILTIN_REPORT 1
-#define CONFIG_BUILTIN_SCRIPT 1
-#define CONFIG_BUILTIN_BENCH 1
-#define CONFIG_BUILTIN_SCHED 1
-#define CONFIG_BUILTIN_TRACE 1
-#define CONFIG_BUILTIN_TOP 1
-#define CONFIG_BUILTIN_RECORD 1
-#define CONFIG_BUILTIN_BUILDID_LIST 1
-#define CONFIG_BUILTIN_INJECT 1
-#define CONFIG_BUILTIN_LOCK 1
-#define CONFIG_BUILTIN_KVM 1
-#define CONFIG_BUILTIN_BUILDID_CACHE 1
-#define CONFIG_BUILTIN_EVLIST 1
-#define CONFIG_BUILTIN_KMEM 1
-#define CONFIG_BUILTIN_STAT 1
-#define CONFIG_BUILTIN_DIFF 1
-#define CONFIG_BUILTIN_ANNOTATE 1
-#define CONFIG_BUILTIN_TIMECHART 1
-#define CONFIG_BUILTIN_LIST 1
-#define CONFIG_BUILTIN_HELP 1
-#define CONFIG_BUILTIN_PROBE 1
-#define CONFIG_BUILTIN_MEM 1
-#else
#include "generated/autoconf.h"
-#endif /* CONFIG_KBUILD */

#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b639e58..00d93ff 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -407,7 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6f04452..a2ff8b7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -535,7 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -981,7 +981,7 @@ static int __cmd_top(struct perf_top *top)

ret = -1;

-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
if (use_browser > 0)
display_fn = display_thread_tui;
#endif
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index efc2b21..7928984 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,7 +77,7 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
use_browser = 1;
if (ui__init() == 0)
@@ -98,7 +98,7 @@ void exit_browser(bool wait_for_ok __maybe_unused)
case 2:
exit_gtk_browser(wait_for_ok);
break;
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
ui__exit(wait_for_ok);
break;
--
2.1.1

2014-10-23 22:33:53

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v3 06/14] perf kbuild: remove legacy tui/gui-related build variables

Remove NO_SLANG (replaced by CONFIG_LIBSLANG)
Remove HAVE_SLANG_SUPPORT from CFLAGS (replaced by CONFIG_LIBSLANG)
Remove NO_GTK2 (replaced by CONFIG_LIBGTK2 or CONFIG_GTK2)
Remove HAVE_GTK2_SUPPORT from CFLAGS (replaced by CONFIG_LIBGTK2)
Remove HAVE_GTK_INFO_BAR_SUPPORT from CFLAGS (replaced by
CONFIG_LIBGTK2_INFOBAR)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 21 +++++++++++++++++++++
tools/perf/config/Makefile | 20 ++++++--------------
tools/perf/config/Makefile.fix-config | 24 ------------------------
tools/perf/config/Makefile.fix-legacy | 8 --------
tools/perf/ui/gtk/browser.c | 4 +++-
tools/perf/ui/gtk/gtk.h | 5 +++--
tools/perf/ui/gtk/util.c | 6 ++++--
tools/perf/ui/setup.c | 4 +++-
tools/perf/ui/ui.h | 4 +++-
tools/perf/util/annotate.h | 4 +++-
tools/perf/util/hist.h | 3 ++-
11 files changed, 48 insertions(+), 55 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index f9fcf9e..eb59567 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -171,6 +171,7 @@ config STDIO

config TUI
bool "Tui (slang based)"
+ depends on LIBSLANG
default y
---help---
Text-based user interface which provides windowing
@@ -179,6 +180,7 @@ config TUI
config GTK2
bool "Gtk2"
default y
+ depends on LIBGTK2
---help---
Elaborate display mode based on libgtk2.

@@ -186,12 +188,31 @@ endmenu

menu "Libraries / Dependencies"

+config LIBSLANG
+ bool "Slang (libslang)"
+ default y
+ ---help---
+ libslang
+
config LIBAUDIT
bool "Audit (libaudit)"
default y
---help---
Linux audit framework dependency.

+config LIBGTK2
+ bool "Gtk2 (libgtk2)"
+ default y
+ ---help---
+ libgtk2
+
+config LIBGTK2_INFOBAR
+ bool "Gtk2 infobar (libgtk2)"
+ depends on LIBGTK2
+ default y
+ ---help---
+ libgtk2-infobar
+
config LIBPERL
bool "Perl"
default y
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 6106e24..27b092c 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -445,32 +445,26 @@ ifndef NO_LIBAUDIT
endif
endif

-ifdef NO_NEWT
- NO_SLANG=1
-endif
-
-ifndef NO_SLANG
+ifdef CONFIG_LIBSLANG
ifneq ($(feature-libslang), 1)
- msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
- NO_SLANG := 1
+ msg := $(warning slang not found, disables SLANG and TUI supports. Please install slang-devel or libslang-dev);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBSLANG)
else
# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
CFLAGS += -I/usr/include/slang
- CFLAGS += -DHAVE_SLANG_SUPPORT
EXTLIBS += -lslang
endif
endif

-ifndef NO_GTK2
+ifdef CONFIG_LIBGTK2
FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
ifneq ($(feature-gtk2), 1)
msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
- NO_GTK2 := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBGTK2)
else
ifeq ($(feature-gtk2-infobar), 1)
- GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBGTK2_INFOBAR)
endif
- CFLAGS += -DHAVE_GTK2_SUPPORT
GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
EXTLIBS += -ldl
@@ -801,8 +795,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_NEWT)
- $(call store,NO_GTK2)
$(call store,NO_DEMANGLE)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 7f65fdb..3d84008 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,30 +19,6 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_NEWT
-ifdef CONFIG_TUI
-ifdef NO_NEWT
-dummy := $(info Disabling CONFIG_TUI)
-dummy := $(shell $(CONFIG) -d CONFIG_TUI)
-endif
-endif
-
-# NO_NEWT
-ifdef CONFIG_TUI
-ifdef NO_SLANG
-dummy := $(info Disabling CONFIG_TUI)
-dummy := $(shell $(CONFIG) -d CONFIG_TUI)
-endif
-endif
-
-# NO_GTK2
-ifdef CONFIG_GTK2
-ifdef NO_GTK2
-dummy := $(info Disabling CONFIG_GTK2)
-dummy := $(shell $(CONFIG) -d CONFIG_GTK2)
-endif
-endif
-
# NO_DEMANGLE
ifdef CONFIG_DEMANGLE
ifdef NO_DEMANGLE
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 2ec91f3..ca219e7 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,14 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_TUI
-NO_SLANG := 1
-endif
-
-ifndef CONFIG_GTK2
-NO_GTK2 := 1
-endif
-
ifndef CONFIG_DEMANGLE
NO_DEMANGLE := 1
endif
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index c24d912..f4df6a6 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "../evlist.h"
#include "../cache.h"
#include "../evsel.h"
@@ -43,7 +45,7 @@ const char *perf_gtk__get_percent_color(double percent)
return NULL;
}

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *perf_gtk__setup_info_bar(void)
{
GtkWidget *info_bar;
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h
index 0a9173f..3762980 100644
--- a/tools/perf/ui/gtk/gtk.h
+++ b/tools/perf/ui/gtk/gtk.h
@@ -7,12 +7,13 @@
#include <gtk/gtk.h>
#pragma GCC diagnostic error "-Wstrict-prototypes"

+#include "generated/autoconf.h"

struct perf_gtk_context {
GtkWidget *main_window;
GtkWidget *notebook;

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *info_bar;
GtkWidget *message_label;
#endif
@@ -42,7 +43,7 @@ void perf_gtk__resize_window(GtkWidget *window);
const char *perf_gtk__get_percent_color(double percent);
GtkWidget *perf_gtk__setup_statusbar(void);

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *perf_gtk__setup_info_bar(void);
#else
static inline GtkWidget *perf_gtk__setup_info_bar(void)
diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c
index 52e7fc4..dde1615 100644
--- a/tools/perf/ui/gtk/util.c
+++ b/tools/perf/ui/gtk/util.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "../util.h"
#include "../../util/debug.h"
#include "gtk.h"
@@ -52,7 +54,7 @@ static int perf_gtk__error(const char *format, va_list args)
return 0;
}

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
static int perf_gtk__warning_info_bar(const char *format, va_list args)
{
char *msg;
@@ -104,7 +106,7 @@ static int perf_gtk__warning_statusbar(const char *format, va_list args)

struct perf_error_ops perf_gtk_eops = {
.error = perf_gtk__error,
-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
.warning = perf_gtk__warning_info_bar,
#else
.warning = perf_gtk__warning_statusbar,
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 7928984..0acaf1b 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -1,6 +1,8 @@
#include <pthread.h>
#include <dlfcn.h>

+#include "generated/autoconf.h"
+
#include "../util/cache.h"
#include "../util/debug.h"
#include "../util/hist.h"
@@ -8,7 +10,7 @@
pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
void *perf_gtk_handle;

-#ifdef HAVE_GTK2_SUPPORT
+#ifdef CONFIG_GTK2
static int setup_gtk_browser(void)
{
int (*perf_ui_init)(void);
diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h
index ab88383..bba3a0e 100644
--- a/tools/perf/ui/ui.h
+++ b/tools/perf/ui/ui.h
@@ -5,6 +5,8 @@
#include <stdbool.h>
#include <linux/compiler.h>

+#include "generated/autoconf.h"
+
extern pthread_mutex_t ui__lock;
extern void *perf_gtk_handle;

@@ -13,7 +15,7 @@ extern int use_browser;
void setup_browser(bool fallback_to_pager);
void exit_browser(bool wait_for_ok);

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
int ui__init(void);
void ui__exit(bool wait_for_ok);
#else
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 112d6e2..692f46c 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -11,6 +11,8 @@
#include <linux/rbtree.h>
#include <pthread.h>

+#include "generated/autoconf.h"
+
struct ins;

struct ins_operands {
@@ -157,7 +159,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, bool print_lines,
bool full_paths, int min_pcnt, int max_lines);

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
int symbol__tui_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel,
struct hist_browser_timer *hbt);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index d0ef9a1..622597d 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -3,6 +3,7 @@

#include <linux/types.h>
#include <pthread.h>
+#include "generated/autoconf.h"
#include "callchain.h"
#include "evsel.h"
#include "header.h"
@@ -298,7 +299,7 @@ struct hist_browser_timer {
int refresh;
};

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
#include "../ui/keysyms.h"
int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
struct hist_browser_timer *hbt);
--
2.1.1

2014-10-23 23:48:08

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v3 00/14] Kbuild for perf

Em Fri, Oct 24, 2014 at 12:28:08AM +0200, Alexis Berlemont escreveu:
> Hello,
>
> Here is a proposal of perf's build process managed by Kbuild:
> * The file Makefile.perf is replaced by Makefile.kbuild
> * Makefile.kbuild generates a default .config file if none exists
> (allyesconfig)
> * Makefile.kbuild adapts the .config file according to the
> features-check tests results
> * Makefile.kbuild builds external dependencies (linux/tools/lib/*)
> * Makefile.kbuild leaves the rest to Kbuild
>
> Regards,

Thanks for working on this!

What was the branch this was made against?

> Alexis.
>
> Alexis Berlemont (11):
> kbuild: add support of custom paths for "auto.conf*" files
> perf kbuild: remove Makefile.perf
> perf kbuild: remove legacy tui/gui-related build variables
> perf kbuild: remove legacy demangle-related build variables
> perf kbuild: cross-compilation variables are now handled in Kconfig
> perf kbuild: remove legacy misc build variables
> perf kbuild: remove legacy libelf-related build variables
> perf kbuild: remove legacy libdwarf-related build variables
> perf kbuild: remove legacy script-related build variables
> perf kbuild: final cosmetic changes
> perf kbuild: add generated Kconfig build-test cases
>
> Jiri Olsa (3):
> perf tools: Kbuild builtin source related fixies
> perf tools: Kbuild source related fixies
> perf tools: Add kbuild support into Makefile.kbuild
>
> scripts/Makefile.build | 3 +-
> scripts/kconfig/confdata.c | 23 +-
> scripts/kconfig/lkc.h | 1 +
> tools/perf/Kbuild | 47 +
> tools/perf/Kconfig | 436 ++++++++++
> tools/perf/MANIFEST | 1 +
> tools/perf/Makefile | 2 +-
> tools/perf/Makefile.kbuild | 443 ++++++++++
> tools/perf/Makefile.perf | 949 ---------------------
> tools/perf/arch/Kbuild | 3 +
> tools/perf/arch/arm/Kbuild | 2 +
> tools/perf/arch/arm/Makefile | 14 -
> tools/perf/arch/arm/tests/Kbuild | 2 +
> tools/perf/arch/arm/util/Kbuild | 3 +
> tools/perf/arch/arm64/Kbuild | 1 +
> tools/perf/arch/arm64/Makefile | 7 -
> tools/perf/arch/arm64/util/Kbuild | 2 +
> tools/perf/arch/powerpc/Kbuild | 1 +
> tools/perf/arch/powerpc/Makefile | 6 -
> tools/perf/arch/powerpc/util/Kbuild | 3 +
> tools/perf/arch/s390/Kbuild | 1 +
> tools/perf/arch/s390/Makefile | 7 -
> tools/perf/arch/s390/util/Kbuild | 2 +
> tools/perf/arch/sh/Kbuild | 1 +
> tools/perf/arch/sh/Makefile | 4 -
> tools/perf/arch/sh/util/Kbuild | 1 +
> tools/perf/arch/sparc/Kbuild | 1 +
> tools/perf/arch/sparc/Makefile | 4 -
> tools/perf/arch/sparc/util/Kbuild | 1 +
> tools/perf/arch/x86/Kbuild | 2 +
> tools/perf/arch/x86/Makefile | 19 -
> tools/perf/arch/x86/include/perf_regs.h | 8 +-
> tools/perf/arch/x86/tests/Kbuild | 3 +
> tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 2 +-
> tools/perf/arch/x86/tests/regs_load.S | 3 +-
> tools/perf/arch/x86/util/Kbuild | 6 +
> tools/perf/arch/x86/util/unwind-libunwind.c | 5 +-
> tools/perf/bench/Kbuild | 12 +
> tools/perf/bench/mem-memcpy-arch.h | 4 +-
> tools/perf/bench/mem-memcpy.c | 4 +-
> tools/perf/bench/mem-memset-arch.h | 4 +-
> tools/perf/bench/mem-memset.c | 4 +-
> tools/perf/builtin-annotate.c | 8 +-
> tools/perf/builtin-bench.c | 5 +-
> tools/perf/builtin-help.c | 1 +
> tools/perf/builtin-inject.c | 2 +-
> tools/perf/builtin-kvm.c | 38 +-
> tools/perf/builtin-lock.c | 5 +-
> tools/perf/builtin-probe.c | 15 +-
> tools/perf/builtin-record.c | 4 +-
> tools/perf/builtin-report.c | 3 +
> tools/perf/builtin-sched.c | 3 +
> tools/perf/builtin-script.c | 6 +-
> tools/perf/builtin-top.c | 19 +-
> tools/perf/config/Makefile | 430 +++++-----
> tools/perf/config/defconfig | 54 ++
> tools/perf/perf-sys.h | 4 +-
> tools/perf/perf.c | 53 +-
> tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
> tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
> tools/perf/tests/Kbuild | 40 +
> tools/perf/tests/builtin-test.c | 3 +-
> tools/perf/tests/configs/MINIMAL_config | 60 ++
> tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++
> .../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++
> .../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++
> .../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 ++
> tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 ++
> tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++
> .../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 ++
> tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 ++
> tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++
> tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 ++
> tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++
> .../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++
> tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 ++
> tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++
> tools/perf/tests/configs/NO_DEMANGLE_config | 71 ++
> tools/perf/tests/configs/NO_GTK2_config | 73 ++
> tools/perf/tests/configs/NO_LIBAUDIT_config | 72 ++
> tools/perf/tests/configs/NO_LIBDWARF_config | 71 ++
> tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++
> tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++
> tools/perf/tests/configs/NO_LIBGTK2_config | 71 ++
> tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++
> tools/perf/tests/configs/NO_LIBPERL_config | 73 ++
> tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++
> tools/perf/tests/configs/NO_LIBSLANG_config | 72 ++
> .../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++
> tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++
> tools/perf/tests/configs/NO_STDIO_config | 73 ++
> tools/perf/tests/configs/NO_TIMERFD_config | 73 ++
> tools/perf/tests/configs/NO_TUI_config | 73 ++
> tools/perf/tests/configs/NO_UNWIND_config | 69 ++
> tools/perf/tests/configs/REF_config | 73 ++
> tools/perf/tests/generate_configs.py | 43 +
> tools/perf/tests/make | 70 +-
> tools/perf/tests/tests.h | 6 +-
> tools/perf/ui/Kbuild | 15 +
> tools/perf/ui/browsers/Kbuild | 9 +
> tools/perf/ui/browsers/scripts.c | 4 +
> tools/perf/ui/gtk/Kbuild | 9 +
> tools/perf/ui/gtk/browser.c | 4 +-
> tools/perf/ui/gtk/gtk.h | 5 +-
> tools/perf/ui/gtk/util.c | 6 +-
> tools/perf/ui/setup.c | 12 +-
> tools/perf/ui/stdio/Kbuild | 1 +
> tools/perf/ui/tui/Kbuild | 4 +
> tools/perf/ui/ui.h | 4 +-
> tools/perf/util/Kbuild | 128 +++
> tools/perf/util/PERF-VERSION-GEN | 4 +
> tools/perf/util/annotate.h | 4 +-
> tools/perf/util/callchain.c | 11 +-
> tools/perf/util/callchain.h | 3 +-
> tools/perf/util/generate-cmdlist.sh | 22 +-
> tools/perf/util/hist.h | 3 +-
> tools/perf/util/include/dwarf-regs.h | 4 +-
> tools/perf/util/machine.c | 3 +-
> tools/perf/util/map.c | 3 +-
> tools/perf/util/perf_regs.c | 1 +
> tools/perf/util/perf_regs.h | 6 +-
> tools/perf/util/probe-event.c | 6 +-
> tools/perf/util/probe-finder.h | 5 +-
> tools/perf/util/scripting-engines/Kbuild | 11 +
> tools/perf/util/setup.py | 8 +-
> tools/perf/util/srcline.c | 8 +-
> tools/perf/util/symbol-elf.c | 3 +-
> tools/perf/util/symbol.h | 33 +-
> tools/perf/util/trace-event-scripting.c | 13 +-
> tools/perf/util/unwind-libunwind.c | 5 +-
> tools/perf/util/unwind.h | 7 +-
> tools/perf/util/util.c | 5 +-
> 143 files changed, 4992 insertions(+), 1410 deletions(-)
> create mode 100644 tools/perf/Kbuild
> create mode 100644 tools/perf/Kconfig
> create mode 100644 tools/perf/Makefile.kbuild
> delete mode 100644 tools/perf/Makefile.perf
> create mode 100644 tools/perf/arch/Kbuild
> create mode 100644 tools/perf/arch/arm/Kbuild
> delete mode 100644 tools/perf/arch/arm/Makefile
> create mode 100644 tools/perf/arch/arm/tests/Kbuild
> create mode 100644 tools/perf/arch/arm/util/Kbuild
> create mode 100644 tools/perf/arch/arm64/Kbuild
> delete mode 100644 tools/perf/arch/arm64/Makefile
> create mode 100644 tools/perf/arch/arm64/util/Kbuild
> create mode 100644 tools/perf/arch/powerpc/Kbuild
> delete mode 100644 tools/perf/arch/powerpc/Makefile
> create mode 100644 tools/perf/arch/powerpc/util/Kbuild
> create mode 100644 tools/perf/arch/s390/Kbuild
> delete mode 100644 tools/perf/arch/s390/Makefile
> create mode 100644 tools/perf/arch/s390/util/Kbuild
> create mode 100644 tools/perf/arch/sh/Kbuild
> delete mode 100644 tools/perf/arch/sh/Makefile
> create mode 100644 tools/perf/arch/sh/util/Kbuild
> create mode 100644 tools/perf/arch/sparc/Kbuild
> delete mode 100644 tools/perf/arch/sparc/Makefile
> create mode 100644 tools/perf/arch/sparc/util/Kbuild
> create mode 100644 tools/perf/arch/x86/Kbuild
> delete mode 100644 tools/perf/arch/x86/Makefile
> create mode 100644 tools/perf/arch/x86/tests/Kbuild
> rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (99%)
> create mode 100644 tools/perf/arch/x86/util/Kbuild
> create mode 100644 tools/perf/bench/Kbuild
> create mode 100644 tools/perf/config/defconfig
> create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
> create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
> create mode 100644 tools/perf/tests/Kbuild
> create mode 100644 tools/perf/tests/configs/MINIMAL_config
> create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
> create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
> create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
> create mode 100644 tools/perf/tests/configs/NO_GTK2_config
> create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
> create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
> create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
> create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
> create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
> create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
> create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
> create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
> create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
> create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
> create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
> create mode 100644 tools/perf/tests/configs/NO_STDIO_config
> create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
> create mode 100644 tools/perf/tests/configs/NO_TUI_config
> create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
> create mode 100644 tools/perf/tests/configs/REF_config
> create mode 100644 tools/perf/tests/generate_configs.py
> create mode 100644 tools/perf/ui/Kbuild
> create mode 100644 tools/perf/ui/browsers/Kbuild
> create mode 100644 tools/perf/ui/gtk/Kbuild
> create mode 100644 tools/perf/ui/stdio/Kbuild
> create mode 100644 tools/perf/ui/tui/Kbuild
> create mode 100644 tools/perf/util/Kbuild
> create mode 100644 tools/perf/util/scripting-engines/Kbuild
>
> --
>
> Changes since v2:
> * All the CCs addresses were missing
>
> 2.1.1

2014-10-24 12:42:18

by Alexis Berlemont

[permalink] [raw]
Subject: Re: [PATCH v3 00/14] Kbuild for perf

Arnaldo Carvalho de Melo wrote:
> Em Fri, Oct 24, 2014 at 12:28:08AM +0200, Alexis Berlemont escreveu:
> > Hello,
> >
> > Here is a proposal of perf's build process managed by Kbuild:
> > * The file Makefile.perf is replaced by Makefile.kbuild
> > * Makefile.kbuild generates a default .config file if none exists
> > (allyesconfig)
> > * Makefile.kbuild adapts the .config file according to the
> > features-check tests results
> > * Makefile.kbuild builds external dependencies (linux/tools/lib/*)
> > * Makefile.kbuild leaves the rest to Kbuild
> >
> > Regards,
>
> Thanks for working on this!
>
> What was the branch this was made against?
>

I used Linus Torvalds' master branch:
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Do you want me to use another branch ?

Alexis.

> > Alexis.
> >
> > Alexis Berlemont (11):
> > kbuild: add support of custom paths for "auto.conf*" files
> > perf kbuild: remove Makefile.perf
> > perf kbuild: remove legacy tui/gui-related build variables
> > perf kbuild: remove legacy demangle-related build variables
> > perf kbuild: cross-compilation variables are now handled in Kconfig
> > perf kbuild: remove legacy misc build variables
> > perf kbuild: remove legacy libelf-related build variables
> > perf kbuild: remove legacy libdwarf-related build variables
> > perf kbuild: remove legacy script-related build variables
> > perf kbuild: final cosmetic changes
> > perf kbuild: add generated Kconfig build-test cases
> >
> > Jiri Olsa (3):
> > perf tools: Kbuild builtin source related fixies
> > perf tools: Kbuild source related fixies
> > perf tools: Add kbuild support into Makefile.kbuild
> >
> > scripts/Makefile.build | 3 +-
> > scripts/kconfig/confdata.c | 23 +-
> > scripts/kconfig/lkc.h | 1 +
> > tools/perf/Kbuild | 47 +
> > tools/perf/Kconfig | 436 ++++++++++
> > tools/perf/MANIFEST | 1 +
> > tools/perf/Makefile | 2 +-
> > tools/perf/Makefile.kbuild | 443 ++++++++++
> > tools/perf/Makefile.perf | 949 ---------------------
> > tools/perf/arch/Kbuild | 3 +
> > tools/perf/arch/arm/Kbuild | 2 +
> > tools/perf/arch/arm/Makefile | 14 -
> > tools/perf/arch/arm/tests/Kbuild | 2 +
> > tools/perf/arch/arm/util/Kbuild | 3 +
> > tools/perf/arch/arm64/Kbuild | 1 +
> > tools/perf/arch/arm64/Makefile | 7 -
> > tools/perf/arch/arm64/util/Kbuild | 2 +
> > tools/perf/arch/powerpc/Kbuild | 1 +
> > tools/perf/arch/powerpc/Makefile | 6 -
> > tools/perf/arch/powerpc/util/Kbuild | 3 +
> > tools/perf/arch/s390/Kbuild | 1 +
> > tools/perf/arch/s390/Makefile | 7 -
> > tools/perf/arch/s390/util/Kbuild | 2 +
> > tools/perf/arch/sh/Kbuild | 1 +
> > tools/perf/arch/sh/Makefile | 4 -
> > tools/perf/arch/sh/util/Kbuild | 1 +
> > tools/perf/arch/sparc/Kbuild | 1 +
> > tools/perf/arch/sparc/Makefile | 4 -
> > tools/perf/arch/sparc/util/Kbuild | 1 +
> > tools/perf/arch/x86/Kbuild | 2 +
> > tools/perf/arch/x86/Makefile | 19 -
> > tools/perf/arch/x86/include/perf_regs.h | 8 +-
> > tools/perf/arch/x86/tests/Kbuild | 3 +
> > tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 2 +-
> > tools/perf/arch/x86/tests/regs_load.S | 3 +-
> > tools/perf/arch/x86/util/Kbuild | 6 +
> > tools/perf/arch/x86/util/unwind-libunwind.c | 5 +-
> > tools/perf/bench/Kbuild | 12 +
> > tools/perf/bench/mem-memcpy-arch.h | 4 +-
> > tools/perf/bench/mem-memcpy.c | 4 +-
> > tools/perf/bench/mem-memset-arch.h | 4 +-
> > tools/perf/bench/mem-memset.c | 4 +-
> > tools/perf/builtin-annotate.c | 8 +-
> > tools/perf/builtin-bench.c | 5 +-
> > tools/perf/builtin-help.c | 1 +
> > tools/perf/builtin-inject.c | 2 +-
> > tools/perf/builtin-kvm.c | 38 +-
> > tools/perf/builtin-lock.c | 5 +-
> > tools/perf/builtin-probe.c | 15 +-
> > tools/perf/builtin-record.c | 4 +-
> > tools/perf/builtin-report.c | 3 +
> > tools/perf/builtin-sched.c | 3 +
> > tools/perf/builtin-script.c | 6 +-
> > tools/perf/builtin-top.c | 19 +-
> > tools/perf/config/Makefile | 430 +++++-----
> > tools/perf/config/defconfig | 54 ++
> > tools/perf/perf-sys.h | 4 +-
> > tools/perf/perf.c | 53 +-
> > tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
> > tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
> > tools/perf/tests/Kbuild | 40 +
> > tools/perf/tests/builtin-test.c | 3 +-
> > tools/perf/tests/configs/MINIMAL_config | 60 ++
> > tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++
> > .../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++
> > .../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++
> > .../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 ++
> > tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 ++
> > tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++
> > .../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 ++
> > tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 ++
> > tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++
> > tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 ++
> > tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++
> > .../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++
> > tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 ++
> > tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++
> > tools/perf/tests/configs/NO_DEMANGLE_config | 71 ++
> > tools/perf/tests/configs/NO_GTK2_config | 73 ++
> > tools/perf/tests/configs/NO_LIBAUDIT_config | 72 ++
> > tools/perf/tests/configs/NO_LIBDWARF_config | 71 ++
> > tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++
> > tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++
> > tools/perf/tests/configs/NO_LIBGTK2_config | 71 ++
> > tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++
> > tools/perf/tests/configs/NO_LIBPERL_config | 73 ++
> > tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++
> > tools/perf/tests/configs/NO_LIBSLANG_config | 72 ++
> > .../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++
> > tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++
> > tools/perf/tests/configs/NO_STDIO_config | 73 ++
> > tools/perf/tests/configs/NO_TIMERFD_config | 73 ++
> > tools/perf/tests/configs/NO_TUI_config | 73 ++
> > tools/perf/tests/configs/NO_UNWIND_config | 69 ++
> > tools/perf/tests/configs/REF_config | 73 ++
> > tools/perf/tests/generate_configs.py | 43 +
> > tools/perf/tests/make | 70 +-
> > tools/perf/tests/tests.h | 6 +-
> > tools/perf/ui/Kbuild | 15 +
> > tools/perf/ui/browsers/Kbuild | 9 +
> > tools/perf/ui/browsers/scripts.c | 4 +
> > tools/perf/ui/gtk/Kbuild | 9 +
> > tools/perf/ui/gtk/browser.c | 4 +-
> > tools/perf/ui/gtk/gtk.h | 5 +-
> > tools/perf/ui/gtk/util.c | 6 +-
> > tools/perf/ui/setup.c | 12 +-
> > tools/perf/ui/stdio/Kbuild | 1 +
> > tools/perf/ui/tui/Kbuild | 4 +
> > tools/perf/ui/ui.h | 4 +-
> > tools/perf/util/Kbuild | 128 +++
> > tools/perf/util/PERF-VERSION-GEN | 4 +
> > tools/perf/util/annotate.h | 4 +-
> > tools/perf/util/callchain.c | 11 +-
> > tools/perf/util/callchain.h | 3 +-
> > tools/perf/util/generate-cmdlist.sh | 22 +-
> > tools/perf/util/hist.h | 3 +-
> > tools/perf/util/include/dwarf-regs.h | 4 +-
> > tools/perf/util/machine.c | 3 +-
> > tools/perf/util/map.c | 3 +-
> > tools/perf/util/perf_regs.c | 1 +
> > tools/perf/util/perf_regs.h | 6 +-
> > tools/perf/util/probe-event.c | 6 +-
> > tools/perf/util/probe-finder.h | 5 +-
> > tools/perf/util/scripting-engines/Kbuild | 11 +
> > tools/perf/util/setup.py | 8 +-
> > tools/perf/util/srcline.c | 8 +-
> > tools/perf/util/symbol-elf.c | 3 +-
> > tools/perf/util/symbol.h | 33 +-
> > tools/perf/util/trace-event-scripting.c | 13 +-
> > tools/perf/util/unwind-libunwind.c | 5 +-
> > tools/perf/util/unwind.h | 7 +-
> > tools/perf/util/util.c | 5 +-
> > 143 files changed, 4992 insertions(+), 1410 deletions(-)
> > create mode 100644 tools/perf/Kbuild
> > create mode 100644 tools/perf/Kconfig
> > create mode 100644 tools/perf/Makefile.kbuild
> > delete mode 100644 tools/perf/Makefile.perf
> > create mode 100644 tools/perf/arch/Kbuild
> > create mode 100644 tools/perf/arch/arm/Kbuild
> > delete mode 100644 tools/perf/arch/arm/Makefile
> > create mode 100644 tools/perf/arch/arm/tests/Kbuild
> > create mode 100644 tools/perf/arch/arm/util/Kbuild
> > create mode 100644 tools/perf/arch/arm64/Kbuild
> > delete mode 100644 tools/perf/arch/arm64/Makefile
> > create mode 100644 tools/perf/arch/arm64/util/Kbuild
> > create mode 100644 tools/perf/arch/powerpc/Kbuild
> > delete mode 100644 tools/perf/arch/powerpc/Makefile
> > create mode 100644 tools/perf/arch/powerpc/util/Kbuild
> > create mode 100644 tools/perf/arch/s390/Kbuild
> > delete mode 100644 tools/perf/arch/s390/Makefile
> > create mode 100644 tools/perf/arch/s390/util/Kbuild
> > create mode 100644 tools/perf/arch/sh/Kbuild
> > delete mode 100644 tools/perf/arch/sh/Makefile
> > create mode 100644 tools/perf/arch/sh/util/Kbuild
> > create mode 100644 tools/perf/arch/sparc/Kbuild
> > delete mode 100644 tools/perf/arch/sparc/Makefile
> > create mode 100644 tools/perf/arch/sparc/util/Kbuild
> > create mode 100644 tools/perf/arch/x86/Kbuild
> > delete mode 100644 tools/perf/arch/x86/Makefile
> > create mode 100644 tools/perf/arch/x86/tests/Kbuild
> > rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (99%)
> > create mode 100644 tools/perf/arch/x86/util/Kbuild
> > create mode 100644 tools/perf/bench/Kbuild
> > create mode 100644 tools/perf/config/defconfig
> > create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
> > create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
> > create mode 100644 tools/perf/tests/Kbuild
> > create mode 100644 tools/perf/tests/configs/MINIMAL_config
> > create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
> > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
> > create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
> > create mode 100644 tools/perf/tests/configs/NO_GTK2_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
> > create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
> > create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
> > create mode 100644 tools/perf/tests/configs/NO_STDIO_config
> > create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
> > create mode 100644 tools/perf/tests/configs/NO_TUI_config
> > create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
> > create mode 100644 tools/perf/tests/configs/REF_config
> > create mode 100644 tools/perf/tests/generate_configs.py
> > create mode 100644 tools/perf/ui/Kbuild
> > create mode 100644 tools/perf/ui/browsers/Kbuild
> > create mode 100644 tools/perf/ui/gtk/Kbuild
> > create mode 100644 tools/perf/ui/stdio/Kbuild
> > create mode 100644 tools/perf/ui/tui/Kbuild
> > create mode 100644 tools/perf/util/Kbuild
> > create mode 100644 tools/perf/util/scripting-engines/Kbuild
> >
> > --
> >
> > Changes since v2:
> > * All the CCs addresses were missing
> >
> > 2.1.1

2014-10-24 12:46:44

by Arnaldo Carvalho de Melo

[permalink] [raw]
Subject: Re: [PATCH v3 00/14] Kbuild for perf

Em Fri, Oct 24, 2014 at 02:39:54PM +0200, Alexis Berlemont escreveu:
> Arnaldo Carvalho de Melo wrote:
> > Em Fri, Oct 24, 2014 at 12:28:08AM +0200, Alexis Berlemont escreveu:
> > > Hello,
> > >
> > > Here is a proposal of perf's build process managed by Kbuild:
> > > * The file Makefile.perf is replaced by Makefile.kbuild
> > > * Makefile.kbuild generates a default .config file if none exists
> > > (allyesconfig)
> > > * Makefile.kbuild adapts the .config file according to the
> > > features-check tests results
> > > * Makefile.kbuild builds external dependencies (linux/tools/lib/*)
> > > * Makefile.kbuild leaves the rest to Kbuild
> > >
> > > Regards,
> >
> > Thanks for working on this!
> >
> > What was the branch this was made against?
> >
>
> I used Linus Torvalds' master branch:
> git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>
> Do you want me to use another branch ?

Yes, please:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf/core

This is where the latest perf tooling development takes place, and it is
where I am going to (try to) apply your patches.

- Arnaldo

> Alexis.
>
> > > Alexis.
> > >
> > > Alexis Berlemont (11):
> > > kbuild: add support of custom paths for "auto.conf*" files
> > > perf kbuild: remove Makefile.perf
> > > perf kbuild: remove legacy tui/gui-related build variables
> > > perf kbuild: remove legacy demangle-related build variables
> > > perf kbuild: cross-compilation variables are now handled in Kconfig
> > > perf kbuild: remove legacy misc build variables
> > > perf kbuild: remove legacy libelf-related build variables
> > > perf kbuild: remove legacy libdwarf-related build variables
> > > perf kbuild: remove legacy script-related build variables
> > > perf kbuild: final cosmetic changes
> > > perf kbuild: add generated Kconfig build-test cases
> > >
> > > Jiri Olsa (3):
> > > perf tools: Kbuild builtin source related fixies
> > > perf tools: Kbuild source related fixies
> > > perf tools: Add kbuild support into Makefile.kbuild
> > >
> > > scripts/Makefile.build | 3 +-
> > > scripts/kconfig/confdata.c | 23 +-
> > > scripts/kconfig/lkc.h | 1 +
> > > tools/perf/Kbuild | 47 +
> > > tools/perf/Kconfig | 436 ++++++++++
> > > tools/perf/MANIFEST | 1 +
> > > tools/perf/Makefile | 2 +-
> > > tools/perf/Makefile.kbuild | 443 ++++++++++
> > > tools/perf/Makefile.perf | 949 ---------------------
> > > tools/perf/arch/Kbuild | 3 +
> > > tools/perf/arch/arm/Kbuild | 2 +
> > > tools/perf/arch/arm/Makefile | 14 -
> > > tools/perf/arch/arm/tests/Kbuild | 2 +
> > > tools/perf/arch/arm/util/Kbuild | 3 +
> > > tools/perf/arch/arm64/Kbuild | 1 +
> > > tools/perf/arch/arm64/Makefile | 7 -
> > > tools/perf/arch/arm64/util/Kbuild | 2 +
> > > tools/perf/arch/powerpc/Kbuild | 1 +
> > > tools/perf/arch/powerpc/Makefile | 6 -
> > > tools/perf/arch/powerpc/util/Kbuild | 3 +
> > > tools/perf/arch/s390/Kbuild | 1 +
> > > tools/perf/arch/s390/Makefile | 7 -
> > > tools/perf/arch/s390/util/Kbuild | 2 +
> > > tools/perf/arch/sh/Kbuild | 1 +
> > > tools/perf/arch/sh/Makefile | 4 -
> > > tools/perf/arch/sh/util/Kbuild | 1 +
> > > tools/perf/arch/sparc/Kbuild | 1 +
> > > tools/perf/arch/sparc/Makefile | 4 -
> > > tools/perf/arch/sparc/util/Kbuild | 1 +
> > > tools/perf/arch/x86/Kbuild | 2 +
> > > tools/perf/arch/x86/Makefile | 19 -
> > > tools/perf/arch/x86/include/perf_regs.h | 8 +-
> > > tools/perf/arch/x86/tests/Kbuild | 3 +
> > > tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 2 +-
> > > tools/perf/arch/x86/tests/regs_load.S | 3 +-
> > > tools/perf/arch/x86/util/Kbuild | 6 +
> > > tools/perf/arch/x86/util/unwind-libunwind.c | 5 +-
> > > tools/perf/bench/Kbuild | 12 +
> > > tools/perf/bench/mem-memcpy-arch.h | 4 +-
> > > tools/perf/bench/mem-memcpy.c | 4 +-
> > > tools/perf/bench/mem-memset-arch.h | 4 +-
> > > tools/perf/bench/mem-memset.c | 4 +-
> > > tools/perf/builtin-annotate.c | 8 +-
> > > tools/perf/builtin-bench.c | 5 +-
> > > tools/perf/builtin-help.c | 1 +
> > > tools/perf/builtin-inject.c | 2 +-
> > > tools/perf/builtin-kvm.c | 38 +-
> > > tools/perf/builtin-lock.c | 5 +-
> > > tools/perf/builtin-probe.c | 15 +-
> > > tools/perf/builtin-record.c | 4 +-
> > > tools/perf/builtin-report.c | 3 +
> > > tools/perf/builtin-sched.c | 3 +
> > > tools/perf/builtin-script.c | 6 +-
> > > tools/perf/builtin-top.c | 19 +-
> > > tools/perf/config/Makefile | 430 +++++-----
> > > tools/perf/config/defconfig | 54 ++
> > > tools/perf/perf-sys.h | 4 +-
> > > tools/perf/perf.c | 53 +-
> > > tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
> > > tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
> > > tools/perf/tests/Kbuild | 40 +
> > > tools/perf/tests/builtin-test.c | 3 +-
> > > tools/perf/tests/configs/MINIMAL_config | 60 ++
> > > tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++
> > > .../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++
> > > .../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++
> > > .../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 ++
> > > tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 ++
> > > tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++
> > > .../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 ++
> > > tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 ++
> > > tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++
> > > tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 ++
> > > tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++
> > > .../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++
> > > tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 ++
> > > tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++
> > > tools/perf/tests/configs/NO_DEMANGLE_config | 71 ++
> > > tools/perf/tests/configs/NO_GTK2_config | 73 ++
> > > tools/perf/tests/configs/NO_LIBAUDIT_config | 72 ++
> > > tools/perf/tests/configs/NO_LIBDWARF_config | 71 ++
> > > tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++
> > > tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++
> > > tools/perf/tests/configs/NO_LIBGTK2_config | 71 ++
> > > tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++
> > > tools/perf/tests/configs/NO_LIBPERL_config | 73 ++
> > > tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++
> > > tools/perf/tests/configs/NO_LIBSLANG_config | 72 ++
> > > .../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++
> > > tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++
> > > tools/perf/tests/configs/NO_STDIO_config | 73 ++
> > > tools/perf/tests/configs/NO_TIMERFD_config | 73 ++
> > > tools/perf/tests/configs/NO_TUI_config | 73 ++
> > > tools/perf/tests/configs/NO_UNWIND_config | 69 ++
> > > tools/perf/tests/configs/REF_config | 73 ++
> > > tools/perf/tests/generate_configs.py | 43 +
> > > tools/perf/tests/make | 70 +-
> > > tools/perf/tests/tests.h | 6 +-
> > > tools/perf/ui/Kbuild | 15 +
> > > tools/perf/ui/browsers/Kbuild | 9 +
> > > tools/perf/ui/browsers/scripts.c | 4 +
> > > tools/perf/ui/gtk/Kbuild | 9 +
> > > tools/perf/ui/gtk/browser.c | 4 +-
> > > tools/perf/ui/gtk/gtk.h | 5 +-
> > > tools/perf/ui/gtk/util.c | 6 +-
> > > tools/perf/ui/setup.c | 12 +-
> > > tools/perf/ui/stdio/Kbuild | 1 +
> > > tools/perf/ui/tui/Kbuild | 4 +
> > > tools/perf/ui/ui.h | 4 +-
> > > tools/perf/util/Kbuild | 128 +++
> > > tools/perf/util/PERF-VERSION-GEN | 4 +
> > > tools/perf/util/annotate.h | 4 +-
> > > tools/perf/util/callchain.c | 11 +-
> > > tools/perf/util/callchain.h | 3 +-
> > > tools/perf/util/generate-cmdlist.sh | 22 +-
> > > tools/perf/util/hist.h | 3 +-
> > > tools/perf/util/include/dwarf-regs.h | 4 +-
> > > tools/perf/util/machine.c | 3 +-
> > > tools/perf/util/map.c | 3 +-
> > > tools/perf/util/perf_regs.c | 1 +
> > > tools/perf/util/perf_regs.h | 6 +-
> > > tools/perf/util/probe-event.c | 6 +-
> > > tools/perf/util/probe-finder.h | 5 +-
> > > tools/perf/util/scripting-engines/Kbuild | 11 +
> > > tools/perf/util/setup.py | 8 +-
> > > tools/perf/util/srcline.c | 8 +-
> > > tools/perf/util/symbol-elf.c | 3 +-
> > > tools/perf/util/symbol.h | 33 +-
> > > tools/perf/util/trace-event-scripting.c | 13 +-
> > > tools/perf/util/unwind-libunwind.c | 5 +-
> > > tools/perf/util/unwind.h | 7 +-
> > > tools/perf/util/util.c | 5 +-
> > > 143 files changed, 4992 insertions(+), 1410 deletions(-)
> > > create mode 100644 tools/perf/Kbuild
> > > create mode 100644 tools/perf/Kconfig
> > > create mode 100644 tools/perf/Makefile.kbuild
> > > delete mode 100644 tools/perf/Makefile.perf
> > > create mode 100644 tools/perf/arch/Kbuild
> > > create mode 100644 tools/perf/arch/arm/Kbuild
> > > delete mode 100644 tools/perf/arch/arm/Makefile
> > > create mode 100644 tools/perf/arch/arm/tests/Kbuild
> > > create mode 100644 tools/perf/arch/arm/util/Kbuild
> > > create mode 100644 tools/perf/arch/arm64/Kbuild
> > > delete mode 100644 tools/perf/arch/arm64/Makefile
> > > create mode 100644 tools/perf/arch/arm64/util/Kbuild
> > > create mode 100644 tools/perf/arch/powerpc/Kbuild
> > > delete mode 100644 tools/perf/arch/powerpc/Makefile
> > > create mode 100644 tools/perf/arch/powerpc/util/Kbuild
> > > create mode 100644 tools/perf/arch/s390/Kbuild
> > > delete mode 100644 tools/perf/arch/s390/Makefile
> > > create mode 100644 tools/perf/arch/s390/util/Kbuild
> > > create mode 100644 tools/perf/arch/sh/Kbuild
> > > delete mode 100644 tools/perf/arch/sh/Makefile
> > > create mode 100644 tools/perf/arch/sh/util/Kbuild
> > > create mode 100644 tools/perf/arch/sparc/Kbuild
> > > delete mode 100644 tools/perf/arch/sparc/Makefile
> > > create mode 100644 tools/perf/arch/sparc/util/Kbuild
> > > create mode 100644 tools/perf/arch/x86/Kbuild
> > > delete mode 100644 tools/perf/arch/x86/Makefile
> > > create mode 100644 tools/perf/arch/x86/tests/Kbuild
> > > rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (99%)
> > > create mode 100644 tools/perf/arch/x86/util/Kbuild
> > > create mode 100644 tools/perf/bench/Kbuild
> > > create mode 100644 tools/perf/config/defconfig
> > > create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
> > > create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
> > > create mode 100644 tools/perf/tests/Kbuild
> > > create mode 100644 tools/perf/tests/configs/MINIMAL_config
> > > create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
> > > create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
> > > create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
> > > create mode 100644 tools/perf/tests/configs/NO_GTK2_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
> > > create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
> > > create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
> > > create mode 100644 tools/perf/tests/configs/NO_STDIO_config
> > > create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
> > > create mode 100644 tools/perf/tests/configs/NO_TUI_config
> > > create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
> > > create mode 100644 tools/perf/tests/configs/REF_config
> > > create mode 100644 tools/perf/tests/generate_configs.py
> > > create mode 100644 tools/perf/ui/Kbuild
> > > create mode 100644 tools/perf/ui/browsers/Kbuild
> > > create mode 100644 tools/perf/ui/gtk/Kbuild
> > > create mode 100644 tools/perf/ui/stdio/Kbuild
> > > create mode 100644 tools/perf/ui/tui/Kbuild
> > > create mode 100644 tools/perf/util/Kbuild
> > > create mode 100644 tools/perf/util/scripting-engines/Kbuild
> > >
> > > --
> > >
> > > Changes since v2:
> > > * All the CCs addresses were missing
> > >
> > > 2.1.1

2014-10-25 22:23:17

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 01/14] kbuild: add support of custom paths for "auto.conf*" files

In the scripts/Makefile.build, use KCONFIG_AUTOCONFIG to include a
custom path for the "auto.conf" file.

The "*conf" programs were modified so as to work with the environment
variable KCONFIG_AUTOCONFIG.

Signed-off-by: Alexis Berlemont <[email protected]>
---
scripts/Makefile.build | 3 ++-
scripts/kconfig/confdata.c | 23 ++++++++++++++++++++++-
scripts/kconfig/lkc.h | 1 +
3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 649ce68..2abb82f 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -31,7 +31,8 @@ subdir-asflags-y :=
subdir-ccflags-y :=

# Read auto.conf if it exists, otherwise ignore
--include include/config/auto.conf
+kconfig-autoconfig := $(if $(KCONFIG_AUTOCONFIG),$(KCONFIG_AUTOCONFIG),include/config/auto.conf)
+-include $(kconfig-autoconfig)

include scripts/Kbuild.include

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index f88d90f..75cf6bf 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -75,6 +75,23 @@ const char *conf_get_autoconfig_name(void)
return name ? name : "include/config/auto.conf";
}

+const char *conf_get_autoconfigdep_name(void)
+{
+ static char res_value[PATH_MAX+1];
+
+ const char *name = conf_get_autoconfig_name();
+
+ if (strlen(name) > PATH_MAX - 4)
+ name = NULL;
+ else {
+ strcpy(res_value, name);
+ strcat(res_value, ".cmd");
+ name = res_value;
+ }
+
+ return name;
+}
+
static char *conf_expand_value(const char *in)
{
struct symbol *sym;
@@ -953,7 +970,11 @@ int conf_write_autoconf(void)

sym_clear_all_valid();

- file_write_dep("include/config/auto.conf.cmd");
+ name = conf_get_autoconfigdep_name();
+ if (name == NULL)
+ return 1;
+
+ file_write_dep(name);

if (conf_split_config())
return 1;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index d5daa7a..ac99004 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -84,6 +84,7 @@ const char *zconf_curname(void);
/* confdata.c */
const char *conf_get_configname(void);
const char *conf_get_autoconfig_name(void);
+const char *conf_get_autoconfigdep_name(void);
char *conf_get_default_confname(void);
void sym_set_change_count(int count);
void sym_add_change_count(int count);
--
2.1.1

2014-10-25 22:23:14

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 00/14] Kbuild for perf

Hello,

Here is a proposal of perf's build process managed by Kbuild:
* The file Makefile.perf is replaced by Makefile.kbuild
* Makefile.kbuild generates a default .config file if none exists
(allyesconfig)
* Makefile.kbuild adapts the .config file according to the
features-check tests results
* Makefile.kbuild builds external dependencies (linux/tools/lib/*)
* Makefile.kbuild leaves the rest to Kbuild

Changes since v3:
* Patchs were generated starting from the following branch:
git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf/core
* Add Kconfig options for 32-bit compatibility VDSOs
* Target build-test: for each .config-based test case, call "make
olddefconfig" so as to prevent failure because of new Kconfig
symbol(s)

Regards,

Alexis.

Alexis Berlemont (11):
kbuild: add support of custom paths for "auto.conf*" files
perf kbuild: remove Makefile.perf
perf kbuild: remove legacy tui/gui-related build variables
perf kbuild: remove legacy demangle-related build variables
perf kbuild: cross-compilation variables are now handled in Kconfig
perf kbuild: remove legacy misc build variables
perf kbuild: remove legacy libelf-related build variables
perf kbuild: remove legacy libdwarf-related build variables
perf kbuild: remove legacy script-related build variables
perf kbuild: final cosmetic changes
perf kbuild: add generated Kconfig build-test cases

Jiri Olsa (3):
perf tools: Kbuild builtin source related fixies
perf tools: Kbuild source related fixies
perf tools: Add kbuild support into Makefile.kbuild

scripts/Makefile.build | 3 +-
scripts/kconfig/confdata.c | 23 +-
scripts/kconfig/lkc.h | 1 +
tools/perf/Kbuild | 47 +
tools/perf/Kconfig | 452 ++++++++++
tools/perf/MANIFEST | 1 +
tools/perf/Makefile | 2 +-
tools/perf/Makefile.kbuild | 443 ++++++++++
tools/perf/Makefile.perf | 981 ---------------------
tools/perf/arch/Kbuild | 3 +
tools/perf/arch/arm/Kbuild | 2 +
tools/perf/arch/arm/Makefile | 14 -
tools/perf/arch/arm/tests/Kbuild | 2 +
tools/perf/arch/arm/util/Kbuild | 3 +
tools/perf/arch/arm64/Kbuild | 1 +
tools/perf/arch/arm64/Makefile | 7 -
tools/perf/arch/arm64/util/Kbuild | 2 +
tools/perf/arch/powerpc/Kbuild | 1 +
tools/perf/arch/powerpc/Makefile | 6 -
tools/perf/arch/powerpc/util/Kbuild | 3 +
tools/perf/arch/s390/Kbuild | 1 +
tools/perf/arch/s390/Makefile | 7 -
tools/perf/arch/s390/util/Kbuild | 2 +
tools/perf/arch/sh/Kbuild | 1 +
tools/perf/arch/sh/Makefile | 4 -
tools/perf/arch/sh/util/Kbuild | 1 +
tools/perf/arch/sparc/Kbuild | 1 +
tools/perf/arch/sparc/Makefile | 4 -
tools/perf/arch/sparc/util/Kbuild | 1 +
tools/perf/arch/x86/Kbuild | 2 +
tools/perf/arch/x86/Makefile | 19 -
tools/perf/arch/x86/include/perf_regs.h | 8 +-
tools/perf/arch/x86/tests/Kbuild | 3 +
tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 2 +-
tools/perf/arch/x86/tests/regs_load.S | 3 +-
tools/perf/arch/x86/util/Kbuild | 6 +
tools/perf/arch/x86/util/unwind-libunwind.c | 5 +-
tools/perf/bench/Kbuild | 12 +
tools/perf/bench/mem-memcpy-arch.h | 4 +-
tools/perf/bench/mem-memcpy.c | 4 +-
tools/perf/bench/mem-memset-arch.h | 4 +-
tools/perf/bench/mem-memset.c | 4 +-
tools/perf/builtin-annotate.c | 8 +-
tools/perf/builtin-bench.c | 5 +-
tools/perf/builtin-help.c | 1 +
tools/perf/builtin-inject.c | 2 +-
tools/perf/builtin-kvm.c | 38 +-
tools/perf/builtin-lock.c | 5 +-
tools/perf/builtin-probe.c | 15 +-
tools/perf/builtin-record.c | 4 +-
tools/perf/builtin-report.c | 3 +
tools/perf/builtin-sched.c | 3 +
tools/perf/builtin-script.c | 6 +-
tools/perf/builtin-top.c | 19 +-
tools/perf/config/Makefile | 459 +++++-----
tools/perf/config/defconfig | 54 ++
tools/perf/perf-sys.h | 4 +-
tools/perf/perf.c | 53 +-
tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
tools/perf/tests/Kbuild | 40 +
tools/perf/tests/builtin-test.c | 3 +-
tools/perf/tests/configs/MINIMAL_config | 60 ++
tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++
.../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++
.../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 ++
tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 ++
tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++
tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++
.../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++
tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 ++
tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++
tools/perf/tests/configs/NO_DEMANGLE_config | 71 ++
tools/perf/tests/configs/NO_GTK2_config | 73 ++
tools/perf/tests/configs/NO_LIBAUDIT_config | 72 ++
tools/perf/tests/configs/NO_LIBDWARF_config | 71 ++
tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++
tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++
tools/perf/tests/configs/NO_LIBGTK2_config | 71 ++
tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++
tools/perf/tests/configs/NO_LIBPERL_config | 73 ++
tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++
tools/perf/tests/configs/NO_LIBSLANG_config | 72 ++
.../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++
tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++
tools/perf/tests/configs/NO_STDIO_config | 73 ++
tools/perf/tests/configs/NO_TIMERFD_config | 73 ++
tools/perf/tests/configs/NO_TUI_config | 73 ++
tools/perf/tests/configs/NO_UNWIND_config | 69 ++
tools/perf/tests/configs/REF_config | 73 ++
tools/perf/tests/generate_configs.py | 43 +
tools/perf/tests/make | 70 +-
tools/perf/tests/tests.h | 6 +-
tools/perf/ui/Kbuild | 15 +
tools/perf/ui/browsers/Kbuild | 9 +
tools/perf/ui/browsers/scripts.c | 4 +
tools/perf/ui/gtk/Kbuild | 9 +
tools/perf/ui/gtk/browser.c | 4 +-
tools/perf/ui/gtk/gtk.h | 5 +-
tools/perf/ui/gtk/util.c | 6 +-
tools/perf/ui/setup.c | 12 +-
tools/perf/ui/stdio/Kbuild | 1 +
tools/perf/ui/tui/Kbuild | 4 +
tools/perf/ui/ui.h | 4 +-
tools/perf/util/Kbuild | 129 +++
tools/perf/util/PERF-VERSION-GEN | 4 +
tools/perf/util/annotate.h | 4 +-
tools/perf/util/callchain.c | 11 +-
tools/perf/util/callchain.h | 3 +-
tools/perf/util/generate-cmdlist.sh | 22 +-
tools/perf/util/hist.h | 3 +-
tools/perf/util/include/dwarf-regs.h | 4 +-
tools/perf/util/machine.c | 3 +-
tools/perf/util/map.c | 3 +-
tools/perf/util/perf_regs.c | 1 +
tools/perf/util/perf_regs.h | 6 +-
tools/perf/util/probe-event.c | 6 +-
tools/perf/util/probe-finder.h | 5 +-
tools/perf/util/scripting-engines/Kbuild | 11 +
tools/perf/util/setup.py | 8 +-
tools/perf/util/srcline.c | 8 +-
tools/perf/util/symbol-elf.c | 3 +-
tools/perf/util/symbol.h | 33 +-
tools/perf/util/trace-event-scripting.c | 13 +-
tools/perf/util/unwind-libunwind.c | 5 +-
tools/perf/util/unwind.h | 7 +-
tools/perf/util/util.c | 5 +-
tools/perf/util/vdso.c | 5 +-
144 files changed, 5021 insertions(+), 1464 deletions(-)
create mode 100644 tools/perf/Kbuild
create mode 100644 tools/perf/Kconfig
create mode 100644 tools/perf/Makefile.kbuild
delete mode 100644 tools/perf/Makefile.perf
create mode 100644 tools/perf/arch/Kbuild
create mode 100644 tools/perf/arch/arm/Kbuild
delete mode 100644 tools/perf/arch/arm/Makefile
create mode 100644 tools/perf/arch/arm/tests/Kbuild
create mode 100644 tools/perf/arch/arm/util/Kbuild
create mode 100644 tools/perf/arch/arm64/Kbuild
delete mode 100644 tools/perf/arch/arm64/Makefile
create mode 100644 tools/perf/arch/arm64/util/Kbuild
create mode 100644 tools/perf/arch/powerpc/Kbuild
delete mode 100644 tools/perf/arch/powerpc/Makefile
create mode 100644 tools/perf/arch/powerpc/util/Kbuild
create mode 100644 tools/perf/arch/s390/Kbuild
delete mode 100644 tools/perf/arch/s390/Makefile
create mode 100644 tools/perf/arch/s390/util/Kbuild
create mode 100644 tools/perf/arch/sh/Kbuild
delete mode 100644 tools/perf/arch/sh/Makefile
create mode 100644 tools/perf/arch/sh/util/Kbuild
create mode 100644 tools/perf/arch/sparc/Kbuild
delete mode 100644 tools/perf/arch/sparc/Makefile
create mode 100644 tools/perf/arch/sparc/util/Kbuild
create mode 100644 tools/perf/arch/x86/Kbuild
delete mode 100644 tools/perf/arch/x86/Makefile
create mode 100644 tools/perf/arch/x86/tests/Kbuild
rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (99%)
create mode 100644 tools/perf/arch/x86/util/Kbuild
create mode 100644 tools/perf/bench/Kbuild
create mode 100644 tools/perf/config/defconfig
create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/tests/Kbuild
create mode 100644 tools/perf/tests/configs/MINIMAL_config
create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
create mode 100644 tools/perf/tests/configs/NO_GTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
create mode 100644 tools/perf/tests/configs/NO_STDIO_config
create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
create mode 100644 tools/perf/tests/configs/NO_TUI_config
create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
create mode 100644 tools/perf/tests/configs/REF_config
create mode 100644 tools/perf/tests/generate_configs.py
create mode 100644 tools/perf/ui/Kbuild
create mode 100644 tools/perf/ui/browsers/Kbuild
create mode 100644 tools/perf/ui/gtk/Kbuild
create mode 100644 tools/perf/ui/stdio/Kbuild
create mode 100644 tools/perf/ui/tui/Kbuild
create mode 100644 tools/perf/util/Kbuild
create mode 100644 tools/perf/util/scripting-engines/Kbuild

--
2.1.1

2014-10-25 22:23:22

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 02/14] perf tools: Kbuild builtin source related fixies

From: Jiri Olsa <[email protected]>

Adding CONFIG_BUILTIN_* defines to govern builtin commands.
This will be useful for kbuild process switch.

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-annotate.c | 8 ++++++-
tools/perf/builtin-cmds.h | 27 ++++++++++++++++++++++
tools/perf/builtin-help.c | 1 +
tools/perf/builtin-kvm.c | 19 ++++++++++------
tools/perf/builtin-report.c | 3 +++
tools/perf/builtin-top.c | 19 ++++++++++++----
tools/perf/perf.c | 45 +++++++++++++++++++++++++++++++++++--
tools/perf/ui/setup.c | 6 +++--
tools/perf/util/generate-cmdlist.sh | 10 +++++++++
9 files changed, 122 insertions(+), 16 deletions(-)
create mode 100644 tools/perf/builtin-cmds.h

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index e7417fe..19cb967 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -5,6 +5,7 @@
* look up and read DSOs and symbol information and display
* a histogram of results, along various sorting keys.
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "util/util.h"
@@ -115,7 +116,7 @@ static void hists__find_annotations(struct hists *hists,
struct perf_evsel *evsel,
struct perf_annotate *ann)
{
- struct rb_node *nd = rb_first(&hists->entries), *next;
+ struct rb_node *nd = rb_first(&hists->entries);
int key = K_RIGHT;

while (nd) {
@@ -154,7 +155,9 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
+#ifdef CONFIG_TUI
} else if (use_browser == 1) {
+ struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
switch (key) {
case -1:
@@ -173,6 +176,7 @@ find_next:

if (next != NULL)
nd = next;
+#endif /* CONFIG_TUI */
} else {
hist_entry__tty_annotate(he, evsel, ann);
nd = rb_next(nd);
@@ -299,7 +303,9 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
+#ifdef CONFIG_TUI
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
+#endif /* CONFIG_TUI */
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
new file mode 100644
index 0000000..fec342a
--- /dev/null
+++ b/tools/perf/builtin-cmds.h
@@ -0,0 +1,27 @@
+#ifndef BUILTIN_CMDS_H
+#define BUILTIN_CMDS_H
+
+#define CONFIG_BUILTIN_REPORT 1
+#define CONFIG_BUILTIN_SCRIPT 1
+#define CONFIG_BUILTIN_BENCH 1
+#define CONFIG_BUILTIN_SCHED 1
+#define CONFIG_BUILTIN_TRACE 1
+#define CONFIG_BUILTIN_TOP 1
+#define CONFIG_BUILTIN_RECORD 1
+#define CONFIG_BUILTIN_BUILDID_LIST 1
+#define CONFIG_BUILTIN_INJECT 1
+#define CONFIG_BUILTIN_LOCK 1
+#define CONFIG_BUILTIN_KVM 1
+#define CONFIG_BUILTIN_BUILDID_CACHE 1
+#define CONFIG_BUILTIN_EVLIST 1
+#define CONFIG_BUILTIN_KMEM 1
+#define CONFIG_BUILTIN_STAT 1
+#define CONFIG_BUILTIN_DIFF 1
+#define CONFIG_BUILTIN_ANNOTATE 1
+#define CONFIG_BUILTIN_TIMECHART 1
+#define CONFIG_BUILTIN_LIST 1
+#define CONFIG_BUILTIN_HELP 1
+#define CONFIG_BUILTIN_PROBE 1
+#define CONFIG_BUILTIN_MEM 1
+
+#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index 25d2062..fbbbaa4 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -7,6 +7,7 @@
#include "util/cache.h"
#include "builtin.h"
#include "util/exec_cmd.h"
+#include "builtin-cmds.h"
#include "common-cmds.h"
#include "util/parse-options.h"
#include "util/run-command.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 3c0f3d4..e042728 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1556,20 +1556,25 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)

if (!strncmp(argv[0], "rec", 3))
return __cmd_record(file_name, argc, argv);
- else if (!strncmp(argv[0], "rep", 3))
+
+ if (!strncmp(argv[0], "rep", 3))
return __cmd_report(file_name, argc, argv);
- else if (!strncmp(argv[0], "diff", 4))
+
+ if (!strncmp(argv[0], "diff", 4))
return cmd_diff(argc, argv, NULL);
- else if (!strncmp(argv[0], "top", 3))
+
+ if (!strncmp(argv[0], "top", 3))
return cmd_top(argc, argv, NULL);
- else if (!strncmp(argv[0], "buildid-list", 12))
+
+ if (!strncmp(argv[0], "buildid-list", 12))
return __cmd_buildid_list(file_name, argc, argv);
+
#ifdef HAVE_KVM_STAT_SUPPORT
- else if (!strncmp(argv[0], "stat", 4))
+ if (!strncmp(argv[0], "stat", 4))
return kvm_cmd_stat(file_name, argc, argv);
#endif
- else
- usage_with_options(kvm_usage, kvm_options);
+
+ usage_with_options(kvm_usage, kvm_options);

return 0;
}
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 140a6cd..00d93ff 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -5,6 +5,7 @@
* look up and read DSOs and symbol information and display
* a histogram of results, along various sorting keys.
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "util/util.h"
@@ -406,6 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
+#ifdef CONFIG_TUI
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
@@ -417,6 +419,7 @@ static int report__browse_hists(struct report *rep)
if (ret != K_SWITCH_INPUT_DATA)
ret = 0;
break;
+#endif /* CONFIG_TUI */
case 2:
ret = report__gtk_browse_hists(rep, help);
break;
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 0aa7747..a2ff8b7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -17,6 +17,7 @@
*
* Released under the GPL v2. (and only v2, not any later version)
*/
+#include "generated/autoconf.h"
#include "builtin.h"

#include "perf.h"
@@ -534,6 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

+#ifdef CONFIG_TUI
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -586,6 +588,7 @@ static void *display_thread_tui(void *arg)
done = 1;
return NULL;
}
+#endif /* CONFIG_TUI */

static void display_sig(int sig __maybe_unused)
{
@@ -926,9 +929,12 @@ static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused)
return 0;
}

+typedef void* (*display_fn_t)(void *);
+
static int __cmd_top(struct perf_top *top)
{
struct record_opts *opts = &top->record_opts;
+ display_fn_t display_fn = display_thread;
pthread_t thread;
int ret;

@@ -965,8 +971,8 @@ static int __cmd_top(struct perf_top *top)
* XXX 'top' still doesn't start workloads like record, trace, but should,
* so leave the check here.
*/
- if (!target__none(&opts->target))
- perf_evlist__enable(top->evlist);
+ if (!target__none(&opts->target))
+ perf_evlist__enable(top->evlist);

/* Wait for a minimal set of events before starting the snapshot */
perf_evlist__poll(top->evlist, 100);
@@ -974,8 +980,13 @@ static int __cmd_top(struct perf_top *top)
perf_top__mmap_read(top);

ret = -1;
- if (pthread_create(&thread, NULL, (use_browser > 0 ? display_thread_tui :
- display_thread), top)) {
+
+#ifdef CONFIG_TUI
+ if (use_browser > 0)
+ display_fn = display_thread_tui;
+#endif
+
+ if (pthread_create(&thread, NULL, display_fn, top)) {
ui__error("Could not create display thread.\n");
goto out_delete;
}
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 452a847..ab363b5 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -7,6 +7,7 @@
* perf top, perf record, perf report, etc.) are started.
*/
#include "builtin.h"
+#include "builtin-cmds.h"

#include "util/exec_cmd.h"
#include "util/cache.h"
@@ -34,34 +35,74 @@ struct cmd_struct {
};

static struct cmd_struct commands[] = {
+#ifdef CONFIG_BUILTIN_BUILDID_CACHE
{ "buildid-cache", cmd_buildid_cache, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_BUILDID_LIST
{ "buildid-list", cmd_buildid_list, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_DIFF
{ "diff", cmd_diff, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_EVLIST
{ "evlist", cmd_evlist, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_HELP
{ "help", cmd_help, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_LIST
{ "list", cmd_list, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_RECORD
{ "record", cmd_record, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_REPORT
{ "report", cmd_report, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_BENCH
{ "bench", cmd_bench, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_STAT
{ "stat", cmd_stat, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_TIMECHART
{ "timechart", cmd_timechart, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_TOP
{ "top", cmd_top, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_ANNOTATE
{ "annotate", cmd_annotate, 0 },
+#endif
{ "version", cmd_version, 0 },
+#ifdef CONFIG_BUILTIN_SCRIPT
{ "script", cmd_script, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_SCHED
{ "sched", cmd_sched, 0 },
-#ifdef HAVE_LIBELF_SUPPORT
+#endif
+#if defined HAVE_LIBELF_SUPPORT && defined CONFIG_BUILTIN_PROBE
{ "probe", cmd_probe, 0 },
#endif
+#ifdef CONFIG_BUILTIN_KMEM
{ "kmem", cmd_kmem, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_LOCK
{ "lock", cmd_lock, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_KVM
{ "kvm", cmd_kvm, 0 },
+#endif
{ "test", cmd_test, 0 },
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#if defined HAVE_LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
{ "trace", cmd_trace, 0 },
#endif
+#ifdef CONFIG_BUILTIN_INJECT
{ "inject", cmd_inject, 0 },
+#endif
+#ifdef CONFIG_BUILTIN_MEM
{ "mem", cmd_mem, 0 },
+#endif
};

struct pager_config {
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ba51fa8..ec7fd36 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,11 +77,13 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
+#ifdef CONFIG_TUI
case 1:
use_browser = 1;
if (ui__init() == 0)
break;
/* fall through */
+#endif
default:
use_browser = 0;
if (fallback_to_pager)
@@ -96,11 +98,11 @@ void exit_browser(bool wait_for_ok)
case 2:
exit_gtk_browser(wait_for_ok);
break;
-
+#ifdef CONFIG_TUI
case 1:
ui__exit(wait_for_ok);
break;
-
+#endif
default:
break;
}
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 36a885d..05ee30f 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -1,5 +1,11 @@
#!/bin/sh

+function cfg()
+{
+ cfg=`echo $1 | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'`
+ echo "$cfg"
+}
+
echo "/* Automatically generated by $0 */
struct cmdname_help
{
@@ -13,6 +19,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
sort |
while read cmd
do
+ echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)"
sed -n '
/^NAME/,/perf-'"$cmd"'/H
${
@@ -20,6 +27,7 @@ do
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
}' "Documentation/perf-$cmd.txt"
+ echo "#endif"
done

echo "#ifdef HAVE_LIBELF_SUPPORT"
@@ -27,6 +35,7 @@ sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
sort |
while read cmd
do
+ echo "#ifdef CONFIG_BUILTIN_$(cfg $cmd)"
sed -n '
/^NAME/,/perf-'"$cmd"'/H
${
@@ -34,6 +43,7 @@ do
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
}' "Documentation/perf-$cmd.txt"
+ echo "#endif"
done
echo "#endif /* HAVE_LIBELF_SUPPORT */"
echo "};"
--
2.1.1

2014-10-25 22:23:30

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 04/14] perf tools: Add kbuild support into Makefile.kbuild

From: Jiri Olsa <[email protected]>

Adding kbuild support into Makefile.kbuild. The 'legacy'
Makefile still stays untouched as it was.

It's possible to use kbuild by running 'make -f Makefile.kbuild'
with any option supported by 'legacy' Makefile.

We now have 2 config files:
'.config' - user configured setup
'.config-detected' - system detected setup

The '.config-detected' affects '.config' and if there's
configured feature in '.config' which was not detected
it is automatically disabled.

The '.config-detected' is re/created if:
- there's no '.config-detected'
- '.config' was changed

In a cleaned tree the perf is built with 'allyesconfig'
having disabled all non-detected features, just as it is
done now.

You can change '.config' via:
make -f Makefile.kbuild menuconfig

There's difference for O=DIR build. The DIR is populated
based on kernel source tree, so the final binary is created
under DIR/tools/perf.

This commit was originally created by Jiri Olsa in February 2013; a
few changes were necessary to fit the perf version of June 2014:
* Add missing CFLAGS for specific .o targets
* Update Kbuild files (new source files, ...)
* Fix recursive invocation of config/features-checks
* Store .config-detected missing variables (libdir, ...)
* Fix missing dependencies between Kconfig options
* Fix installation of traceevent plugins
* Fix missing cleanings of feature-check binaries
* CROSS_COMPILE was not used to define AS, CC, ...
* CROSS_COMPILE was not stored in .config-detected
* Take into account DESTDIR and prefix set in the command line
* Add missing Kbuild files for non-x86 architectures
(powerpc, arm, arm64, sh, s390, sparc)
* Move perf-time-to-tsc.c into x86-specific tests directory

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kbuild | 47 +++
tools/perf/Kconfig | 284 ++++++++++++++
tools/perf/Makefile.kbuild | 431 +++++++++++++++++++++
tools/perf/Makefile.perf | 2 +-
tools/perf/arch/Kbuild | 3 +
tools/perf/arch/arm/Kbuild | 2 +
tools/perf/arch/arm/Makefile | 14 -
tools/perf/arch/arm/tests/Kbuild | 2 +
tools/perf/arch/arm/util/Kbuild | 3 +
tools/perf/arch/arm64/Kbuild | 1 +
tools/perf/arch/arm64/Makefile | 7 -
tools/perf/arch/arm64/util/Kbuild | 2 +
tools/perf/arch/powerpc/Kbuild | 1 +
tools/perf/arch/powerpc/Makefile | 6 -
tools/perf/arch/powerpc/util/Kbuild | 3 +
tools/perf/arch/s390/Kbuild | 1 +
tools/perf/arch/s390/Makefile | 7 -
tools/perf/arch/s390/util/Kbuild | 2 +
tools/perf/arch/sh/Kbuild | 1 +
tools/perf/arch/sh/Makefile | 4 -
tools/perf/arch/sh/util/Kbuild | 1 +
tools/perf/arch/sparc/Kbuild | 1 +
tools/perf/arch/sparc/Makefile | 4 -
tools/perf/arch/sparc/util/Kbuild | 1 +
tools/perf/arch/x86/Kbuild | 1 +
tools/perf/arch/x86/tests/Kbuild | 3 +
tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 0
tools/perf/arch/x86/util/Kbuild | 5 +
tools/perf/bench/Kbuild | 12 +
tools/perf/builtin-cmds.h | 4 +
tools/perf/config/Makefile | 55 ++-
tools/perf/config/Makefile.fix-config | 104 +++++
tools/perf/config/Makefile.fix-legacy | 46 +++
tools/perf/config/defconfig | 54 +++
tools/perf/perf-sys.h | 4 +-
tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
tools/perf/tests/Kbuild | 38 ++
tools/perf/ui/Kbuild | 15 +
tools/perf/ui/browsers/Kbuild | 9 +
tools/perf/ui/gtk/Kbuild | 9 +
tools/perf/ui/stdio/Kbuild | 1 +
tools/perf/ui/tui/Kbuild | 4 +
tools/perf/util/Kbuild | 126 ++++++
tools/perf/util/PERF-VERSION-GEN | 4 +
tools/perf/util/generate-cmdlist.sh | 8 +-
tools/perf/util/scripting-engines/Kbuild | 11 +
tools/perf/util/setup.py | 8 +-
48 files changed, 1310 insertions(+), 52 deletions(-)
create mode 100644 tools/perf/Kbuild
create mode 100644 tools/perf/Kconfig
create mode 100644 tools/perf/Makefile.kbuild
create mode 100644 tools/perf/arch/Kbuild
create mode 100644 tools/perf/arch/arm/Kbuild
delete mode 100644 tools/perf/arch/arm/Makefile
create mode 100644 tools/perf/arch/arm/tests/Kbuild
create mode 100644 tools/perf/arch/arm/util/Kbuild
create mode 100644 tools/perf/arch/arm64/Kbuild
delete mode 100644 tools/perf/arch/arm64/Makefile
create mode 100644 tools/perf/arch/arm64/util/Kbuild
create mode 100644 tools/perf/arch/powerpc/Kbuild
delete mode 100644 tools/perf/arch/powerpc/Makefile
create mode 100644 tools/perf/arch/powerpc/util/Kbuild
create mode 100644 tools/perf/arch/s390/Kbuild
delete mode 100644 tools/perf/arch/s390/Makefile
create mode 100644 tools/perf/arch/s390/util/Kbuild
create mode 100644 tools/perf/arch/sh/Kbuild
delete mode 100644 tools/perf/arch/sh/Makefile
create mode 100644 tools/perf/arch/sh/util/Kbuild
create mode 100644 tools/perf/arch/sparc/Kbuild
delete mode 100644 tools/perf/arch/sparc/Makefile
create mode 100644 tools/perf/arch/sparc/util/Kbuild
create mode 100644 tools/perf/arch/x86/Kbuild
create mode 100644 tools/perf/arch/x86/tests/Kbuild
rename tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c (100%)
create mode 100644 tools/perf/arch/x86/util/Kbuild
create mode 100644 tools/perf/bench/Kbuild
create mode 100644 tools/perf/config/Makefile.fix-config
create mode 100644 tools/perf/config/Makefile.fix-legacy
create mode 100644 tools/perf/config/defconfig
create mode 100644 tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/scripts/python/Perf-Trace-Util/Kbuild
create mode 100644 tools/perf/tests/Kbuild
create mode 100644 tools/perf/ui/Kbuild
create mode 100644 tools/perf/ui/browsers/Kbuild
create mode 100644 tools/perf/ui/gtk/Kbuild
create mode 100644 tools/perf/ui/stdio/Kbuild
create mode 100644 tools/perf/ui/tui/Kbuild
create mode 100644 tools/perf/util/Kbuild
create mode 100644 tools/perf/util/scripting-engines/Kbuild

diff --git a/tools/perf/Kbuild b/tools/perf/Kbuild
new file mode 100644
index 0000000..16cb804
--- /dev/null
+++ b/tools/perf/Kbuild
@@ -0,0 +1,47 @@
+obj-y += perf.o
+
+obj-$(CONFIG_BUILTIN_ANNOTATE) += builtin-annotate.o
+obj-$(CONFIG_BUILTIN_BENCH) += builtin-bench.o
+obj-$(CONFIG_BUILTIN_BENCH) += bench/
+obj-$(CONFIG_BUILTIN_BUILDID_CACHE) += builtin-buildid-cache.o
+obj-$(CONFIG_BUILTIN_BUILDID_LIST) += builtin-buildid-list.o
+obj-$(CONFIG_BUILTIN_DIFF) += builtin-diff.o
+obj-$(CONFIG_BUILTIN_EVLIST) += builtin-evlist.o
+obj-$(CONFIG_BUILTIN_HELP) += builtin-help.o
+obj-$(CONFIG_BUILTIN_INJECT) += builtin-inject.o
+obj-$(CONFIG_BUILTIN_KMEM) += builtin-kmem.o
+obj-$(CONFIG_BUILTIN_KVM) += builtin-kvm.o
+obj-$(CONFIG_BUILTIN_LIST) += builtin-list.o
+obj-$(CONFIG_BUILTIN_LOCK) += builtin-lock.o
+obj-$(CONFIG_BUILTIN_PROBE) += builtin-probe.o
+obj-$(CONFIG_BUILTIN_RECORD) += builtin-record.o
+obj-$(CONFIG_BUILTIN_REPORT) += builtin-report.o
+obj-$(CONFIG_BUILTIN_SCHED) += builtin-sched.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += builtin-script.o
+obj-$(CONFIG_BUILTIN_STAT) += builtin-stat.o
+obj-$(CONFIG_BUILTIN_TIMECHART) += builtin-timechart.o
+obj-$(CONFIG_BUILTIN_TOP) += builtin-top.o
+obj-$(CONFIG_BUILTIN_TRACE) += builtin-trace.o
+obj-$(CONFIG_BUILTIN_MEM) += builtin-mem.o
+obj-$(CONFIG_BUILTIN_TEST) += tests/
+
+obj-y += ../../lib/rbtree.o
+obj-y += ../lib/symbol/kallsyms.o
+
+obj-y += util/
+obj-y += ui/
+obj-y += arch/
+
+obj-$(CONFIG_LIBPERL) += scripts/perl/Perf-Trace-Util/
+obj-$(CONFIG_LIBPYTHON) += scripts/python/Perf-Trace-Util/
+
+CFLAGS_rbtree.o += -Wno-unused-parameter
+
+CFLAGS_perf.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_perf.o += -include PERF-VERSION-FILE
+
+$(obj)/perf.o: $(obj)/PERF-VERSION-FILE
+
+CFLAGS_builtin-help.o += -D"PERF_HTML_PATH=KBUILD_STR($(htmldir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_INFO_PATH=KBUILD_STR($(infodir_SQ))"
+CFLAGS_builtin-help.o += -D"PERF_MAN_PATH=KBUILD_STR($(mandir_SQ))"
diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
new file mode 100644
index 0000000..f9fcf9e
--- /dev/null
+++ b/tools/perf/Kconfig
@@ -0,0 +1,284 @@
+
+mainmenu "The perf configuration"
+
+menu "Built-in commands"
+
+config BUILTIN_RECORD
+ bool "record"
+ default y
+ ---help---
+ Run a command and record its profile into a perf archive.
+
+config BUILTIN_REPORT
+ bool "report"
+ default y
+ ---help---
+ Read a perf archive (created by perf record) and display the
+ profile.
+
+config BUILTIN_STAT
+ bool "stat"
+ default y
+ ---help---
+ Run a command and gather performance counter statistics.
+
+config BUILTIN_TOP
+ bool "top"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Generate and display a performance counter profile in
+ real-time.
+
+config BUILTIN_TRACE
+ bool "trace"
+ default y
+ depends on BUILTIN_RECORD && LIBAUDIT
+ ---help---
+ Strace inspired tool.
+
+config BUILTIN_ANNOTATE
+ bool "annotate"
+ default y
+ ---help---
+ Read a perf archive (created by perf record) and display
+ annotated code.
+
+config BUILTIN_BENCH
+ bool "bench"
+ default y
+ ---help---
+ General framework for benchmark suites.
+
+config BUILTIN_BUILDID_CACHE
+ bool "buildid-cache"
+ default y
+ ---help---
+ Manage build-id cache.
+
+config BUILTIN_BUILDID_LIST
+ bool "buildid-list"
+ default y
+ ---help---
+ List the buildids in a perf archive file.
+
+config BUILTIN_DIFF
+ bool "diff"
+ default y
+ ---help---
+ Read perf archive files and display the differential
+ profile.
+
+config BUILTIN_EVLIST
+ bool "evlist"
+ default y
+ ---help---
+ List the event names in a perf archive file
+
+config BUILTIN_HELP
+ bool "help"
+ default y
+ ---help---
+ Display help information about perf
+
+config BUILTIN_INJECT
+ bool "inject"
+ default y
+ ---help---
+ The inject feature reads a perf-record event stream and
+ repipes it to stdout.
+
+config BUILTIN_KMEM
+ bool "kmem"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to trace/measure kernel memory(slab) properties.
+
+config BUILTIN_KVM
+ bool "kvm"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT && \
+ BUILTIN_RECORD && BUILTIN_BUILDID_LIST && \
+ BUILTIN_TOP && BUILTIN_DIFF && BUILTIN_STAT
+ ---help---
+ Tool to trace/measure kvm guest os
+
+config BUILTIN_LIST
+ bool "list"
+ default y
+ ---help---
+ List all symbolic event types.
+
+config BUILTIN_LOCK
+ bool "lock"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Analyze lock events.
+
+config BUILTIN_PROBE
+ bool "probe"
+ default y
+ depends on LIBELF
+ ---help---
+ Define new dynamic tracepoints
+
+config BUILTIN_SCHED
+ bool "sched"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to trace/measure scheduler properties (latencies).
+
+config BUILTIN_SCRIPT
+ bool "script"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Read perf archive file (created by perf record) and display
+ trace output.
+
+config BUILTIN_TIMECHART
+ bool "timechart"
+ default y
+ depends on BUILTIN_RECORD
+ ---help---
+ Tool to visualize total system behavior during a workload.
+
+config BUILTIN_MEM
+ bool "mem"
+ default y
+ depends on BUILTIN_RECORD && BUILTIN_REPORT
+ ---help---
+ Profile memory accesses.
+
+config BUILTIN_TEST
+ bool "test"
+ default y
+ ---help---
+ Runs sanity tests.
+
+endmenu
+
+menu "GUI"
+
+config STDIO
+ bool "Terminal"
+ default y
+ ---help---
+ Most basic display mode.
+
+config TUI
+ bool "Tui (slang based)"
+ default y
+ ---help---
+ Text-based user interface which provides windowing
+ facilities.
+
+config GTK2
+ bool "Gtk2"
+ default y
+ ---help---
+ Elaborate display mode based on libgtk2.
+
+endmenu
+
+menu "Libraries / Dependencies"
+
+config LIBAUDIT
+ bool "Audit (libaudit)"
+ default y
+ ---help---
+ Linux audit framework dependency.
+
+config LIBPERL
+ bool "Perl"
+ default y
+ ---help---
+ Libperl dependency needed by the perf script feature.
+
+config LIBPYTHON
+ bool "Python"
+ default y
+ ---help---
+ Libpython dependency needed by the perf script feature.
+
+choice
+ prompt "Elf library"
+ default LIBELF
+ ---help---
+ Perf needs ELF files manipulation facilities. To fulfill
+ these tasks, perf can rely on either the libelf library or a
+ minimal builtin support.
+
+
+ config LIBELF
+ bool "elf"
+ ---help---
+ Libelf library.
+
+ config LIBELF_MINIMAL
+ bool "builtin support"
+ ---help---
+ Builtin elf support.
+endchoice
+
+config LIBUNWIND
+ bool "User space libunwind callchains"
+ default y
+ ---help---
+ The library libunwind provides a portable C API to determine
+ the call-chain of a program.
+
+config LIBUNWIND_DIR
+ string "libunwind directory"
+ depends on LIBUNWIND
+ ---help---
+ Directory holding the libuwind dependency (headers +
+ libraries).
+
+config NUMA
+ bool "Numa support (bench)"
+ default y
+ ---help---
+ The library libnuma offers facilities to configure NUMA
+ policies supported by the linux kernel.
+
+config DEMANGLE
+ bool "Demangle symbols"
+ default y
+ ---help---
+ Enable demangling so as to display human-readable
+ symbols. This option is convenient with C++ programs.
+
+config BIONIC
+ bool "Bionic support"
+ default n
+ ---help---
+ The Bionic libc is a derivation of the BSD's standard C
+ library code developed by Google for their Android operating
+ system.
+
+endmenu
+
+menu "Build"
+config DEBUG
+ bool "Compile with debug info"
+ default n
+ ---help---
+ Compile with debug info.
+
+config DEBUG_PARSER
+ bool "Compile with parsers debug info"
+ default n
+ ---help---
+ Compile with parsers debug info.
+
+config BACKTRACE
+ bool "Compile with dump_stack support"
+ default y
+ ---help---
+ Compile with dump_stack support.
+
+endmenu
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
new file mode 100644
index 0000000..51eba07
--- /dev/null
+++ b/tools/perf/Makefile.kbuild
@@ -0,0 +1,431 @@
+srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
+objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
+
+VPATH := $(srctree)
+
+export srctree VPATH
+
+MAKEFLAGS += --include-dir=$(srctree)
+MAKEFLAGS += --no-builtin-rules
+MAKEFLAGS += --no-print-directory
+
+ifeq ("$(origin V)", "command line")
+KBUILD_VERBOSE = $(V)
+endif
+
+ifndef KBUILD_VERBOSE
+KBUILD_VERBOSE = 0
+endif
+
+ifeq ($(KBUILD_VERBOSE),1)
+quiet =
+Q =
+else
+quiet=quiet_
+Q = @
+endif
+
+# If the user is running make -s (silent mode), suppress echoing of
+# commands
+ifneq ($(filter s% -s%,$(MAKEFLAGS)),)
+quiet=silent_
+endif
+
+export quiet Q KBUILD_VERBOSE
+
+ifndef V
+QUIET_LINK = @echo ' LD $@';
+QUIET_GEN = @echo ' GEN $@';
+QUIET_CLEAN = @echo ' CLEAN tools/perf';
+endif
+
+export QUIET_BISON QUIET_FLEX
+
+ifeq ($(KBUILD_SRC),)
+
+ifeq ("$(origin O)", "command line")
+KBUILD_OUTPUT := $(O)
+else
+KBUILD_OUTPUT := $(objtree)
+endif
+
+# Invoke a second make in the output directory, passing relevant variables
+# check that the output directory actually exists
+saved-output := $(KBUILD_OUTPUT)
+KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+$(if $(KBUILD_OUTPUT),, \
+ $(error output directory "$(saved-output)" does not exist))
+
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/lib)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/include/config)
+dummy := $(shell mkdir -p $(KBUILD_OUTPUT)/tools/perf)
+
+PHONY += $(MAKECMDGOALS) sub-make
+
+$(filter-out sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) all: sub-make
+ @:
+
+sub-make: FORCE
+ $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
+ KBUILD_SRC=$(srctree) \
+ -f $(CURDIR)/Makefile.kbuild \
+ $(filter-out sub-make,$(MAKECMDGOALS))
+
+# Leave processing to above invocation of make
+skip-makefile := 1
+endif # ifeq ($(KBUILD_SRC),)
+
+export KBUILD_SRC
+
+ifeq ($(skip-makefile),)
+
+build := -f $(srctree)/scripts/Makefile.build obj
+
+src-kernel := $(srctree)
+src-perf := $(srctree)/tools/perf
+obj-kernel := $(objtree)
+obj-perf := $(objtree)/tools/perf
+
+VPATH += $(src-perf)
+
+export src-perf obj-perf
+
+OUTPUT := $(obj-perf)/
+
+export OUTPUT DESTDIR
+
+AS = $(CROSS_COMPILE)as
+LD = $(CROSS_COMPILE)ld
+CC = $(CROSS_COMPILE)gcc
+CPP = $(CC) -E
+HOSTCC = gcc
+FLEX = flex
+BISON = bison
+INSTALL = install
+PKG_CONFIG = pkg-config
+
+export AS LD CC CPP HOSTCC FLEX BISON PKG_CONFIG
+
+# kbuild related config
+CONFIG_SHELL := /bin/sh
+
+KBUILD_KCONFIG := $(src-perf)/Kconfig
+KCONFIG_CONFIG ?= $(obj-perf)/.config
+KCONFIG_TRISTATE := $(obj-perf)/include/config/tristate.conf
+KCONFIG_AUTOHEADER := $(obj-perf)/include/generated/autoconf.h
+KCONFIG_AUTOCONFIG := $(obj-perf)/include/config/auto.conf
+KCONFIG_SCRIPT := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+export CONFIG_SHELL
+export KBUILD_KCONFIG
+export KCONFIG_CONFIG KCONFIG_TRISTATE
+export KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG KCONFIG_SCRIPT
+
+# perf detected config
+CONFIG_DETECTED := $(obj-perf)/.config-detected
+
+export CONFIG_DETECTED
+
+# external .a libs
+LIBTRACEEVENT := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
+LIBAPIKFS := $(obj-kernel)/tools/lib/api/libapikfs.a
+LIBS_A := $(LIBTRACEEVENT) $(LIBAPIKFS)
+
+export LIBTRACEEVENT LIBAPIKFS
+
+all:
+
+scripts_basic:
+ $(Q)$(MAKE) $(build)=scripts/basic
+
+defconfig: scripts_basic
+ $(Q)cp $(src-perf)/config/defconfig $(KCONFIG_CONFIG)
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig oldconfig
+
+%config: scripts_basic
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig $@
+
+$(KCONFIG_CONFIG):
+ $(Q)$(MAKE) $(build)=scripts/basic
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig allyesconfig
+
+$(CONFIG_DETECTED): $(KCONFIG_CONFIG)
+ $(Q)$(MAKE) -f $(src-perf)/config/Makefile
+
+# no need to include auto.conf.cmd, because .config
+# is the only dependency here
+$(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
+ $(Q)$(MAKE) -f $(src-perf)/config/Makefile.fix-config
+ $(Q)mkdir -p $(obj-perf)/include/config
+ $(Q)mkdir -p $(obj-perf)/include/generated
+ $(Q)$(MAKE) -s $(build)=scripts/kconfig silentoldconfig
+ @touch $(CONFIG_DETECTED) # final touch.. to keep the time dependency correct
+
+clean-dirs := $(addprefix _clean_, tools/perf/)
+
+$(clean-dirs):
+ $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean
+ $(Q)$(QUIET_CLEAN)
+ $(Q)rm -f $(obj-perf)/perf
+ $(Q)rm -f $(obj-perf)/common-cmds.h
+ $(Q)rm -f $(obj-perf)/python/perf.so
+ $(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+ $(Q)find $(obj-perf) \
+ \( -name '*.[oas]' -o -name '.*.cmd' \
+ -o -name '.*.d' -o -name '.*.tmp' \
+ -o -name '*-flex.[ch]' -o -name '*-bison.[ch]' \
+ \) -type f -print | xargs rm -f
+ $(Q)$(python-clean)
+ $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
+ @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
+
+TAGS tags:
+ $(Q)rm -f $(src-perf)/tags
+ $(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs ctags -a
+
+cscope:
+ $(Q)rm -f $(src-perf)/cscope*
+ $(QUIET_GEN)cd $(src-perf); find . -name '*.[hcS]' -print | xargs cscope -b
+
+PHONY += clean $(clean-dirs) tags TAGS cscope
+
+ifneq ($(filter %config help clean tags TAGS cscope,$(MAKECMDGOALS)),)
+dont-detect := 1
+endif
+
+ifndef dont-detect
+# detected config variables
+-include $(CONFIG_DETECTED)
+
+ifdef CONFIG_DETECTED_STORED
+# Following variables are needed within Kbuild files, we need
+# to export them as they are not part of the .config set.
+export CONFIG_ARCH := $(ARCH)
+export CROSS_COMPILE
+export CONFIG_X86_64
+export htmldir_SQ
+export infodir_SQ
+export mandir_SQ
+export perfexecdir_SQ
+export PARSER_DEBUG_BISON
+export PARSER_DEBUG_FLEX
+export ETC_PERFCONFIG_SQ
+export libdir_SQ
+export plugindir_SQ
+export PYTHON_EMBED_CCOPTS
+export PERL_EMBED_CCOPTS
+export GTK_CFLAGS
+
+# The variable DESTDIR could be overloaded at make launch time
+ifdef DESTDIR
+ DESTDIR_SQ = $(subst ','\'',$(DESTDIR))
+else
+ DESTDIR = $(DESTDIR_SQ)
+endif
+export DESTDIR DESTDIR_SQ
+
+# The variable prefix could be overloaded at make launch time
+ifdef prefix
+ prefix_SQ = $(subst ','\'',$(prefix))
+else
+ prefix = $(prefix_SQ)
+endif
+
+export prefix prefix_SQ
+
+endif # CONFIG_DETECTED_STORED
+
+endif # !dont-detect
+
+# let sources know it's kbuild
+CFLAGS += -DCONFIG_KBUILD
+
+# kbuild related config
+LINUXINCLUDE := $(CFLAGS)
+KBUILD_BUILTIN := 1
+KBUILD_CHECKSRC := 0
+
+export LINUXINCLUDE
+export KBUILD_BUILTIN KBUILD_CHECKSRC
+
+# pyuthon language binding
+PYTHON_EXTBUILD := $(src-perf)/python_ext_build/
+PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
+
+export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
+
+python-clean := rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so
+
+PYTHON_EXT_SRCS := $(addprefix $(src-perf)/,$(shell grep -v ^\# $(src-perf)/util/python-ext-sources))
+PYTHON_EXT_DEPS := $(src-perf)/util/python-ext-sources $(src-perf)/util/setup.py
+PYTHON_EXT_CFLAGS := $(CFLAGS) -w
+
+export PYTHON_EXT_SRCS
+
+
+$(obj-perf)/python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
+ $(QUIET_GEN)CFLAGS='$(PYTHON_EXT_CFLAGS)' $(PYTHON_WORD) $(src-perf)/util/setup.py \
+ --quiet build_ext; \
+ mkdir -p $(obj-perf)/python && \
+ cp $(PYTHON_EXTBUILD_LIB)perf.so $(obj-perf)/python/
+
+all: tools/perf/PERF-VERSION-FILE scripts_basic tools/perf/perf $(LANG_BINDINGS)
+
+$(obj-perf)/common-cmds.h: $(src-perf)/util/generate-cmdlist.sh $(src-perf)/command-list.txt
+ $(QUIET_GEN)$(src-perf)/util/generate-cmdlist.sh $(src-perf) > $@+ && mv $@+ $@
+
+PHONY += all scripts_basic
+
+$(obj-perf)/built-in.o: $(obj-perf)/common-cmds.h $(KCONFIG_AUTOCONFIG) FORCE
+ $(Q)$(MAKE) LDFLAGS="" $(build)=tools/perf
+
+LIBS = -Wl,--whole-archive $^ -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
+
+tools/perf/perf: $(obj-perf)/built-in.o $(LIBS_A)
+ $(QUIET_LINK)$(CC) $(LDFLAGS) -o $@ $(LIBS) $(GTK_LIBS)
+
+$(LIBTRACEEVENT): FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/traceevent
+ $(Q)$(MAKE) -C $(src-kernel)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent
+
+$(LIBTRACEEVENT)-clean: FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/traceevent
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent clean
+
+$(LIBTRACEEVENT)-install: $(LIBTRACEEVENT) FORCE
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/traceevent O=$(obj-kernel)/tools/lib/traceevent plugin_dir=$(plugindir_SQ) install
+
+$(LIBAPIKFS): FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/api
+ $(Q)$(MAKE) -C $(srctree)/tools/lib/api O=$(obj-kernel)/tools/lib/api
+
+$(LIBAPIKFS)-clean: FORCE
+ @mkdir -p $(obj-kernel)/tools/lib/api
+ $(Q)$(MAKE) -sC $(srctree)/tools/lib/api O=$(obj-kernel)/tools/lib/api clean
+
+tools/perf/PERF-VERSION-FILE: FORCE
+ $(QUIET_GEN)$(SHELL_PATH) $(src-perf)/util/PERF-VERSION-GEN $(obj-perf)/
+
+
+# Single targets
+# ---------------------------------------------------------------------------
+# Single targets are compatible with:
+# - build with mixed source and output
+# - build with separate output dir 'make O=...'
+# - external modules
+#
+# target-dir => where to store outputfile
+# build-dir => directory in kernel source tree to use
+
+build-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(patsubst %/,%,$(dir $@))))
+target-dir = $(patsubst $(obj-kernel)/%,%,$(abspath $(obj-perf)/$(dir $@)))
+
+%.o: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.i: %.c scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.s: %.S scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+%.o: %.S scripts_basic FORCE
+ $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)/$(notdir $@)
+
+SCRIPT_SH += $(src-perf)/perf-archive.sh
+SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
+
+$(SCRIPTS) : % : %.sh
+ $(QUIET_GEN)$(INSTALL) '[email protected]' '$(perf-obj)$@'
+
+all: $(SCRIPTS)
+
+install-bin: all
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
+ $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
+ $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
+ $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
+ $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+
+install: install-bin try-install-man $(LIBTRACEEVENT)-install
+
+DOC_TARGETS := doc man html info pdf
+
+$(DOC_TARGETS):
+ $(Q)$(MAKE) -C $(src-perf)/Documentation $(@:doc=all)
+
+INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
+INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
+
+# 'make install-doc' should call 'make -C Documentation install'
+$(INSTALL_DOC_TARGETS):
+ $(Q)$(MAKE) -C $(src-perf)/Documentation $(@:-doc=)
+
+help:
+ @echo 'Perf make targets:'
+ @echo ' doc - make *all* documentation (see below)'
+ @echo ' man - make manpage documentation (access with man <foo>)'
+ @echo ' html - make html documentation'
+ @echo ' info - make GNU info documentation (access with info <foo>)'
+ @echo ' pdf - make pdf documentation'
+ @echo ' TAGS - use etags to make tag information for source browsing'
+ @echo ' tags - use ctags to make tag information for source browsing'
+ @echo ' cscope - use cscope to make interactive browsing database'
+ @echo ''
+ @echo 'Perf install targets:'
+ @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
+ @echo ' HINT: use "make prefix=<path> <install target>" to install to a particular'
+ @echo ' path like make prefix=/usr/local install install-doc'
+ @echo ' install - install compiled binaries'
+ @echo ' install-doc - install *all* documentation'
+ @echo ' install-man - install manpage documentation'
+ @echo ' install-html - install html documentation'
+ @echo ' install-info - install GNU info documentation'
+ @echo ' install-pdf - install pdf documentation'
+ @echo ''
+ @echo ' quick-install-doc - alias for quick-install-man'
+ @echo ' quick-install-man - install the documentation quickly'
+ @echo ' quick-install-html - install the html documentation quickly'
+ @echo ''
+ @echo 'Perf maintainer targets:'
+ @echo ' clean - clean all binary objects and build output'
+
+
+ifdef MAKE_DEBUG
+dummy := $(info DEBUG MAKEFLAGS $(MAKEFLAGS))
+dummy := $(info DEBUG VPATH $(VPATH))
+dummy := $(info DEBUG srctree $(srctree))
+dummy := $(info DEBUG objtree $(objtree))
+dummy := $(info DEBUG src-kernel $(src-kernel))
+dummy := $(info DEBUG src-perf $(src-perf))
+dummy := $(info DEBUG obj-kernel $(obj-kernel))
+dummy := $(info DEBUG obj-perf $(obj-perf))
+dummy := $(info DEBUG KBUILD_KCONFIG $(KBUILD_KCONFIG))
+dummy := $(info DEBUG KCONFIG_CONFIG $(KCONFIG_CONFIG))
+dummy := $(info DEBUG KCONFIG_TRISTATE $(KCONFIG_TRISTATE))
+dummy := $(info DEBUG KCONFIG_AUTOHEADER $(KCONFIG_AUTOHEADER))
+dummy := $(info DEBUG KCONFIG_AUTOCONFIG $(KCONFIG_AUTOCONFIG))
+dummy := $(info DEBUG TRACE_EVENT_DIR $(TRACE_EVENT_DIR))
+dummy := $(info DEBUG LIBAPIKFS $(LIBAPIKFS))
+endif
+
+endif # skip-makefile
+
+PHONY += FORCE
+.PHONY: $(PHONY)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 3caf7da..0e84559 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -634,7 +634,7 @@ $(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPU
$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt

$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
- $(QUIET_GEN). util/generate-cmdlist.sh > $@+ && mv $@+ $@
+ $(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@

$(SCRIPTS) : % : %.sh
$(QUIET_GEN)$(INSTALL) '[email protected]' '$(OUTPUT)$@'
diff --git a/tools/perf/arch/Kbuild b/tools/perf/arch/Kbuild
new file mode 100644
index 0000000..5cf419e
--- /dev/null
+++ b/tools/perf/arch/Kbuild
@@ -0,0 +1,3 @@
+obj-y += common.o
+
+obj-y += $(CONFIG_ARCH)/
diff --git a/tools/perf/arch/arm/Kbuild b/tools/perf/arch/arm/Kbuild
new file mode 100644
index 0000000..f5581bee
--- /dev/null
+++ b/tools/perf/arch/arm/Kbuild
@@ -0,0 +1,2 @@
+obj-y += util/
+obj-y += tests/
diff --git a/tools/perf/arch/arm/Makefile b/tools/perf/arch/arm/Makefile
deleted file mode 100644
index 09d6215..0000000
--- a/tools/perf/arch/arm/Makefile
+++ /dev/null
@@ -1,14 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifndef NO_LIBDW_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-endif
-ifndef NO_DWARF_UNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
-endif
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
new file mode 100644
index 0000000..5d63e9d
--- /dev/null
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -0,0 +1,2 @@
+obj-y += regs_load.o
+obj-y += dwarf-unwind.o
diff --git a/tools/perf/arch/arm/util/Kbuild b/tools/perf/arch/arm/util/Kbuild
new file mode 100644
index 0000000..c96666a
--- /dev/null
+++ b/tools/perf/arch/arm/util/Kbuild
@@ -0,0 +1,3 @@
+obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-y += unwind-libdw.o
diff --git a/tools/perf/arch/arm64/Kbuild b/tools/perf/arch/arm64/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/arm64/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/arm64/Makefile b/tools/perf/arch/arm64/Makefile
deleted file mode 100644
index 67e9b3d..0000000
--- a/tools/perf/arch/arm64/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifndef NO_LIBUNWIND
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
diff --git a/tools/perf/arch/arm64/util/Kbuild b/tools/perf/arch/arm64/util/Kbuild
new file mode 100644
index 0000000..136bc86
--- /dev/null
+++ b/tools/perf/arch/arm64/util/Kbuild
@@ -0,0 +1,2 @@
+obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/powerpc/Kbuild b/tools/perf/arch/powerpc/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/powerpc/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/powerpc/Makefile b/tools/perf/arch/powerpc/Makefile
deleted file mode 100644
index 6f7782b..0000000
--- a/tools/perf/arch/powerpc/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/skip-callchain-idx.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
diff --git a/tools/perf/arch/powerpc/util/Kbuild b/tools/perf/arch/powerpc/util/Kbuild
new file mode 100644
index 0000000..244ff2c
--- /dev/null
+++ b/tools/perf/arch/powerpc/util/Kbuild
@@ -0,0 +1,3 @@
+obj-y += header.o
+obj-y += skip-callchain-idx.o
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/s390/Kbuild b/tools/perf/arch/s390/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/s390/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/s390/Makefile b/tools/perf/arch/s390/Makefile
deleted file mode 100644
index 798ac73..0000000
--- a/tools/perf/arch/s390/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
new file mode 100644
index 0000000..24e8ee7
--- /dev/null
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -0,0 +1,2 @@
+obj-y += kvm-stat.o
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/sh/Kbuild b/tools/perf/arch/sh/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/sh/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/sh/Makefile b/tools/perf/arch/sh/Makefile
deleted file mode 100644
index 15130b5..0000000
--- a/tools/perf/arch/sh/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
diff --git a/tools/perf/arch/sh/util/Kbuild b/tools/perf/arch/sh/util/Kbuild
new file mode 100644
index 0000000..8e698ae
--- /dev/null
+++ b/tools/perf/arch/sh/util/Kbuild
@@ -0,0 +1 @@
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/sparc/Kbuild b/tools/perf/arch/sparc/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/sparc/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/sparc/Makefile b/tools/perf/arch/sparc/Makefile
deleted file mode 100644
index 15130b5..0000000
--- a/tools/perf/arch/sparc/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-ifndef NO_DWARF
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
diff --git a/tools/perf/arch/sparc/util/Kbuild b/tools/perf/arch/sparc/util/Kbuild
new file mode 100644
index 0000000..8e698ae
--- /dev/null
+++ b/tools/perf/arch/sparc/util/Kbuild
@@ -0,0 +1 @@
+obj-y += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Kbuild b/tools/perf/arch/x86/Kbuild
new file mode 100644
index 0000000..52fd6fa
--- /dev/null
+++ b/tools/perf/arch/x86/Kbuild
@@ -0,0 +1 @@
+obj-y += util/
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
new file mode 100644
index 0000000..3b5aa14
--- /dev/null
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -0,0 +1,3 @@
+obj-y += perf-time-to-tsc.o
+obj-y += regs_load.o
+obj-y += dwarf-unwind.o
diff --git a/tools/perf/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
similarity index 100%
rename from tools/perf/tests/perf-time-to-tsc.c
rename to tools/perf/arch/x86/tests/perf-time-to-tsc.c
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
new file mode 100644
index 0000000..c7b86c0
--- /dev/null
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -0,0 +1,5 @@
+obj-y += dwarf-regs.o
+obj-y += header.o
+obj-y += tsc.o
+obj-y += kvm-stat.o
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/bench/Kbuild b/tools/perf/bench/Kbuild
new file mode 100644
index 0000000..e604fe2
--- /dev/null
+++ b/tools/perf/bench/Kbuild
@@ -0,0 +1,12 @@
+obj-y += mem-memcpy.o
+obj-y += mem-memset.o
+obj-y += sched-messaging.o
+obj-y += sched-pipe.o
+obj-y += futex-hash.o
+obj-y += futex-requeue.o
+obj-y += futex-wake.o
+
+obj-$(CONFIG_NUMA) += numa.o
+
+obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
+obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index fec342a..49550c9 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -1,6 +1,7 @@
#ifndef BUILTIN_CMDS_H
#define BUILTIN_CMDS_H

+#ifndef CONFIG_KBUILD
#define CONFIG_BUILTIN_REPORT 1
#define CONFIG_BUILTIN_SCRIPT 1
#define CONFIG_BUILTIN_BENCH 1
@@ -23,5 +24,8 @@
#define CONFIG_BUILTIN_HELP 1
#define CONFIG_BUILTIN_PROBE 1
#define CONFIG_BUILTIN_MEM 1
+#else
+#include "generated/autoconf.h"
+#endif /* CONFIG_KBUILD */

#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 71264e4..d5fec7c 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -24,6 +24,7 @@ ifeq ($(ARCH),x86)
CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
+ CONFIG_X86_64=y
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
@@ -84,6 +85,10 @@ ifndef NO_LIBELF
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif

+ifdef KCONFIG_CONFIG
+include $(src-perf)/config/Makefile.fix-legacy
+endif
+
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

@@ -159,7 +164,7 @@ endif

feature_check = $(eval $(feature_check_code))
define feature_check_code
- feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
+ feature-$(1) := $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS) $(FEATURE_CHECK_CFLAGS-$(1))" LDFLAGS="$(LDFLAGS) $(FEATURE_CHECK_LDFLAGS-$(1))" -C $(src-perf)/config/feature-checks test-$1.bin >/dev/null 2>/dev/null && echo 1 || echo 0)
endef

feature_set = $(eval $(feature_set_code))
@@ -260,7 +265,7 @@ ifeq ($(feature-all), 1)
#
$(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_set,$(feat)))
else
- $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
+ $(shell $(MAKE) OUTPUT=$(OUTPUT_FEATURES) CFLAGS="$(EXTRA_CFLAGS)" LDFLAGS=$(LDFLAGS) -i -j -C $(src-perf)/config/feature-checks $(addsuffix .bin,$(CORE_FEATURE_TESTS)) >/dev/null 2>&1)
$(foreach feat,$(CORE_FEATURE_TESTS),$(call feature_check,$(feat)))
endif

@@ -275,6 +280,7 @@ ifeq ($(DEBUG),0)
endif

CFLAGS += -I$(src-perf)/util/include
+CFLAGS += -I$(obj-perf)/include
CFLAGS += -I$(src-perf)/arch/$(ARCH)/include
CFLAGS += -I$(srctree)/tools/include/
CFLAGS += -I$(srctree)/arch/$(ARCH)/include/uapi
@@ -797,3 +803,48 @@ endif
ifeq ($(display_lib),1)
$(info )
endif
+
+ifdef CONFIG_DETECTED
+
+store = @echo "$(1)=$($(1))" >> $(CONFIG_DETECTED)
+
+all:
+ @echo "CONFIG_DETECTED_STORED=1" > $(CONFIG_DETECTED)
+ $(call store,ARCH)
+ $(call store,CROSS_COMPILE)
+ $(call store,CFLAGS)
+ $(call store,LDFLAGS)
+ $(call store,EXTLIBS)
+ $(call store,htmldir_SQ)
+ $(call store,infodir_SQ)
+ $(call store,mandir_SQ)
+ $(call store,perfexecdir_SQ)
+ $(call store,prefix_SQ)
+ $(call store,PARSER_DEBUG_BISON)
+ $(call store,PARSER_DEBUG_FLEX)
+ $(call store,PYTHON_EMBED_CCOPTS)
+ $(call store,PERL_EMBED_CCOPTS)
+ $(call store,CONFIG_X86_64)
+ $(call store,NO_LIBUNWIND)
+ $(call store,NO_LIBPERL)
+ $(call store,NO_LIBPYTHON)
+ $(call store,NO_NEWT)
+ $(call store,NO_GTK2)
+ $(call store,NO_DEMANGLE)
+ $(call store,NO_LIBELF)
+ $(call store,NO_LIBUNWIND)
+ $(call store,NO_BACKTRACE)
+ $(call store,NO_LIBNUMA)
+ $(call store,NO_LIBAUDIT)
+ $(call store,NO_LIBBIONIC)
+ $(call store,ETC_PERFCONFIG_SQ)
+ $(call store,DESTDIR_SQ)
+ $(call store,bindir_SQ)
+ $(call store,libdir_SQ)
+ $(call store,plugindir_SQ)
+ $(call store,perfexec_instdir_SQ)
+ $(call store,sysconfdir_SQ)
+ $(call store,GTK_CFLAGS)
+ $(call store,GTK_LIBS)
+
+endif # CONFIG_DETECTED
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
new file mode 100644
index 0000000..7f65fdb
--- /dev/null
+++ b/tools/perf/config/Makefile.fix-config
@@ -0,0 +1,104 @@
+include $(CONFIG_DETECTED)
+include $(KCONFIG_CONFIG)
+
+CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
+
+# NO_LIBPERL
+ifdef CONFIG_LIBPERL
+ifdef NO_LIBPERL
+dummy := $(info Disabling CONFIG_LIBPERL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPERL)
+endif
+endif
+
+# NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
+ifdef NO_LIBPYTHON
+dummy := $(info Disabling CONFIG_LIBPYTHON)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_NEWT
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_NEWT
+ifdef CONFIG_TUI
+ifdef NO_SLANG
+dummy := $(info Disabling CONFIG_TUI)
+dummy := $(shell $(CONFIG) -d CONFIG_TUI)
+endif
+endif
+
+# NO_GTK2
+ifdef CONFIG_GTK2
+ifdef NO_GTK2
+dummy := $(info Disabling CONFIG_GTK2)
+dummy := $(shell $(CONFIG) -d CONFIG_GTK2)
+endif
+endif
+
+# NO_DEMANGLE
+ifdef CONFIG_DEMANGLE
+ifdef NO_DEMANGLE
+dummy := $(info Disabling CONFIG_DEMANGLE)
+dummy := $(shell $(CONFIG) -d CONFIG_DEMANGLE)
+endif
+endif
+
+# NO_LIBELF
+ifdef CONFIG_LIBELF
+ifdef NO_LIBELF
+dummy := $(info Disabling CONFIG_LIBELF)
+dummy := $(info Enabling CONFIG_LIBELF_MINIMAL)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBELF)
+dummy := $(shell $(CONFIG) -e CONFIG_LIBELF_MINIMAL)
+endif
+endif
+
+# NO_LIBUNWIND
+ifdef CONFIG_LIBUNWIND
+ifdef NO_LIBUNWIND
+dummy := $(info Disabling CONFIG_LIBUNWIND)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
+endif
+endif
+
+# NO_BACKTRACE
+ifdef CONFIG_BACKTRACE
+ifdef NO_BACKTRACE
+dummy := $(info Disabling CONFIG_BACKTRACE)
+dummy := $(shell $(CONFIG) -d CONFIG_BACKTRACE)
+endif
+endif
+
+# NO_LIBNUMA
+ifdef CONFIG_NUMA
+ifdef NO_LIBNUMA
+dummy := $(info Disabling CONFIG_NUMA)
+dummy := $(shell $(CONFIG) -d CONFIG_NUMA)
+endif
+endif
+
+# NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
+ifdef NO_LIBAUDIT
+dummy := $(info Disabling CONFIG_LIBAUDIT)
+dummy := $(shell $(CONFIG) -d CONFIG_LIBAUDIT)
+endif
+endif
+
+# NO_LIBBIONIC
+ifdef CONFIG_BIONIC
+ifdef NO_LIBBIONIC
+dummy := $(info Disabling CONFIG_BIONIC)
+dummy := $(shell $(CONFIG) -d CONFIG_BIONIC)
+endif
+endif
+
+all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
new file mode 100644
index 0000000..2ec91f3
--- /dev/null
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -0,0 +1,46 @@
+
+include $(KCONFIG_CONFIG)
+
+ifndef CONFIG_LIBPERL
+NO_LIBPERL := 1
+endif
+
+ifndef CONFIG_LIBPYTHON
+NO_LIBPYTHON := 1
+endif
+
+ifndef CONFIG_TUI
+NO_SLANG := 1
+endif
+
+ifndef CONFIG_GTK2
+NO_GTK2 := 1
+endif
+
+ifndef CONFIG_DEMANGLE
+NO_DEMANGLE := 1
+endif
+
+ifndef CONFIG_LIBELF
+NO_LIBELF := 1
+endif
+
+ifndef CONFIG_LIBUNWIND
+NO_LIBUNWIND := 1
+endif
+
+ifndef CONFIG_BACKTRACE
+NO_BACKTRACE := 1
+endif
+
+ifndef CONFIG_NUMA
+export NO_LIBNUMA := 1
+endif
+
+ifndef CONFIG_LIBAUDIT
+NO_LIBAUDIT := 1
+endif
+
+ifdef CONFIG_BIONIC
+NO_LIBBIONIC := 1
+endif
diff --git a/tools/perf/config/defconfig b/tools/perf/config/defconfig
new file mode 100644
index 0000000..7a385f1
--- /dev/null
+++ b/tools/perf/config/defconfig
@@ -0,0 +1,54 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# Linux Kernel Configuration
+#
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+# CONFIG_BUILTIN_TOP is not set
+# CONFIG_BUILTIN_ANNOTATE is not set
+# CONFIG_BUILTIN_BENCH is not set
+# CONFIG_BUILTIN_BUILDID_CACHE is not set
+# CONFIG_BUILTIN_BUILDID_LIST is not set
+CONFIG_BUILTIN_DIFF=y
+# CONFIG_BUILTIN_EVLIST is not set
+CONFIG_BUILTIN_HELP=y
+# CONFIG_BUILTIN_INJECT is not set
+# CONFIG_BUILTIN_KMEM is not set
+# CONFIG_BUILTIN_KVM is not set
+# CONFIG_BUILTIN_LIST is not set
+# CONFIG_BUILTIN_LOCK is not set
+# CONFIG_BUILTIN_SCHED is not set
+CONFIG_BUILTIN_SCRIPT=y
+# CONFIG_BUILTIN_TIMECHART is not set
+# CONFIG_BUILTIN_TEST is not set
+
+#
+# Libraries
+#
+# CONFIG_LIBAUDIT is not set
+# CONFIG_LIBPERL is not set
+# CONFIG_LIBPYTHON is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_BACKTRACE=y
+# CONFIG_LIBUNWIND is not set
+# CONFIG_NUMA is not set
+# CONFIG_DEMANGLE is not set
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+# CONFIG_TUI is not set
+# CONFIG_GTK2 is not set
+
+#
+# Build
+#
+CONFIG_DEBUG=y
+# CONFIG_DEBUG_PARSER is not set
diff --git a/tools/perf/perf-sys.h b/tools/perf/perf-sys.h
index a3b13d7..19d51a4 100644
--- a/tools/perf/perf-sys.h
+++ b/tools/perf/perf-sys.h
@@ -8,6 +8,8 @@
#include <linux/perf_event.h>
#include <asm/unistd.h>

+#include "generated/autoconf.h"
+
#if defined(__i386__)
#define mb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
#define wmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory")
@@ -181,7 +183,7 @@ sys_perf_event_open(struct perf_event_attr *attr,
fd = syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags);

-#ifdef HAVE_ATTR_TEST
+#ifdef CONFIG_BUILTIN_TEST
if (unlikely(test_attr__enabled))
test_attr__open(attr, pid, cpu, fd, group_fd, flags);
#endif
diff --git a/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild b/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
new file mode 100644
index 0000000..fd9aa3c
--- /dev/null
+++ b/tools/perf/scripts/perl/Perf-Trace-Util/Kbuild
@@ -0,0 +1,6 @@
+obj-y += Context.o
+
+CFLAGS_Context.o := $(PERL_EMBED_CCOPTS)
+CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs
+CFLAGS_Context.o += -Wno-undef -Wno-switch-default
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Kbuild b/tools/perf/scripts/python/Perf-Trace-Util/Kbuild
new file mode 100644
index 0000000..7884730
--- /dev/null
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Kbuild
@@ -0,0 +1,5 @@
+obj-y += Context.o
+
+CFLAGS_Context.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_Context.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_Context.o += -Wno-unused-parameter -Wno-nested-externs
diff --git a/tools/perf/tests/Kbuild b/tools/perf/tests/Kbuild
new file mode 100644
index 0000000..9f56ce8
--- /dev/null
+++ b/tools/perf/tests/Kbuild
@@ -0,0 +1,38 @@
+obj-y += builtin-test.o
+obj-y += attr.o
+obj-y += dso-data.o
+obj-y += evsel-roundtrip-name.o
+obj-y += evsel-tp-sched.o
+obj-y += fdarray.o
+obj-y += hists_link.o
+obj-y += mmap-basic.o
+obj-y += open-syscall-all-cpus.o
+obj-y += open-syscall.o
+obj-y += open-syscall-tp-fields.o
+obj-y += parse-events.o
+obj-y += perf-record.o
+obj-y += pmu.o
+obj-y += python-use.o
+obj-y += rdpmc.o
+obj-y += vmlinux-kallsyms.o
+obj-y += bp_signal.o
+obj-y += bp_signal_overflow.o
+obj-y += sw-clock.o
+obj-y += task-exit.o
+obj-y += code-reading.o
+obj-y += sample-parsing.o
+obj-y += keep-tracking.o
+obj-y += parse-no-sample-id-all.o
+obj-y += mmap-thread-lookup.o
+obj-y += thread-mg-share.o
+obj-y += switch-tracking.o
+obj-y += hists_output.o
+obj-y += hists_cumulate.o
+obj-y += hists_common.o
+obj-y += hists_filter.o
+
+CFLAGS_python-use.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
+CFLAGS_python-use.o += -D"PYTHONPATH=KBUILD_STR(python)"
+
+CFLAGS_attr.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
+CFLAGS_attr.o += -D"BINDIR=KBUILD_STR($(bindir_SQ))"
diff --git a/tools/perf/ui/Kbuild b/tools/perf/ui/Kbuild
new file mode 100644
index 0000000..44ad988
--- /dev/null
+++ b/tools/perf/ui/Kbuild
@@ -0,0 +1,15 @@
+obj-$(CONFIG_TUI) += browser.o
+obj-y += helpline.o
+obj-y += hist.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
+
+obj-y += browsers/
+obj-y += stdio/
+
+obj-$(CONFIG_TUI) += tui/
+obj-$(CONFIG_GTK2) += gtk/
+
+CFLAGS_browser.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_setup.o += -D"LIBDIR=KBUILD_STR($(libdir_SQ))"
\ No newline at end of file
diff --git a/tools/perf/ui/browsers/Kbuild b/tools/perf/ui/browsers/Kbuild
new file mode 100644
index 0000000..3a5fd55
--- /dev/null
+++ b/tools/perf/ui/browsers/Kbuild
@@ -0,0 +1,9 @@
+obj-$(CONFIG_TUI) += annotate.o
+obj-$(CONFIG_TUI) += header.o
+obj-$(CONFIG_TUI) += hists.o
+obj-$(CONFIG_TUI) += map.o
+obj-$(CONFIG_TUI) += scripts.o
+
+CFLAGS_hists.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_map.o += -DENABLE_SLFUTURE_CONST
+CFLAGS_scripts.o += -DENABLE_SLFUTURE_CONST
diff --git a/tools/perf/ui/gtk/Kbuild b/tools/perf/ui/gtk/Kbuild
new file mode 100644
index 0000000..83e3e58
--- /dev/null
+++ b/tools/perf/ui/gtk/Kbuild
@@ -0,0 +1,9 @@
+obj-y += browser.o
+obj-y += hists.o
+obj-y += setup.o
+obj-y += util.o
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += annotate.o
+
+subdir-ccflags-y := $(GTK_CFLAGS)
\ No newline at end of file
diff --git a/tools/perf/ui/stdio/Kbuild b/tools/perf/ui/stdio/Kbuild
new file mode 100644
index 0000000..9de4bd9
--- /dev/null
+++ b/tools/perf/ui/stdio/Kbuild
@@ -0,0 +1 @@
+obj-y += hist.o
diff --git a/tools/perf/ui/tui/Kbuild b/tools/perf/ui/tui/Kbuild
new file mode 100644
index 0000000..e282409
--- /dev/null
+++ b/tools/perf/ui/tui/Kbuild
@@ -0,0 +1,4 @@
+obj-y += helpline.o
+obj-y += progress.o
+obj-y += setup.o
+obj-y += util.o
diff --git a/tools/perf/util/Kbuild b/tools/perf/util/Kbuild
new file mode 100644
index 0000000..1095f1b
--- /dev/null
+++ b/tools/perf/util/Kbuild
@@ -0,0 +1,126 @@
+obj-y += abspath.o
+obj-y += alias.o
+obj-y += annotate.o
+obj-y += bitmap.o
+obj-y += build-id.o
+obj-y += callchain.o
+obj-y += cgroup.o
+obj-y += color.o
+obj-y += comm.o
+obj-y += config.o
+obj-y += cpumap.o
+obj-y += ctype.o
+obj-y += db-export.o
+obj-y += debug.o
+obj-y += dso.o
+obj-y += environment.o
+obj-y += event.o
+obj-y += evlist.o
+obj-y += evsel.o
+obj-y += exec_cmd.o
+obj-y += header.o
+obj-y += help.o
+obj-y += hist.o
+obj-y += hweight.o
+obj-y += intlist.o
+obj-y += levenshtein.o
+obj-y += machine.o
+obj-y += map.o
+obj-y += pager.o
+obj-y += parse-options.o
+obj-y += path.o
+obj-y += pmu-flex.o
+obj-y += pmu-bison.o
+obj-y += pmu.o
+obj-y += pstack.o
+obj-y += quote.o
+obj-y += rblist.o
+obj-y += run-command.o
+obj-y += session.o
+obj-y += ordered-events.o
+obj-y += sigchain.o
+obj-y += sort.o
+obj-y += stat.o
+obj-y += record.o
+obj-y += srcline.o
+obj-y += data.o
+obj-y += strbuf.o
+obj-y += strfilter.o
+obj-y += string.o
+obj-y += strlist.o
+obj-y += svghelper.o
+obj-y += symbol.o
+obj-y += perf_regs.o
+obj-y += tsc.o
+obj-y += cloexec.o
+
+obj-$(CONFIG_LIBUNWIND) += unwind.o
+
+obj-$(CONFIG_LIBELF) += symbol-elf.o
+obj-$(CONFIG_LIBELF) += dwarf-aux.o
+obj-$(CONFIG_LIBELF) += probe-event.o
+obj-$(CONFIG_LIBELF) += probe-finder.o
+
+obj-$(CONFIG_LIBELF_MINIMAL) += symbol-minimal.o
+
+obj-y += target.o
+obj-y += thread.o
+obj-y += thread_map.o
+obj-y += top.o
+obj-y += usage.o
+obj-y += util.o
+obj-y += values.o
+obj-y += xyarray.o
+obj-y += vdso.o
+obj-y += wrapper.o
+obj-y += trace-event.o
+obj-y += trace-event-info.o
+obj-y += trace-event-parse.o
+obj-$(CONFIG_BUILTIN_SCRIPT) += trace-event-scripting.o
+obj-y += trace-event-read.o
+
+obj-$(CONFIG_BUILTIN_SCRIPT) += scripting-engines/
+
+define bison
+$(Q)echo ' BI $@'
+$(Q)$(BISON) -v $< -d $(PARSER_DEBUG_BISON) -o $@ -p $1
+endef
+
+define flex
+$(Q)echo ' FL $@';
+$(Q)$(FLEX) --header-file=$(basename $@).h $(PARSER_DEBUG_FLEX) -t $< > $@
+endef
+
+obj-y += parse-events-flex.o
+obj-y += parse-events-bison.o
+obj-y += parse-events.o
+
+$(obj)/parse-events-bison.c: $(src)/parse-events.y
+ $(call bison,parse_events_)
+
+$(obj)/parse-events-flex.c: $(src)/parse-events.l $(obj)/parse-events-bison.c
+ $(call flex)
+
+$(src)/parse-events-flex.o: $(src)/parse-events-flex.c
+$(src)/parse-events-bison.o: $(src)/parse-events-bison.c
+
+$(src)/parse-events.o: $(src)/parse-events-flex.o
+
+$(src)/pmu-bison.c: $(src)/pmu.y
+ $(call bison,perf_pmu_)
+
+$(src)/pmu-flex.c: $(src)/pmu.l $(src)/pmu-bison.c
+ $(call flex)
+
+$(src)/pmu-flex.o: $(src)/pmu-flex.c
+$(src)/pmu-bison.o: $(src)/pmu-bison.c
+
+CFLAGS_parse-events-flex.o += -w
+CFLAGS_parse-events-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+CFLAGS_parse-events.o += -Wno-redundant-decls
+CFLAGS_pmu-flex.o += -w
+CFLAGS_pmu-bison.o += -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w
+
+CFLAGS_config.o += -D"ETC_PERFCONFIG=KBUILD_STR($(ETC_PERFCONFIG_SQ))"
+CFLAGS_exec_cmd.o += -D"PERF_EXEC_PATH=KBUILD_STR($(perfexecdir_SQ))"
+CFLAGS_exec_cmd.o += -D"PREFIX=KBUILD_STR($(prefix_SQ))"
diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
index 39f1750..efb74f0 100755
--- a/tools/perf/util/PERF-VERSION-GEN
+++ b/tools/perf/util/PERF-VERSION-GEN
@@ -9,6 +9,10 @@ GVF=${OUTPUT}PERF-VERSION-FILE
LF='
'

+if [ "${srctree}x" = "x" ]; then
+srctree=../..
+fi
+
#
# First check if there is a .git to get the version from git describe
# otherwise try to get the version from the kernel Makefile
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 05ee30f..5d84ffc 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -15,7 +15,7 @@ struct cmdname_help

static struct cmdname_help common_cmds[] = {"

-sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ ]*\)[ ].* common.*/\1/p' $1/command-list.txt |
sort |
while read cmd
do
@@ -26,12 +26,12 @@ do
x
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/perf-$cmd.txt"
+ }' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done

echo "#ifdef HAVE_LIBELF_SUPPORT"
-sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' command-list.txt |
+sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' $1/command-list.txt |
sort |
while read cmd
do
@@ -42,7 +42,7 @@ do
x
s/.*perf-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/
p
- }' "Documentation/perf-$cmd.txt"
+ }' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done
echo "#endif /* HAVE_LIBELF_SUPPORT */"
diff --git a/tools/perf/util/scripting-engines/Kbuild b/tools/perf/util/scripting-engines/Kbuild
new file mode 100644
index 0000000..ebe216c
--- /dev/null
+++ b/tools/perf/util/scripting-engines/Kbuild
@@ -0,0 +1,11 @@
+obj-$(CONFIG_LIBPERL) += trace-event-perl.o
+obj-$(CONFIG_LIBPYTHON) += trace-event-python.o
+
+CFLAGS_trace-event-perl.o := $(PERL_EMBED_CCOPTS)
+CFLAGS_trace-event-perl.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_trace-event-perl.o += -Wno-unused-parameter -Wno-shadow -Wno-undef
+CFLAGS_trace-event-perl.o += -Wno-switch-default
+
+CFLAGS_trace-event-python.o := $(PYTHON_EMBED_CCOPTS)
+CFLAGS_trace-event-python.o += -Wno-redundant-decls -Wno-strict-prototypes
+CFLAGS_trace-event-python.o += -Wno-unused-parameter -Wno-shadow
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index d0aee4b..a5c73de 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -2,6 +2,7 @@

from distutils.core import setup, Extension
from os import getenv
+from os import environ

from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
@@ -27,8 +28,11 @@ build_tmp = getenv('PYTHON_EXTBUILD_TMP')
libtraceevent = getenv('LIBTRACEEVENT')
libapikfs = getenv('LIBAPIKFS')

-ext_sources = [f.strip() for f in file('util/python-ext-sources')
- if len(f.strip()) > 0 and f[0] != '#']
+if environ.has_key('PYTHON_EXT_SRCS'):
+ ext_sources = getenv('PYTHON_EXT_SRCS').split()
+else:
+ ext_sources = [f.strip() for f in file('util/python-ext-sources')
+ if len(f.strip()) > 0 and f[0] != '#']

perf = Extension('perf',
sources = ext_sources,
--
2.1.1

2014-10-25 22:23:35

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 07/14] perf kbuild: remove legacy demangle-related build variables

Remove NO_DEMANGLE (replaced by CONFIG_DEMANGLE)
Remove HAVE_LIBBFD_SUPPORT (replaced by CONFIG_LIBBFD)
Remove HAVE_CPLUS_DEMANGLE_SUPPORT (replaced by CONFIG_LIBIBERTY_ONLY)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 36 +++++++++++++++++++++------
tools/perf/config/Makefile | 46 ++++++++++++++++++-----------------
tools/perf/config/Makefile.fix-legacy | 4 ---
tools/perf/util/srcline.c | 8 +++---
tools/perf/util/symbol.h | 25 +++++++++++++------
5 files changed, 75 insertions(+), 44 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index eb59567..026ef67 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -225,6 +225,35 @@ config LIBPYTHON
---help---
Libpython dependency needed by the perf script feature.

+config TIMERFD
+ bool "Timer via file descriptor"
+ default y
+ ---help---
+ Timer via file descriptor
+
+config DEMANGLE
+ bool "Demangle symbols"
+ default y
+ ---help---
+ Enable demangling so as to display human-readable
+ symbols. This option is convenient with C++ programs.
+
+choice DEMANGLE_DEPS
+ prompt "Demangle dependency(ies)"
+ depends on DEMANGLE
+ default LIBBFD
+
+config LIBBFD
+ bool "BFD + libiberty libraries"
+ ---help---
+ Binary File Descriptor and libiberty libraries
+
+config LIBIBERTY_ONLY
+ bool "Libiberty only"
+ ---help---
+ Libiberty
+endchoice
+
choice
prompt "Elf library"
default LIBELF
@@ -266,13 +295,6 @@ config NUMA
The library libnuma offers facilities to configure NUMA
policies supported by the linux kernel.

-config DEMANGLE
- bool "Demangle symbols"
- default y
- ---help---
- Enable demangling so as to display human-readable
- symbols. This option is convenient with C++ programs.
-
config BIONIC
bool "Bionic support"
default n
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index e41c9de..0e36bbe 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -575,33 +575,36 @@ ifeq ($(feature-libbfd), 1)
endif
endif

-ifdef NO_DEMANGLE
- CFLAGS += -DNO_DEMANGLE
-else
- ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
- EXTLIBS += -liberty
- CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
- else
- ifneq ($(feature-libbfd), 1)
- ifneq ($(feature-liberty), 1)
- ifneq ($(feature-liberty-z), 1)
- # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
- # or any of 'bfd iberty z' trinity
- ifeq ($(feature-cplus-demangle), 1)
- EXTLIBS += -liberty
- CFLAGS += -DHAVE_CPLUS_DEMANGLE_SUPPORT
- else
- msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
- CFLAGS += -DNO_DEMANGLE
- endif
+ifdef CONFIG_LIBBFD
+ ifneq ($(feature-libbfd), 1)
+ # TODO: there might be an issue here: feature-liberty and
+ # feature-liberty-z cannot be set; they can be set only if
+ # feature-libbfd is set
+ ifneq ($(feature-liberty), 1)
+ ifneq ($(feature-liberty-z), 1)
+ # we dont have neither HAVE_CPLUS_DEMANGLE_SUPPORT
+ # or any of 'bfd iberty z' trinity
+ ifeq ($(feature-cplus-demangle), 1)
+ EXTLIBS += -liberty
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBBFD)
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBIBERTY_ONLY)
+ else
+ msg := $(warning No bfd.h/libbfd found, install binutils-dev[el]/zlib-static to gain symbol demangling)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_DEMANGLE)
endif
endif
endif
endif
endif

-ifneq ($(filter -lbfd,$(EXTLIBS)),)
- CFLAGS += -DHAVE_LIBBFD_SUPPORT
+ifdef CONFIG_LIBIBERTY_ONLY
+ $(call feature_check,cplus-demangle)
+ ifeq ($(feature-cplus-demangle), 1)
+ EXTLIBS += -liberty
+ else
+ msg := $(warning No libiberty found, install binutils-dev[el]/zlib-static to gain symbol demangling)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_DEMANGLE)
+ endif
endif

ifndef NO_BACKTRACE
@@ -822,7 +825,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_DEMANGLE)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
$(call store,NO_BACKTRACE)
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index ca219e7..64dbb1a 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,10 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_DEMANGLE
-NO_DEMANGLE := 1
-endif
-
ifndef CONFIG_LIBELF
NO_LIBELF := 1
endif
diff --git a/tools/perf/util/srcline.c b/tools/perf/util/srcline.c
index f3e4bc5..38df8f4 100644
--- a/tools/perf/util/srcline.c
+++ b/tools/perf/util/srcline.c
@@ -4,11 +4,13 @@

#include <linux/kernel.h>

+#include "generated/autoconf.h"
+
#include "util/dso.h"
#include "util/util.h"
#include "util/debug.h"

-#ifdef HAVE_LIBBFD_SUPPORT
+#ifdef CONFIG_LIBBFD

/*
* Implement addr2line using libbfd.
@@ -189,7 +191,7 @@ void dso__free_a2l(struct dso *dso)
dso->a2l = NULL;
}

-#else /* HAVE_LIBBFD_SUPPORT */
+#else /* !CONFIG_LIBBFD */

static int addr2line(const char *dso_name, unsigned long addr,
char **file, unsigned int *line_nr,
@@ -242,7 +244,7 @@ void dso__free_a2l(struct dso *dso __maybe_unused)
{
}

-#endif /* HAVE_LIBBFD_SUPPORT */
+#endif /* CONFIG_LIBBFD */

/*
* Number of addr2line failures (without success) before disabling it for that
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index eb2c19b..7e3a003 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -1,6 +1,8 @@
#ifndef __PERF_SYMBOL
#define __PERF_SYMBOL 1

+#include "generated/autoconf.h"
+
#include <linux/types.h>
#include <stdbool.h>
#include <stdint.h>
@@ -23,26 +25,33 @@

#include "dso.h"

-#ifdef HAVE_CPLUS_DEMANGLE_SUPPORT
+#ifdef CONFIG_DEMANGLE
+
+#ifdef CONFIG_LIBBFD
+
+#define PACKAGE 'perf'
+#include <bfd.h>
+
+#elif defined(CONFIG_LIBIBERTY_ONLY)
extern char *cplus_demangle(const char *, int);

static inline char *bfd_demangle(void __maybe_unused *v, const char *c, int i)
{
return cplus_demangle(c, i);
}
-#else
-#ifdef NO_DEMANGLE
+
+#else /* Unknown dependency */
+#error "Inconsistent demangling configuration"
+#endif
+
+#else /* !CONFIG_DEMANGLE */
static inline char *bfd_demangle(void __maybe_unused *v,
const char __maybe_unused *c,
int __maybe_unused i)
{
return NULL;
}
-#else
-#define PACKAGE 'perf'
-#include <bfd.h>
-#endif
-#endif
+#endif /* CONFIG_DEMANGLE */

/*
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
--
2.1.1

2014-10-25 22:23:42

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 09/14] perf kbuild: remove legacy misc build variables

Remove NO_LIBAUDIT (replaced by CONFIG_LIBAUDIT)
Remove HAVE_LIBAUDIT_SUPPORT from CFLAGS (replaced by CONFIG_LIBAUDIT)
Remove HAVE_TIMERFD_SUPPORT (replaced by CONFIG_TIMERFD)
Remove HAVE_ON_EXIT_SUPPORT (replaced by CONFIG_ON_EXIT)
Remove HAVE_BACKTRACE_SUPPORT (replaced by CONFIG_BACKTRACE)
Remove HAVE_LIBNUMA_SUPPORT (replaced by CONFIG_LIBNUMA)
Remove NO_BIONIC (replaced by CONFIG_BIONIC)
Remove NO_PERF_REGS (replaced by CONFIG_PERF_REGS)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 12 ++++++++--
tools/perf/arch/arm/tests/Kbuild | 2 +-
tools/perf/arch/x86/tests/Kbuild | 2 +-
tools/perf/bench/Kbuild | 2 +-
tools/perf/builtin-bench.c | 5 ++--
tools/perf/builtin-kvm.c | 13 ++++++-----
tools/perf/builtin-record.c | 2 ++
tools/perf/config/Makefile | 43 +++++++++++++----------------------
tools/perf/config/Makefile.fix-config | 32 --------------------------
tools/perf/config/Makefile.fix-legacy | 16 -------------
tools/perf/util/perf_regs.c | 3 +++
tools/perf/util/perf_regs.h | 6 +++--
tools/perf/util/util.c | 5 ++--
13 files changed, 51 insertions(+), 92 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 5f85923..29853a6 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -312,8 +312,8 @@ config LIBUNWIND_DIR
Directory holding the libuwind dependency (headers +
libraries).

-config NUMA
- bool "Numa support (bench)"
+config LIBNUMA
+ bool "Libnuma support"
default y
---help---
The library libnuma offers facilities to configure NUMA
@@ -327,6 +327,14 @@ config BIONIC
library code developed by Google for their Android operating
system.

+config PERF_REGS
+ bool "Cache register accesses"
+ depends on (ARCH = "x86" || ARCH = "arm" || ARCH = "arm64")
+ default y
+ ---help---
+ Cache register accesses for unwind processing to speed-up
+ performances.
+
endmenu

menu "Build"
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
index 5d63e9d..1318ed0 100644
--- a/tools/perf/arch/arm/tests/Kbuild
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -1,2 +1,2 @@
-obj-y += regs_load.o
+obj-$(CONFIG_PERF_REGS) += regs_load.o
obj-y += dwarf-unwind.o
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
index 3b5aa14..8287dae 100644
--- a/tools/perf/arch/x86/tests/Kbuild
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -1,3 +1,3 @@
obj-y += perf-time-to-tsc.o
-obj-y += regs_load.o
+obj-$(CONFIG_PERF_REGS) += regs_load.o
obj-y += dwarf-unwind.o
diff --git a/tools/perf/bench/Kbuild b/tools/perf/bench/Kbuild
index e604fe2..863646a 100644
--- a/tools/perf/bench/Kbuild
+++ b/tools/perf/bench/Kbuild
@@ -6,7 +6,7 @@ obj-y += futex-hash.o
obj-y += futex-requeue.o
obj-y += futex-wake.o

-obj-$(CONFIG_NUMA) += numa.o
+obj-$(CONFIG_LIBNUMA) += numa.o

obj-$(CONFIG_X86_64) += mem-memcpy-x86-64-asm.o
obj-$(CONFIG_X86_64) += mem-memset-x86-64-asm.o
diff --git a/tools/perf/builtin-bench.c b/tools/perf/builtin-bench.c
index b9a56fa..5116d25 100644
--- a/tools/perf/builtin-bench.c
+++ b/tools/perf/builtin-bench.c
@@ -14,6 +14,7 @@
* numa ... NUMA scheduling and MM performance
* futex ... Futex performance
*/
+#include "generated/autoconf.h"
#include "perf.h"
#include "util/util.h"
#include "util/parse-options.h"
@@ -33,7 +34,7 @@ struct bench {
bench_fn_t fn;
};

-#ifdef HAVE_LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
static struct bench numa_benchmarks[] = {
{ "mem", "Benchmark for NUMA workloads", bench_numa },
{ "all", "Test all NUMA benchmarks", NULL },
@@ -72,7 +73,7 @@ struct collection {
static struct collection collections[] = {
{ "sched", "Scheduler and IPC benchmarks", sched_benchmarks },
{ "mem", "Memory access benchmarks", mem_benchmarks },
-#ifdef HAVE_LIBNUMA_SUPPORT
+#ifdef CONFIG_LIBNUMA
{ "numa", "NUMA scheduling and MM benchmarks", numa_benchmarks },
#endif
{"futex", "Futex stressing benchmarks", futex_benchmarks },
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index e042728..19a1d17 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "builtin.h"
#include "perf.h"

@@ -20,7 +21,7 @@
#include "util/data.h"

#include <sys/prctl.h>
-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
#include <sys/timerfd.h>
#endif

@@ -123,7 +124,7 @@ static void init_kvm_event_record(struct perf_kvm_stat *kvm)
INIT_LIST_HEAD(&kvm->kvm_events_cache[i]);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static void clear_events_cache_stats(struct list_head *kvm_events_cache)
{
struct list_head *head;
@@ -622,7 +623,7 @@ static void print_result(struct perf_kvm_stat *kvm)
pr_info("\nLost events: %" PRIu64 "\n\n", kvm->lost_events);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static int process_lost_event(struct perf_tool *tool,
union perf_event *event __maybe_unused,
struct perf_sample *sample __maybe_unused,
@@ -707,7 +708,7 @@ static bool verify_vcpu(int vcpu)
return true;
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
/* keeping the max events to a modest level to keep
* the processing of samples per mmap smooth.
*/
@@ -1224,7 +1225,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv)
return kvm_events_report_vcpu(kvm);
}

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
static struct perf_evlist *kvm_live_event_list(void)
{
struct perf_evlist *evlist;
@@ -1439,7 +1440,7 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
if (!strncmp(argv[1], "rep", 3))
return kvm_events_report(&kvm, argc - 1 , argv + 1);

-#ifdef HAVE_TIMERFD_SUPPORT
+#ifdef CONFIG_TIMERFD
if (!strncmp(argv[1], "live", 4))
return kvm_events_live(&kvm, argc - 1 , argv + 1);
#endif
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 5091a27..2b531ad 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -5,6 +5,8 @@
* (or a CPU, or a PID) into the perf.data output file - for
* later analysis via perf report.
*/
+
+#include "generated/autoconf.h"
#include "builtin.h"

#include "perf.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 1e7e369..15bd90b 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -16,8 +16,6 @@ CFLAGS := $(EXTRA_CFLAGS) $(EXTRA_WARNINGS)

include $(src-perf)/config/Makefile.arch

-NO_PERF_REGS := 1
-
# Additional ARCH settings for x86
ifeq ($(ARCH),x86)
ifeq ($(IS_X86_64),1)
@@ -26,16 +24,13 @@ ifeq ($(ARCH),x86)
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
- NO_PERF_REGS := 0
endif

ifeq ($(ARCH),arm)
- NO_PERF_REGS := 0
LIBUNWIND_LIBS = -lunwind -lunwind-arm
endif

ifeq ($(ARCH),arm64)
- NO_PERF_REGS := 0
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

@@ -68,10 +63,6 @@ else
FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
endif

-ifeq ($(NO_PERF_REGS),0)
- CFLAGS += -DHAVE_PERF_REGS_SUPPORT
-endif
-
ifndef NO_LIBELF
# for linking with debug library, run like:
# make DEBUG=1 LIBDW_DIR=/opt/libdw/
@@ -303,12 +294,14 @@ ifeq ($(feature-sync-compare-and-swap), 1)
CFLAGS += -DHAVE_SYNC_COMPARE_AND_SWAP_SUPPORT
endif

-ifndef NO_BIONIC
+ifdef CONFIG_BIONIC
$(call feature_check,bionic)
ifeq ($(feature-bionic), 1)
BIONIC := 1
EXTLIBS := $(filter-out -lrt,$(EXTLIBS))
EXTLIBS := $(filter-out -lpthread,$(EXTLIBS))
+ else
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_BIONIC)
endif
endif

@@ -435,12 +428,11 @@ ifndef NO_LIBUNWIND
LDFLAGS += $(LIBUNWIND_LDFLAGS)
endif

-ifndef NO_LIBAUDIT
+ifdef CONFIG_LIBAUDIT
ifneq ($(feature-libaudit), 1)
- msg := $(warning No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev);
- NO_LIBAUDIT := 1
+ msg := $(warning No libaudit.h found, disables LIBAUDIT support and 'trace' tool, please install audit-libs-devel or libaudit-dev);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBAUDIT)
else
- CFLAGS += -DHAVE_LIBAUDIT_SUPPORT
EXTLIBS += -laudit
endif
endif
@@ -493,10 +485,11 @@ else
endif
endif

-ifeq ($(feature-timerfd), 1)
- CFLAGS += -DHAVE_TIMERFD_SUPPORT
-else
- msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+ifdef CONFIG_TIMERFD
+ ifneq ($(feature-timerfd), 1)
+ msg := $(warning No timerfd support. Disables 'perf kvm stat live');
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_TIMERFD)
+ endif
endif

disable-python = $(eval $(disable-python_code))
@@ -605,18 +598,17 @@ ifdef CONFIG_LIBIBERTY_ONLY
endif
endif

-ifndef NO_BACKTRACE
- ifeq ($(feature-backtrace), 1)
- CFLAGS += -DHAVE_BACKTRACE_SUPPORT
+ifdef CONFIG_BACKTRACE
+ ifneq ($(feature-backtrace), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_BACKTRACE)
endif
endif

-ifndef NO_LIBNUMA
+ifdef CONFIG_LIBNUMA
ifeq ($(feature-libnuma), 0)
msg := $(warning No numa.h found, disables 'perf bench numa mem' benchmark, please install numactl-devel/libnuma-devel/libnuma-dev);
- NO_LIBNUMA := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBNUMA)
else
- CFLAGS += -DHAVE_LIBNUMA_SUPPORT
EXTLIBS += -lnuma
endif
endif
@@ -824,9 +816,6 @@ all:
$(call store,NO_LIBPYTHON)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
- $(call store,NO_BACKTRACE)
- $(call store,NO_LIBNUMA)
- $(call store,NO_LIBAUDIT)
$(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 3d84008..2ba684b 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -45,36 +45,4 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
endif
endif

-# NO_BACKTRACE
-ifdef CONFIG_BACKTRACE
-ifdef NO_BACKTRACE
-dummy := $(info Disabling CONFIG_BACKTRACE)
-dummy := $(shell $(CONFIG) -d CONFIG_BACKTRACE)
-endif
-endif
-
-# NO_LIBNUMA
-ifdef CONFIG_NUMA
-ifdef NO_LIBNUMA
-dummy := $(info Disabling CONFIG_NUMA)
-dummy := $(shell $(CONFIG) -d CONFIG_NUMA)
-endif
-endif
-
-# NO_LIBAUDIT
-ifdef CONFIG_LIBAUDIT
-ifdef NO_LIBAUDIT
-dummy := $(info Disabling CONFIG_LIBAUDIT)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBAUDIT)
-endif
-endif
-
-# NO_LIBBIONIC
-ifdef CONFIG_BIONIC
-ifdef NO_LIBBIONIC
-dummy := $(info Disabling CONFIG_BIONIC)
-dummy := $(shell $(CONFIG) -d CONFIG_BIONIC)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 64dbb1a..8e32b74 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -16,19 +16,3 @@ endif
ifndef CONFIG_LIBUNWIND
NO_LIBUNWIND := 1
endif
-
-ifndef CONFIG_BACKTRACE
-NO_BACKTRACE := 1
-endif
-
-ifndef CONFIG_NUMA
-export NO_LIBNUMA := 1
-endif
-
-ifndef CONFIG_LIBAUDIT
-NO_LIBAUDIT := 1
-endif
-
-ifdef CONFIG_BIONIC
-NO_LIBBIONIC := 1
-endif
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 43168fb..01720b5 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -1,7 +1,9 @@
#include <errno.h>
+#include "generated/autoconf.h"
#include "perf_regs.h"
#include "event.h"

+#ifdef CONFIG_PERF_REGS
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
{
int i, idx = 0;
@@ -25,3 +27,4 @@ out:
*valp = regs->cache_regs[id];
return 0;
}
+#endif /* CONFIG_PERF_REGS */
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 980dbf7..44d9b08 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -1,11 +1,13 @@
#ifndef __PERF_REGS_H
#define __PERF_REGS_H

+#include <linux/compiler.h>
#include <linux/types.h>
+#include "generated/autoconf.h"

struct regs_dump;

-#ifdef HAVE_PERF_REGS_SUPPORT
+#ifdef CONFIG_PERF_REGS
#include <perf_regs.h>

int perf_reg_value(u64 *valp, struct regs_dump *regs, int id);
@@ -25,5 +27,5 @@ static inline int perf_reg_value(u64 *valp __maybe_unused,
{
return 0;
}
-#endif /* HAVE_PERF_REGS_SUPPORT */
+#endif /* CONFIG_PERF_REGS */
#endif /* __PERF_REGS_H */
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index d5eab3f..17667d8 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -1,9 +1,10 @@
+#include "generated/autoconf.h"
#include "../perf.h"
#include "util.h"
#include "debug.h"
#include <api/fs/fs.h>
#include <sys/mman.h>
-#ifdef HAVE_BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
#include <execinfo.h>
#endif
#include <stdio.h>
@@ -250,7 +251,7 @@ int hex2u64(const char *ptr, u64 *long_val)
}

/* Obtain a backtrace and print it to stdout. */
-#ifdef HAVE_BACKTRACE_SUPPORT
+#ifdef CONFIG_BACKTRACE
void dump_stack(void)
{
void *array[16];
--
2.1.1

2014-10-25 22:23:46

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 10/14] perf kbuild: remove legacy libelf-related build variables

Remove NO_LIBELF (replaced by CONFIG_LIBELF)
Remove HAVE_LIBELF_SUPPORT (replaced by CONFIG_LIBELF)
Remove HAVE_LIBELF_MMAP_SUPPORT (replaced by CONFIG_LIBELF_MMAP)
Remove HAVE_LIBELF_GETPHDRNUM__SUPPORT (replaced by
CONFIG_LIBELF_GETPHDRNUM_)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 23 ++++++++++++++++++++++
tools/perf/builtin-inject.c | 2 +-
tools/perf/config/Makefile | 37 +++++++++++++++--------------------
tools/perf/config/Makefile.fix-config | 18 -----------------
tools/perf/config/Makefile.fix-legacy | 4 ----
tools/perf/perf.c | 2 +-
tools/perf/util/generate-cmdlist.sh | 4 ++--
tools/perf/util/map.c | 3 ++-
tools/perf/util/symbol-elf.c | 3 ++-
tools/perf/util/symbol.h | 8 ++++----
10 files changed, 51 insertions(+), 53 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 29853a6..2eaf3ca 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -256,6 +256,7 @@ config TIMERFD
Timer via file descriptor

config DEMANGLE
+ depends on LIBELF
bool "Demangle symbols"
default y
---help---
@@ -298,7 +299,29 @@ choice
Builtin elf support.
endchoice

+config LIBELF_MMAP
+ depends on LIBELF
+ bool "Libelf mmap support"
+ default y
+ ---help---
+ libdelf mmap
+
+config LIBELF_GETPHDRNUM
+ depends on LIBELF
+ default y
+ bool "Libelf getphdrnum support"
+ ---help---
+ libdelf mmap
+
+config LIBDWARF
+ depends on LIBELF
+ bool "Dwarf (libdwarf)"
+ default y
+ ---help---
+ libdwarf
+
config LIBUNWIND
+ depends on LIBELF
bool "User space libunwind callchains"
default y
---help---
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 06f1758..cb19ccc 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -229,7 +229,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
* account this as unresolved.
*/
} else {
-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
pr_warning("no symbols found in %s, maybe "
"install a debug package?\n",
al.map->dso->long_name);
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 15bd90b..19dab72 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -305,12 +305,7 @@ ifdef CONFIG_BIONIC
endif
endif

-ifdef NO_LIBELF
- NO_DWARF := 1
- NO_DEMANGLE := 1
- NO_LIBUNWIND := 1
- NO_LIBDW_DWARF_UNWIND := 1
-else
+ifdef CONFIG_LIBELF
ifeq ($(feature-libelf), 0)
ifeq ($(feature-glibc), 1)
LIBC_SUPPORT := 1
@@ -320,12 +315,9 @@ else
endif
ifeq ($(LIBC_SUPPORT),1)
msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
-
- NO_LIBELF := 1
- NO_DWARF := 1
- NO_DEMANGLE := 1
- NO_LIBUNWIND := 1
- NO_LIBDW_DWARF_UNWIND := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF)
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBELF_MINIMAL)
+ EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
else
ifneq ($(filter s% -static%,$(LDFLAGS),),)
msg := $(error No static glibc found, please install glibc-static);
@@ -334,6 +326,7 @@ else
endif
endif
else
+ LIBELF = 1
ifndef NO_LIBDW_DWARF_UNWIND
ifneq ($(feature-libdw-dwarf-unwind),1)
NO_LIBDW_DWARF_UNWIND := 1
@@ -345,17 +338,20 @@ else
NO_DWARF := 1
endif # Dwarf support
endif # libelf support
-endif # NO_LIBELF
+endif # CONFIG_LIBELF

-ifndef NO_LIBELF
- CFLAGS += -DHAVE_LIBELF_SUPPORT
+ifeq ($(LIBELF), 1)

- ifeq ($(feature-libelf-mmap), 1)
- CFLAGS += -DHAVE_LIBELF_MMAP_SUPPORT
+ ifdef CONFIG_LIBELF_MMAP
+ ifneq ($(feature-libelf-mmap), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ endif
endif

- ifeq ($(feature-libelf-getphdrnum), 1)
- CFLAGS += -DHAVE_ELF_GETPHDRNUM_SUPPORT
+ ifdef CONFIG_LIBELF_MMAP
+ ifneq ($(feature-libelf-getphdrnum), 1)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ endif
endif

# include ARCH specific config
@@ -371,7 +367,7 @@ ifndef NO_LIBELF
EXTLIBS += -lelf -ldw
endif # PERF_HAVE_DWARF_REGS
endif # NO_DWARF
-endif # NO_LIBELF
+endif # LIBELF

ifeq ($(ARCH),powerpc)
ifndef NO_DWARF
@@ -814,7 +810,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 2ba684b..99948b7 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,24 +19,6 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_DEMANGLE
-ifdef CONFIG_DEMANGLE
-ifdef NO_DEMANGLE
-dummy := $(info Disabling CONFIG_DEMANGLE)
-dummy := $(shell $(CONFIG) -d CONFIG_DEMANGLE)
-endif
-endif
-
-# NO_LIBELF
-ifdef CONFIG_LIBELF
-ifdef NO_LIBELF
-dummy := $(info Disabling CONFIG_LIBELF)
-dummy := $(info Enabling CONFIG_LIBELF_MINIMAL)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBELF)
-dummy := $(shell $(CONFIG) -e CONFIG_LIBELF_MINIMAL)
-endif
-endif
-
# NO_LIBUNWIND
ifdef CONFIG_LIBUNWIND
ifdef NO_LIBUNWIND
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 8e32b74..8568d37 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,10 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_LIBELF
-NO_LIBELF := 1
-endif
-
ifndef CONFIG_LIBUNWIND
NO_LIBUNWIND := 1
endif
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 976ded6..b4fd910 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -81,7 +81,7 @@ static struct cmd_struct commands[] = {
#ifdef CONFIG_BUILTIN_SCHED
{ "sched", cmd_sched, 0 },
#endif
-#if defined HAVE_LIBELF_SUPPORT && defined CONFIG_BUILTIN_PROBE
+#if defined CONFIG_LIBELF && defined CONFIG_BUILTIN_PROBE
{ "probe", cmd_probe, 0 },
#endif
#ifdef CONFIG_BUILTIN_KMEM
diff --git a/tools/perf/util/generate-cmdlist.sh b/tools/perf/util/generate-cmdlist.sh
index 5d84ffc..a8dbdc2 100755
--- a/tools/perf/util/generate-cmdlist.sh
+++ b/tools/perf/util/generate-cmdlist.sh
@@ -30,7 +30,7 @@ do
echo "#endif"
done

-echo "#ifdef HAVE_LIBELF_SUPPORT"
+echo "#ifdef CONFIG_LIBELF"
sed -n -e 's/^perf-\([^ ]*\)[ ].* full.*/\1/p' $1/command-list.txt |
sort |
while read cmd
@@ -45,5 +45,5 @@ do
}' "$1/Documentation/perf-$cmd.txt"
echo "#endif"
done
-echo "#endif /* HAVE_LIBELF_SUPPORT */"
+echo "#endif /* CONFIG_LIBELF */"
echo "};"
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index 040a785..77c2d85 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "symbol.h"
#include <errno.h>
#include <inttypes.h>
@@ -272,7 +273,7 @@ int map__load(struct map *map, symbol_filter_t filter)
pr_warning(", continuing without symbols\n");
return -1;
} else if (nr == 0) {
-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
const size_t len = strlen(name);
const size_t real_len = len - sizeof(DSO__DELETED);

diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 1e23a5b..db340ab 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -5,13 +5,14 @@
#include <unistd.h>
#include <inttypes.h>

+#include "generated/autoconf.h"
#include "symbol.h"
#include "machine.h"
#include "vdso.h"
#include <symbol/kallsyms.h>
#include "debug.h"

-#ifndef HAVE_ELF_GETPHDRNUM_SUPPORT
+#ifndef CONFIG_LIBELF_GETPHDRNUM
static int elf_getphdrnum(Elf *elf, size_t *dst)
{
GElf_Ehdr gehdr;
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 7e3a003..53bf6df 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -17,7 +17,7 @@
#include "event.h"
#include "util.h"

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
#include <libelf.h>
#include <gelf.h>
#endif
@@ -57,13 +57,13 @@ static inline char *bfd_demangle(void __maybe_unused *v,
* libelf 0.8.x and earlier do not support ELF_C_READ_MMAP;
* for newer versions we can use mmap to reduce memory usage:
*/
-#ifdef HAVE_LIBELF_MMAP_SUPPORT
+#ifdef CONFIG_LIBELF_MMAP
# define PERF_ELF_C_READ_MMAP ELF_C_READ_MMAP
#else
# define PERF_ELF_C_READ_MMAP ELF_C_READ
#endif

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
extern Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
GElf_Shdr *shp, const char *name, size_t *idx);
#endif
@@ -220,7 +220,7 @@ struct symsrc {
int fd;
enum dso_binary_type type;

-#ifdef HAVE_LIBELF_SUPPORT
+#ifdef CONFIG_LIBELF
Elf *elf;
GElf_Ehdr ehdr;

--
2.1.1

2014-10-25 22:23:57

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 14/14] perf kbuild: add generated Kconfig build-test cases

Thanks to the python module kconfiglib, we were able to generate build
configurations. The set is, of course, not exhaustive but for each
option, all the possible states are tested. If, during development
step, a new symbol is added into the Kconfig file, the target
build-test will not fail (olddefconfig is called so that new
parameters are filled with their default value).

Signed-off-by: Alexis Berlemont <[email protected]>
---

Changes since v3:
* Target build-test: for each .config-based test case, call "make
olddefconfig" so as to prevent failure because of new Kconfig
symbol(s)

tools/perf/MANIFEST | 1 +
tools/perf/tests/configs/MINIMAL_config | 60 ++++++++++++++++++
tools/perf/tests/configs/NO_BACKTRACE_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_ANNOTATE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_BENCH_config | 73 ++++++++++++++++++++++
.../tests/configs/NO_BUILTIN_BUILDID_CACHE_config | 73 ++++++++++++++++++++++
.../tests/configs/NO_BUILTIN_BUILDID_LIST_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_DIFF_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_EVLIST_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_HELP_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_INJECT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_KMEM_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_KVM_STAT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_KVM_config | 72 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_LIST_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_LOCK_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_MEM_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_PROBE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_RECORD_config | 63 +++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_REPORT_config | 68 ++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_SCHED_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_STAT_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TEST_config | 73 ++++++++++++++++++++++
.../perf/tests/configs/NO_BUILTIN_TIMECHART_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TOP_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_BUILTIN_TRACE_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_DEMANGLE_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_GTK2_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBAUDIT_config | 72 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBDWARF_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBELF_MMAP_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBGTK2_config | 71 +++++++++++++++++++++
tools/perf/tests/configs/NO_LIBNUMA_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBPERL_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBPYTHON_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_LIBSLANG_config | 72 +++++++++++++++++++++
.../tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_PERF_REGS_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_STDIO_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_TIMERFD_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_TUI_config | 73 ++++++++++++++++++++++
tools/perf/tests/configs/NO_UNWIND_config | 69 ++++++++++++++++++++
tools/perf/tests/configs/REF_config | 73 ++++++++++++++++++++++
tools/perf/tests/generate_configs.py | 43 +++++++++++++
tools/perf/tests/make | 70 ++++++---------------
47 files changed, 3227 insertions(+), 50 deletions(-)
create mode 100644 tools/perf/tests/configs/MINIMAL_config
create mode 100644 tools/perf/tests/configs/NO_BACKTRACE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BENCH_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_DIFF_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_HELP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_INJECT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KMEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_KVM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LIST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_LOCK_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_MEM_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_PROBE_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_RECORD_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_REPORT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCHED_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_STAT_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TEST_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TOP_config
create mode 100644 tools/perf/tests/configs/NO_BUILTIN_TRACE_config
create mode 100644 tools/perf/tests/configs/NO_DEMANGLE_config
create mode 100644 tools/perf/tests/configs/NO_GTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBAUDIT_config
create mode 100644 tools/perf/tests/configs/NO_LIBDWARF_config
create mode 100644 tools/perf/tests/configs/NO_LIBELF_MMAP_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
create mode 100644 tools/perf/tests/configs/NO_LIBGTK2_config
create mode 100644 tools/perf/tests/configs/NO_LIBNUMA_config
create mode 100644 tools/perf/tests/configs/NO_LIBPERL_config
create mode 100644 tools/perf/tests/configs/NO_LIBPYTHON_config
create mode 100644 tools/perf/tests/configs/NO_LIBSLANG_config
create mode 100644 tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
create mode 100644 tools/perf/tests/configs/NO_PERF_REGS_config
create mode 100644 tools/perf/tests/configs/NO_STDIO_config
create mode 100644 tools/perf/tests/configs/NO_TIMERFD_config
create mode 100644 tools/perf/tests/configs/NO_TUI_config
create mode 100644 tools/perf/tests/configs/NO_UNWIND_config
create mode 100644 tools/perf/tests/configs/REF_config
create mode 100644 tools/perf/tests/generate_configs.py

diff --git a/tools/perf/MANIFEST b/tools/perf/MANIFEST
index 344c4d3..def2b5b 100644
--- a/tools/perf/MANIFEST
+++ b/tools/perf/MANIFEST
@@ -1,3 +1,4 @@
+scripts
tools/perf
tools/scripts
tools/lib/traceevent
diff --git a/tools/perf/tests/configs/MINIMAL_config b/tools/perf/tests/configs/MINIMAL_config
new file mode 100644
index 0000000..fa6503e
--- /dev/null
+++ b/tools/perf/tests/configs/MINIMAL_config
@@ -0,0 +1,60 @@
+#
+# Automatically generated file; DO NOT EDIT.
+# The perf configuration
+#
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+
+#
+# Libraries / Dependencies
+#
+# CONFIG_LIBSLANG is not set
+# CONFIG_LIBAUDIT is not set
+# CONFIG_LIBGTK2 is not set
+# CONFIG_LIBPERL is not set
+# CONFIG_LIBPYTHON is not set
+# CONFIG_TIMERFD is not set
+# CONFIG_LIBELF is not set
+CONFIG_LIBELF_MINIMAL=y
+# CONFIG_LIBNUMA is not set
+# CONFIG_BIONIC is not set
+# CONFIG_PERF_REGS is not set
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BACKTRACE_config b/tools/perf/tests/configs/NO_BACKTRACE_config
new file mode 100644
index 0000000..e0be1a4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BACKTRACE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+# CONFIG_BACKTRACE is not set
diff --git a/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config b/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
new file mode 100644
index 0000000..4d38fb4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_ANNOTATE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+# CONFIG_BUILTIN_ANNOTATE is not set
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BENCH_config b/tools/perf/tests/configs/NO_BUILTIN_BENCH_config
new file mode 100644
index 0000000..38a0cf2
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BENCH_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+# CONFIG_BUILTIN_BENCH is not set
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
new file mode 100644
index 0000000..d41e3e5
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_CACHE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+# CONFIG_BUILTIN_BUILDID_CACHE is not set
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
new file mode 100644
index 0000000..f8c7a98
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_BUILDID_LIST_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+# CONFIG_BUILTIN_BUILDID_LIST is not set
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_DIFF_config b/tools/perf/tests/configs/NO_BUILTIN_DIFF_config
new file mode 100644
index 0000000..4fdb2ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_DIFF_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+# CONFIG_BUILTIN_DIFF is not set
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config b/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
new file mode 100644
index 0000000..4d474a6
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_EVLIST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+# CONFIG_BUILTIN_EVLIST is not set
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_HELP_config b/tools/perf/tests/configs/NO_BUILTIN_HELP_config
new file mode 100644
index 0000000..9611823
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_HELP_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+# CONFIG_BUILTIN_HELP is not set
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_INJECT_config b/tools/perf/tests/configs/NO_BUILTIN_INJECT_config
new file mode 100644
index 0000000..ac9e908
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_INJECT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+# CONFIG_BUILTIN_INJECT is not set
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KMEM_config b/tools/perf/tests/configs/NO_BUILTIN_KMEM_config
new file mode 100644
index 0000000..e808a30
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KMEM_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+# CONFIG_BUILTIN_KMEM is not set
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config b/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
new file mode 100644
index 0000000..b7d36d5
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KVM_STAT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+# CONFIG_BUILTIN_KVM_STAT is not set
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_KVM_config b/tools/perf/tests/configs/NO_BUILTIN_KVM_config
new file mode 100644
index 0000000..dc47acb
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_KVM_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+# CONFIG_BUILTIN_KVM is not set
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_LIST_config b/tools/perf/tests/configs/NO_BUILTIN_LIST_config
new file mode 100644
index 0000000..a573501
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_LIST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+# CONFIG_BUILTIN_LIST is not set
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_LOCK_config b/tools/perf/tests/configs/NO_BUILTIN_LOCK_config
new file mode 100644
index 0000000..6b3a100
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_LOCK_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+# CONFIG_BUILTIN_LOCK is not set
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_MEM_config b/tools/perf/tests/configs/NO_BUILTIN_MEM_config
new file mode 100644
index 0000000..247ab6e
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_MEM_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+# CONFIG_BUILTIN_MEM is not set
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_PROBE_config b/tools/perf/tests/configs/NO_BUILTIN_PROBE_config
new file mode 100644
index 0000000..19a083b
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_PROBE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+# CONFIG_BUILTIN_PROBE is not set
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_RECORD_config b/tools/perf/tests/configs/NO_BUILTIN_RECORD_config
new file mode 100644
index 0000000..151c0f7
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_RECORD_config
@@ -0,0 +1,63 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+# CONFIG_BUILTIN_RECORD is not set
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_REPORT_config b/tools/perf/tests/configs/NO_BUILTIN_REPORT_config
new file mode 100644
index 0000000..88c2c17
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_REPORT_config
@@ -0,0 +1,68 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+# CONFIG_BUILTIN_REPORT is not set
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_SCHED_config b/tools/perf/tests/configs/NO_BUILTIN_SCHED_config
new file mode 100644
index 0000000..ded3e68
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_SCHED_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+# CONFIG_BUILTIN_SCHED is not set
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config b/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
new file mode 100644
index 0000000..369c58e
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_SCRIPT_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+# CONFIG_BUILTIN_SCRIPT is not set
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_STAT_config b/tools/perf/tests/configs/NO_BUILTIN_STAT_config
new file mode 100644
index 0000000..147f3ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_STAT_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+# CONFIG_BUILTIN_STAT is not set
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TEST_config b/tools/perf/tests/configs/NO_BUILTIN_TEST_config
new file mode 100644
index 0000000..66acb87
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TEST_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+# CONFIG_BUILTIN_TEST is not set
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config b/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
new file mode 100644
index 0000000..04dba98
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TIMECHART_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+# CONFIG_BUILTIN_TIMECHART is not set
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TOP_config b/tools/perf/tests/configs/NO_BUILTIN_TOP_config
new file mode 100644
index 0000000..0af5579
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TOP_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+# CONFIG_BUILTIN_TOP is not set
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_BUILTIN_TRACE_config b/tools/perf/tests/configs/NO_BUILTIN_TRACE_config
new file mode 100644
index 0000000..5717064
--- /dev/null
+++ b/tools/perf/tests/configs/NO_BUILTIN_TRACE_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+# CONFIG_BUILTIN_TRACE is not set
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_DEMANGLE_config b/tools/perf/tests/configs/NO_DEMANGLE_config
new file mode 100644
index 0000000..47c8263
--- /dev/null
+++ b/tools/perf/tests/configs/NO_DEMANGLE_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+# CONFIG_DEMANGLE is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_GTK2_config b/tools/perf/tests/configs/NO_GTK2_config
new file mode 100644
index 0000000..529872b
--- /dev/null
+++ b/tools/perf/tests/configs/NO_GTK2_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+# CONFIG_GTK2 is not set
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBAUDIT_config b/tools/perf/tests/configs/NO_LIBAUDIT_config
new file mode 100644
index 0000000..c7db9d2
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBAUDIT_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+# CONFIG_LIBAUDIT is not set
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBDWARF_config b/tools/perf/tests/configs/NO_LIBDWARF_config
new file mode 100644
index 0000000..45cb7c8
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBDWARF_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+# CONFIG_LIBDWARF is not set
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBELF_MMAP_config b/tools/perf/tests/configs/NO_LIBELF_MMAP_config
new file mode 100644
index 0000000..ec83684
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBELF_MMAP_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+# CONFIG_LIBELF_MMAP is not set
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config b/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
new file mode 100644
index 0000000..9b62c67
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBGTK2_INFOBAR_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+# CONFIG_LIBGTK2_INFOBAR is not set
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBGTK2_config b/tools/perf/tests/configs/NO_LIBGTK2_config
new file mode 100644
index 0000000..c16fc4d
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBGTK2_config
@@ -0,0 +1,71 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+# CONFIG_LIBGTK2 is not set
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBNUMA_config b/tools/perf/tests/configs/NO_LIBNUMA_config
new file mode 100644
index 0000000..c3006b4
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBNUMA_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+# CONFIG_LIBNUMA is not set
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBPERL_config b/tools/perf/tests/configs/NO_LIBPERL_config
new file mode 100644
index 0000000..317d3f28
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBPERL_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+# CONFIG_LIBPERL is not set
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBPYTHON_config b/tools/perf/tests/configs/NO_LIBPYTHON_config
new file mode 100644
index 0000000..a63acb3
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBPYTHON_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+# CONFIG_LIBPYTHON is not set
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBSLANG_config b/tools/perf/tests/configs/NO_LIBSLANG_config
new file mode 100644
index 0000000..fa7726c
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBSLANG_config
@@ -0,0 +1,72 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+# CONFIG_LIBSLANG is not set
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config b/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
new file mode 100644
index 0000000..837a80f
--- /dev/null
+++ b/tools/perf/tests/configs/NO_LIBUNWIND_DEBUG_FRAME_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+# CONFIG_LIBUNWIND_DEBUG_FRAME is not set
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_PERF_REGS_config b/tools/perf/tests/configs/NO_PERF_REGS_config
new file mode 100644
index 0000000..eae8a16
--- /dev/null
+++ b/tools/perf/tests/configs/NO_PERF_REGS_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+# CONFIG_PERF_REGS is not set
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_STDIO_config b/tools/perf/tests/configs/NO_STDIO_config
new file mode 100644
index 0000000..b80e1ff
--- /dev/null
+++ b/tools/perf/tests/configs/NO_STDIO_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+# CONFIG_STDIO is not set
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_TIMERFD_config b/tools/perf/tests/configs/NO_TIMERFD_config
new file mode 100644
index 0000000..4a0d134
--- /dev/null
+++ b/tools/perf/tests/configs/NO_TIMERFD_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+# CONFIG_TIMERFD is not set
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_TUI_config b/tools/perf/tests/configs/NO_TUI_config
new file mode 100644
index 0000000..be233df
--- /dev/null
+++ b/tools/perf/tests/configs/NO_TUI_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+# CONFIG_TUI is not set
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/NO_UNWIND_config b/tools/perf/tests/configs/NO_UNWIND_config
new file mode 100644
index 0000000..caefd3a
--- /dev/null
+++ b/tools/perf/tests/configs/NO_UNWIND_config
@@ -0,0 +1,69 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+# CONFIG_UNWIND is not set
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/configs/REF_config b/tools/perf/tests/configs/REF_config
new file mode 100644
index 0000000..7708411
--- /dev/null
+++ b/tools/perf/tests/configs/REF_config
@@ -0,0 +1,73 @@
+CONFIG_ARCH="x86"
+CONFIG_X86_64=y
+CONFIG_CROSS_COMPILE=""
+
+#
+# Built-in commands
+#
+CONFIG_BUILTIN_RECORD=y
+CONFIG_BUILTIN_REPORT=y
+CONFIG_BUILTIN_STAT=y
+CONFIG_BUILTIN_TOP=y
+CONFIG_BUILTIN_TRACE=y
+CONFIG_BUILTIN_ANNOTATE=y
+CONFIG_BUILTIN_BENCH=y
+CONFIG_BUILTIN_BUILDID_CACHE=y
+CONFIG_BUILTIN_BUILDID_LIST=y
+CONFIG_BUILTIN_DIFF=y
+CONFIG_BUILTIN_EVLIST=y
+CONFIG_BUILTIN_HELP=y
+CONFIG_BUILTIN_INJECT=y
+CONFIG_BUILTIN_KMEM=y
+CONFIG_BUILTIN_KVM=y
+CONFIG_BUILTIN_KVM_STAT=y
+CONFIG_BUILTIN_LIST=y
+CONFIG_BUILTIN_LOCK=y
+CONFIG_BUILTIN_PROBE=y
+CONFIG_BUILTIN_SCHED=y
+CONFIG_BUILTIN_SCRIPT=y
+CONFIG_BUILTIN_TIMECHART=y
+CONFIG_BUILTIN_MEM=y
+CONFIG_BUILTIN_TEST=y
+
+#
+# GUI
+#
+CONFIG_STDIO=y
+CONFIG_TUI=y
+CONFIG_GTK2=y
+
+#
+# Libraries / Dependencies
+#
+CONFIG_LIBSLANG=y
+CONFIG_LIBAUDIT=y
+CONFIG_LIBGTK2=y
+CONFIG_LIBGTK2_INFOBAR=y
+CONFIG_LIBPERL=y
+CONFIG_LIBPYTHON=y
+CONFIG_TIMERFD=y
+CONFIG_DEMANGLE=y
+CONFIG_LIBBFD=y
+# CONFIG_LIBIBERTY_ONLY is not set
+CONFIG_LIBELF=y
+# CONFIG_LIBELF_MINIMAL is not set
+CONFIG_LIBELF_MMAP=y
+CONFIG_LIBELF_GETPHDRNUM=y
+CONFIG_LIBDWARF=y
+CONFIG_LIBDWARF_DIR=""
+CONFIG_UNWIND=y
+CONFIG_LIBUNWIND=y
+# CONFIG_LIBDWARF_UNWIND is not set
+CONFIG_LIBUNWIND_DEBUG_FRAME=y
+CONFIG_LIBUNWIND_DIR=""
+CONFIG_LIBNUMA=y
+# CONFIG_BIONIC is not set
+CONFIG_PERF_REGS=y
+
+#
+# Build
+#
+# CONFIG_DEBUG is not set
+# CONFIG_DEBUG_PARSER is not set
+CONFIG_BACKTRACE=y
diff --git a/tools/perf/tests/generate_configs.py b/tools/perf/tests/generate_configs.py
new file mode 100644
index 0000000..e055a7f
--- /dev/null
+++ b/tools/perf/tests/generate_configs.py
@@ -0,0 +1,43 @@
+import os
+import sys
+import itertools
+import kconfiglib
+
+# Let's set some environment variables to define the target
+# architecture; we choose x86 because, so far, nearly all features are
+# available on x86.
+os.environ['ARCH'] = 'x86'
+os.environ['IS_64_BIT'] = '1'
+os.environ['CROSS_COMPILE'] = ''
+
+# Load Kconfig pattern
+ref_config = kconfiglib.Config(sys.argv[1])
+
+# Generate defconfig (by default, all options are set to y)
+ref_config.write_config('REF_config')
+
+# Get all the symbols
+symbols = dict([(s.get_name(), s) for s in ref_config.get_symbols()])
+
+# Remove odd symbols
+symbols.pop('y', None)
+symbols.pop('m', None)
+symbols.pop('n', None)
+
+# Remove choice-related symbols
+choices = ref_config.get_choices()
+items = [c.get_items() for c in choices]
+names = [i.get_name() for i in itertools.chain.from_iterable(items)]
+for name in names:
+ symbols.pop(name, None)
+
+for name in symbols:
+ symbol = symbols[name]
+ if not symbol.is_modifiable():
+ continue
+ if symbol.get_value() != 'y':
+ continue
+ symbol.set_user_value('n')
+ filename = 'NO_' + name + '_config'
+ ref_config.write_config(filename)
+ symbol.set_user_value('y')
diff --git a/tools/perf/tests/make b/tools/perf/tests/make
index 69a71ff..90970fd 100644
--- a/tools/perf/tests/make
+++ b/tools/perf/tests/make
@@ -11,34 +11,17 @@ else
lib = lib
endif

+list = $(shell ls $1 2>/dev/null)
has = $(shell which $1 2>/dev/null)

# standard single make variable specified
+make_pure :=
make_clean_all := clean all
make_python_perf_so := python/perf.so
-make_debug := DEBUG=1
-make_no_libperl := NO_LIBPERL=1
-make_no_libpython := NO_LIBPYTHON=1
-make_no_scripts := NO_LIBPYTHON=1 NO_LIBPERL=1
-make_no_newt := NO_NEWT=1
-make_no_slang := NO_SLANG=1
-make_no_gtk2 := NO_GTK2=1
-make_no_ui := NO_NEWT=1 NO_SLANG=1 NO_GTK2=1
-make_no_demangle := NO_DEMANGLE=1
-make_no_libelf := NO_LIBELF=1
-make_no_libunwind := NO_LIBUNWIND=1
-make_no_libdw_dwarf_unwind := NO_LIBDW_DWARF_UNWIND=1
-make_no_backtrace := NO_BACKTRACE=1
-make_no_libnuma := NO_LIBNUMA=1
-make_no_libaudit := NO_LIBAUDIT=1
-make_no_libbionic := NO_LIBBIONIC=1
make_tags := tags
make_cscope := cscope
make_help := help
make_doc := doc
-make_perf_o := perf.o
-make_util_map_o := util/map.o
-make_util_pmu_bison_o := util/pmu-bison.o
make_install := install
make_install_bin := install-bin
make_install_doc := install-doc
@@ -48,37 +31,11 @@ make_install_info := install-info
make_install_pdf := install-pdf
make_static := LDFLAGS=-static

-# all the NO_* variable combined
-make_minimal := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1
-make_minimal += NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1
-make_minimal += NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1
-make_minimal += NO_LIBDW_DWARF_UNWIND=1
-
# $(run) contains all available tests
run := make_pure
run += make_clean_all
-run += make_python_perf_so
-run += make_debug
-run += make_no_libperl
-run += make_no_libpython
-run += make_no_scripts
-run += make_no_newt
-run += make_no_slang
-run += make_no_gtk2
-run += make_no_ui
-run += make_no_demangle
-run += make_no_libelf
-run += make_no_libunwind
-run += make_no_libdw_dwarf_unwind
-run += make_no_backtrace
-run += make_no_libnuma
-run += make_no_libaudit
-run += make_no_libbionic
run += make_help
run += make_doc
-run += make_perf_o
-run += make_util_map_o
-run += make_util_pmu_bison_o
run += make_install
run += make_install_bin
# FIXME 'install-*' commented out till they're fixed
@@ -87,8 +44,7 @@ run += make_install_bin
# run += make_install_html
# run += make_install_info
# run += make_install_pdf
-run += make_minimal
-run += make_static
+# run += make_static

ifneq ($(call has,ctags),)
run += make_tags
@@ -104,6 +60,10 @@ run_O := $(addsuffix _O,$(run))
# disable some tests for O=...
run_O := $(filter-out make_python_perf_so_O,$(run_O))

+# $(run_CONFIGS) is a set of automatically-generated Kconfig
+# configurations
+run_CONFIGS := $(call list,$(PERF)/tests/configs/)
+
# define test for each compile as 'test_NAME' variable
# with the test itself as a value
test_make_tags = test -f tags
@@ -183,7 +143,7 @@ test_make_util_pmu_bison_o_O := test -f $$TMP_O/util/pmu-bison.o
test_default = test -x $(PERF)/perf
test = $(if $(test_$1),$(test_$1),$(test_default))

-test_default_O = test -x $$TMP_O/perf
+test_default_O = test -x $$TMP_O/tools/perf/perf
test_O = $(if $(test_$1),$(test_$1),$(test_default_O))

all:
@@ -218,13 +178,23 @@ $(run_O):
$(call test_O,$@) && \
rm -rf $@ $$TMP_O $$TMP_DEST || (cat $@ ; false)

+$(run_CONFIGS):
+ $(call clean)
+ @TMP_DEST=$$(mktemp -d); \
+ cmd="cd $(PERF) && cp tests/configs/$@ .config && make -f $(MK) DESTDIR=$$TMP_DEST olddefconfig && make -f $(MK) JOBS=4 DESTDIR=$$TMP_DEST"; \
+ echo "- $@: $$cmd" && echo $$cmd > $@ && \
+ ( eval $$cmd ) >> $@ 2>&1; \
+ echo " test: $(call test,$@)" >> $@ 2>&1; \
+ $(call test,$@) && \
+ rm -f $@ \
+ rm -rf $$TMP_DEST
+
tarpkg:
@cmd="$(PERF)/tests/perf-targz-src-pkg $(PERF)"; \
echo "- $@: $$cmd" && echo $$cmd > $@ && \
( eval $$cmd ) >> $@ 2>&1
-

-all: $(run) $(run_O) tarpkg
+all: $(run) $(run_O) $(run_CONFIGS) tarpkg
@echo OK

out: $(run_O)
--
2.1.1

2014-10-25 22:23:52

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 11/14] perf kbuild: remove legacy libdwarf-related build variables

* Remove NO_DWARF (replaced by CONFIG_LIBDWARF)
* Remove HAVE_DWARF_SUPPORT (replaced by CONFIG_LIBDWARF)
* Remove the useless variable PERF_HAVE_DWARF_REGS
* fix compilation issues if PERF_REGS is disabled

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 59 +++++++++-
tools/perf/arch/arm/tests/Kbuild | 2 +-
tools/perf/arch/arm/util/Kbuild | 4 +-
tools/perf/arch/arm64/util/Kbuild | 2 +-
tools/perf/arch/powerpc/util/Kbuild | 4 +-
tools/perf/arch/s390/util/Kbuild | 2 +-
tools/perf/arch/sh/util/Kbuild | 2 +-
tools/perf/arch/sparc/util/Kbuild | 2 +-
tools/perf/arch/x86/Kbuild | 1 +
tools/perf/arch/x86/Makefile | 8 +-
tools/perf/arch/x86/tests/Kbuild | 2 +-
tools/perf/arch/x86/tests/perf-time-to-tsc.c | 2 +-
tools/perf/arch/x86/util/Kbuild | 3 +-
tools/perf/builtin-probe.c | 15 +--
tools/perf/builtin-record.c | 2 +-
tools/perf/config/Makefile | 170 +++++++++++++--------------
tools/perf/config/Makefile.fix-config | 8 --
tools/perf/config/Makefile.fix-legacy | 4 -
tools/perf/tests/Kbuild | 2 +
tools/perf/tests/builtin-test.c | 3 +-
tools/perf/tests/tests.h | 6 +-
tools/perf/util/Kbuild | 11 +-
tools/perf/util/callchain.c | 11 +-
tools/perf/util/callchain.h | 3 +-
tools/perf/util/include/dwarf-regs.h | 4 +-
tools/perf/util/machine.c | 3 +-
tools/perf/util/perf_regs.c | 2 -
tools/perf/util/probe-event.c | 6 +-
tools/perf/util/probe-finder.h | 5 +-
tools/perf/util/unwind-libunwind.c | 5 +-
tools/perf/util/unwind.h | 7 +-
31 files changed, 203 insertions(+), 157 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 2eaf3ca..54a194d 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -287,7 +287,6 @@ choice
these tasks, perf can rely on either the libelf library or a
minimal builtin support.

-
config LIBELF
bool "elf"
---help---
@@ -318,15 +317,51 @@ config LIBDWARF
bool "Dwarf (libdwarf)"
default y
---help---
- libdwarf
+ A library for parsing DWARF debug information.
+
+config LIBDWARF_DIR
+ string "libdwarf directory"
+ depends on LIBDWARF
+ ---help---
+ Directory holding the libdwarf dependency (headers +
+ libraries)
+
+config UNWIND
+ depends on (LIBELF && PERF_REGS)
+ bool "User space unwind callchains"
+ default y
+ ---help---
+ Enable call-chain unwinding of user-space application.
+
+choice UNWIND_DEPS
+ prompt "Unwind dependency"
+ depends on UNWIND
+ default LIBUNWIND

config LIBUNWIND
- depends on LIBELF
- bool "User space libunwind callchains"
+ depends on (LIBELF && PERF_REGS)
+ bool "Libunwind"
+ ---help---
+ Rely on libunwind post unwind support to determine the
+ call-chain of a user-space program. The library libunwind
+ supports all the architectures.
+
+config LIBDWARF_UNWIND
+ depends on (LIBDWARF && PERF_REGS && (ARCH = "x86" || ARCH = "arm"))
+ bool "Libdwarf unwind"
+ ---help---
+ Rely on lidw DWARF post unwind support to determine the
+ call-chain of a user-space program. So far there's only x86
+ and arm libdw unwind support merged in perf.
+
+endchoice
+
+config LIBUNWIND_DEBUG_FRAME
+ depends on LIBUNWIND
+ bool "libunwind debug frame"
default y
---help---
- The library libunwind provides a portable C API to determine
- the call-chain of a program.
+ libunwind debug frame

config LIBUNWIND_DIR
string "libunwind directory"
@@ -335,6 +370,18 @@ config LIBUNWIND_DIR
Directory holding the libuwind dependency (headers +
libraries).

+config SKIP_CALLCHAIN_IDX
+ depends on (LIBDWARF && ARCH = "powerpc")
+ bool "Skip unnecessary callchain entries thanks to Dwarf"
+ default y
+ ---help---
+ When saving the callchain on Power, the kernel
+ conservatively saves excess entries in the callchain. A few
+ of these entries are needed in some cases but not others. If
+ the unnecessary entries are not ignored, we end up with
+ duplicate arcs in the call-graphs. Use DWARF debug
+ information to skip over any unnecessary callchain entries.
+
config LIBNUMA
bool "Libnuma support"
default y
diff --git a/tools/perf/arch/arm/tests/Kbuild b/tools/perf/arch/arm/tests/Kbuild
index 1318ed0..f1d8426 100644
--- a/tools/perf/arch/arm/tests/Kbuild
+++ b/tools/perf/arch/arm/tests/Kbuild
@@ -1,2 +1,2 @@
obj-$(CONFIG_PERF_REGS) += regs_load.o
-obj-y += dwarf-unwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += dwarf-unwind.o
diff --git a/tools/perf/arch/arm/util/Kbuild b/tools/perf/arch/arm/util/Kbuild
index c96666a..df195c0 100644
--- a/tools/perf/arch/arm/util/Kbuild
+++ b/tools/perf/arch/arm/util/Kbuild
@@ -1,3 +1,3 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
-obj-y += unwind-libdw.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/arch/arm64/util/Kbuild b/tools/perf/arch/arm64/util/Kbuild
index 136bc86..bd35d10 100644
--- a/tools/perf/arch/arm64/util/Kbuild
+++ b/tools/perf/arch/arm64/util/Kbuild
@@ -1,2 +1,2 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
diff --git a/tools/perf/arch/powerpc/util/Kbuild b/tools/perf/arch/powerpc/util/Kbuild
index 244ff2c..f33f79d 100644
--- a/tools/perf/arch/powerpc/util/Kbuild
+++ b/tools/perf/arch/powerpc/util/Kbuild
@@ -1,3 +1,3 @@
obj-y += header.o
-obj-y += skip-callchain-idx.o
-obj-y += dwarf-regs.o
+obj-$(CONFIG_SKIP_CALLCHAIN_IDX) += skip-callchain-idx.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
index 24e8ee7..73df1ff 100644
--- a/tools/perf/arch/s390/util/Kbuild
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -1,2 +1,2 @@
obj-y += kvm-stat.o
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/sh/util/Kbuild b/tools/perf/arch/sh/util/Kbuild
index 8e698ae..930ba99 100644
--- a/tools/perf/arch/sh/util/Kbuild
+++ b/tools/perf/arch/sh/util/Kbuild
@@ -1 +1 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/sparc/util/Kbuild b/tools/perf/arch/sparc/util/Kbuild
index 8e698ae..930ba99 100644
--- a/tools/perf/arch/sparc/util/Kbuild
+++ b/tools/perf/arch/sparc/util/Kbuild
@@ -1 +1 @@
-obj-y += dwarf-regs.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Kbuild b/tools/perf/arch/x86/Kbuild
index 52fd6fa..f5581bee 100644
--- a/tools/perf/arch/x86/Kbuild
+++ b/tools/perf/arch/x86/Kbuild
@@ -1 +1,2 @@
obj-y += util/
+obj-y += tests/
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
index 9b21881..af36aad 100644
--- a/tools/perf/arch/x86/Makefile
+++ b/tools/perf/arch/x86/Makefile
@@ -1,14 +1,12 @@
-ifndef NO_DWARF
+ifeq ($(LIBDWARF), 1)
PERF_HAVE_DWARF_REGS := 1
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
endif
-ifndef NO_LIBUNWIND
+ifeq ($(LIBUNWIND), 1)
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
endif
-ifndef NO_LIBDW_DWARF_UNWIND
+ifeq ($(LIBDWARF_UNWIND), 1)
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-endif
-ifndef NO_DWARF_UNWIND
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
endif
diff --git a/tools/perf/arch/x86/tests/Kbuild b/tools/perf/arch/x86/tests/Kbuild
index 8287dae..6d06051 100644
--- a/tools/perf/arch/x86/tests/Kbuild
+++ b/tools/perf/arch/x86/tests/Kbuild
@@ -1,3 +1,3 @@
obj-y += perf-time-to-tsc.o
obj-$(CONFIG_PERF_REGS) += regs_load.o
-obj-y += dwarf-unwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += dwarf-unwind.o
diff --git a/tools/perf/arch/x86/tests/perf-time-to-tsc.c b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
index f238442..4fff792 100644
--- a/tools/perf/arch/x86/tests/perf-time-to-tsc.c
+++ b/tools/perf/arch/x86/tests/perf-time-to-tsc.c
@@ -9,7 +9,7 @@
#include "thread_map.h"
#include "cpumap.h"
#include "tsc.h"
-#include "tests.h"
+#include "tests/tests.h"

#define CHECK__(x) { \
while ((x) < 0) { \
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
index c7b86c0..adca885 100644
--- a/tools/perf/arch/x86/util/Kbuild
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -1,5 +1,6 @@
-obj-y += dwarf-regs.o
obj-y += header.o
obj-y += tsc.o
obj-y += kvm-stat.o
+obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index 23d6e7f..c2a6d86 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -30,6 +30,7 @@
#include <stdlib.h>
#include <string.h>

+#include "generated/autoconf.h"
#include "perf.h"
#include "builtin.h"
#include "util/util.h"
@@ -180,7 +181,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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
else if (!strcmp(opt->long_name, "module"))
params.uprobes = false;
#endif
@@ -206,7 +207,7 @@ static int opt_set_target(const struct option *opt, const char *str,
return ret;
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
static int opt_show_lines(const struct option *opt __maybe_unused,
const char *str, int unset __maybe_unused)
{
@@ -306,7 +307,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"perf probe [<options>] --line 'LINEDESC'",
"perf probe [<options>] --vars 'PROBEPOINT'",
#endif
@@ -320,7 +321,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"[EVENT=]FUNC[@SRC][+OFF|%return|:RL|;PT]|SRC:AL|SRC;PT"
" [[NAME=]ARG ...]",
#else
@@ -332,7 +333,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
"\t\tSRC:\tSource code path\n"
"\t\tRL:\tRelative line number from function entry.\n"
"\t\tAL:\tAbsolute line number in file.\n"
@@ -345,7 +346,7 @@ __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 HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
OPT_CALLBACK('L', "line", NULL,
"FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]",
"Show source code lines.", opt_show_lines),
@@ -439,7 +440,7 @@ __cmd_probe(int argc, const char **argv, const char *prefix __maybe_unused)
return ret;
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF
if (params.show_lines) {
ret = show_line_range(&params.line_range, params.target,
params.uprobes);
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 2b531ad..ce777868 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -715,7 +715,7 @@ static struct record record = {

#define CALLCHAIN_HELP "setup and enables call-graph (stack chain/backtrace) recording: "

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
const char record_callchain_help[] = CALLCHAIN_HELP "fp dwarf";
#else
const char record_callchain_help[] = CALLCHAIN_HELP "fp";
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 19dab72..fe375da 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,23 +34,16 @@ ifeq ($(ARCH),arm64)
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

-# So far there's only x86 and arm libdw unwind support merged in perf.
-# Disable it on all other architectures in case libdw unwind
-# support is detected in system. Add supported architectures
-# to the check.
-ifneq ($(ARCH),$(filter $(ARCH),x86 arm))
- NO_LIBDW_DWARF_UNWIND := 1
-endif
-
ifeq ($(LIBUNWIND_LIBS),)
- NO_LIBUNWIND := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
else
+ LIBUNWIND = 1
#
# For linking with debug library, run like:
#
# make DEBUG=1 LIBUNWIND_DIR=/opt/libunwind/
#
- ifdef LIBUNWIND_DIR
+ ifdef CONFIG_LIBUNWIND_DIR
LIBUNWIND_CFLAGS = -I$(LIBUNWIND_DIR)/include
LIBUNWIND_LDFLAGS = -L$(LIBUNWIND_DIR)/lib
endif
@@ -63,12 +56,10 @@ else
FEATURE_CHECK_LDFLAGS-libunwind-debug-frame = $(LIBUNWIND_LDFLAGS)
endif

-ifndef NO_LIBELF
- # for linking with debug library, run like:
- # make DEBUG=1 LIBDW_DIR=/opt/libdw/
- ifdef LIBDW_DIR
- LIBDW_CFLAGS := -I$(LIBDW_DIR)/include
- LIBDW_LDFLAGS := -L$(LIBDW_DIR)/lib
+ifdef CONFIG_LIBELF
+ ifdef CONFIG_LIBDWARF_DIR
+ LIBDW_CFLAGS := -I$(CONFIG_LIBDWARF_DIR)/include
+ LIBDW_LDFLAGS := -L$(CONFIG_LIBDWARF_DIR)/lib
endif
FEATURE_CHECK_CFLAGS-libdw-dwarf-unwind := $(LIBDW_CFLAGS)
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
@@ -327,16 +318,22 @@ ifdef CONFIG_LIBELF
endif
else
LIBELF = 1
- ifndef NO_LIBDW_DWARF_UNWIND
- ifneq ($(feature-libdw-dwarf-unwind),1)
- NO_LIBDW_DWARF_UNWIND := 1
- msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set LIBDW_DIR);
- endif
- endif
- ifneq ($(feature-dwarf), 1)
- msg := $(warning 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);
- NO_DWARF := 1
- endif # Dwarf support
+ ifdef CONFIG_LIBDWARF
+ ifneq ($(feature-dwarf), 1)
+ msg := $(warning 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);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF)
+ else
+ LIBDWARF = 1
+ endif # Dwarf support
+ ifdef CONFIG_LIBDWARF_UNWIND
+ ifneq ($(feature-libdw-dwarf-unwind),1)
+ msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set CONFIG_LIBDWARF_DIR);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF_UNWIND)
+ else
+ LIBDWARF_UNWIND = 1
+ endif # Dwarf unwind support detected
+ endif # CONFIG_LIBDWARF_UNWIND
+ endif # CONFIG_LIBDWARF
endif # libelf support
endif # CONFIG_LIBELF

@@ -357,72 +354,75 @@ ifeq ($(LIBELF), 1)
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

- ifndef NO_DWARF
- ifeq ($(origin PERF_HAVE_DWARF_REGS), undefined)
- msg := $(warning DWARF register mappings have not been defined for architecture $(ARCH), DWARF support disabled);
- NO_DWARF := 1
- else
- CFLAGS += -DHAVE_DWARF_SUPPORT $(LIBDW_CFLAGS)
- LDFLAGS += $(LIBDW_LDFLAGS)
- EXTLIBS += -lelf -ldw
- endif # PERF_HAVE_DWARF_REGS
- endif # NO_DWARF
+ ifeq ($(LIBDWARF), 1)
+ CFLAGS += $(LIBDW_CFLAGS)
+ LDFLAGS += $(LIBDW_LDFLAGS)
+ EXTLIBS += -lelf -ldw
+ endif # LIBDWARF
endif # LIBELF

-ifeq ($(ARCH),powerpc)
- ifndef NO_DWARF
- CFLAGS += -DHAVE_SKIP_CALLCHAIN_IDX
- endif
-endif
-
-ifndef NO_LIBUNWIND
- ifneq ($(feature-libunwind), 1)
- msg := $(warning No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR);
- NO_LIBUNWIND := 1
+ifdef CONFIG_UNWIND
+ # CONFIG_LIBUNWIND is the default choice; so, if it is not
+ # available, let's try another one
+ ifdef CONFIG_LIBUNWIND
+ ifeq ($(LIBUNWIND), 1)
+ ifneq ($(feature-libunwind), 1)
+ LIBUNWIND = 0
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
+ ifeq ($(LIBDWARF_UNWIND), 1)
+ msg := $(warning No libunwind found, post unwind will rely on libdwarf-unwind. Please install libunwind-dev[el] >= 1.1);
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBDWARF_UNWIND)
+ else
+ msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
+ endif # LIBDWARF_UNWIND
+ else # feature-libunwind OK
+ EXTLIBS += $(LIBUNWIND_LIBS)
+ CFLAGS += $(LIBUNWIND_CFLAGS)
+ LDFLAGS += $(LIBUNWIND_LDFLAGS)
+ endif # feature-libunwind
+ endif # LIBUNWIND
+ endif # CONFIG_LIBUNWIND
+
+ # CONFIG_LIBDWARF_UNWIND is not the default choice (so the user's
+ # choice); so, we disable CONFIG_UNWIND if it is not available
+ ifdef CONFIG_LIBDWARF_UNWIND
+ ifneq ($(LIBDWARF_UNWIND), 1)
+ msg := $(warning Disabling post unwing because (libdwarf-unwind is not available));
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
+ endif
+ endif # CONFIG_LIBDWARF_UNWIND
+
+ # if libunwind is OK, let's check the option DEBUG_FRAME
+ ifdef CONFIG_LIBUNWIND
+ ifeq ($(LIBUNWIND), 1)
+ ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
+ $(call feature_check,libunwind-debug-frame)
+ ifneq ($(feature-libunwind-debug-frame), 1)
+ msg := $(warning No debug_frame support found in libunwind);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND_DEBUG_FRAME)
+ endif
+ else
+ # non-ARM has no dwarf_find_debug_frame() function:
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND_DEBUG_FRAME)
+ endif
+ endif
endif
-endif

-dwarf-post-unwind := 1
-dwarf-post-unwind-text := BUG
+dwarf-post-unwind = 0
+dwarf-post-unwind-text = BUG

-# setup DWARF post unwinder
-ifdef NO_LIBUNWIND
- ifdef NO_LIBDW_DWARF_UNWIND
- msg := $(warning Disabling post unwind, no support found.);
- dwarf-post-unwind := 0
- else
- dwarf-post-unwind-text := libdw
- endif
-else
+ifeq ($(LIBUNWIND), 1)
+ dwarf-post-unwind := 1
dwarf-post-unwind-text := libunwind
- # Enable libunwind support by default.
- ifndef NO_LIBDW_DWARF_UNWIND
- NO_LIBDW_DWARF_UNWIND := 1
- endif
-endif
-
-ifeq ($(dwarf-post-unwind),1)
- CFLAGS += -DHAVE_DWARF_UNWIND_SUPPORT
else
- NO_DWARF_UNWIND := 1
-endif
-
-ifndef NO_LIBUNWIND
- ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
- $(call feature_check,libunwind-debug-frame)
- ifneq ($(feature-libunwind-debug-frame), 1)
- msg := $(warning No debug_frame support found in libunwind);
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
- endif
- else
- # non-ARM has no dwarf_find_debug_frame() function:
- CFLAGS += -DNO_LIBUNWIND_DEBUG_FRAME
+ ifeq ($(LIBDWARF_UNWIND), 1)
+ dwarf-post-unwind := 1
+ dwarf-post-unwind-text := libdw
endif
- CFLAGS += -DHAVE_LIBUNWIND_SUPPORT
- EXTLIBS += $(LIBUNWIND_LIBS)
- CFLAGS += $(LIBUNWIND_CFLAGS)
- LDFLAGS += $(LIBUNWIND_LDFLAGS)
-endif
+endif # LIBUNWIND
+
+endif # CONFIG_UNWIND

ifdef CONFIG_LIBAUDIT
ifneq ($(feature-libaudit), 1)
@@ -810,8 +810,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_LIBUNWIND)
- $(call store,NO_LIBBIONIC)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
$(call store,bindir_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 99948b7..e63539f 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,12 +19,4 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_LIBUNWIND
-ifdef CONFIG_LIBUNWIND
-ifdef NO_LIBUNWIND
-dummy := $(info Disabling CONFIG_LIBUNWIND)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBUNWIND)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 8568d37..20a4062 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -8,7 +8,3 @@ endif
ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif
-
-ifndef CONFIG_LIBUNWIND
-NO_LIBUNWIND := 1
-endif
diff --git a/tools/perf/tests/Kbuild b/tools/perf/tests/Kbuild
index 9f56ce8..f362620 100644
--- a/tools/perf/tests/Kbuild
+++ b/tools/perf/tests/Kbuild
@@ -31,6 +31,8 @@ obj-y += hists_cumulate.o
obj-y += hists_common.o
obj-y += hists_filter.o

+obj-$(LIBDWARF_UNWIND) += dwarf-unwind.o
+
CFLAGS_python-use.o += -D"PYTHON=KBUILD_STR($(PYTHON_WORD))"
CFLAGS_python-use.o += -D"PYTHONPATH=KBUILD_STR(python)"

diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 162c978..e3e21b1 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -5,6 +5,7 @@
*/
#include <unistd.h>
#include <string.h>
+#include "generated/autoconf.h"
#include "builtin.h"
#include "hist.h"
#include "intlist.h"
@@ -127,7 +128,7 @@ static struct test {
.func = test__parse_no_sample_id_all,
},
#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
{
.desc = "Test dwarf unwind",
.func = test__dwarf_unwind,
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index 00e776a..a14555d 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -1,6 +1,8 @@
#ifndef TESTS_H
#define TESTS_H

+#include "generated/autoconf.h"
+
#define TEST_ASSERT_VAL(text, cond) \
do { \
if (!(cond)) { \
@@ -52,12 +54,10 @@ int test__switch_tracking(void);
int test__fdarray__filter(void);
int test__fdarray__add(void);

-#if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
struct thread;
struct perf_sample;
int test__arch_unwind_sample(struct perf_sample *sample,
struct thread *thread);
#endif
-#endif
#endif /* TESTS_H */
diff --git a/tools/perf/util/Kbuild b/tools/perf/util/Kbuild
index 1095f1b..5bd8697 100644
--- a/tools/perf/util/Kbuild
+++ b/tools/perf/util/Kbuild
@@ -50,16 +50,19 @@ obj-y += string.o
obj-y += strlist.o
obj-y += svghelper.o
obj-y += symbol.o
-obj-y += perf_regs.o
obj-y += tsc.o
obj-y += cloexec.o

-obj-$(CONFIG_LIBUNWIND) += unwind.o
+obj-$(CONFIG_PERF_REGS) += perf_regs.o
+
+obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
+obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o

obj-$(CONFIG_LIBELF) += symbol-elf.o
-obj-$(CONFIG_LIBELF) += dwarf-aux.o
obj-$(CONFIG_LIBELF) += probe-event.o
-obj-$(CONFIG_LIBELF) += probe-finder.o
+
+obj-$(CONFIG_LIBDWARF) += dwarf-aux.o
+obj-$(CONFIG_LIBDWARF) += probe-finder.o

obj-$(CONFIG_LIBELF_MINIMAL) += symbol-minimal.o

diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 0022980..6186b25 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -17,6 +17,7 @@

#include "asm/bug.h"

+#include "generated/autoconf.h"
#include "hist.h"
#include "util.h"
#include "sort.h"
@@ -25,7 +26,7 @@

__thread struct callchain_cursor callchain_cursor;

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
static int get_stack_size(const char *str, unsigned long *_size)
{
char *endptr;
@@ -51,7 +52,7 @@ static int get_stack_size(const char *str, unsigned long *_size)
max_size, str);
return -1;
}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_LIBDWARF_UNWIND */

int parse_callchain_record_opt(const char *arg)
{
@@ -80,7 +81,7 @@ int parse_callchain_record_opt(const char *arg)
"needed for -g fp\n");
break;

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
/* Dwarf style */
} else if (!strncmp(name, "dwarf", sizeof("dwarf"))) {
const unsigned long default_stack_dump_size = 8192;
@@ -96,7 +97,7 @@ int parse_callchain_record_opt(const char *arg)
ret = get_stack_size(tok, &size);
callchain_param.dump_size = size;
}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_LIBDWARF_UNWIND */
} else {
pr_err("callchain: Unknown --call-graph option "
"value: %s\n", arg);
@@ -208,7 +209,7 @@ int perf_callchain_config(const char *var, const char *value)

if (!strcmp(var, "record-mode"))
return parse_callchain_record_opt(value);
-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_LIBDWARF_UNWIND
if (!strcmp(var, "dump-size")) {
unsigned long size = 0;
int ret;
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h
index 3caccc2..0691f1f 100644
--- a/tools/perf/util/callchain.h
+++ b/tools/perf/util/callchain.h
@@ -1,6 +1,7 @@
#ifndef __PERF_CALLCHAIN_H
#define __PERF_CALLCHAIN_H

+#include "generated/autoconf.h"
#include "../perf.h"
#include <linux/list.h>
#include <linux/rbtree.h>
@@ -183,7 +184,7 @@ static inline void callchain_cursor_snapshot(struct callchain_cursor *dest,
dest->nr -= src->pos;
}

-#ifdef HAVE_SKIP_CALLCHAIN_IDX
+#ifdef CONFIG_SKIP_CALLCHAIN_IDX
extern int arch_skip_callchain_idx(struct thread *thread, struct ip_callchain *chain);
#else
static inline int arch_skip_callchain_idx(struct thread *thread __maybe_unused,
diff --git a/tools/perf/util/include/dwarf-regs.h b/tools/perf/util/include/dwarf-regs.h
index 8f14965..93cd69c 100644
--- a/tools/perf/util/include/dwarf-regs.h
+++ b/tools/perf/util/include/dwarf-regs.h
@@ -1,7 +1,9 @@
#ifndef _PERF_DWARF_REGS_H_
#define _PERF_DWARF_REGS_H_

-#ifdef HAVE_DWARF_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_LIBDWARF
const char *get_arch_regstr(unsigned int n);
#endif

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 51a6303..77679b2 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -1,3 +1,4 @@
+#include "generated/autoconf.h"
#include "callchain.h"
#include "debug.h"
#include "event.h"
@@ -1402,7 +1403,7 @@ static int thread__resolve_callchain_sample(struct thread *thread,
else
j = chain->nr - i - 1;

-#ifdef HAVE_SKIP_CALLCHAIN_IDX
+#ifdef CONFIG_SKIP_CALLCHAIN_IDX
if (j == skip_idx)
continue;
#endif
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 01720b5..434f85b 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -3,7 +3,6 @@
#include "perf_regs.h"
#include "event.h"

-#ifdef CONFIG_PERF_REGS
int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
{
int i, idx = 0;
@@ -27,4 +26,3 @@ out:
*valp = regs->cache_regs[id];
return 0;
}
-#endif /* CONFIG_PERF_REGS */
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c
index c150ca4..d31d5d0 100644
--- a/tools/perf/util/probe-event.c
+++ b/tools/perf/util/probe-event.c
@@ -32,6 +32,7 @@
#include <limits.h>
#include <elf.h>

+#include "generated/autoconf.h"
#include "util.h"
#include "event.h"
#include "strlist.h"
@@ -256,8 +257,7 @@ static void clear_probe_trace_events(struct probe_trace_event *tevs, int ntevs)
clear_probe_trace_event(tevs + i);
}

-#ifdef HAVE_DWARF_SUPPORT
-
+#ifdef CONFIG_LIBDWARF
/* Open new debuginfo of given module */
static struct debuginfo *open_debuginfo(const char *module, bool silent)
{
@@ -799,7 +799,7 @@ out:
return ret;
}

-#else /* !HAVE_DWARF_SUPPORT */
+#else /* !CONFIG_LIBDWARF */

static int
find_perf_probe_point_from_dwarf(struct probe_trace_point *tp __maybe_unused,
diff --git a/tools/perf/util/probe-finder.h b/tools/perf/util/probe-finder.h
index 92590b2..13cb054 100644
--- a/tools/perf/util/probe-finder.h
+++ b/tools/perf/util/probe-finder.h
@@ -2,6 +2,7 @@
#define _PROBE_FINDER_H

#include <stdbool.h>
+#include "generated/autoconf.h"
#include "util.h"
#include "intlist.h"
#include "probe-event.h"
@@ -16,7 +17,7 @@ static inline int is_c_varname(const char *name)
return isalpha(name[0]) || name[0] == '_';
}

-#ifdef HAVE_DWARF_SUPPORT
+#ifdef CONFIG_LIBDWARF

#include "dwarf-aux.h"

@@ -107,6 +108,6 @@ struct line_finder {
int found;
};

-#endif /* HAVE_DWARF_SUPPORT */
+#endif /* CONFIG_LIBDWARF */

#endif /*_PROBE_FINDER_H */
diff --git a/tools/perf/util/unwind-libunwind.c b/tools/perf/util/unwind-libunwind.c
index 371219a..6ed9b7d 100644
--- a/tools/perf/util/unwind-libunwind.c
+++ b/tools/perf/util/unwind-libunwind.c
@@ -24,6 +24,7 @@
#include <linux/list.h>
#include <libunwind.h>
#include <libunwind-ptrace.h>
+#include "generated/autoconf.h"
#include "callchain.h"
#include "thread.h"
#include "session.h"
@@ -261,7 +262,7 @@ static int read_unwind_spec_eh_frame(struct dso *dso, struct machine *machine,
return ret;
}

-#ifndef NO_LIBUNWIND_DEBUG_FRAME
+#ifdef CONFIG_LIBUNWIND_DEBUG_FRAME
static int read_unwind_spec_debug_frame(struct dso *dso,
struct machine *machine, u64 *offset)
{
@@ -319,7 +320,7 @@ find_proc_info(unw_addr_space_t as, unw_word_t ip, unw_proc_info_t *pi,
need_unwind_info, arg);
}

-#ifndef NO_LIBUNWIND_DEBUG_FRAME
+#ifdef CONFIG_LIBUNWIND_DEBUG_FRAME
/* Check the .debug_frame section for unwinding info */
if (!read_unwind_spec_debug_frame(map->dso, ui->machine, &segbase)) {
memset(&di, 0, sizeof(di));
diff --git a/tools/perf/util/unwind.h b/tools/perf/util/unwind.h
index 12790cf..936e224 100644
--- a/tools/perf/util/unwind.h
+++ b/tools/perf/util/unwind.h
@@ -2,6 +2,7 @@
#define __UNWIND_H

#include <linux/types.h>
+#include "generated/autoconf.h"
#include "event.h"
#include "symbol.h"
#include "thread.h"
@@ -14,12 +15,12 @@ struct unwind_entry {

typedef int (*unwind_entry_cb_t)(struct unwind_entry *entry, void *arg);

-#ifdef HAVE_DWARF_UNWIND_SUPPORT
+#ifdef CONFIG_UNWIND
int unwind__get_entries(unwind_entry_cb_t cb, void *arg,
struct thread *thread,
struct perf_sample *data, int max_stack);
/* libunwind specific */
-#ifdef HAVE_LIBUNWIND_SUPPORT
+#ifdef CONFIG_LIBUNWIND
int libunwind__arch_reg_id(int regnum);
int unwind__prepare_access(struct thread *thread);
void unwind__flush_access(struct thread *thread);
@@ -51,5 +52,5 @@ static inline int unwind__prepare_access(struct thread *thread __maybe_unused)

static inline void unwind__flush_access(struct thread *thread __maybe_unused) {}
static inline void unwind__finish_access(struct thread *thread __maybe_unused) {}
-#endif /* HAVE_DWARF_UNWIND_SUPPORT */
+#endif /* CONFIG_UNWIND */
#endif /* __UNWIND_H */
--
2.1.1

2014-10-25 22:23:50

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 12/14] perf kbuild: remove legacy script-related build variables

Remove NO_LIBPERL (replaced by CONFIG_LIBPERL)
Remove NO_LIBPYTHON (replaced by CONFIG_LIBPYTHON)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-script.c | 6 +++--
tools/perf/config/Makefile | 41 +++++++++------------------------
tools/perf/config/Makefile.fix-config | 16 -------------
tools/perf/config/Makefile.fix-legacy | 8 -------
tools/perf/util/trace-event-scripting.c | 13 ++++++-----
5 files changed, 22 insertions(+), 62 deletions(-)

diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index ce304df..2d077c1 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "builtin.h"

#include "perf.h"
@@ -1370,11 +1372,11 @@ int find_scripts(char **scripts_array, char **scripts_path_array)
for_each_lang(scripts_path, scripts_dir, lang_dirent, lang_next) {
snprintf(lang_path, MAXPATHLEN, "%s/%s", scripts_path,
lang_dirent.d_name);
-#ifdef NO_LIBPERL
+#ifndef CONFIG_LIBPERL
if (strstr(lang_path, "perl"))
continue;
#endif
-#ifdef NO_LIBPYTHON
+#ifndef CONFIG_LIBPYTHON
if (strstr(lang_path, "python"))
continue;
#endif
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index fe375da..b628fa9 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -101,7 +101,7 @@ ifdef PARSER_DEBUG
CFLAGS += -DPARSER_DEBUG
endif

-ifndef NO_LIBPYTHON
+ifdef CONFIG_LIBPYTHON
# Try different combinations to accommodate systems that only have
# python[2][-config] in weird combinations but always preferring
# python2 and python2-config as per pep-0394. If we catch a
@@ -462,9 +462,7 @@ endif
grep-libs = $(filter -l%,$(1))
strip-libs = $(filter-out -l%,$(1))

-ifdef NO_LIBPERL
- CFLAGS += -DNO_LIBPERL
-else
+ifdef CONFIG_LIBPERL
PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
@@ -472,9 +470,8 @@ else
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)

ifneq ($(feature-libperl), 1)
- CFLAGS += -DNO_LIBPERL
- NO_LIBPERL := 1
msg := $(warning Missing perl devel files. Disabling perl scripting support, consider installing perl-ExtUtils-Embed);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBPERL)
else
LDFLAGS += $(PERL_EMBED_LDFLAGS)
EXTLIBS += $(PERL_EMBED_LIBADD)
@@ -488,17 +485,14 @@ ifdef CONFIG_TIMERFD
endif
endif

-disable-python = $(eval $(disable-python_code))
-define disable-python_code
- CFLAGS += -DNO_LIBPYTHON
- $(if $(1),$(warning No $(1) was found))
- $(warning Python support will not be built)
- NO_LIBPYTHON := 1
-endef
+ifdef CONFIG_LIBPYTHON

-ifdef NO_LIBPYTHON
- $(call disable-python)
-else
+ disable-python = $(eval $(disable-python_code))
+ define disable-python_code
+ $(if $(1),$(warning No $(1) was found))
+ $(warning Python support will not be built)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBPYTHON)
+ endef

ifndef PYTHON
$(call disable-python,python interpreter)
@@ -522,18 +516,7 @@ else
else

ifneq ($(feature-libpython-version), 1)
- $(warning Python 3 is not yet supported; please set)
- $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
- $(warning If you also have Python 2 installed, then)
- $(warning try something like:)
- $(warning $(and ,))
- $(warning $(and ,) make PYTHON=python2)
- $(warning $(and ,))
- $(warning Otherwise, disable Python support entirely:)
- $(warning $(and ,))
- $(warning $(and ,) make NO_LIBPYTHON=1)
- $(warning $(and ,))
- $(error $(and ,))
+ $(call disable-python,python2 interpreter)
else
LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
EXTLIBS += $(PYTHON_EMBED_LIBADD)
@@ -808,8 +791,6 @@ all:
$(call store,PYTHON_EMBED_CCOPTS)
$(call store,PERL_EMBED_CCOPTS)
$(call store,NO_LIBUNWIND)
- $(call store,NO_LIBPERL)
- $(call store,NO_LIBPYTHON)
$(call store,ETC_PERFCONFIG_SQ)
$(call store,DESTDIR_SQ)
$(call store,bindir_SQ)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index e63539f..3f0e33e 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -3,20 +3,4 @@ include $(KCONFIG_CONFIG)

CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)

-# NO_LIBPERL
-ifdef CONFIG_LIBPERL
-ifdef NO_LIBPERL
-dummy := $(info Disabling CONFIG_LIBPERL)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBPERL)
-endif
-endif
-
-# NO_LIBPYTHON
-ifdef CONFIG_LIBPYTHON
-ifdef NO_LIBPYTHON
-dummy := $(info Disabling CONFIG_LIBPYTHON)
-dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
-endif
-endif
-
all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 20a4062..431c9bf 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -1,10 +1,2 @@

include $(KCONFIG_CONFIG)
-
-ifndef CONFIG_LIBPERL
-NO_LIBPERL := 1
-endif
-
-ifndef CONFIG_LIBPYTHON
-NO_LIBPYTHON := 1
-endif
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 5c9bdd1..a8319bb 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <errno.h>

+#include "generated/autoconf.h"
#include "../perf.h"
#include "util.h"
#include "trace-event.h"
@@ -99,7 +100,7 @@ static void register_python_scripting(struct scripting_ops *scripting_ops)
scripting_context = malloc(sizeof(struct scripting_context));
}

-#ifdef NO_LIBPYTHON
+#ifndef CONFIG_LIBPYTHON
void setup_python_scripting(void)
{
register_python_scripting(&python_scripting_unsupported_ops);
@@ -163,16 +164,16 @@ static void register_perl_scripting(struct scripting_ops *scripting_ops)
scripting_context = malloc(sizeof(struct scripting_context));
}

-#ifdef NO_LIBPERL
+#ifdef CONFIG_LIBPERL
+extern struct scripting_ops perl_scripting_ops;
+
void setup_perl_scripting(void)
{
- register_perl_scripting(&perl_scripting_unsupported_ops);
+ register_perl_scripting(&perl_scripting_ops);
}
#else
-extern struct scripting_ops perl_scripting_ops;
-
void setup_perl_scripting(void)
{
- register_perl_scripting(&perl_scripting_ops);
+ register_perl_scripting(&perl_scripting_unsupported_ops);
}
#endif
--
2.1.1

2014-10-25 22:24:30

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 13/14] perf kbuild: final cosmetic changes

* Correctly rename internal makefile variables
* Remove makefiles in tools/perf/config which became empty and useless
* Remove builtin-cmds.h
* Remove arch/x86/Makefile
* Improve outputs of clean and install targets
* Remove creation of PERF-FEATURES file which is redundant with the
.config file generated by Kconfig.
* replace HAVE_KVM_STAT_SUPPORT by a Kconfig option
* replace HAVE_SKIP_CALLCHAIN_IDX by a Kconfig option
* add Kconfig options for 32-bit compatibility VDSOs

Signed-off-by: Alexis Berlemont <[email protected]>
---

Changes since v3:
* Add Kconfig options for 32-bit compatibility VDSOs

tools/perf/Kconfig | 29 ++++++++-
tools/perf/Makefile.kbuild | 76 ++++++++++++++----------
tools/perf/arch/s390/util/Kbuild | 2 +-
tools/perf/arch/x86/Makefile | 17 ------
tools/perf/arch/x86/util/Kbuild | 2 +-
tools/perf/builtin-cmds.h | 6 --
tools/perf/builtin-help.c | 2 +-
tools/perf/builtin-kvm.c | 6 +-
tools/perf/builtin-lock.c | 2 +-
tools/perf/builtin-sched.c | 2 +-
tools/perf/config/Makefile | 108 +++++++++++-----------------------
tools/perf/config/Makefile.fix-config | 6 --
tools/perf/config/Makefile.fix-legacy | 2 -
tools/perf/perf.c | 2 +-
tools/perf/util/vdso.c | 5 +-
15 files changed, 115 insertions(+), 152 deletions(-)
delete mode 100644 tools/perf/arch/x86/Makefile
delete mode 100644 tools/perf/builtin-cmds.h
delete mode 100644 tools/perf/config/Makefile.fix-config
delete mode 100644 tools/perf/config/Makefile.fix-legacy

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 54a194d..83f3d6d 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -5,9 +5,9 @@ config TARGET_ARCH
string
option env="ARCH"

-config TARGET_IS_X86_64
+config TARGET_IS_64_BIT
string
- option env="IS_X86_64"
+ option env="IS_64_BIT"

config TARGET_CROSS_COMPILE
string
@@ -19,7 +19,7 @@ config ARCH

config X86_64
bool
- default y if TARGET_ARCH = "x86" && TARGET_IS_X86_64 = "1"
+ default y if TARGET_ARCH = "x86" && TARGET_IS_64_BIT = "1"

config CROSS_COMPILE
string
@@ -128,6 +128,13 @@ config BUILTIN_KVM
---help---
Tool to trace/measure kvm guest os

+config BUILTIN_KVM_STAT
+ bool "kvm-stat"
+ default y
+ depends on BUILTIN_KVM && (ARCH = "x86" || ARCH = "s390")
+ ---help---
+ Get performance counter statistics on a kvm guest os.
+
config BUILTIN_LIST
bool "list"
default y
@@ -405,6 +412,22 @@ config PERF_REGS
Cache register accesses for unwind processing to speed-up
performances.

+config READ_VDSO32
+ bool "Support 32-bit compatibility"
+ depends on TARGET_IS_64_BIT = "1"
+ default y
+ ---help---
+ On 64-bits architecture, support 32-bit compatibility VDSOs
+
+config READ_VDSOX32
+ bool "Support x32 compatibility"
+ depends on X86_64
+ default y
+ ---help---
+ On x86_64 architecture, support x32 compatibility VDSOs
+ (code for x86_64 architecture but "long" and pointer types
+ set to 32 bits)
+
endmenu

menu "Build"
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index b48fe7f..84b7c01 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -1,6 +1,5 @@
srctree := $(abspath $(if $(KBUILD_SRC),$(KBUILD_SRC),$(CURDIR)/../../))
objtree := $(abspath $(if $(KBUILD_SRC),$(CURDIR),$(CURDIR)/../..))
-
VPATH := $(srctree)

export srctree VPATH
@@ -36,7 +35,8 @@ export quiet Q KBUILD_VERBOSE
ifndef V
QUIET_LINK = @echo ' LD $@';
QUIET_GEN = @echo ' GEN $@';
-QUIET_CLEAN = @echo ' CLEAN tools/perf';
+QUIET_CLEAN = @printf ' CLEAN %s\n' $1;
+QUIET_INSTALL = @printf ' INSTALL %s\n' $1;
endif

export QUIET_BISON QUIET_FLEX
@@ -127,7 +127,7 @@ export CONFIG_DETECTED

# arch-related main variables
include $(src-perf)/config/Makefile.arch
-export ARCH IS_X86_64 CROSS_COMPILE
+export ARCH IS_X86_64 IS_64_BIT CROSS_COMPILE

# external .a libs
LIBTRACEEVENT := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
@@ -158,7 +158,6 @@ $(CONFIG_DETECTED): $(KCONFIG_CONFIG)
# no need to include auto.conf.cmd, because .config
# is the only dependency here
$(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
- $(Q)$(MAKE) -f $(src-perf)/config/Makefile.fix-config
$(Q)mkdir -p $(obj-perf)/include/config
$(Q)mkdir -p $(obj-perf)/include/generated
$(Q)$(MAKE) -s $(build)=scripts/kconfig silentoldconfig
@@ -167,22 +166,26 @@ $(KCONFIG_AUTOCONFIG): $(KCONFIG_CONFIG) $(CONFIG_DETECTED)
clean-dirs := $(addprefix _clean_, tools/perf/)

$(clean-dirs):
+ $(call QUIET_CLEAN, core-objs)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.clean obj=$(patsubst _clean_%,%,$@)

-clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean
- $(Q)$(QUIET_CLEAN)
- $(Q)rm -f $(obj-perf)/perf
- $(Q)rm -f $(obj-perf)/common-cmds.h
- $(Q)rm -f $(obj-perf)/python/perf.so
+config-clean:
+ $(call QUIET_CLEAN, config)
+ @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
$(Q)rm -rf $(obj-perf)/include/generated $(obj-perf)/include/config
+ $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
+ $(Q)rm -f $(obj-perf)/common-cmds.h
+
+clean: $(clean-dirs) $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
+ $(call QUIET_CLEAN, core-progs)
+ $(Q)rm -f $(obj-perf)/perf
+ $(call QUIET_CLEAN, misc)
$(Q)find $(obj-perf) \
\( -name '*.[oas]' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' \
-o -name '*-flex.[ch]' -o -name '*-bison.[ch]' \
\) -type f -print | xargs rm -f
- $(Q)$(python-clean)
- $(Q)rm -f $(CONFIG_DETECTED) $(KCONFIG_CONFIG)
- @$(MAKE) OUTPUT=$(obj-perf)/config/feature-checks/ -C $(src-perf)/config/feature-checks clean >/dev/null
+ $(python-clean)

TAGS tags:
$(Q)rm -f $(src-perf)/tags
@@ -257,7 +260,7 @@ PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/

export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP

-python-clean := rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so
+python-clean := $(call QUIET_CLEAN, python) rm -rf $(PYTHON_EXTBUILD) $(obj-perf)/python/perf.so

PYTHON_EXT_SRCS := $(addprefix $(src-perf)/,$(shell grep -v ^\# $(src-perf)/util/python-ext-sources))
PYTHON_EXT_DEPS := $(src-perf)/util/python-ext-sources $(src-perf)/util/setup.py
@@ -343,25 +346,34 @@ $(SCRIPTS) : % : %.sh
all: $(SCRIPTS)

install-bin: all
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'
- $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
- $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'
- $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
- $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'
- $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
- $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'
- $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
- $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
- $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
+ $(call QUIET_INSTALL, binaries) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)' ; \
+ $(INSTALL) $(obj-perf)/perf '$(DESTDIR_SQ)$(bindir_SQ)' ; \
+ ln '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
+ $(call QUIET_INSTALL, libexec) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(call QUIET_INSTALL, perf-archive) \
+ $(INSTALL) $(src-perf)/perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
+ $(call QUIET_INSTALL, perl-scripts) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl' ; \
+ $(INSTALL) $(src-perf)/scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
+ $(call QUIET_INSTALL, python-scripts) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' ; \
+ $(INSTALL) $(src-perf)/scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace' ; \
+ $(INSTALL) $(src-perf)/scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' ; \
+ $(INSTALL) $(src-perf)/scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+ $(call QUIET_INSTALL, perf_completion-script) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d' ; \
+ $(INSTALL) $(src-perf)/perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
+ $(call QUIET_INSTALL, tests) \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' ; \
+ $(INSTALL) $(src-perf)/tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests' ; \
+ $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr' ; \
+ $(INSTALL) $(src-perf)/tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'

install: install-bin try-install-man $(LIBTRACEEVENT)-install

diff --git a/tools/perf/arch/s390/util/Kbuild b/tools/perf/arch/s390/util/Kbuild
index 73df1ff..833e3b8 100644
--- a/tools/perf/arch/s390/util/Kbuild
+++ b/tools/perf/arch/s390/util/Kbuild
@@ -1,2 +1,2 @@
-obj-y += kvm-stat.o
+obj-$(CONFIG_BUILTIN_KVM_STAT) += kvm-stat.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
diff --git a/tools/perf/arch/x86/Makefile b/tools/perf/arch/x86/Makefile
deleted file mode 100644
index af36aad..0000000
--- a/tools/perf/arch/x86/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-ifeq ($(LIBDWARF), 1)
-PERF_HAVE_DWARF_REGS := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/dwarf-regs.o
-endif
-ifeq ($(LIBUNWIND), 1)
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libunwind.o
-endif
-ifeq ($(LIBDWARF_UNWIND), 1)
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/unwind-libdw.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/regs_load.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/tests/dwarf-unwind.o
-endif
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/header.o
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/tsc.o
-LIB_H += arch/$(ARCH)/util/tsc.h
-HAVE_KVM_STAT_SUPPORT := 1
-LIB_OBJS += $(OUTPUT)arch/$(ARCH)/util/kvm-stat.o
diff --git a/tools/perf/arch/x86/util/Kbuild b/tools/perf/arch/x86/util/Kbuild
index adca885..fe382ce 100644
--- a/tools/perf/arch/x86/util/Kbuild
+++ b/tools/perf/arch/x86/util/Kbuild
@@ -1,6 +1,6 @@
obj-y += header.o
obj-y += tsc.o
-obj-y += kvm-stat.o
+obj-$(CONFIG_BUILTIN_KVM_STAT) += kvm-stat.o
obj-$(CONFIG_LIBDWARF) += dwarf-regs.o
obj-$(CONFIG_LIBUNWIND) += unwind-libunwind.o
obj-$(CONFIG_LIBDWARF_UNWIND) += unwind-libdw.o
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
deleted file mode 100644
index 863727f..0000000
--- a/tools/perf/builtin-cmds.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef BUILTIN_CMDS_H
-#define BUILTIN_CMDS_H
-
-#include "generated/autoconf.h"
-
-#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c
index fbbbaa4..3e9854c 100644
--- a/tools/perf/builtin-help.c
+++ b/tools/perf/builtin-help.c
@@ -3,11 +3,11 @@
*
* Builtin help command
*/
+#include "generated/autoconf.h"
#include "perf.h"
#include "util/cache.h"
#include "builtin.h"
#include "util/exec_cmd.h"
-#include "builtin-cmds.h"
#include "common-cmds.h"
#include "util/parse-options.h"
#include "util/run-command.h"
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index 19a1d17..f564a1f 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -30,7 +30,7 @@
#include <pthread.h>
#include <math.h>

-#ifdef HAVE_KVM_STAT_SUPPORT
+#ifdef CONFIG_BUILTIN_KVM_STAT
#include <asm/kvm_perf.h>
#include "util/kvm-stat.h"

@@ -1448,7 +1448,7 @@ static int kvm_cmd_stat(const char *file_name, int argc, const char **argv)
perf_stat:
return cmd_stat(argc, argv, NULL);
}
-#endif /* HAVE_KVM_STAT_SUPPORT */
+#endif /* CONFIG_BUILTIN_KVM_STAT */

static int __cmd_record(const char *file_name, int argc, const char **argv)
{
@@ -1570,7 +1570,7 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused)
if (!strncmp(argv[0], "buildid-list", 12))
return __cmd_buildid_list(file_name, argc, argv);

-#ifdef HAVE_KVM_STAT_SUPPORT
+#ifdef CONFIG_BUILTIN_KVM_STAT
if (!strncmp(argv[0], "stat", 4))
return kvm_cmd_stat(file_name, argc, argv);
#endif
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index 05c0e1c..5181224 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,5 +1,5 @@
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"
#include "perf.h"

#include "util/evlist.h"
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index e38b021..02b3bfe 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1,5 +1,5 @@
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"
#include "perf.h"

#include "util/util.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index b628fa9..7cff9f3 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -34,10 +34,14 @@ ifeq ($(ARCH),arm64)
LIBUNWIND_LIBS = -lunwind -lunwind-aarch64
endif

+ifdef KCONFIG_CONFIG
+include $(KCONFIG_CONFIG)
+endif
+
ifeq ($(LIBUNWIND_LIBS),)
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
else
- LIBUNWIND = 1
+ config-libunwind = 1
#
# For linking with debug library, run like:
#
@@ -65,10 +69,6 @@ ifdef CONFIG_LIBELF
FEATURE_CHECK_LDFLAGS-libdw-dwarf-unwind := $(LIBDW_LDFLAGS) -ldw
endif

-ifdef KCONFIG_CONFIG
-include $(src-perf)/config/Makefile.fix-legacy
-endif
-
# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

@@ -299,12 +299,12 @@ endif
ifdef CONFIG_LIBELF
ifeq ($(feature-libelf), 0)
ifeq ($(feature-glibc), 1)
- LIBC_SUPPORT := 1
+ config-libc := 1
endif
ifeq ($(BIONIC),1)
- LIBC_SUPPORT := 1
+ config-libc := 1
endif
- ifeq ($(LIBC_SUPPORT),1)
+ ifeq ($(config-libc),1)
msg := $(warning No libelf found, disables 'probe' tool, please install elfutils-libelf-devel/libelf-dev);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF)
$(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBELF_MINIMAL)
@@ -317,27 +317,27 @@ ifdef CONFIG_LIBELF
endif
endif
else
- LIBELF = 1
+ config-libelf = 1
ifdef CONFIG_LIBDWARF
ifneq ($(feature-dwarf), 1)
msg := $(warning 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);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF)
else
- LIBDWARF = 1
+ config-libdwarf = 1
endif # Dwarf support
ifdef CONFIG_LIBDWARF_UNWIND
ifneq ($(feature-libdw-dwarf-unwind),1)
msg := $(warning No libdw DWARF unwind found, Please install elfutils-devel/libdw-dev >= 0.158 and/or set CONFIG_LIBDWARF_DIR);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBDWARF_UNWIND)
else
- LIBDWARF_UNWIND = 1
+ config-libdwarf-unwind = 1
endif # Dwarf unwind support detected
endif # CONFIG_LIBDWARF_UNWIND
endif # CONFIG_LIBDWARF
endif # libelf support
endif # CONFIG_LIBELF

-ifeq ($(LIBELF), 1)
+ifeq ($(config-libelf), 1)

ifdef CONFIG_LIBELF_MMAP
ifneq ($(feature-libelf-mmap), 1)
@@ -345,16 +345,16 @@ ifeq ($(LIBELF), 1)
endif
endif

- ifdef CONFIG_LIBELF_MMAP
+ ifdef CONFIG_LIBELF_GETPHDRNUM
ifneq ($(feature-libelf-getphdrnum), 1)
- $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_MMAP)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBELF_GETPHDRNUM)
endif
endif

# include ARCH specific config
-include $(src-perf)/arch/$(ARCH)/Makefile

- ifeq ($(LIBDWARF), 1)
+ ifeq ($(config-libdwarf), 1)
CFLAGS += $(LIBDW_CFLAGS)
LDFLAGS += $(LIBDW_LDFLAGS)
EXTLIBS += -lelf -ldw
@@ -365,17 +365,17 @@ ifdef CONFIG_UNWIND
# CONFIG_LIBUNWIND is the default choice; so, if it is not
# available, let's try another one
ifdef CONFIG_LIBUNWIND
- ifeq ($(LIBUNWIND), 1)
+ ifeq ($(config-libunwind), 1)
ifneq ($(feature-libunwind), 1)
- LIBUNWIND = 0
+ config-libunwind = 0
$(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBUNWIND)
- ifeq ($(LIBDWARF_UNWIND), 1)
+ ifeq ($(config-libdwarf-unwind), 1)
msg := $(warning No libunwind found, post unwind will rely on libdwarf-unwind. Please install libunwind-dev[el] >= 1.1);
$(shell $(KCONFIG_SCRIPT) -e CONFIG_LIBDWARF_UNWIND)
else
msg := $(warning No libunwind found, disabling post unwind support. Please install libunwind-dev[el] >= 1.1);
$(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
- endif # LIBDWARF_UNWIND
+ endif # config-libdwarf-unwind
else # feature-libunwind OK
EXTLIBS += $(LIBUNWIND_LIBS)
CFLAGS += $(LIBUNWIND_CFLAGS)
@@ -387,7 +387,7 @@ ifdef CONFIG_UNWIND
# CONFIG_LIBDWARF_UNWIND is not the default choice (so the user's
# choice); so, we disable CONFIG_UNWIND if it is not available
ifdef CONFIG_LIBDWARF_UNWIND
- ifneq ($(LIBDWARF_UNWIND), 1)
+ ifneq ($(config-libdwarf-unwind), 1)
msg := $(warning Disabling post unwing because (libdwarf-unwind is not available));
$(shell $(KCONFIG_SCRIPT) -d CONFIG_UNWIND)
endif
@@ -395,7 +395,7 @@ ifdef CONFIG_UNWIND

# if libunwind is OK, let's check the option DEBUG_FRAME
ifdef CONFIG_LIBUNWIND
- ifeq ($(LIBUNWIND), 1)
+ ifeq ($(config-libunwind), 1)
ifeq ($(ARCH),$(filter $(ARCH),arm arm64))
$(call feature_check,libunwind-debug-frame)
ifneq ($(feature-libunwind-debug-frame), 1)
@@ -412,11 +412,11 @@ ifdef CONFIG_UNWIND
dwarf-post-unwind = 0
dwarf-post-unwind-text = BUG

-ifeq ($(LIBUNWIND), 1)
+ifeq ($(config-libunwind), 1)
dwarf-post-unwind := 1
dwarf-post-unwind-text := libunwind
else
- ifeq ($(LIBDWARF_UNWIND), 1)
+ ifeq ($(config-libdwarf-unwind), 1)
dwarf-post-unwind := 1
dwarf-post-unwind-text := libdw
endif
@@ -592,33 +592,18 @@ ifdef CONFIG_LIBNUMA
endif
endif

-ifdef HAVE_KVM_STAT_SUPPORT
- CFLAGS += -DHAVE_KVM_STAT_SUPPORT
+ifdef CONFIG_READ_VDSO32
+ $(call feature_check,compile-32)
+ ifeq ($(feature-compile-32), 0)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_READ_VDSO32)
+ endif
endif

-ifeq (${IS_64_BIT}, 1)
- ifndef NO_PERF_READ_VDSO32
- $(call feature_check,compile-32)
- ifeq ($(feature-compile-32), 1)
- CFLAGS += -DHAVE_PERF_READ_VDSO32
- else
- NO_PERF_READ_VDSO32 := 1
- endif
+ifdef CONFIG_READ_VDSOX32
+ $(call feature_check,compile-x32)
+ ifeq ($(feature-compile-x32), 0)
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_READ_VDSOX32)
endif
- ifneq (${IS_X86_64}, 1)
- NO_PERF_READ_VDSOX32 := 1
- endif
- ifndef NO_PERF_READ_VDSOX32
- $(call feature_check,compile-x32)
- ifeq ($(feature-compile-x32), 1)
- CFLAGS += -DHAVE_PERF_READ_VDSOX32
- else
- NO_PERF_READ_VDSOX32 := 1
- endif
- endif
-else
- NO_PERF_READ_VDSO32 := 1
- NO_PERF_READ_VDSOX32 := 1
endif

# Among the variables below, these:
@@ -712,36 +697,9 @@ define feature_print_text_code
MSG = $(shell printf '...%30s: %s' $(1) $(2))
endef

-PERF_FEATURES := $(foreach feat,$(LIB_FEATURE_TESTS),feature-$(feat)($(feature-$(feat))))
-PERF_FEATURES_FILE := $(shell touch $(OUTPUT)PERF-FEATURES; cat $(OUTPUT)PERF-FEATURES)
-
-ifeq ($(dwarf-post-unwind),1)
- PERF_FEATURES += dwarf-post-unwind($(dwarf-post-unwind-text))
-endif
-
-# The $(display_lib) controls the default detection message
-# output. It's set if:
-# - detected features differes from stored features from
-# last build (in PERF-FEATURES file)
-# - one of the $(LIB_FEATURE_TESTS) is not detected
-# - VF is enabled
-
-ifneq ("$(PERF_FEATURES)","$(PERF_FEATURES_FILE)")
- $(shell echo "$(PERF_FEATURES)" > $(OUTPUT)PERF-FEATURES)
- display_lib := 1
-endif
-
-feature_check = $(eval $(feature_check_code))
-define feature_check_code
- ifneq ($(feature-$(1)), 1)
- display_lib := 1
- endif
-endef
-
-$(foreach feat,$(LIB_FEATURE_TESTS),$(call feature_check,$(feat)))
+display_lib := 1

ifeq ($(VF),1)
- display_lib := 1
display_vf := 1
endif

diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
deleted file mode 100644
index 3f0e33e..0000000
--- a/tools/perf/config/Makefile.fix-config
+++ /dev/null
@@ -1,6 +0,0 @@
-include $(CONFIG_DETECTED)
-include $(KCONFIG_CONFIG)
-
-CONFIG := $(srctree)/scripts/config --file $(KCONFIG_CONFIG)
-
-all:
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
deleted file mode 100644
index 431c9bf..0000000
--- a/tools/perf/config/Makefile.fix-legacy
+++ /dev/null
@@ -1,2 +0,0 @@
-
-include $(KCONFIG_CONFIG)
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index b4fd910..69e9b9d 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -6,8 +6,8 @@
* This is the main hub from which the sub-commands (perf stat,
* perf top, perf record, perf report, etc.) are started.
*/
+#include "generated/autoconf.h"
#include "builtin.h"
-#include "builtin-cmds.h"

#include "util/exec_cmd.h"
#include "util/cache.h"
diff --git a/tools/perf/util/vdso.c b/tools/perf/util/vdso.c
index 5c7dd79..bd2f4f9 100644
--- a/tools/perf/util/vdso.c
+++ b/tools/perf/util/vdso.c
@@ -8,6 +8,7 @@
#include <stdlib.h>
#include <linux/kernel.h>

+#include "generated/autoconf.h"
#include "vdso.h"
#include "util.h"
#include "symbol.h"
@@ -256,11 +257,11 @@ static int vdso__dso_findnew_compat(struct machine *machine,

dso_type = machine__thread_dso_type(machine, thread);

-#ifndef HAVE_PERF_READ_VDSO32
+#ifndef CONFIG_READ_VDSO32
if (dso_type == DSO__TYPE_32BIT)
return 0;
#endif
-#ifndef HAVE_PERF_READ_VDSOX32
+#ifndef CONFIG_READ_VDSOX32
if (dso_type == DSO__TYPE_X32BIT)
return 0;
#endif
--
2.1.1

2014-10-25 22:25:31

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 08/14] perf kbuild: cross-compilation variables are now handled in Kconfig

The variable CONFIG_ARCH and CONFIG_CROSS_COMPILE were added.

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 24 ++++++++++++++++++++++++
tools/perf/Makefile.kbuild | 8 ++++----
tools/perf/arch/x86/include/perf_regs.h | 8 +++++---
tools/perf/arch/x86/tests/regs_load.S | 3 ++-
tools/perf/arch/x86/util/unwind-libunwind.c | 5 +++--
tools/perf/bench/mem-memcpy-arch.h | 4 +++-
tools/perf/bench/mem-memcpy.c | 4 +++-
tools/perf/bench/mem-memset-arch.h | 4 +++-
tools/perf/bench/mem-memset.c | 4 +++-
tools/perf/config/Makefile | 7 ++-----
10 files changed, 52 insertions(+), 19 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index 026ef67..5f85923 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -1,6 +1,30 @@

mainmenu "The perf configuration"

+config TARGET_ARCH
+ string
+ option env="ARCH"
+
+config TARGET_IS_X86_64
+ string
+ option env="IS_X86_64"
+
+config TARGET_CROSS_COMPILE
+ string
+ option env="CROSS_COMPILE"
+
+config ARCH
+ string
+ default TARGET_ARCH
+
+config X86_64
+ bool
+ default y if TARGET_ARCH = "x86" && TARGET_IS_X86_64 = "1"
+
+config CROSS_COMPILE
+ string
+ default TARGET_CROSS_COMPILE
+
menu "Built-in commands"

config BUILTIN_RECORD
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index 8d9e8b0..b48fe7f 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -123,9 +123,12 @@ export KCONFIG_AUTOHEADER KCONFIG_AUTOCONFIG KCONFIG_SCRIPT

# perf detected config
CONFIG_DETECTED := $(obj-perf)/.config-detected
-
export CONFIG_DETECTED

+# arch-related main variables
+include $(src-perf)/config/Makefile.arch
+export ARCH IS_X86_64 CROSS_COMPILE
+
# external .a libs
LIBTRACEEVENT := $(obj-kernel)/tools/lib/traceevent/libtraceevent.a
LIBAPIKFS := $(obj-kernel)/tools/lib/api/libapikfs.a
@@ -202,9 +205,6 @@ ifndef dont-detect
ifdef CONFIG_DETECTED_STORED
# Following variables are needed within Kbuild files, we need
# to export them as they are not part of the .config set.
-export CONFIG_ARCH := $(ARCH)
-export CROSS_COMPILE
-export CONFIG_X86_64
export htmldir_SQ
export infodir_SQ
export mandir_SQ
diff --git a/tools/perf/arch/x86/include/perf_regs.h b/tools/perf/arch/x86/include/perf_regs.h
index 7df517a..d969cca 100644
--- a/tools/perf/arch/x86/include/perf_regs.h
+++ b/tools/perf/arch/x86/include/perf_regs.h
@@ -5,9 +5,11 @@
#include <linux/types.h>
#include <asm/perf_regs.h>

+#include "generated/autoconf.h"
+
void perf_regs_load(u64 *regs);

-#ifndef HAVE_ARCH_X86_64_SUPPORT
+#ifndef CONFIG_X86_64
#define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1)
#define PERF_REGS_MAX PERF_REG_X86_32_MAX
#define PERF_SAMPLE_REGS_ABI PERF_SAMPLE_REGS_ABI_32
@@ -58,7 +60,7 @@ static inline const char *perf_reg_name(int id)
return "FS";
case PERF_REG_X86_GS:
return "GS";
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
case PERF_REG_X86_R8:
return "R8";
case PERF_REG_X86_R9:
@@ -75,7 +77,7 @@ static inline const char *perf_reg_name(int id)
return "R14";
case PERF_REG_X86_R15:
return "R15";
-#endif /* HAVE_ARCH_X86_64_SUPPORT */
+#endif /* CONFIG_X86_64 */
default:
return NULL;
}
diff --git a/tools/perf/arch/x86/tests/regs_load.S b/tools/perf/arch/x86/tests/regs_load.S
index 60875d5..822a797 100644
--- a/tools/perf/arch/x86/tests/regs_load.S
+++ b/tools/perf/arch/x86/tests/regs_load.S
@@ -1,4 +1,5 @@
#include <linux/linkage.h>
+#include "generated/autoconf.h"

#define AX 0
#define BX 1 * 8
@@ -26,7 +27,7 @@
#define R15 23 * 8

.text
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
ENTRY(perf_regs_load)
movq %rax, AX(%rdi)
movq %rbx, BX(%rdi)
diff --git a/tools/perf/arch/x86/util/unwind-libunwind.c b/tools/perf/arch/x86/util/unwind-libunwind.c
index db25e93..e4960c1 100644
--- a/tools/perf/arch/x86/util/unwind-libunwind.c
+++ b/tools/perf/arch/x86/util/unwind-libunwind.c
@@ -1,11 +1,12 @@

#include <errno.h>
#include <libunwind.h>
+#include "generated/autoconf.h"
#include "perf_regs.h"
#include "../../util/unwind.h"
#include "../../util/debug.h"

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64
int libunwind__arch_reg_id(int regnum)
{
int id;
@@ -109,4 +110,4 @@ int libunwind__arch_reg_id(int regnum)

return id;
}
-#endif /* HAVE_ARCH_X86_64_SUPPORT */
+#endif /* CONFIG_X86_64 */
diff --git a/tools/perf/bench/mem-memcpy-arch.h b/tools/perf/bench/mem-memcpy-arch.h
index 57b4ed8..8e3f0a9 100644
--- a/tools/perf/bench/mem-memcpy-arch.h
+++ b/tools/perf/bench/mem-memcpy-arch.h
@@ -1,5 +1,7 @@

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_X86_64

#define MEMCPY_FN(fn, name, desc) \
extern void *fn(void *, const void *, size_t);
diff --git a/tools/perf/bench/mem-memcpy.c b/tools/perf/bench/mem-memcpy.c
index 2465141..9061d2b 100644
--- a/tools/perf/bench/mem-memcpy.c
+++ b/tools/perf/bench/mem-memcpy.c
@@ -6,6 +6,8 @@
* Written by Hitoshi Mitake <[email protected]>
*/

+#include "generated/autoconf.h"
+
#include "../perf.h"
#include "../util/util.h"
#include "../util/parse-options.h"
@@ -59,7 +61,7 @@ struct routine routines[] = {
{ "default",
"Default memcpy() provided by glibc",
memcpy },
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64

#define MEMCPY_FN(fn, name, desc) { name, desc, fn },
#include "mem-memcpy-x86-64-asm-def.h"
diff --git a/tools/perf/bench/mem-memset-arch.h b/tools/perf/bench/mem-memset-arch.h
index 633800c..5dfc4c5 100644
--- a/tools/perf/bench/mem-memset-arch.h
+++ b/tools/perf/bench/mem-memset-arch.h
@@ -1,5 +1,7 @@

-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#include "generated/autoconf.h"
+
+#ifdef CONFIG_X86_64

#define MEMSET_FN(fn, name, desc) \
extern void *fn(void *, int, size_t);
diff --git a/tools/perf/bench/mem-memset.c b/tools/perf/bench/mem-memset.c
index 75fc3e6..73e8d8d 100644
--- a/tools/perf/bench/mem-memset.c
+++ b/tools/perf/bench/mem-memset.c
@@ -6,6 +6,8 @@
* Trivial clone of mem-memcpy.c.
*/

+#include "generated/autoconf.h"
+
#include "../perf.h"
#include "../util/util.h"
#include "../util/parse-options.h"
@@ -59,7 +61,7 @@ static const struct routine routines[] = {
{ "default",
"Default memset() provided by glibc",
memset },
-#ifdef HAVE_ARCH_X86_64_SUPPORT
+#ifdef CONFIG_X86_64

#define MEMSET_FN(fn, name, desc) { name, desc, fn },
#include "mem-memset-x86-64-asm-def.h"
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index 0e36bbe..1e7e369 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -20,11 +20,9 @@ NO_PERF_REGS := 1

# Additional ARCH settings for x86
ifeq ($(ARCH),x86)
- ifeq (${IS_X86_64}, 1)
- CFLAGS += -DHAVE_ARCH_X86_64_SUPPORT
- ARCH_INCLUDE = ../../arch/x86/lib/memcpy_64.S ../../arch/x86/lib/memset_64.S
+ ifeq ($(IS_X86_64),1)
LIBUNWIND_LIBS = -lunwind -lunwind-x86_64
- CONFIG_X86_64=y
+ $(shell $(KCONFIG_SCRIPT) -e CONFIG_X86_64)
else
LIBUNWIND_LIBS = -lunwind -lunwind-x86
endif
@@ -821,7 +819,6 @@ all:
$(call store,PARSER_DEBUG_FLEX)
$(call store,PYTHON_EMBED_CCOPTS)
$(call store,PERL_EMBED_CCOPTS)
- $(call store,CONFIG_X86_64)
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
--
2.1.1

2014-10-25 22:25:49

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 06/14] perf kbuild: remove legacy tui/gui-related build variables

Remove NO_SLANG (replaced by CONFIG_LIBSLANG)
Remove HAVE_SLANG_SUPPORT from CFLAGS (replaced by CONFIG_LIBSLANG)
Remove NO_GTK2 (replaced by CONFIG_LIBGTK2 or CONFIG_GTK2)
Remove HAVE_GTK2_SUPPORT from CFLAGS (replaced by CONFIG_LIBGTK2)
Remove HAVE_GTK_INFO_BAR_SUPPORT from CFLAGS (replaced by
CONFIG_LIBGTK2_INFOBAR)

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Kconfig | 21 +++++++++++++++++++++
tools/perf/config/Makefile | 20 ++++++--------------
tools/perf/config/Makefile.fix-config | 24 ------------------------
tools/perf/config/Makefile.fix-legacy | 8 --------
tools/perf/ui/gtk/browser.c | 4 +++-
tools/perf/ui/gtk/gtk.h | 5 +++--
tools/perf/ui/gtk/util.c | 6 ++++--
tools/perf/ui/setup.c | 4 +++-
tools/perf/ui/ui.h | 4 +++-
tools/perf/util/annotate.h | 4 +++-
tools/perf/util/hist.h | 3 ++-
11 files changed, 48 insertions(+), 55 deletions(-)

diff --git a/tools/perf/Kconfig b/tools/perf/Kconfig
index f9fcf9e..eb59567 100644
--- a/tools/perf/Kconfig
+++ b/tools/perf/Kconfig
@@ -171,6 +171,7 @@ config STDIO

config TUI
bool "Tui (slang based)"
+ depends on LIBSLANG
default y
---help---
Text-based user interface which provides windowing
@@ -179,6 +180,7 @@ config TUI
config GTK2
bool "Gtk2"
default y
+ depends on LIBGTK2
---help---
Elaborate display mode based on libgtk2.

@@ -186,12 +188,31 @@ endmenu

menu "Libraries / Dependencies"

+config LIBSLANG
+ bool "Slang (libslang)"
+ default y
+ ---help---
+ libslang
+
config LIBAUDIT
bool "Audit (libaudit)"
default y
---help---
Linux audit framework dependency.

+config LIBGTK2
+ bool "Gtk2 (libgtk2)"
+ default y
+ ---help---
+ libgtk2
+
+config LIBGTK2_INFOBAR
+ bool "Gtk2 infobar (libgtk2)"
+ depends on LIBGTK2
+ default y
+ ---help---
+ libgtk2-infobar
+
config LIBPERL
bool "Perl"
default y
diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
index d5fec7c..e41c9de 100644
--- a/tools/perf/config/Makefile
+++ b/tools/perf/config/Makefile
@@ -447,32 +447,26 @@ ifndef NO_LIBAUDIT
endif
endif

-ifdef NO_NEWT
- NO_SLANG=1
-endif
-
-ifndef NO_SLANG
+ifdef CONFIG_LIBSLANG
ifneq ($(feature-libslang), 1)
- msg := $(warning slang not found, disables TUI support. Please install slang-devel or libslang-dev);
- NO_SLANG := 1
+ msg := $(warning slang not found, disables SLANG and TUI supports. Please install slang-devel or libslang-dev);
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBSLANG)
else
# Fedora has /usr/include/slang/slang.h, but ubuntu /usr/include/slang.h
CFLAGS += -I/usr/include/slang
- CFLAGS += -DHAVE_SLANG_SUPPORT
EXTLIBS += -lslang
endif
endif

-ifndef NO_GTK2
+ifdef CONFIG_LIBGTK2
FLAGS_GTK2=$(CFLAGS) $(LDFLAGS) $(EXTLIBS) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0 2>/dev/null)
ifneq ($(feature-gtk2), 1)
msg := $(warning GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev);
- NO_GTK2 := 1
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBGTK2)
else
ifeq ($(feature-gtk2-infobar), 1)
- GTK_CFLAGS := -DHAVE_GTK_INFO_BAR_SUPPORT
+ $(shell $(KCONFIG_SCRIPT) -d CONFIG_LIBGTK2_INFOBAR)
endif
- CFLAGS += -DHAVE_GTK2_SUPPORT
GTK_CFLAGS += $(shell $(PKG_CONFIG) --cflags gtk+-2.0 2>/dev/null)
GTK_LIBS := $(shell $(PKG_CONFIG) --libs gtk+-2.0 2>/dev/null)
EXTLIBS += -ldl
@@ -828,8 +822,6 @@ all:
$(call store,NO_LIBUNWIND)
$(call store,NO_LIBPERL)
$(call store,NO_LIBPYTHON)
- $(call store,NO_NEWT)
- $(call store,NO_GTK2)
$(call store,NO_DEMANGLE)
$(call store,NO_LIBELF)
$(call store,NO_LIBUNWIND)
diff --git a/tools/perf/config/Makefile.fix-config b/tools/perf/config/Makefile.fix-config
index 7f65fdb..3d84008 100644
--- a/tools/perf/config/Makefile.fix-config
+++ b/tools/perf/config/Makefile.fix-config
@@ -19,30 +19,6 @@ dummy := $(shell $(CONFIG) -d CONFIG_LIBPYTHON)
endif
endif

-# NO_NEWT
-ifdef CONFIG_TUI
-ifdef NO_NEWT
-dummy := $(info Disabling CONFIG_TUI)
-dummy := $(shell $(CONFIG) -d CONFIG_TUI)
-endif
-endif
-
-# NO_NEWT
-ifdef CONFIG_TUI
-ifdef NO_SLANG
-dummy := $(info Disabling CONFIG_TUI)
-dummy := $(shell $(CONFIG) -d CONFIG_TUI)
-endif
-endif
-
-# NO_GTK2
-ifdef CONFIG_GTK2
-ifdef NO_GTK2
-dummy := $(info Disabling CONFIG_GTK2)
-dummy := $(shell $(CONFIG) -d CONFIG_GTK2)
-endif
-endif
-
# NO_DEMANGLE
ifdef CONFIG_DEMANGLE
ifdef NO_DEMANGLE
diff --git a/tools/perf/config/Makefile.fix-legacy b/tools/perf/config/Makefile.fix-legacy
index 2ec91f3..ca219e7 100644
--- a/tools/perf/config/Makefile.fix-legacy
+++ b/tools/perf/config/Makefile.fix-legacy
@@ -9,14 +9,6 @@ ifndef CONFIG_LIBPYTHON
NO_LIBPYTHON := 1
endif

-ifndef CONFIG_TUI
-NO_SLANG := 1
-endif
-
-ifndef CONFIG_GTK2
-NO_GTK2 := 1
-endif
-
ifndef CONFIG_DEMANGLE
NO_DEMANGLE := 1
endif
diff --git a/tools/perf/ui/gtk/browser.c b/tools/perf/ui/gtk/browser.c
index c24d912..f4df6a6 100644
--- a/tools/perf/ui/gtk/browser.c
+++ b/tools/perf/ui/gtk/browser.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "../evlist.h"
#include "../cache.h"
#include "../evsel.h"
@@ -43,7 +45,7 @@ const char *perf_gtk__get_percent_color(double percent)
return NULL;
}

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *perf_gtk__setup_info_bar(void)
{
GtkWidget *info_bar;
diff --git a/tools/perf/ui/gtk/gtk.h b/tools/perf/ui/gtk/gtk.h
index 0a9173f..3762980 100644
--- a/tools/perf/ui/gtk/gtk.h
+++ b/tools/perf/ui/gtk/gtk.h
@@ -7,12 +7,13 @@
#include <gtk/gtk.h>
#pragma GCC diagnostic error "-Wstrict-prototypes"

+#include "generated/autoconf.h"

struct perf_gtk_context {
GtkWidget *main_window;
GtkWidget *notebook;

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *info_bar;
GtkWidget *message_label;
#endif
@@ -42,7 +43,7 @@ void perf_gtk__resize_window(GtkWidget *window);
const char *perf_gtk__get_percent_color(double percent);
GtkWidget *perf_gtk__setup_statusbar(void);

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
GtkWidget *perf_gtk__setup_info_bar(void);
#else
static inline GtkWidget *perf_gtk__setup_info_bar(void)
diff --git a/tools/perf/ui/gtk/util.c b/tools/perf/ui/gtk/util.c
index 52e7fc4..dde1615 100644
--- a/tools/perf/ui/gtk/util.c
+++ b/tools/perf/ui/gtk/util.c
@@ -1,3 +1,5 @@
+#include "generated/autoconf.h"
+
#include "../util.h"
#include "../../util/debug.h"
#include "gtk.h"
@@ -52,7 +54,7 @@ static int perf_gtk__error(const char *format, va_list args)
return 0;
}

-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
static int perf_gtk__warning_info_bar(const char *format, va_list args)
{
char *msg;
@@ -104,7 +106,7 @@ static int perf_gtk__warning_statusbar(const char *format, va_list args)

struct perf_error_ops perf_gtk_eops = {
.error = perf_gtk__error,
-#ifdef HAVE_GTK_INFO_BAR_SUPPORT
+#ifdef CONFIG_LIBGTK2_INFOBAR
.warning = perf_gtk__warning_info_bar,
#else
.warning = perf_gtk__warning_statusbar,
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index 7928984..0acaf1b 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -1,6 +1,8 @@
#include <pthread.h>
#include <dlfcn.h>

+#include "generated/autoconf.h"
+
#include "../util/cache.h"
#include "../util/debug.h"
#include "../util/hist.h"
@@ -8,7 +10,7 @@
pthread_mutex_t ui__lock = PTHREAD_MUTEX_INITIALIZER;
void *perf_gtk_handle;

-#ifdef HAVE_GTK2_SUPPORT
+#ifdef CONFIG_GTK2
static int setup_gtk_browser(void)
{
int (*perf_ui_init)(void);
diff --git a/tools/perf/ui/ui.h b/tools/perf/ui/ui.h
index ab88383..bba3a0e 100644
--- a/tools/perf/ui/ui.h
+++ b/tools/perf/ui/ui.h
@@ -5,6 +5,8 @@
#include <stdbool.h>
#include <linux/compiler.h>

+#include "generated/autoconf.h"
+
extern pthread_mutex_t ui__lock;
extern void *perf_gtk_handle;

@@ -13,7 +15,7 @@ extern int use_browser;
void setup_browser(bool fallback_to_pager);
void exit_browser(bool wait_for_ok);

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
int ui__init(void);
void ui__exit(bool wait_for_ok);
#else
diff --git a/tools/perf/util/annotate.h b/tools/perf/util/annotate.h
index 112d6e2..692f46c 100644
--- a/tools/perf/util/annotate.h
+++ b/tools/perf/util/annotate.h
@@ -11,6 +11,8 @@
#include <linux/rbtree.h>
#include <pthread.h>

+#include "generated/autoconf.h"
+
struct ins;

struct ins_operands {
@@ -157,7 +159,7 @@ int symbol__tty_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel, bool print_lines,
bool full_paths, int min_pcnt, int max_lines);

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
int symbol__tui_annotate(struct symbol *sym, struct map *map,
struct perf_evsel *evsel,
struct hist_browser_timer *hbt);
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index d0ef9a1..622597d 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -3,6 +3,7 @@

#include <linux/types.h>
#include <pthread.h>
+#include "generated/autoconf.h"
#include "callchain.h"
#include "evsel.h"
#include "header.h"
@@ -298,7 +299,7 @@ struct hist_browser_timer {
int refresh;
};

-#ifdef HAVE_SLANG_SUPPORT
+#ifdef CONFIG_LIBSLANG
#include "../ui/keysyms.h"
int hist_entry__tui_annotate(struct hist_entry *he, struct perf_evsel *evsel,
struct hist_browser_timer *hbt);
--
2.1.1

2014-10-25 22:26:33

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 05/14] perf kbuild: remove Makefile.perf

The file Makefile.perf contained legacy build rules. It is replaced by
Makefile.kbuild which relies on Kbuild. Consequently, some minor
points need updates:
* The constant CONFIG_KBUILD can be removed
* The main Makefile wrapper now call Makefile.kbuild instead of
Makefile.perf

Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/Makefile | 2 +-
tools/perf/Makefile.kbuild | 2 +-
tools/perf/Makefile.perf | 981 ------------------------------------------
tools/perf/builtin-annotate.c | 4 +-
tools/perf/builtin-cmds.h | 25 --
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-top.c | 4 +-
tools/perf/ui/setup.c | 4 +-
8 files changed, 9 insertions(+), 1015 deletions(-)
delete mode 100644 tools/perf/Makefile.perf

diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index cb2e586..4512f16 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -55,7 +55,7 @@ define print_msg
endef

define make
- @$(MAKE) -f Makefile.perf --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
+ @$(MAKE) -f Makefile.kbuild --no-print-directory -j$(JOBS) O=$(FULL_O) $(SET_DEBUG) $@
endef

#
diff --git a/tools/perf/Makefile.kbuild b/tools/perf/Makefile.kbuild
index 51eba07..8d9e8b0 100644
--- a/tools/perf/Makefile.kbuild
+++ b/tools/perf/Makefile.kbuild
@@ -43,7 +43,7 @@ export QUIET_BISON QUIET_FLEX

ifeq ($(KBUILD_SRC),)

-ifeq ("$(origin O)", "command line")
+ifneq ($(O),)
KBUILD_OUTPUT := $(O)
else
KBUILD_OUTPUT := $(objtree)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
deleted file mode 100644
index 0e84559..0000000
--- a/tools/perf/Makefile.perf
+++ /dev/null
@@ -1,981 +0,0 @@
-include ../scripts/Makefile.include
-
-# The default target of this Makefile is...
-all:
-
-include config/utilities.mak
-
-# Define V to have a more verbose compile.
-#
-# Define VF to have a more verbose feature check output.
-#
-# Define O to save output files in a separate directory.
-#
-# Define ARCH as name of target architecture if you want cross-builds.
-#
-# Define CROSS_COMPILE as prefix name of compiler if you want cross-builds.
-#
-# Define NO_LIBPERL to disable perl script extension.
-#
-# Define NO_LIBPYTHON to disable python script extension.
-#
-# Define PYTHON to point to the python binary if the default
-# `python' is not correct; for example: PYTHON=python2
-#
-# Define PYTHON_CONFIG to point to the python-config binary if
-# the default `$(PYTHON)-config' is not correct.
-#
-# Define ASCIIDOC8 if you want to format documentation with AsciiDoc 8
-#
-# Define DOCBOOK_XSL_172 if you want to format man pages with DocBook XSL v1.72.
-#
-# Define LDFLAGS=-static to build a static binary.
-#
-# Define EXTRA_CFLAGS=-m64 or EXTRA_CFLAGS=-m32 as appropriate for cross-builds.
-#
-# Define NO_DWARF if you do not want debug-info analysis feature at all.
-#
-# Define WERROR=0 to disable treating any warnings as errors.
-#
-# Define NO_NEWT if you do not want TUI support. (deprecated)
-#
-# Define NO_SLANG if you do not want TUI support.
-#
-# Define NO_GTK2 if you do not want GTK+ GUI support.
-#
-# Define NO_DEMANGLE if you do not want C++ symbol demangling.
-#
-# Define NO_LIBELF if you do not want libelf dependency (e.g. cross-builds)
-#
-# Define NO_LIBUNWIND if you do not want libunwind dependency for dwarf
-# backtrace post unwind.
-#
-# Define NO_BACKTRACE if you do not want stack backtrace debug feature
-#
-# Define NO_LIBNUMA if you do not want numa perf benchmark
-#
-# Define NO_LIBAUDIT if you do not want libaudit support
-#
-# Define NO_LIBBIONIC if you do not want bionic support
-#
-# Define NO_LIBDW_DWARF_UNWIND if you do not want libdw support
-# for dwarf backtrace post unwind.
-#
-# Define NO_PERF_READ_VDSO32 if you do not want to build perf-read-vdso32
-# for reading the 32-bit compatibility VDSO in 64-bit mode
-#
-# Define NO_PERF_READ_VDSOX32 if you do not want to build perf-read-vdsox32
-# for reading the x32 mode 32-bit compatibility VDSO in 64-bit mode
-
-ifeq ($(srctree),)
-srctree := $(patsubst %/,%,$(dir $(shell pwd)))
-srctree := $(patsubst %/,%,$(dir $(srctree)))
-#$(info Determined 'srctree' to be $(srctree))
-endif
-
-ifneq ($(objtree),)
-#$(info Determined 'objtree' to be $(objtree))
-endif
-
-ifneq ($(OUTPUT),)
-#$(info Determined 'OUTPUT' to be $(OUTPUT))
-endif
-
-$(OUTPUT)PERF-VERSION-FILE: ../../.git/HEAD
- @$(SHELL_PATH) util/PERF-VERSION-GEN $(OUTPUT)
- @touch $(OUTPUT)PERF-VERSION-FILE
-
-CC = $(CROSS_COMPILE)gcc
-AR = $(CROSS_COMPILE)ar
-PKG_CONFIG = $(CROSS_COMPILE)pkg-config
-
-RM = rm -f
-LN = ln -f
-MKDIR = mkdir
-FIND = find
-INSTALL = install
-FLEX = flex
-BISON = bison
-STRIP = strip
-
-LIB_DIR = $(srctree)/tools/lib/api/
-TRACE_EVENT_DIR = $(srctree)/tools/lib/traceevent/
-
-# include config/Makefile by default and rule out
-# non-config cases
-config := 1
-
-NON_CONFIG_TARGETS := clean TAGS tags cscope help
-
-ifdef MAKECMDGOALS
-ifeq ($(filter-out $(NON_CONFIG_TARGETS),$(MAKECMDGOALS)),)
- config := 0
-endif
-endif
-
-ifeq ($(config),1)
-include config/Makefile
-endif
-
-export prefix bindir sharedir sysconfdir DESTDIR
-
-# sparse is architecture-neutral, which means that we need to tell it
-# explicitly what architecture to check for. Fix this up for yours..
-SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__
-
-# Guard against environment variables
-BUILTIN_OBJS =
-LIB_H =
-LIB_OBJS =
-GTK_OBJS =
-PYRF_OBJS =
-SCRIPT_SH =
-
-SCRIPT_SH += perf-archive.sh
-SCRIPT_SH += perf-with-kcore.sh
-
-grep-libs = $(filter -l%,$(1))
-strip-libs = $(filter-out -l%,$(1))
-
-ifneq ($(OUTPUT),)
- TE_PATH=$(OUTPUT)
-ifneq ($(subdir),)
- LIB_PATH=$(OUTPUT)/../lib/api/
-else
- LIB_PATH=$(OUTPUT)
-endif
-else
- TE_PATH=$(TRACE_EVENT_DIR)
- LIB_PATH=$(LIB_DIR)
-endif
-
-LIBTRACEEVENT = $(TE_PATH)libtraceevent.a
-export LIBTRACEEVENT
-
-LIBAPIKFS = $(LIB_PATH)libapikfs.a
-export LIBAPIKFS
-
-# python extension build directories
-PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
-PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
-PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
-export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
-
-python-clean := $(call QUIET_CLEAN, python) $(RM) -r $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
-
-PYTHON_EXT_SRCS := $(shell grep -v ^\# util/python-ext-sources)
-PYTHON_EXT_DEPS := util/python-ext-sources util/setup.py $(LIBTRACEEVENT) $(LIBAPIKFS)
-
-$(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS)
- $(QUIET_GEN)CFLAGS='$(CFLAGS)' $(PYTHON_WORD) util/setup.py \
- --quiet build_ext; \
- mkdir -p $(OUTPUT)python && \
- cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
-#
-# No Perl scripts right now:
-#
-
-SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH))
-
-PROGRAMS += $(OUTPUT)perf
-
-ifndef NO_PERF_READ_VDSO32
-PROGRAMS += $(OUTPUT)perf-read-vdso32
-endif
-
-ifndef NO_PERF_READ_VDSOX32
-PROGRAMS += $(OUTPUT)perf-read-vdsox32
-endif
-
-# what 'all' will build and 'install' will install, in perfexecdir
-ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
-
-# what 'all' will build but not install in perfexecdir
-OTHER_PROGRAMS = $(OUTPUT)perf
-
-# Set paths to tools early so that they can be used for version tests.
-ifndef SHELL_PATH
- SHELL_PATH = /bin/sh
-endif
-ifndef PERL_PATH
- PERL_PATH = /usr/bin/perl
-endif
-
-export PERL_PATH
-
-$(OUTPUT)util/parse-events-flex.c: util/parse-events.l $(OUTPUT)util/parse-events-bison.c
- $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/parse-events-flex.h $(PARSER_DEBUG_FLEX) util/parse-events.l
-
-$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
- $(QUIET_BISON)$(BISON) -v util/parse-events.y -d $(PARSER_DEBUG_BISON) -o $(OUTPUT)util/parse-events-bison.c -p parse_events_
-
-$(OUTPUT)util/pmu-flex.c: util/pmu.l $(OUTPUT)util/pmu-bison.c
- $(QUIET_FLEX)$(FLEX) -o $@ --header-file=$(OUTPUT)util/pmu-flex.h util/pmu.l
-
-$(OUTPUT)util/pmu-bison.c: util/pmu.y
- $(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c -p perf_pmu_
-
-$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
-$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
-
-LIB_FILE=$(OUTPUT)libperf.a
-
-LIB_H += ../lib/symbol/kallsyms.h
-LIB_H += ../../include/uapi/linux/perf_event.h
-LIB_H += ../../include/linux/rbtree.h
-LIB_H += ../../include/linux/list.h
-LIB_H += ../../include/uapi/linux/const.h
-LIB_H += ../include/linux/hash.h
-LIB_H += ../../include/linux/stringify.h
-LIB_H += util/include/linux/bitmap.h
-LIB_H += util/include/linux/bitops.h
-LIB_H += ../include/linux/compiler.h
-LIB_H += util/include/linux/const.h
-LIB_H += util/include/linux/ctype.h
-LIB_H += util/include/linux/kernel.h
-LIB_H += util/include/linux/list.h
-LIB_H += ../include/linux/export.h
-LIB_H += util/include/linux/poison.h
-LIB_H += util/include/linux/rbtree.h
-LIB_H += util/include/linux/rbtree_augmented.h
-LIB_H += util/include/linux/string.h
-LIB_H += ../include/linux/types.h
-LIB_H += util/include/linux/linkage.h
-LIB_H += util/include/asm/asm-offsets.h
-LIB_H += ../include/asm/bug.h
-LIB_H += util/include/asm/byteorder.h
-LIB_H += util/include/asm/hweight.h
-LIB_H += util/include/asm/swab.h
-LIB_H += util/include/asm/system.h
-LIB_H += util/include/asm/uaccess.h
-LIB_H += util/include/dwarf-regs.h
-LIB_H += util/include/asm/dwarf2.h
-LIB_H += util/include/asm/cpufeature.h
-LIB_H += util/include/asm/unistd_32.h
-LIB_H += util/include/asm/unistd_64.h
-LIB_H += perf.h
-LIB_H += util/annotate.h
-LIB_H += util/cache.h
-LIB_H += util/callchain.h
-LIB_H += util/build-id.h
-LIB_H += util/db-export.h
-LIB_H += util/debug.h
-LIB_H += util/pmu.h
-LIB_H += util/event.h
-LIB_H += util/evsel.h
-LIB_H += util/evlist.h
-LIB_H += util/exec_cmd.h
-LIB_H += util/find-vdso-map.c
-LIB_H += util/levenshtein.h
-LIB_H += util/machine.h
-LIB_H += util/map.h
-LIB_H += util/parse-options.h
-LIB_H += util/parse-events.h
-LIB_H += util/quote.h
-LIB_H += util/util.h
-LIB_H += util/xyarray.h
-LIB_H += util/header.h
-LIB_H += util/help.h
-LIB_H += util/session.h
-LIB_H += util/ordered-events.h
-LIB_H += util/strbuf.h
-LIB_H += util/strlist.h
-LIB_H += util/strfilter.h
-LIB_H += util/svghelper.h
-LIB_H += util/tool.h
-LIB_H += util/run-command.h
-LIB_H += util/sigchain.h
-LIB_H += util/dso.h
-LIB_H += util/symbol.h
-LIB_H += util/color.h
-LIB_H += util/values.h
-LIB_H += util/sort.h
-LIB_H += util/hist.h
-LIB_H += util/comm.h
-LIB_H += util/thread.h
-LIB_H += util/thread_map.h
-LIB_H += util/trace-event.h
-LIB_H += util/probe-finder.h
-LIB_H += util/dwarf-aux.h
-LIB_H += util/probe-event.h
-LIB_H += util/pstack.h
-LIB_H += util/cpumap.h
-LIB_H += util/top.h
-LIB_H += $(ARCH_INCLUDE)
-LIB_H += util/cgroup.h
-LIB_H += $(LIB_INCLUDE)traceevent/event-parse.h
-LIB_H += util/target.h
-LIB_H += util/rblist.h
-LIB_H += util/intlist.h
-LIB_H += util/perf_regs.h
-LIB_H += util/unwind.h
-LIB_H += util/vdso.h
-LIB_H += util/tsc.h
-LIB_H += ui/helpline.h
-LIB_H += ui/progress.h
-LIB_H += ui/util.h
-LIB_H += ui/ui.h
-LIB_H += util/data.h
-LIB_H += util/kvm-stat.h
-
-LIB_OBJS += $(OUTPUT)util/abspath.o
-LIB_OBJS += $(OUTPUT)util/alias.o
-LIB_OBJS += $(OUTPUT)util/annotate.o
-LIB_OBJS += $(OUTPUT)util/build-id.o
-LIB_OBJS += $(OUTPUT)util/config.o
-LIB_OBJS += $(OUTPUT)util/ctype.o
-LIB_OBJS += $(OUTPUT)util/db-export.o
-LIB_OBJS += $(OUTPUT)util/pmu.o
-LIB_OBJS += $(OUTPUT)util/environment.o
-LIB_OBJS += $(OUTPUT)util/event.o
-LIB_OBJS += $(OUTPUT)util/evlist.o
-LIB_OBJS += $(OUTPUT)util/evsel.o
-LIB_OBJS += $(OUTPUT)util/exec_cmd.o
-LIB_OBJS += $(OUTPUT)util/help.o
-LIB_OBJS += $(OUTPUT)util/kallsyms.o
-LIB_OBJS += $(OUTPUT)util/levenshtein.o
-LIB_OBJS += $(OUTPUT)util/parse-options.o
-LIB_OBJS += $(OUTPUT)util/parse-events.o
-LIB_OBJS += $(OUTPUT)util/path.o
-LIB_OBJS += $(OUTPUT)util/rbtree.o
-LIB_OBJS += $(OUTPUT)util/bitmap.o
-LIB_OBJS += $(OUTPUT)util/hweight.o
-LIB_OBJS += $(OUTPUT)util/run-command.o
-LIB_OBJS += $(OUTPUT)util/quote.o
-LIB_OBJS += $(OUTPUT)util/strbuf.o
-LIB_OBJS += $(OUTPUT)util/string.o
-LIB_OBJS += $(OUTPUT)util/strlist.o
-LIB_OBJS += $(OUTPUT)util/strfilter.o
-LIB_OBJS += $(OUTPUT)util/top.o
-LIB_OBJS += $(OUTPUT)util/usage.o
-LIB_OBJS += $(OUTPUT)util/wrapper.o
-LIB_OBJS += $(OUTPUT)util/sigchain.o
-LIB_OBJS += $(OUTPUT)util/dso.o
-LIB_OBJS += $(OUTPUT)util/symbol.o
-LIB_OBJS += $(OUTPUT)util/symbol-elf.o
-LIB_OBJS += $(OUTPUT)util/color.o
-LIB_OBJS += $(OUTPUT)util/pager.o
-LIB_OBJS += $(OUTPUT)util/header.o
-LIB_OBJS += $(OUTPUT)util/callchain.o
-LIB_OBJS += $(OUTPUT)util/values.o
-LIB_OBJS += $(OUTPUT)util/debug.o
-LIB_OBJS += $(OUTPUT)util/machine.o
-LIB_OBJS += $(OUTPUT)util/map.o
-LIB_OBJS += $(OUTPUT)util/pstack.o
-LIB_OBJS += $(OUTPUT)util/session.o
-LIB_OBJS += $(OUTPUT)util/ordered-events.o
-LIB_OBJS += $(OUTPUT)util/comm.o
-LIB_OBJS += $(OUTPUT)util/thread.o
-LIB_OBJS += $(OUTPUT)util/thread_map.o
-LIB_OBJS += $(OUTPUT)util/trace-event-parse.o
-LIB_OBJS += $(OUTPUT)util/parse-events-flex.o
-LIB_OBJS += $(OUTPUT)util/parse-events-bison.o
-LIB_OBJS += $(OUTPUT)util/pmu-flex.o
-LIB_OBJS += $(OUTPUT)util/pmu-bison.o
-LIB_OBJS += $(OUTPUT)util/trace-event-read.o
-LIB_OBJS += $(OUTPUT)util/trace-event-info.o
-LIB_OBJS += $(OUTPUT)util/trace-event-scripting.o
-LIB_OBJS += $(OUTPUT)util/trace-event.o
-LIB_OBJS += $(OUTPUT)util/svghelper.o
-LIB_OBJS += $(OUTPUT)util/sort.o
-LIB_OBJS += $(OUTPUT)util/hist.o
-LIB_OBJS += $(OUTPUT)util/probe-event.o
-LIB_OBJS += $(OUTPUT)util/util.o
-LIB_OBJS += $(OUTPUT)util/xyarray.o
-LIB_OBJS += $(OUTPUT)util/cpumap.o
-LIB_OBJS += $(OUTPUT)util/cgroup.o
-LIB_OBJS += $(OUTPUT)util/target.o
-LIB_OBJS += $(OUTPUT)util/rblist.o
-LIB_OBJS += $(OUTPUT)util/intlist.o
-LIB_OBJS += $(OUTPUT)util/vdso.o
-LIB_OBJS += $(OUTPUT)util/stat.o
-LIB_OBJS += $(OUTPUT)util/record.o
-LIB_OBJS += $(OUTPUT)util/srcline.o
-LIB_OBJS += $(OUTPUT)util/data.o
-LIB_OBJS += $(OUTPUT)util/tsc.o
-LIB_OBJS += $(OUTPUT)util/cloexec.o
-
-LIB_OBJS += $(OUTPUT)ui/setup.o
-LIB_OBJS += $(OUTPUT)ui/helpline.o
-LIB_OBJS += $(OUTPUT)ui/progress.o
-LIB_OBJS += $(OUTPUT)ui/util.o
-LIB_OBJS += $(OUTPUT)ui/hist.o
-LIB_OBJS += $(OUTPUT)ui/stdio/hist.o
-
-LIB_OBJS += $(OUTPUT)arch/common.o
-
-LIB_OBJS += $(OUTPUT)tests/parse-events.o
-LIB_OBJS += $(OUTPUT)tests/dso-data.o
-LIB_OBJS += $(OUTPUT)tests/attr.o
-LIB_OBJS += $(OUTPUT)tests/vmlinux-kallsyms.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall-all-cpus.o
-LIB_OBJS += $(OUTPUT)tests/open-syscall-tp-fields.o
-LIB_OBJS += $(OUTPUT)tests/mmap-basic.o
-LIB_OBJS += $(OUTPUT)tests/perf-record.o
-LIB_OBJS += $(OUTPUT)tests/rdpmc.o
-LIB_OBJS += $(OUTPUT)tests/evsel-roundtrip-name.o
-LIB_OBJS += $(OUTPUT)tests/evsel-tp-sched.o
-LIB_OBJS += $(OUTPUT)tests/fdarray.o
-LIB_OBJS += $(OUTPUT)tests/pmu.o
-LIB_OBJS += $(OUTPUT)tests/hists_common.o
-LIB_OBJS += $(OUTPUT)tests/hists_link.o
-LIB_OBJS += $(OUTPUT)tests/hists_filter.o
-LIB_OBJS += $(OUTPUT)tests/hists_output.o
-LIB_OBJS += $(OUTPUT)tests/hists_cumulate.o
-LIB_OBJS += $(OUTPUT)tests/python-use.o
-LIB_OBJS += $(OUTPUT)tests/bp_signal.o
-LIB_OBJS += $(OUTPUT)tests/bp_signal_overflow.o
-LIB_OBJS += $(OUTPUT)tests/task-exit.o
-LIB_OBJS += $(OUTPUT)tests/sw-clock.o
-ifeq ($(ARCH),x86)
-LIB_OBJS += $(OUTPUT)tests/perf-time-to-tsc.o
-endif
-LIB_OBJS += $(OUTPUT)tests/code-reading.o
-LIB_OBJS += $(OUTPUT)tests/sample-parsing.o
-LIB_OBJS += $(OUTPUT)tests/parse-no-sample-id-all.o
-ifndef NO_DWARF_UNWIND
-ifeq ($(ARCH),$(filter $(ARCH),x86 arm))
-LIB_OBJS += $(OUTPUT)tests/dwarf-unwind.o
-endif
-endif
-LIB_OBJS += $(OUTPUT)tests/mmap-thread-lookup.o
-LIB_OBJS += $(OUTPUT)tests/thread-mg-share.o
-LIB_OBJS += $(OUTPUT)tests/switch-tracking.o
-
-BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
-BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
-# Benchmark modules
-BUILTIN_OBJS += $(OUTPUT)bench/sched-messaging.o
-BUILTIN_OBJS += $(OUTPUT)bench/sched-pipe.o
-ifeq ($(RAW_ARCH),x86_64)
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy-x86-64-asm.o
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memset-x86-64-asm.o
-endif
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memcpy.o
-BUILTIN_OBJS += $(OUTPUT)bench/mem-memset.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-hash.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-wake.o
-BUILTIN_OBJS += $(OUTPUT)bench/futex-requeue.o
-
-BUILTIN_OBJS += $(OUTPUT)builtin-diff.o
-BUILTIN_OBJS += $(OUTPUT)builtin-evlist.o
-BUILTIN_OBJS += $(OUTPUT)builtin-help.o
-BUILTIN_OBJS += $(OUTPUT)builtin-sched.o
-BUILTIN_OBJS += $(OUTPUT)builtin-buildid-list.o
-BUILTIN_OBJS += $(OUTPUT)builtin-buildid-cache.o
-BUILTIN_OBJS += $(OUTPUT)builtin-list.o
-BUILTIN_OBJS += $(OUTPUT)builtin-record.o
-BUILTIN_OBJS += $(OUTPUT)builtin-report.o
-BUILTIN_OBJS += $(OUTPUT)builtin-stat.o
-BUILTIN_OBJS += $(OUTPUT)builtin-timechart.o
-BUILTIN_OBJS += $(OUTPUT)builtin-top.o
-BUILTIN_OBJS += $(OUTPUT)builtin-script.o
-BUILTIN_OBJS += $(OUTPUT)builtin-probe.o
-BUILTIN_OBJS += $(OUTPUT)builtin-kmem.o
-BUILTIN_OBJS += $(OUTPUT)builtin-lock.o
-BUILTIN_OBJS += $(OUTPUT)builtin-kvm.o
-BUILTIN_OBJS += $(OUTPUT)builtin-inject.o
-BUILTIN_OBJS += $(OUTPUT)tests/builtin-test.o
-BUILTIN_OBJS += $(OUTPUT)builtin-mem.o
-
-PERFLIBS = $(LIB_FILE) $(LIBAPIKFS) $(LIBTRACEEVENT)
-
-# We choose to avoid "if .. else if .. else .. endif endif"
-# because maintaining the nesting to match is a pain. If
-# we had "elif" things would have been much nicer...
-
--include arch/$(ARCH)/Makefile
-
-ifneq ($(OUTPUT),)
- CFLAGS += -I$(OUTPUT)
-endif
-
-ifdef NO_LIBELF
-EXTLIBS := $(filter-out -lelf,$(EXTLIBS))
-
-# Remove ELF/DWARF dependent codes
-LIB_OBJS := $(filter-out $(OUTPUT)util/symbol-elf.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/dwarf-aux.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-event.o,$(LIB_OBJS))
-LIB_OBJS := $(filter-out $(OUTPUT)util/probe-finder.o,$(LIB_OBJS))
-
-BUILTIN_OBJS := $(filter-out $(OUTPUT)builtin-probe.o,$(BUILTIN_OBJS))
-
-# Use minimal symbol handling
-LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
-
-else # NO_LIBELF
-ifndef NO_DWARF
- LIB_OBJS += $(OUTPUT)util/probe-finder.o
- LIB_OBJS += $(OUTPUT)util/dwarf-aux.o
-endif # NO_DWARF
-endif # NO_LIBELF
-
-ifndef NO_LIBDW_DWARF_UNWIND
- LIB_OBJS += $(OUTPUT)util/unwind-libdw.o
- LIB_H += util/unwind-libdw.h
-endif
-
-ifndef NO_LIBUNWIND
- LIB_OBJS += $(OUTPUT)util/unwind-libunwind.o
-endif
-LIB_OBJS += $(OUTPUT)tests/keep-tracking.o
-
-ifndef NO_LIBAUDIT
- BUILTIN_OBJS += $(OUTPUT)builtin-trace.o
-endif
-
-ifndef NO_SLANG
- LIB_OBJS += $(OUTPUT)ui/browser.o
- LIB_OBJS += $(OUTPUT)ui/browsers/annotate.o
- LIB_OBJS += $(OUTPUT)ui/browsers/hists.o
- LIB_OBJS += $(OUTPUT)ui/browsers/map.o
- LIB_OBJS += $(OUTPUT)ui/browsers/scripts.o
- LIB_OBJS += $(OUTPUT)ui/browsers/header.o
- LIB_OBJS += $(OUTPUT)ui/tui/setup.o
- LIB_OBJS += $(OUTPUT)ui/tui/util.o
- LIB_OBJS += $(OUTPUT)ui/tui/helpline.o
- LIB_OBJS += $(OUTPUT)ui/tui/progress.o
- LIB_H += ui/tui/tui.h
- LIB_H += ui/browser.h
- LIB_H += ui/browsers/map.h
- LIB_H += ui/keysyms.h
- LIB_H += ui/libslang.h
-endif
-
-ifndef NO_GTK2
- ALL_PROGRAMS += $(OUTPUT)libperf-gtk.so
-
- GTK_OBJS += $(OUTPUT)ui/gtk/browser.o
- GTK_OBJS += $(OUTPUT)ui/gtk/hists.o
- GTK_OBJS += $(OUTPUT)ui/gtk/setup.o
- GTK_OBJS += $(OUTPUT)ui/gtk/util.o
- GTK_OBJS += $(OUTPUT)ui/gtk/helpline.o
- GTK_OBJS += $(OUTPUT)ui/gtk/progress.o
- GTK_OBJS += $(OUTPUT)ui/gtk/annotate.o
-
-install-gtk: $(OUTPUT)libperf-gtk.so
- $(call QUIET_INSTALL, 'GTK UI') \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(libdir_SQ)'; \
- $(INSTALL) $(OUTPUT)libperf-gtk.so '$(DESTDIR_SQ)$(libdir_SQ)'
-endif
-
-ifndef NO_LIBPERL
- LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
- LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
-endif
-
-ifndef NO_LIBPYTHON
- LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
- LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
-endif
-
-ifeq ($(NO_PERF_REGS),0)
- ifeq ($(ARCH),x86)
- LIB_H += arch/x86/include/perf_regs.h
- endif
- LIB_OBJS += $(OUTPUT)util/perf_regs.o
-endif
-
-ifndef NO_LIBNUMA
- BUILTIN_OBJS += $(OUTPUT)bench/numa.o
-endif
-
-ifdef ASCIIDOC8
- export ASCIIDOC8
-endif
-
-LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
-
-export INSTALL SHELL_PATH
-
-### Build rules
-
-SHELL = $(SHELL_PATH)
-
-all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
-
-please_set_SHELL_PATH_to_a_more_modern_shell:
- @$$(:)
-
-shell_compatibility_test: please_set_SHELL_PATH_to_a_more_modern_shell
-
-strip: $(PROGRAMS) $(OUTPUT)perf
- $(STRIP) $(STRIP_OPTS) $(PROGRAMS) $(OUTPUT)perf
-
-$(OUTPUT)perf.o: perf.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -include $(OUTPUT)PERF-VERSION-FILE \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- $(CFLAGS) -c $(filter %.c,$^) -o $@
-
-$(OUTPUT)perf: $(OUTPUT)perf.o $(BUILTIN_OBJS) $(PERFLIBS)
- $(QUIET_LINK)$(CC) $(CFLAGS) $(LDFLAGS) $(OUTPUT)perf.o \
- $(BUILTIN_OBJS) $(LIBS) -o $@
-
-$(GTK_OBJS): $(OUTPUT)%.o: %.c $(LIB_H)
- $(QUIET_CC)$(CC) -o $@ -c -fPIC $(CFLAGS) $(GTK_CFLAGS) $<
-
-$(OUTPUT)libperf-gtk.so: $(GTK_OBJS) $(PERFLIBS)
- $(QUIET_LINK)$(CC) -o $@ -shared $(LDFLAGS) $(filter %.o,$^) $(GTK_LIBS)
-
-$(OUTPUT)builtin-help.o: builtin-help.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- '-DPERF_MAN_PATH="$(mandir_SQ)"' \
- '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
-
-$(OUTPUT)builtin-timechart.o: builtin-timechart.c $(OUTPUT)common-cmds.h $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_HTML_PATH="$(htmldir_SQ)"' \
- '-DPERF_MAN_PATH="$(mandir_SQ)"' \
- '-DPERF_INFO_PATH="$(infodir_SQ)"' $<
-
-$(OUTPUT)common-cmds.h: util/generate-cmdlist.sh command-list.txt
-
-$(OUTPUT)common-cmds.h: $(wildcard Documentation/perf-*.txt)
- $(QUIET_GEN). util/generate-cmdlist.sh ./ > $@+ && mv $@+ $@
-
-$(SCRIPTS) : % : %.sh
- $(QUIET_GEN)$(INSTALL) '[email protected]' '$(OUTPUT)$@'
-
-# These can record PERF_VERSION
-$(OUTPUT)perf.o perf.spec \
- $(SCRIPTS) \
- : $(OUTPUT)PERF-VERSION-FILE
-
-.SUFFIXES:
-
-#
-# If a target does not match any of the later rules then prefix it by $(OUTPUT)
-# This makes targets like 'make O=/tmp/perf perf.o' work in a natural way.
-#
-ifneq ($(OUTPUT),)
-%.o: $(OUTPUT)%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-util/%.o: $(OUTPUT)util/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-bench/%.o: $(OUTPUT)bench/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-tests/%.o: $(OUTPUT)tests/%.o
- @echo " # Redirected target $@ => $(OUTPUT)$@"
-endif
-
-# These two need to be here so that when O= is not used they take precedence
-# over the general rule for .o
-
-$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -w $<
-
-$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c -Iutil/ $(CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -w $<
-
-$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
-$(OUTPUT)%.s: %.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -S $(CFLAGS) $<
-$(OUTPUT)%.o: %.S
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-$(OUTPUT)%.s: %.S
- $(QUIET_CC)$(CC) -o $@ -E $(CFLAGS) $<
-
-$(OUTPUT)util/exec_cmd.o: util/exec_cmd.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DPERF_EXEC_PATH="$(perfexecdir_SQ)"' \
- '-DPREFIX="$(prefix_SQ)"' \
- $<
-
-$(OUTPUT)tests/attr.o: tests/attr.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- '-DBINDIR="$(bindir_SQ)"' -DPYTHON='"$(PYTHON_WORD)"' \
- $<
-
-$(OUTPUT)tests/python-use.o: tests/python-use.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) \
- -DPYTHONPATH='"$(OUTPUT)python"' \
- -DPYTHON='"$(PYTHON_WORD)"' \
- $<
-
-$(OUTPUT)tests/dwarf-unwind.o: tests/dwarf-unwind.c
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -fno-optimize-sibling-calls $<
-
-$(OUTPUT)util/config.o: util/config.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
-
-$(OUTPUT)ui/setup.o: ui/setup.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DLIBDIR='"$(libdir_SQ)"' $<
-
-$(OUTPUT)ui/browser.o: ui/browser.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/annotate.o: ui/browsers/annotate.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/hists.o: ui/browsers/hists.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/map.o: ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)ui/browsers/scripts.o: ui/browsers/scripts.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -DENABLE_SLFUTURE_CONST $<
-
-$(OUTPUT)util/kallsyms.o: ../lib/symbol/kallsyms.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $<
-
-$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-unused-parameter -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
-
-$(OUTPUT)util/parse-events.o: util/parse-events.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) -Wno-redundant-decls $<
-
-$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow -Wno-undef -Wno-switch-default $<
-
-$(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o: scripts/perl/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs -Wno-undef -Wno-switch-default $<
-
-$(OUTPUT)util/scripting-engines/trace-event-python.o: util/scripting-engines/trace-event-python.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
-
-$(OUTPUT)scripts/python/Perf-Trace-Util/Context.o: scripts/python/Perf-Trace-Util/Context.c $(OUTPUT)PERF-CFLAGS
- $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(PYTHON_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-nested-externs $<
-
-$(OUTPUT)perf-%: %.o $(PERFLIBS)
- $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
-
-ifndef NO_PERF_READ_VDSO32
-$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-vdso-map.c
- $(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
-endif
-
-ifndef NO_PERF_READ_VDSOX32
-$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-vdso-map.c
- $(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
-endif
-
-$(LIB_OBJS) $(BUILTIN_OBJS): $(LIB_H)
-$(patsubst perf-%,%.o,$(PROGRAMS)): $(LIB_H) $(wildcard */*.h)
-
-# we compile into subdirectories. if the target directory is not the source directory, they might not exists. So
-# we depend the various files onto their directories.
-DIRECTORY_DEPS = $(LIB_OBJS) $(BUILTIN_OBJS) $(GTK_OBJS)
-DIRECTORY_DEPS += $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h
-# no need to add flex objects, because they depend on bison ones
-DIRECTORY_DEPS += $(OUTPUT)util/parse-events-bison.c
-DIRECTORY_DEPS += $(OUTPUT)util/pmu-bison.c
-
-OUTPUT_DIRECTORIES := $(sort $(dir $(DIRECTORY_DEPS)))
-
-$(DIRECTORY_DEPS): | $(OUTPUT_DIRECTORIES)
-# In the second step, we make a rule to actually create these directories
-$(OUTPUT_DIRECTORIES):
- $(QUIET_MKDIR)$(MKDIR) -p $@ 2>/dev/null
-
-$(LIB_FILE): $(LIB_OBJS)
- $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $(LIB_OBJS)
-
-# libtraceevent.a
-TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch])
-
-LIBTRACEEVENT_FLAGS = $(QUIET_SUBDIR1) O=$(OUTPUT)
-LIBTRACEEVENT_FLAGS += CFLAGS="-g -Wall $(EXTRA_CFLAGS)"
-LIBTRACEEVENT_FLAGS += plugin_dir=$(plugindir_SQ)
-
-$(LIBTRACEEVENT): $(TE_SOURCES) $(OUTPUT)PERF-CFLAGS
- $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) libtraceevent.a plugins
-
-$(LIBTRACEEVENT)-clean:
- $(call QUIET_CLEAN, libtraceevent)
- @$(MAKE) -C $(TRACE_EVENT_DIR) O=$(OUTPUT) clean >/dev/null
-
-install-traceevent-plugins: $(LIBTRACEEVENT)
- $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) install_plugins
-
-LIBAPIKFS_SOURCES = $(wildcard $(LIB_PATH)fs/*.[ch] $(LIB_PATH)fd/*.[ch])
-
-# if subdir is set, we've been called from above so target has been built
-# already
-$(LIBAPIKFS): $(LIBAPIKFS_SOURCES)
-ifeq ($(subdir),)
- $(QUIET_SUBDIR0)$(LIB_DIR) $(QUIET_SUBDIR1) O=$(OUTPUT) libapikfs.a
-endif
-
-$(LIBAPIKFS)-clean:
-ifeq ($(subdir),)
- $(call QUIET_CLEAN, libapikfs)
- @$(MAKE) -C $(LIB_DIR) O=$(OUTPUT) clean >/dev/null
-endif
-
-help:
- @echo 'Perf make targets:'
- @echo ' doc - make *all* documentation (see below)'
- @echo ' man - make manpage documentation (access with man <foo>)'
- @echo ' html - make html documentation'
- @echo ' info - make GNU info documentation (access with info <foo>)'
- @echo ' pdf - make pdf documentation'
- @echo ' TAGS - use etags to make tag information for source browsing'
- @echo ' tags - use ctags to make tag information for source browsing'
- @echo ' cscope - use cscope to make interactive browsing database'
- @echo ''
- @echo 'Perf install targets:'
- @echo ' NOTE: documentation build requires asciidoc, xmlto packages to be installed'
- @echo ' HINT: use "prefix" or "DESTDIR" to install to a particular'
- @echo ' path like "make prefix=/usr/local install install-doc"'
- @echo ' install - install compiled binaries'
- @echo ' install-doc - install *all* documentation'
- @echo ' install-man - install manpage documentation'
- @echo ' install-html - install html documentation'
- @echo ' install-info - install GNU info documentation'
- @echo ' install-pdf - install pdf documentation'
- @echo ''
- @echo ' quick-install-doc - alias for quick-install-man'
- @echo ' quick-install-man - install the documentation quickly'
- @echo ' quick-install-html - install the html documentation quickly'
- @echo ''
- @echo 'Perf maintainer targets:'
- @echo ' clean - clean all binary objects and build output'
-
-
-DOC_TARGETS := doc man html info pdf
-
-INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
-INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
-
-# 'make doc' should call 'make -C Documentation all'
-$(DOC_TARGETS):
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
-
-TAG_FOLDERS= . ../lib/traceevent ../lib/api ../lib/symbol
-TAG_FILES= ../../include/uapi/linux/perf_event.h
-
-TAGS:
- $(QUIET_GEN)$(RM) TAGS; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs etags -a $(TAG_FILES)
-
-tags:
- $(QUIET_GEN)$(RM) tags; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs ctags -a $(TAG_FILES)
-
-cscope:
- $(QUIET_GEN)$(RM) cscope*; \
- $(FIND) $(TAG_FOLDERS) -name '*.[hcS]' -print | xargs cscope -b $(TAG_FILES)
-
-### Detect prefix changes
-TRACK_CFLAGS = $(subst ','\'',$(CFLAGS)):\
- $(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ):$(plugindir_SQ)
-
-$(OUTPUT)PERF-CFLAGS: .FORCE-PERF-CFLAGS
- @FLAGS='$(TRACK_CFLAGS)'; \
- if test x"$$FLAGS" != x"`cat $(OUTPUT)PERF-CFLAGS 2>/dev/null`" ; then \
- echo 1>&2 " FLAGS: * new build flags or prefix"; \
- echo "$$FLAGS" >$(OUTPUT)PERF-CFLAGS; \
- fi
-
-### Testing rules
-
-# GNU make supports exporting all variables by "export" without parameters.
-# However, the environment gets quite big, and some programs have problems
-# with that.
-
-check: $(OUTPUT)common-cmds.h
- if sparse; \
- then \
- for i in *.c */*.c; \
- do \
- sparse $(CFLAGS) $(SPARSE_FLAGS) $$i || exit; \
- done; \
- else \
- exit 1; \
- fi
-
-### Installation rules
-
-install-gtk:
-
-install-bin: all install-gtk
- $(call QUIET_INSTALL, binaries) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(bindir_SQ)'; \
- $(INSTALL) $(OUTPUT)perf '$(DESTDIR_SQ)$(bindir_SQ)'; \
- $(LN) '$(DESTDIR_SQ)$(bindir_SQ)/perf' '$(DESTDIR_SQ)$(bindir_SQ)/trace'
-ifndef NO_PERF_READ_VDSO32
- $(call QUIET_INSTALL, perf-read-vdso32) \
- $(INSTALL) $(OUTPUT)perf-read-vdso32 '$(DESTDIR_SQ)$(bindir_SQ)';
-endif
-ifndef NO_PERF_READ_VDSOX32
- $(call QUIET_INSTALL, perf-read-vdsox32) \
- $(INSTALL) $(OUTPUT)perf-read-vdsox32 '$(DESTDIR_SQ)$(bindir_SQ)';
-endif
- $(call QUIET_INSTALL, libexec) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(call QUIET_INSTALL, perf-archive) \
- $(INSTALL) $(OUTPUT)perf-archive -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
- $(call QUIET_INSTALL, perf-with-kcore) \
- $(INSTALL) $(OUTPUT)perf-with-kcore -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)'
-ifndef NO_LIBPERL
- $(call QUIET_INSTALL, perl-scripts) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/perl/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/perl/*.pl -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'; \
- $(INSTALL) scripts/perl/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/perl/bin'
-endif
-ifndef NO_LIBPYTHON
- $(call QUIET_INSTALL, python-scripts) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'; \
- $(INSTALL) scripts/python/Perf-Trace-Util/lib/Perf/Trace/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/Perf-Trace-Util/lib/Perf/Trace'; \
- $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'; \
- $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
-endif
- $(call QUIET_INSTALL, perf_completion-script) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d'; \
- $(INSTALL) perf-completion.sh '$(DESTDIR_SQ)$(sysconfdir_SQ)/bash_completion.d/perf'
- $(call QUIET_INSTALL, tests) \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
- $(INSTALL) tests/attr.py '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests'; \
- $(INSTALL) -d -m 755 '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'; \
- $(INSTALL) tests/attr/* '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/tests/attr'
-
-install: install-bin try-install-man install-traceevent-plugins
-
-install-python_ext:
- $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
-
-# 'make install-doc' should call 'make -C Documentation install'
-$(INSTALL_DOC_TARGETS):
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
-
-### Cleaning rules
-
-#
-# This is here, not in config/Makefile, because config/Makefile does
-# not get included for the clean target:
-#
-config-clean:
- $(call QUIET_CLEAN, config)
- @$(MAKE) -C config/feature-checks clean >/dev/null
-
-clean: $(LIBTRACEEVENT)-clean $(LIBAPIKFS)-clean config-clean
- $(call QUIET_CLEAN, core-objs) $(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(OUTPUT)perf.o $(LANG_BINDINGS) $(GTK_OBJS)
- $(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)PERF-CFLAGS $(OUTPUT)PERF-FEATURES $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex*
- $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
- $(python-clean)
-
-#
-# Trick: if ../../.git does not exist - we are building out of tree for example,
-# then force version regeneration:
-#
-ifeq ($(wildcard ../../.git/HEAD),)
- GIT-HEAD-PHONY = ../../.git/HEAD
-else
- GIT-HEAD-PHONY =
-endif
-
-.PHONY: all install clean config-clean strip install-gtk
-.PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
-.PHONY: $(GIT-HEAD-PHONY) TAGS tags cscope .FORCE-PERF-CFLAGS
-
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index a46af8f..7b97b8a 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -155,7 +155,7 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
} else if (use_browser == 1) {
struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
@@ -303,7 +303,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
#endif
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
diff --git a/tools/perf/builtin-cmds.h b/tools/perf/builtin-cmds.h
index 49550c9..863727f 100644
--- a/tools/perf/builtin-cmds.h
+++ b/tools/perf/builtin-cmds.h
@@ -1,31 +1,6 @@
#ifndef BUILTIN_CMDS_H
#define BUILTIN_CMDS_H

-#ifndef CONFIG_KBUILD
-#define CONFIG_BUILTIN_REPORT 1
-#define CONFIG_BUILTIN_SCRIPT 1
-#define CONFIG_BUILTIN_BENCH 1
-#define CONFIG_BUILTIN_SCHED 1
-#define CONFIG_BUILTIN_TRACE 1
-#define CONFIG_BUILTIN_TOP 1
-#define CONFIG_BUILTIN_RECORD 1
-#define CONFIG_BUILTIN_BUILDID_LIST 1
-#define CONFIG_BUILTIN_INJECT 1
-#define CONFIG_BUILTIN_LOCK 1
-#define CONFIG_BUILTIN_KVM 1
-#define CONFIG_BUILTIN_BUILDID_CACHE 1
-#define CONFIG_BUILTIN_EVLIST 1
-#define CONFIG_BUILTIN_KMEM 1
-#define CONFIG_BUILTIN_STAT 1
-#define CONFIG_BUILTIN_DIFF 1
-#define CONFIG_BUILTIN_ANNOTATE 1
-#define CONFIG_BUILTIN_TIMECHART 1
-#define CONFIG_BUILTIN_LIST 1
-#define CONFIG_BUILTIN_HELP 1
-#define CONFIG_BUILTIN_PROBE 1
-#define CONFIG_BUILTIN_MEM 1
-#else
#include "generated/autoconf.h"
-#endif /* CONFIG_KBUILD */

#endif /* BUILTIN_CMDS_H */
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index b639e58..00d93ff 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -407,7 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 6f04452..a2ff8b7 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -535,7 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -981,7 +981,7 @@ static int __cmd_top(struct perf_top *top)

ret = -1;

-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
if (use_browser > 0)
display_fn = display_thread_tui;
#endif
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index efc2b21..7928984 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,7 +77,7 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
use_browser = 1;
if (ui__init() == 0)
@@ -98,7 +98,7 @@ void exit_browser(bool wait_for_ok __maybe_unused)
case 2:
exit_gtk_browser(wait_for_ok);
break;
-#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
+#ifdef CONFIG_TUI
case 1:
ui__exit(wait_for_ok);
break;
--
2.1.1

2014-10-25 22:26:55

by Alexis Berlemont

[permalink] [raw]
Subject: [PATCH v4 03/14] perf tools: Kbuild source related fixies

From: Jiri Olsa <[email protected]>

Fixing several sources config dependencies to allow
separate config builds.

This commit was originally created by Jiri Olsa in 2013. Minor changes
were needed to get it working one year later:
* Remove #ifdef directives related with GUI / TUI (because of code
changes in ui/setup.c)
* Fix a link issue if the option BUILTIN_TRACE is disabled.
* Fix typo (CONFIG_BULTIN_ instead CONFIG_BUILTIN_)

Signed-off-by: Jiri Olsa <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Michal Marek <[email protected]>
Cc: [email protected]
Cc: Stephane Eranian <[email protected]>
Signed-off-by: Alexis Berlemont <[email protected]>
---
tools/perf/builtin-annotate.c | 6 +++---
tools/perf/builtin-lock.c | 5 ++++-
tools/perf/builtin-report.c | 2 +-
tools/perf/builtin-sched.c | 3 +++
tools/perf/builtin-top.c | 4 ++--
tools/perf/perf.c | 10 ++++++++--
tools/perf/ui/browsers/scripts.c | 4 ++++
tools/perf/ui/setup.c | 6 +++---
8 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 19cb967..a46af8f 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -155,7 +155,7 @@ find_next:

/* skip missing symbols */
nd = rb_next(nd);
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
} else if (use_browser == 1) {
struct rb_node *next = NULL;
key = hist_entry__tui_annotate(he, evsel, NULL);
@@ -303,9 +303,9 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace,
"dump raw trace in ASCII"),
OPT_BOOLEAN(0, "gtk", &annotate.use_gtk, "Use the GTK interface"),
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
OPT_BOOLEAN(0, "tui", &annotate.use_tui, "Use the TUI interface"),
-#endif /* CONFIG_TUI */
+#endif
OPT_BOOLEAN(0, "stdio", &annotate.use_stdio, "Use the stdio interface"),
OPT_STRING('k', "vmlinux", &symbol_conf.vmlinux_name,
"file", "vmlinux pathname"),
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c
index e7ec715..05c0e1c 100644
--- a/tools/perf/builtin-lock.c
+++ b/tools/perf/builtin-lock.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "builtin-cmds.h"
#include "perf.h"

#include "util/evlist.h"
@@ -995,9 +996,11 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused)
usage_with_options(report_usage, report_options);
}
rc = __cmd_report(false);
+#ifdef CONFIG_BUILTIN_SCRIPT
} else if (!strcmp(argv[0], "script")) {
/* Aliased to 'perf script' */
- return cmd_script(argc, argv, prefix);
+ rc = cmd_script(argc, argv, prefix);
+#endif
} else if (!strcmp(argv[0], "info")) {
if (argc) {
argc = parse_options(argc, argv,
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 00d93ff..b639e58 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -407,7 +407,7 @@ static int report__browse_hists(struct report *rep)
const char *help = "For a higher level overview, try: perf report --sort comm,dso";

switch (use_browser) {
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
ret = perf_evlist__tui_browse_hists(evlist, help, NULL,
rep->min_percent,
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index 891c393..e38b021 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1,4 +1,5 @@
#include "builtin.h"
+#include "builtin-cmds.h"
#include "perf.h"

#include "util/util.h"
@@ -1742,11 +1743,13 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused)
if (!argc)
usage_with_options(sched_usage, sched_options);

+#ifdef CONFIG_BUILTIN_SCRIPT
/*
* Aliased to 'perf script' for now:
*/
if (!strcmp(argv[0], "script"))
return cmd_script(argc, argv, prefix);
+#endif

if (!strncmp(argv[0], "rec", 3)) {
return __cmd_record(argc, argv);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index a2ff8b7..6f04452 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -535,7 +535,7 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
return ret;
}

-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
static void perf_top__sort_new_samples(void *arg)
{
struct perf_top *t = arg;
@@ -981,7 +981,7 @@ static int __cmd_top(struct perf_top *top)

ret = -1;

-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
if (use_browser > 0)
display_fn = display_thread_tui;
#endif
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index ab363b5..976ded6 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -93,8 +93,10 @@ static struct cmd_struct commands[] = {
#ifdef CONFIG_BUILTIN_KVM
{ "kvm", cmd_kvm, 0 },
#endif
+#ifdef CONFIG_BUILTIN_TEST
{ "test", cmd_test, 0 },
-#if defined HAVE_LIBAUDIT_SUPPORT && defined CONFIG_BUILTIN_TRACE
+#endif
+#ifdef CONFIG_BUILTIN_TRACE
{ "trace", cmd_trace, 0 },
#endif
#ifdef CONFIG_BUILTIN_INJECT
@@ -539,7 +541,7 @@ int main(int argc, const char **argv)
goto out;
}
if (!prefixcmp(cmd, "trace")) {
-#ifdef HAVE_LIBAUDIT_SUPPORT
+#ifdef CONFIG_BUILTIN_TRACE
set_buildid_dir();
setup_path();
argv[0] = "trace";
@@ -563,13 +565,17 @@ int main(int argc, const char **argv)
} else {
/* The user didn't specify a command; give them help */
printf("\n usage: %s\n\n", perf_usage_string);
+#ifdef CONFIG_BUILTIN_HELP
list_common_cmds_help();
printf("\n %s\n\n", perf_more_info_string);
+#endif
goto out;
}
cmd = argv[0];

+#ifdef CONFIG_BUILTIN_TEST
test_attr__init();
+#endif

/*
* We use PATH to find perf commands, but we prepend some higher
diff --git a/tools/perf/ui/browsers/scripts.c b/tools/perf/ui/browsers/scripts.c
index 402d2bd..128988d 100644
--- a/tools/perf/ui/browsers/scripts.c
+++ b/tools/perf/ui/browsers/scripts.c
@@ -59,7 +59,11 @@ static int list_scripts(char *script_name)
paths[i] = names[i] + SCRIPT_NAMELEN;
}

+#ifdef CONFIG_BUILTIN_SCRIPT
num = find_scripts(names, paths);
+#else
+ num = 0;
+#endif
if (num > 0) {
choice = ui__popup_menu(num, names);
if (choice < num && choice >= 0) {
diff --git a/tools/perf/ui/setup.c b/tools/perf/ui/setup.c
index ec7fd36..efc2b21 100644
--- a/tools/perf/ui/setup.c
+++ b/tools/perf/ui/setup.c
@@ -77,7 +77,7 @@ void setup_browser(bool fallback_to_pager)
PERF_GTK_DSO);
sleep(1);
/* fall through */
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
use_browser = 1;
if (ui__init() == 0)
@@ -92,13 +92,13 @@ void setup_browser(bool fallback_to_pager)
}
}

-void exit_browser(bool wait_for_ok)
+void exit_browser(bool wait_for_ok __maybe_unused)
{
switch (use_browser) {
case 2:
exit_gtk_browser(wait_for_ok);
break;
-#ifdef CONFIG_TUI
+#if defined(CONFIG_TUI) || !defined(CONFIG_KBUILD)
case 1:
ui__exit(wait_for_ok);
break;
--
2.1.1

2014-10-27 22:38:04

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v4 00/14] Kbuild for perf

On Sun, Oct 26, 2014 at 12:20:25AM +0200, Alexis Berlemont wrote:
> Hello,
>
> Here is a proposal of perf's build process managed by Kbuild:
> * The file Makefile.perf is replaced by Makefile.kbuild
> * Makefile.kbuild generates a default .config file if none exists
> (allyesconfig)
> * Makefile.kbuild adapts the .config file according to the
> features-check tests results
> * Makefile.kbuild builds external dependencies (linux/tools/lib/*)
> * Makefile.kbuild leaves the rest to Kbuild
>
> Changes since v3:
> * Patchs were generated starting from the following branch:
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf/core
> * Add Kconfig options for 32-bit compatibility VDSOs
> * Target build-test: for each .config-based test case, call "make
> olddefconfig" so as to prevent failure because of new Kconfig
> symbol(s)

hi,
I tried 'make clean && make' and got attached errors.
I'm running Fedora 20 on x86_64

jirka


---
BUILD: Doing 'make -j4' parallel build
GEN tools/perf/PERF-VERSION-FILE
make[3]: *** No rule to make target `kernelversion'. Stop.
MKDIR libapi_dirs
CC /home/jolsa/kernel.org/linux-perf/tools/lib/api/fs/fs.o
CC /home/jolsa/kernel.org/linux-perf/tools/lib/api/fs/debugfs.o
CC /home/jolsa/kernel.org/linux-perf/tools/lib/api/fd/array.o
AR libapikfs.a
LD tools/perf/arch/built-in.o
LD tools/perf/built-in.o
LD tools/perf/perf
/bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
/bin/ld: skipping incompatible /lib/librt.so when searching for -lrt
/bin/ld: skipping incompatible /lib/librt.a when searching for -lrt
/bin/ld: skipping incompatible /lib/librt.so when searching for -lrt
/bin/ld: skipping incompatible /lib/librt.a when searching for -lrt
/bin/ld: skipping incompatible /lib/libm.so when searching for -lm
/bin/ld: skipping incompatible /lib/libm.a when searching for -lm
/bin/ld: skipping incompatible /lib/libm.so when searching for -lm
/bin/ld: skipping incompatible /lib/libm.a when searching for -lm
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libresolv.so when searching for -lresolv
/bin/ld: skipping incompatible /lib/libresolv.a when searching for -lresolv
/bin/ld: skipping incompatible /lib/libresolv.so when searching for -lresolv
/bin/ld: skipping incompatible /lib/libresolv.a when searching for -lresolv
/bin/ld: skipping incompatible /lib/libnsl.so when searching for -lnsl
/bin/ld: skipping incompatible /lib/libnsl.a when searching for -lnsl
/bin/ld: skipping incompatible /lib/libnsl.so when searching for -lnsl
/bin/ld: skipping incompatible /lib/libnsl.a when searching for -lnsl
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libm.so when searching for -lm
/bin/ld: skipping incompatible /lib/libm.a when searching for -lm
/bin/ld: skipping incompatible /lib/libm.so when searching for -lm
/bin/ld: skipping incompatible /lib/libm.a when searching for -lm
/bin/ld: skipping incompatible /lib/libcrypt.so when searching for -lcrypt
/bin/ld: skipping incompatible /lib/libcrypt.a when searching for -lcrypt
/bin/ld: skipping incompatible /lib/libcrypt.so when searching for -lcrypt
/bin/ld: skipping incompatible /lib/libcrypt.a when searching for -lcrypt
/bin/ld: skipping incompatible /lib/libutil.so when searching for -lutil
/bin/ld: skipping incompatible /lib/libutil.a when searching for -lutil
/bin/ld: skipping incompatible /lib/libutil.so when searching for -lutil
/bin/ld: skipping incompatible /lib/libutil.a when searching for -lutil
/bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
/bin/ld: skipping incompatible /lib/libc.so when searching for -lc
/bin/ld: skipping incompatible /lib/libc.a when searching for -lc
/bin/ld: skipping incompatible /lib/libc.so when searching for -lc
/bin/ld: skipping incompatible /lib/libc.a when searching for -lc
/bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
/bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libutil.so when searching for -lutil
/bin/ld: skipping incompatible /lib/libutil.a when searching for -lutil
/bin/ld: skipping incompatible /lib/libutil.so when searching for -lutil
/bin/ld: skipping incompatible /lib/libutil.a when searching for -lutil
/bin/ld: skipping incompatible /lib/libm.so when searching for -lm
/bin/ld: skipping incompatible /lib/libm.a when searching for -lm
/bin/ld: skipping incompatible /lib/libm.so when searching for -lm
/bin/ld: skipping incompatible /lib/libm.a when searching for -lm
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
/bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
/bin/ld: skipping incompatible /lib/libc.so when searching for -lc
/bin/ld: skipping incompatible /lib/libc.a when searching for -lc
/bin/ld: skipping incompatible /lib/libc.so when searching for -lc
/bin/ld: skipping incompatible /lib/libc.a when searching for -lc

2014-10-28 23:57:01

by Alexis Berlemont

[permalink] [raw]
Subject: Re: [PATCH v4 00/14] Kbuild for perf

Jiri Olsa wrote:
> On Sun, Oct 26, 2014 at 12:20:25AM +0200, Alexis Berlemont wrote:
> > Hello,
> >
> > Here is a proposal of perf's build process managed by Kbuild:
> > * The file Makefile.perf is replaced by Makefile.kbuild
> > * Makefile.kbuild generates a default .config file if none exists
> > (allyesconfig)
> > * Makefile.kbuild adapts the .config file according to the
> > features-check tests results
> > * Makefile.kbuild builds external dependencies (linux/tools/lib/*)
> > * Makefile.kbuild leaves the rest to Kbuild
> >
> > Changes since v3:
> > * Patchs were generated starting from the following branch:
> > git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git perf/core
> > * Add Kconfig options for 32-bit compatibility VDSOs
> > * Target build-test: for each .config-based test case, call "make
> > olddefconfig" so as to prevent failure because of new Kconfig
> > symbol(s)
>
> hi,
> I tried 'make clean && make' and got attached errors.
> I'm running Fedora 20 on x86_64
>

OK. I may have an idea. The parameters CONFIG_LIBDWARF_DIR and
CONFIG_LIBUNWIND_DIR are empty (default value). So the variable
LDFLAGS stored into .config-detected contains things like
"-L/lib" and your /lib directory contains 32bit binaries.

Could you send me the files .config and .config-detected which were
generated during the build?

I will send a new patch set.

* FYI, so far, I tested the build:
* on my archlinux x86_64 system
* and with many cross-toolchains (powerpc, arm, etc.) generated by
crosstool-ng

I should have tested on other distros especially fedora... Sorry.

Thank you very much for testing it!

Alexis.

> jirka
>
>
> ---
> BUILD: Doing 'make -j4' parallel build
> GEN tools/perf/PERF-VERSION-FILE
> make[3]: *** No rule to make target `kernelversion'. Stop.
> MKDIR libapi_dirs
> CC /home/jolsa/kernel.org/linux-perf/tools/lib/api/fs/fs.o
> CC /home/jolsa/kernel.org/linux-perf/tools/lib/api/fs/debugfs.o
> CC /home/jolsa/kernel.org/linux-perf/tools/lib/api/fd/array.o
> AR libapikfs.a
> LD tools/perf/arch/built-in.o
> LD tools/perf/built-in.o
> LD tools/perf/perf
> /bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
> /bin/ld: skipping incompatible /lib/librt.so when searching for -lrt
> /bin/ld: skipping incompatible /lib/librt.a when searching for -lrt
> /bin/ld: skipping incompatible /lib/librt.so when searching for -lrt
> /bin/ld: skipping incompatible /lib/librt.a when searching for -lrt
> /bin/ld: skipping incompatible /lib/libm.so when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.a when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.so when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.a when searching for -lm
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libresolv.so when searching for -lresolv
> /bin/ld: skipping incompatible /lib/libresolv.a when searching for -lresolv
> /bin/ld: skipping incompatible /lib/libresolv.so when searching for -lresolv
> /bin/ld: skipping incompatible /lib/libresolv.a when searching for -lresolv
> /bin/ld: skipping incompatible /lib/libnsl.so when searching for -lnsl
> /bin/ld: skipping incompatible /lib/libnsl.a when searching for -lnsl
> /bin/ld: skipping incompatible /lib/libnsl.so when searching for -lnsl
> /bin/ld: skipping incompatible /lib/libnsl.a when searching for -lnsl
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libm.so when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.a when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.so when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.a when searching for -lm
> /bin/ld: skipping incompatible /lib/libcrypt.so when searching for -lcrypt
> /bin/ld: skipping incompatible /lib/libcrypt.a when searching for -lcrypt
> /bin/ld: skipping incompatible /lib/libcrypt.so when searching for -lcrypt
> /bin/ld: skipping incompatible /lib/libcrypt.a when searching for -lcrypt
> /bin/ld: skipping incompatible /lib/libutil.so when searching for -lutil
> /bin/ld: skipping incompatible /lib/libutil.a when searching for -lutil
> /bin/ld: skipping incompatible /lib/libutil.so when searching for -lutil
> /bin/ld: skipping incompatible /lib/libutil.a when searching for -lutil
> /bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libc.so when searching for -lc
> /bin/ld: skipping incompatible /lib/libc.a when searching for -lc
> /bin/ld: skipping incompatible /lib/libc.so when searching for -lc
> /bin/ld: skipping incompatible /lib/libc.a when searching for -lc
> /bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.so when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libpthread.a when searching for -lpthread
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libutil.so when searching for -lutil
> /bin/ld: skipping incompatible /lib/libutil.a when searching for -lutil
> /bin/ld: skipping incompatible /lib/libutil.so when searching for -lutil
> /bin/ld: skipping incompatible /lib/libutil.a when searching for -lutil
> /bin/ld: skipping incompatible /lib/libm.so when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.a when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.so when searching for -lm
> /bin/ld: skipping incompatible /lib/libm.a when searching for -lm
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.so when searching for -ldl
> /bin/ld: skipping incompatible /lib/libdl.a when searching for -ldl
> /bin/ld: skipping incompatible /lib/libc.so when searching for -lc
> /bin/ld: skipping incompatible /lib/libc.a when searching for -lc
> /bin/ld: skipping incompatible /lib/libc.so when searching for -lc
> /bin/ld: skipping incompatible /lib/libc.a when searching for -lc

2014-10-29 08:17:47

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v4 04/14] perf tools: Add kbuild support into Makefile.kbuild

On Sun, Oct 26, 2014 at 12:20:29AM +0200, Alexis Berlemont wrote:
> From: Jiri Olsa <[email protected]>

SNIP

> ---
> tools/perf/Kbuild | 47 +++
> tools/perf/Kconfig | 284 ++++++++++++++
> tools/perf/Makefile.kbuild | 431 +++++++++++++++++++++
> tools/perf/Makefile.perf | 2 +-
> tools/perf/arch/Kbuild | 3 +
> tools/perf/arch/arm/Kbuild | 2 +
> tools/perf/arch/arm/Makefile | 14 -
> tools/perf/arch/arm/tests/Kbuild | 2 +
> tools/perf/arch/arm/util/Kbuild | 3 +
> tools/perf/arch/arm64/Kbuild | 1 +
> tools/perf/arch/arm64/Makefile | 7 -
> tools/perf/arch/arm64/util/Kbuild | 2 +
> tools/perf/arch/powerpc/Kbuild | 1 +
> tools/perf/arch/powerpc/Makefile | 6 -
> tools/perf/arch/powerpc/util/Kbuild | 3 +
> tools/perf/arch/s390/Kbuild | 1 +
> tools/perf/arch/s390/Makefile | 7 -
> tools/perf/arch/s390/util/Kbuild | 2 +
> tools/perf/arch/sh/Kbuild | 1 +
> tools/perf/arch/sh/Makefile | 4 -
> tools/perf/arch/sh/util/Kbuild | 1 +
> tools/perf/arch/sparc/Kbuild | 1 +
> tools/perf/arch/sparc/Makefile | 4 -
> tools/perf/arch/sparc/util/Kbuild | 1 +
> tools/perf/arch/x86/Kbuild | 1 +
> tools/perf/arch/x86/tests/Kbuild | 3 +
> tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 0
> tools/perf/arch/x86/util/Kbuild | 5 +
> tools/perf/bench/Kbuild | 12 +
> tools/perf/builtin-cmds.h | 4 +
> tools/perf/config/Makefile | 55 ++-
> tools/perf/config/Makefile.fix-config | 104 +++++
> tools/perf/config/Makefile.fix-legacy | 46 +++
> tools/perf/config/defconfig | 54 +++
> tools/perf/perf-sys.h | 4 +-
> tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
> tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
> tools/perf/tests/Kbuild | 38 ++
> tools/perf/ui/Kbuild | 15 +
> tools/perf/ui/browsers/Kbuild | 9 +
> tools/perf/ui/gtk/Kbuild | 9 +
> tools/perf/ui/stdio/Kbuild | 1 +
> tools/perf/ui/tui/Kbuild | 4 +
> tools/perf/util/Kbuild | 126 ++++++
> tools/perf/util/PERF-VERSION-GEN | 4 +
> tools/perf/util/generate-cmdlist.sh | 8 +-
> tools/perf/util/scripting-engines/Kbuild | 11 +
> tools/perf/util/setup.py | 8 +-

so this patch took the perf Makefile (at that time) and changed it to
use the kbuild.. but since that time the Makefile.perf came and many
other changes, which need to be reflected in Makefile.kbuild

I need to revisit the logic and split the change into more incremental
patches (the patchset is too big)

I can redo patches 2,3,4 and get back to you, sounds ok?

thanks,
jirka

2014-10-29 23:07:37

by Alexis Berlemont

[permalink] [raw]
Subject: Re: [PATCH v4 04/14] perf tools: Add kbuild support into Makefile.kbuild

Jiri Olsa wrote:
> On Sun, Oct 26, 2014 at 12:20:29AM +0200, Alexis Berlemont wrote:
> > From: Jiri Olsa <[email protected]>
>
> SNIP
>
> > ---
> > tools/perf/Kbuild | 47 +++
> > tools/perf/Kconfig | 284 ++++++++++++++
> > tools/perf/Makefile.kbuild | 431 +++++++++++++++++++++
> > tools/perf/Makefile.perf | 2 +-
> > tools/perf/arch/Kbuild | 3 +
> > tools/perf/arch/arm/Kbuild | 2 +
> > tools/perf/arch/arm/Makefile | 14 -
> > tools/perf/arch/arm/tests/Kbuild | 2 +
> > tools/perf/arch/arm/util/Kbuild | 3 +
> > tools/perf/arch/arm64/Kbuild | 1 +
> > tools/perf/arch/arm64/Makefile | 7 -
> > tools/perf/arch/arm64/util/Kbuild | 2 +
> > tools/perf/arch/powerpc/Kbuild | 1 +
> > tools/perf/arch/powerpc/Makefile | 6 -
> > tools/perf/arch/powerpc/util/Kbuild | 3 +
> > tools/perf/arch/s390/Kbuild | 1 +
> > tools/perf/arch/s390/Makefile | 7 -
> > tools/perf/arch/s390/util/Kbuild | 2 +
> > tools/perf/arch/sh/Kbuild | 1 +
> > tools/perf/arch/sh/Makefile | 4 -
> > tools/perf/arch/sh/util/Kbuild | 1 +
> > tools/perf/arch/sparc/Kbuild | 1 +
> > tools/perf/arch/sparc/Makefile | 4 -
> > tools/perf/arch/sparc/util/Kbuild | 1 +
> > tools/perf/arch/x86/Kbuild | 1 +
> > tools/perf/arch/x86/tests/Kbuild | 3 +
> > tools/perf/{ => arch/x86}/tests/perf-time-to-tsc.c | 0
> > tools/perf/arch/x86/util/Kbuild | 5 +
> > tools/perf/bench/Kbuild | 12 +
> > tools/perf/builtin-cmds.h | 4 +
> > tools/perf/config/Makefile | 55 ++-
> > tools/perf/config/Makefile.fix-config | 104 +++++
> > tools/perf/config/Makefile.fix-legacy | 46 +++
> > tools/perf/config/defconfig | 54 +++
> > tools/perf/perf-sys.h | 4 +-
> > tools/perf/scripts/perl/Perf-Trace-Util/Kbuild | 6 +
> > tools/perf/scripts/python/Perf-Trace-Util/Kbuild | 5 +
> > tools/perf/tests/Kbuild | 38 ++
> > tools/perf/ui/Kbuild | 15 +
> > tools/perf/ui/browsers/Kbuild | 9 +
> > tools/perf/ui/gtk/Kbuild | 9 +
> > tools/perf/ui/stdio/Kbuild | 1 +
> > tools/perf/ui/tui/Kbuild | 4 +
> > tools/perf/util/Kbuild | 126 ++++++
> > tools/perf/util/PERF-VERSION-GEN | 4 +
> > tools/perf/util/generate-cmdlist.sh | 8 +-
> > tools/perf/util/scripting-engines/Kbuild | 11 +
> > tools/perf/util/setup.py | 8 +-
>
> so this patch took the perf Makefile (at that time) and changed it to
> use the kbuild.. but since that time the Makefile.perf came and many
> other changes, which need to be reflected in Makefile.kbuild
>
> I need to revisit the logic and split the change into more incremental
> patches (the patchset is too big)
>
> I can redo patches 2,3,4 and get back to you, sounds ok?

Of course.

Which changes in Makefile.perf do you have in mind ? I thought that
Makefile.kbuild was just supposed to build the few extra dependencies
(libtraceevent, etc.). I thought that I updated your original patch
accordingly with the changes before and after the add of
Makefile.perf.

Alexis.

2014-10-31 08:36:14

by Jiri Olsa

[permalink] [raw]
Subject: Re: [PATCH v4 04/14] perf tools: Add kbuild support into Makefile.kbuild

On Thu, Oct 30, 2014 at 12:05:07AM +0100, Alexis Berlemont wrote:

SNIP

> > > tools/perf/util/Kbuild | 126 ++++++
> > > tools/perf/util/PERF-VERSION-GEN | 4 +
> > > tools/perf/util/generate-cmdlist.sh | 8 +-
> > > tools/perf/util/scripting-engines/Kbuild | 11 +
> > > tools/perf/util/setup.py | 8 +-
> >
> > so this patch took the perf Makefile (at that time) and changed it to
> > use the kbuild.. but since that time the Makefile.perf came and many
> > other changes, which need to be reflected in Makefile.kbuild
> >
> > I need to revisit the logic and split the change into more incremental
> > patches (the patchset is too big)
> >
> > I can redo patches 2,3,4 and get back to you, sounds ok?
>
> Of course.
>
> Which changes in Makefile.perf do you have in mind ? I thought that
> Makefile.kbuild was just supposed to build the few extra dependencies
> (libtraceevent, etc.). I thought that I updated your original patch
> accordingly with the changes before and after the add of
> Makefile.perf.

hm, I just stumbled on QUIET_* stuff definitions in Makefile.kbuild,
(which got moved into scripts some time ago) and assumed this was
the case for the rest of the file ;-)

jirka